diff --git a/package.json b/package.json index 7223486b..771400e8 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "@codemirror/basic-setup": "^0.19.1", "@codemirror/lang-html": "^0.19.4", "@codemirror/lang-java": "^0.19.1", - "@halo-dev/admin-api": "^1.0.0-alpha.50", + "@halo-dev/admin-api": "^1.0.0-alpha.51", "@halo-dev/editor": "^3.0.0-alpha.2", "ant-design-vue": "^1.7.8", "dayjs": "^1.10.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a0e84845..752adb90 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,7 +6,7 @@ specifiers: '@codemirror/basic-setup': ^0.19.1 '@codemirror/lang-html': ^0.19.4 '@codemirror/lang-java': ^0.19.1 - '@halo-dev/admin-api': ^1.0.0-alpha.50 + '@halo-dev/admin-api': ^1.0.0-alpha.51 '@halo-dev/editor': ^3.0.0-alpha.2 '@vue/cli-plugin-babel': ~5.0.1 '@vue/cli-plugin-eslint': ~5.0.1 @@ -52,7 +52,7 @@ dependencies: '@codemirror/basic-setup': 0.19.1 '@codemirror/lang-html': 0.19.4 '@codemirror/lang-java': 0.19.1 - '@halo-dev/admin-api': 1.0.0-alpha.50 + '@halo-dev/admin-api': 1.0.0-alpha.51 '@halo-dev/editor': 3.0.0-alpha.2 ant-design-vue: 1.7.8_9065e7474e033a8e4b95615fc8e6c36c dayjs: 1.10.7 @@ -1577,8 +1577,8 @@ packages: - supports-color dev: true - /@halo-dev/admin-api/1.0.0-alpha.50: - resolution: {integrity: sha512-/kfkBPRqnhMRCMhKWMWz+rboUAxGCM5Tcv13BaBKlG04wEY7ewgrXrFMvxfYd0luIik+knluwKj1OwWix+2ZhA==} + /@halo-dev/admin-api/1.0.0-alpha.51: + resolution: {integrity: sha512-xREMnlN9GNTiw4Y2qJvpRu3SgmqhJ9l2e4ctfJ3vzG4AJacttHku5hKUxdOFE95sL7UFXEcE3MlNQqVJkHPksw==} engines: {node: '>=12'} dependencies: '@halo-dev/rest-api-client': 1.0.0-alpha.50 diff --git a/src/components/Editor/MarkdownEditor.vue b/src/components/Editor/MarkdownEditor.vue index 2c134420..724035b1 100644 --- a/src/components/Editor/MarkdownEditor.vue +++ b/src/components/Editor/MarkdownEditor.vue @@ -4,7 +4,8 @@ ref="editor" v-model="originalContentData" :boxShadow="false" - :toolbars="markdownEditorToolbars" + :subfield="subfield" + :toolbars="toolbars" :uploadRequest="handleAttachmentUpload" autofocus @change="handleChange" @@ -19,7 +20,7 @@ import haloEditor from '@halo-dev/editor' import '@halo-dev/editor/dist/lib/style.css' import apiClient from '@/utils/api-client' -import { markdownEditorToolbars } from '@/core/constant' +import { editorToolbars } from '@/core/constant' export default { name: 'MarkdownEditor', @@ -31,11 +32,20 @@ export default { type: String, required: false, default: '' + }, + toolbars: { + type: Object, + default: () => { + return editorToolbars + } + }, + subfield: { + type: Boolean, + default: true } }, data() { return { - markdownEditorToolbars, attachmentSelectVisible: false } }, diff --git a/src/core/constant.js b/src/core/constant.js index 03717f70..5715c89d 100644 --- a/src/core/constant.js +++ b/src/core/constant.js @@ -1,4 +1,4 @@ -export const markdownEditorToolbars = { +export const editorToolbars = { bold: true, italic: true, header: true, @@ -24,6 +24,28 @@ export const markdownEditorToolbars = { preview: true } +export const simpleEditorToolbars = { + bold: true, + italic: true, + header: true, + underline: true, + strikethrough: true, + superscript: true, + subscript: true, + quote: true, + ol: true, + ul: true, + link: true, + imagelink: true, + code: true, + table: true, + undo: true, + redo: true, + subfield: true, + htmlcode: true, + preview: true +} + export const actionLogTypes = { BLOG_INITIALIZED: { value: 0, diff --git a/src/views/dashboard/components/JournalPublishCard.vue b/src/views/dashboard/components/JournalPublishCard.vue index c314885d..91e88b7b 100644 --- a/src/views/dashboard/components/JournalPublishCard.vue +++ b/src/views/dashboard/components/JournalPublishCard.vue @@ -1,9 +1,11 @@