|
@@ -74,92 +74,6 @@
|
|
|
class="prose prose-zinc dark:prose-invert max-w-none content-editor p-4 bg-box-transparent rounded-lg relative"
|
|
|
@count="state.contentLength = $event"
|
|
|
>
|
|
|
- <template #prepend="{ editor }">
|
|
|
- <div
|
|
|
- class="p-2 rounded-lg backdrop-blur flex items-center sticky top-0 z-50 bg-box-transparent space-x-1 mb-2"
|
|
|
- >
|
|
|
- <button
|
|
|
- :class="{
|
|
|
- 'bg-box-transparent text-primary': editor.isActive('heading', {
|
|
|
- level: 1,
|
|
|
- }),
|
|
|
- }"
|
|
|
- title="Heading 1"
|
|
|
- class="editor-menu-btn hoverable"
|
|
|
- @click="editor.commands.toggleHeading({ level: 1 })"
|
|
|
- >
|
|
|
- <v-remixicon name="riH1" />
|
|
|
- </button>
|
|
|
- <button
|
|
|
- :class="{
|
|
|
- 'bg-box-transparent text-primary': editor.isActive('heading', {
|
|
|
- level: 2,
|
|
|
- }),
|
|
|
- }"
|
|
|
- title="Heading 2"
|
|
|
- class="editor-menu-btn hoverable"
|
|
|
- @click="editor.commands.toggleHeading({ level: 2 })"
|
|
|
- >
|
|
|
- <v-remixicon name="riH2" />
|
|
|
- </button>
|
|
|
- <span
|
|
|
- class="w-px h-5 bg-gray-300 dark:bg-gray-600"
|
|
|
- style="margin: 0 12px"
|
|
|
- ></span>
|
|
|
- <button
|
|
|
- v-for="item in menuItems"
|
|
|
- :key="item.id"
|
|
|
- :title="item.name"
|
|
|
- :class="{
|
|
|
- 'bg-box-transparent text-primary': editor.isActive(item.id),
|
|
|
- }"
|
|
|
- class="editor-menu-btn hoverable"
|
|
|
- @click="editor.chain().focus()[item.action]().run()"
|
|
|
- >
|
|
|
- <v-remixicon :name="item.icon" />
|
|
|
- </button>
|
|
|
- <span
|
|
|
- class="w-px h-5 bg-gray-300 dark:bg-gray-600"
|
|
|
- style="margin: 0 12px"
|
|
|
- ></span>
|
|
|
- <button
|
|
|
- :class="{
|
|
|
- 'bg-box-transparent text-primary':
|
|
|
- editor.isActive('blockquote'),
|
|
|
- }"
|
|
|
- title="Blockquote"
|
|
|
- class="editor-menu-btn hoverable"
|
|
|
- @click="editor.commands.toggleBlockquote()"
|
|
|
- >
|
|
|
- <v-remixicon name="riDoubleQuotesL" />
|
|
|
- </button>
|
|
|
- <button
|
|
|
- title="Insert image"
|
|
|
- class="editor-menu-btn hoverable"
|
|
|
- @click="insertImage(editor)"
|
|
|
- >
|
|
|
- <v-remixicon name="riImageLine" />
|
|
|
- </button>
|
|
|
- <button
|
|
|
- :class="{
|
|
|
- 'bg-box-transparent text-primary': editor.isActive('link'),
|
|
|
- }"
|
|
|
- title="Link"
|
|
|
- class="editor-menu-btn hoverable"
|
|
|
- @click="setLink(editor)"
|
|
|
- >
|
|
|
- <v-remixicon name="riLinkM" />
|
|
|
- </button>
|
|
|
- <button
|
|
|
- v-show="editor.isActive('link')"
|
|
|
- title="Remove link"
|
|
|
- class="editor-menu-btn hoverable"
|
|
|
- @click="editor.commands.unsetLink()"
|
|
|
- >
|
|
|
- <v-remixicon name="riLinkUnlinkM" />
|
|
|
- </button>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
<template #append>
|
|
|
<p
|
|
|
class="text-sm text-gray-600 dark:text-gray-200 absolute bottom-2 right-2"
|
|
@@ -197,17 +111,6 @@ const toast = useToast();
|
|
|
const userStore = useUserStore();
|
|
|
const sharedWorkflowStore = useSharedWorkflowStore();
|
|
|
|
|
|
-const menuItems = [
|
|
|
- { id: 'bold', name: 'Bold', icon: 'riBold', action: 'toggleBold' },
|
|
|
- { id: 'italic', name: 'Italic', icon: 'riItalic', action: 'toggleItalic' },
|
|
|
- {
|
|
|
- id: 'strike',
|
|
|
- name: 'Strikethrough',
|
|
|
- icon: 'riStrikethrough2',
|
|
|
- action: 'toggleStrike',
|
|
|
- },
|
|
|
-];
|
|
|
-
|
|
|
const state = reactive({
|
|
|
contentLength: 0,
|
|
|
isPublishing: false,
|
|
@@ -263,32 +166,6 @@ async function publishWorkflow() {
|
|
|
state.isPublishing = false;
|
|
|
}
|
|
|
}
|
|
|
-function setLink(editor) {
|
|
|
- const previousUrl = editor.getAttributes('link').href;
|
|
|
- const url = window.prompt('URL', previousUrl);
|
|
|
-
|
|
|
- if (url === null) return;
|
|
|
-
|
|
|
- if (url === '') {
|
|
|
- editor.chain().focus().extendMarkRange('link').unsetLink().run();
|
|
|
-
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- editor
|
|
|
- .chain()
|
|
|
- .focus()
|
|
|
- .extendMarkRange('link')
|
|
|
- .setLink({ href: url, target: '_blank' })
|
|
|
- .run();
|
|
|
-}
|
|
|
-function insertImage(editor) {
|
|
|
- const url = window.prompt('URL');
|
|
|
-
|
|
|
- if (url) {
|
|
|
- editor.chain().focus().setImage({ src: url }).run();
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
watch(
|
|
|
() => state.workflow,
|