+
@@ -195,7 +288,7 @@ const props = defineProps({
},
allowUpload: {
type: Boolean,
- default: true,
+ default: false,
required: false,
},
});
@@ -217,11 +310,13 @@ let uploadForm = reactive(
Form({
title: FormControl("", And([Required(), Min(4)])),
description: FormControl(""),
- })
+ }),
);
const uploadPreview = ref("");
-
+const uploadPreviewMissing = ref(
+ 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="-20 -20 64 64"%3E%3Cpath d="M22 20.7L3.3 2L2 3.3L3 4.3V19C3 20.1 3.9 21 5 21H19.7L20.7 22L22 20.7M5 19V6.3L12.6 13.9L11.1 15.8L9 13.1L6 17H15.7L17.7 19H5M8.8 5L6.8 3H19C20.1 3 21 3.9 21 5V17.2L19 15.2V5H8.8" /%3E%3C/svg%3E',
+);
/**
* Is the media loading/busy
*/
@@ -326,7 +421,7 @@ const handleClickInsert = async () => {
submitFormData.append("title", uploadForm.controls.title.value);
submitFormData.append(
"description",
- uploadForm.controls.description.value
+ uploadForm.controls.description.value,
);
try {
let result = await api.post({
@@ -337,7 +432,8 @@ const handleClickInsert = async () => {
},
progress: (progressData) =>
(progressText.value = `Uploading File: ${Math.floor(
- (progressData.loaded / progressData.total) * 100
+ (progressData.loaded / progressData.total) *
+ 100,
)}%`),
});
if (result.data) {
@@ -357,7 +453,7 @@ const handleClickInsert = async () => {
"The server is taking longer then expected to process the file.\nOnce the file has been processed, select it from the media browser.";
} else {
await new Promise((resolve) =>
- setTimeout(resolve, 500)
+ setTimeout(resolve, 500),
);
try {
let updateResult = await api.get({
@@ -377,7 +473,7 @@ const handleClickInsert = async () => {
mediaProcessed = true;
} else if (
updateData.medium.status.startsWith(
- "Failed"
+ "Failed",
) == true
) {
throw "error";
@@ -481,7 +577,7 @@ const handleChangeSelectFile = async () => {
if (firstFile != null) {
if (uploadForm.controls.title.value.length == 0) {
uploadForm.controls.title.value = convertFileNameToTitle(
- firstFile.name
+ firstFile.name,
);
}
@@ -595,131 +691,3 @@ const computedInsertDisabled = computed(() => {
handleLoad();
-
-
diff --git a/resources/js/extensions/danger.ts b/resources/js/extensions/danger.ts
new file mode 100644
index 0000000..921ad9e
--- /dev/null
+++ b/resources/js/extensions/danger.ts
@@ -0,0 +1,60 @@
+import { mergeAttributes, Node } from "@tiptap/core";
+
+export interface DangerOptions {
+ HTMLAttributes: Record;
+}
+
+declare module "@tiptap/core" {
+ interface Commands {
+ danger: {
+ /**
+ * Toggle a paragraph
+ */
+ setDanger: () => ReturnType;
+ toggleDanger: () => ReturnType;
+ };
+ }
+}
+
+export const Danger = Node.create({
+ name: "danger",
+
+ priority: 1000,
+
+ addOptions() {
+ return {
+ HTMLAttributes: { class: "danger" },
+ };
+ },
+
+ group: "block",
+
+ content: "inline*",
+
+ parseHTML() {
+ return [{ tag: "p", class: "danger" }];
+ },
+
+ renderHTML({ HTMLAttributes }) {
+ return [
+ "p",
+ mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
+ 0,
+ ];
+ },
+
+ addCommands() {
+ return {
+ setDanger:
+ () =>
+ ({ commands }) => {
+ return commands.setNode(this.name);
+ },
+ toggleDanger:
+ () =>
+ ({ commands }) => {
+ return commands.toggleNode(this.name, "paragraph");
+ },
+ };
+ },
+});
diff --git a/resources/js/extensions/success.ts b/resources/js/extensions/success.ts
new file mode 100644
index 0000000..a7997fe
--- /dev/null
+++ b/resources/js/extensions/success.ts
@@ -0,0 +1,60 @@
+import { mergeAttributes, Node } from "@tiptap/core";
+
+export interface SuccessOptions {
+ HTMLAttributes: Record;
+}
+
+declare module "@tiptap/core" {
+ interface Commands {
+ success: {
+ /**
+ * Toggle a paragraph
+ */
+ setSuccess: () => ReturnType;
+ toggleSuccess: () => ReturnType;
+ };
+ }
+}
+
+export const Success = Node.create({
+ name: "success",
+
+ priority: 1000,
+
+ addOptions() {
+ return {
+ HTMLAttributes: { class: "success" },
+ };
+ },
+
+ group: "block",
+
+ content: "inline*",
+
+ parseHTML() {
+ return [{ tag: "p", class: "success" }];
+ },
+
+ renderHTML({ HTMLAttributes }) {
+ return [
+ "p",
+ mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
+ 0,
+ ];
+ },
+
+ addCommands() {
+ return {
+ setSuccess:
+ () =>
+ ({ commands }) => {
+ return commands.setNode(this.name);
+ },
+ toggleSuccess:
+ () =>
+ ({ commands }) => {
+ return commands.toggleNode(this.name, "paragraph");
+ },
+ };
+ },
+});
diff --git a/resources/js/extensions/warning.ts b/resources/js/extensions/warning.ts
new file mode 100644
index 0000000..58e9d6c
--- /dev/null
+++ b/resources/js/extensions/warning.ts
@@ -0,0 +1,60 @@
+import { mergeAttributes, Node } from "@tiptap/core";
+
+export interface WarningOptions {
+ HTMLAttributes: Record;
+}
+
+declare module "@tiptap/core" {
+ interface Commands {
+ warning: {
+ /**
+ * Toggle a paragraph
+ */
+ setWarning: () => ReturnType;
+ toggleWarning: () => ReturnType;
+ };
+ }
+}
+
+export const Warning = Node.create({
+ name: "warning",
+
+ priority: 1000,
+
+ addOptions() {
+ return {
+ HTMLAttributes: { class: "warning" },
+ };
+ },
+
+ group: "block",
+
+ content: "inline*",
+
+ parseHTML() {
+ return [{ tag: "p", class: "warning" }];
+ },
+
+ renderHTML({ HTMLAttributes }) {
+ return [
+ "p",
+ mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
+ 0,
+ ];
+ },
+
+ addCommands() {
+ return {
+ setWarning:
+ () =>
+ ({ commands }) => {
+ return commands.setNode(this.name);
+ },
+ toggleWarning:
+ () =>
+ ({ commands }) => {
+ return commands.toggleNode(this.name, "paragraph");
+ },
+ };
+ },
+});
diff --git a/resources/views/app.blade.php b/resources/views/app.blade.php
index 8b0bb02..70ac7d5 100644
--- a/resources/views/app.blade.php
+++ b/resources/views/app.blade.php
@@ -37,59 +37,25 @@
input { font-family: Poppins, Roboto, "Open Sans", ui-sans-serif, system-ui, sans-serif; }
.scrollbar-width-none { scrollbar-width: none; }
.scrollbar-width-none::-webkit-scrollbar { display: none; }
+ .bg-center { background-position: center; }
+ .whitespace-nowrap {white-space: nowrap; }
.spin{animation:rotate 1s infinite linear}
- .sm-html .ProseMirror {
- outline: none;
- }
-
- .sm-html hr {
- border-top: 1px solid #aaa;
- margin: 1.5rem 0;
- }
-
- .sm-html pre {
- padding: 0 1rem;
- line-height: 1rem;
- }
-
- .sm-html blockquote {
- border-left: 4px solid #ddd;
- margin-left: 1rem;
- padding-left: 1rem;
- }
-
- .sm-html p.info {
- display: flex;
- border: 1px solid rgba(14,165,233,1);
- background-color: rgba(14,165,233,0.25);
- border-radius: 0.5rem;
- padding: 0.5rem 1rem 0.5rem 0.75rem;
- margin: 0.5rem;
- font-size: 80%;
- }
-
- .sm-html p.info::before {
- content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' %3E%3Cpath d='M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z' fill='currentColor' /%3E%3C/svg%3E");
- display: inline-block;
- color: rgba(14,165,233,1);
- width: 1.5rem;
- height: 1.5rem;
- margin-right: 0.5rem;
- margin-top: 0.1rem;
- }
-
- .sm-editor::-webkit-scrollbar {
- background-color: transparent;
- width: 16px;
- }
-
- .sm-editor::-webkit-scrollbar-thumb {
- background-color: #aaa;
- border: 4px solid transparent;
- border-radius: 8px;
- background-clip: padding-box;
- }
-
+ .sm-html .ProseMirror { outline: none; }
+ .sm-html hr { border-top: 1px solid #aaa; margin: 1.5rem 0; }
+ .sm-html pre { padding: 0 1rem; line-height: 1rem; }
+ .sm-html blockquote { border-left: 4px solid #ddd; margin-left: 1rem; padding-left: 1rem; }
+ .sm-html p.info, .sm-html p.success, .sm-html p.warning, .sm-html p.danger { display: flex; border-radius: 0.5rem; padding: 0.5rem 1rem 0.5rem 0.75rem; margin: 0.5rem; font-size: 80%; }
+ .sm-html p.info::before, .sm-html p.success::before, .sm-html p.warning::before, .sm-html p.danger::before { display: inline-block; width: 1.5rem; height: 1.5rem; margin-right: 0.5rem; margin-top: 0.1rem; }
+ .sm-html p.info { border: 1px solid rgba(14,165,233,1); background-color: rgba(14,165,233,0.25); }
+ .sm-html p.info::before { color: rgba(14,165,233,1); content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' %3E%3Cpath d='M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z' fill='rgba(14,165,233,1)' /%3E%3C/svg%3E"); }
+ .sm-html p.success { border: 1px solid rgba(22,163,74,1); background-color: rgba(22,163,74,0.25); }
+ .sm-html p.success::before { color: rgba(22,163,74,1); content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' %3E%3Cpath d='M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M12 20C7.59 20 4 16.41 4 12S7.59 4 12 4 20 7.59 20 12 16.41 20 12 20M16.59 7.58L10 14.17L7.41 11.59L6 13L10 17L18 9L16.59 7.58Z' fill='rgba(22,163,74,1)' /%3E%3C/svg%3E"); }
+ .sm-html p.warning { border: 1px solid rgba(202,138,4,1); background-color: rgba(250,204,21,0.25); }
+ .sm-html p.warning::before { color: rgba(202,138,4,1); content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' %3E%3Cpath d='M12,2L1,21H23M12,6L19.53,19H4.47M11,10V14H13V10M11,16V18H13V16' fill='rgba(202,138,4,1)' /%3E%3C/svg%3E"); }
+ .sm-html p.danger { border: 1px solid rgba(220,38,38,1); background-color: rgba(220,38,38,0.25); }
+ .sm-html p.danger::before { color: rgba(220,38,38,1); content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' %3E%3Cpath d='M8.27,3L3,8.27V15.73L8.27,21H15.73L21,15.73V8.27L15.73,3M8.41,7L12,10.59L15.59,7L17,8.41L13.41,12L17,15.59L15.59,17L12,13.41L8.41,17L7,15.59L10.59,12L7,8.41' fill='rgba(220,38,38,1)' /%3E%3C/svg%3E"); }
+ .sm-editor::-webkit-scrollbar { background-color: transparent; width: 16px; }
+ .sm-editor::-webkit-scrollbar-thumb { background-color: #aaa; border: 4px solid transparent; border-radius: 8px; background-clip: padding-box; }
@keyframes rotate{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}