From 7f8cee92ad41554211bbc98125420a5f336fdcd4 Mon Sep 17 00:00:00 2001 From: aolinpk <2755561608@qq.com> Date: Mon, 3 Jun 2024 17:41:29 +0800 Subject: [PATCH] =?UTF-8?q?feat(md):=20MarkdownMD=20=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A=E4=B9=89=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=B7=A5=E5=85=B7=E6=A0=8F=20#1862?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../editor-md/src/components/toolbar.tsx | 8 +- .../src/composables/use-editor-md-toolbar.ts | 4 +- .../src/composables/use-editor-md.ts | 2 + .../devui/editor-md/src/editor-md-types.ts | 1 + .../devui/editor-md/src/editor-md.tsx | 2 + .../devui-vue/devui/editor-md/src/utils.ts | 2 +- .../docs/components/editor-md/index.md | 81 ++++++++++++++++++- 7 files changed, 92 insertions(+), 8 deletions(-) diff --git a/packages/devui-vue/devui/editor-md/src/components/toolbar.tsx b/packages/devui-vue/devui/editor-md/src/components/toolbar.tsx index b0f19946c1..1939527b1f 100644 --- a/packages/devui-vue/devui/editor-md/src/components/toolbar.tsx +++ b/packages/devui-vue/devui/editor-md/src/components/toolbar.tsx @@ -6,20 +6,20 @@ import './toolbar.scss'; export default defineComponent({ name: 'DMdToolbar', setup() { - const { toolbars, toolbarConfig } = useToolbar(); - + const { toolbars, toolbarConfig, customToolbars } = useToolbar(); + const tempToolbars = { ...toolbars, ...customToolbars?.value }; return () => (
diff --git a/packages/devui-vue/devui/editor-md/src/composables/use-editor-md-toolbar.ts b/packages/devui-vue/devui/editor-md/src/composables/use-editor-md-toolbar.ts index 7e823c44f7..3c8c6bba69 100644 --- a/packages/devui-vue/devui/editor-md/src/composables/use-editor-md-toolbar.ts +++ b/packages/devui-vue/devui/editor-md/src/composables/use-editor-md-toolbar.ts @@ -2,7 +2,7 @@ import { inject } from 'vue'; import { EditorMdInjectionKey, IEditorMdInjection } from '../editor-md-types'; export function useToolbar() { - const { toolbars, toolbarConfig } = inject(EditorMdInjectionKey) as IEditorMdInjection; + const { toolbars, toolbarConfig, customToolbars } = inject(EditorMdInjectionKey) as IEditorMdInjection; - return { toolbars, toolbarConfig }; + return { toolbars, toolbarConfig, customToolbars }; } diff --git a/packages/devui-vue/devui/editor-md/src/composables/use-editor-md.ts b/packages/devui-vue/devui/editor-md/src/composables/use-editor-md.ts index 72b8925632..65d0c0a00e 100644 --- a/packages/devui-vue/devui/editor-md/src/composables/use-editor-md.ts +++ b/packages/devui-vue/devui/editor-md/src/composables/use-editor-md.ts @@ -414,8 +414,10 @@ export function useEditorMd(props: EditorMdProps, ctx: SetupContext) { renderRef, containerRef, toolbars, + toolbarConfig, previewHtmlList, isHintShow, + customToolbars, getEditorIns, onPaste, previewContentChange, diff --git a/packages/devui-vue/devui/editor-md/src/editor-md-types.ts b/packages/devui-vue/devui/editor-md/src/editor-md-types.ts index c6b4fa3b4e..9598190711 100644 --- a/packages/devui-vue/devui/editor-md/src/editor-md-types.ts +++ b/packages/devui-vue/devui/editor-md/src/editor-md-types.ts @@ -136,6 +136,7 @@ export interface IEditorMdInjection { showFullscreen: Ref