From e5057cfdaf82ef85feda5baad5b7ef7b481ca715 Mon Sep 17 00:00:00 2001 From: Kagol Date: Wed, 23 Oct 2024 09:23:02 +0800 Subject: [PATCH] feat(fluent-editor): export default toolbar (#2350) --- .../renderless/src/fluent-editor/options.ts | 52 ++++++++++--------- packages/vue/src/fluent-editor/src/index.ts | 2 + 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/packages/renderless/src/fluent-editor/options.ts b/packages/renderless/src/fluent-editor/options.ts index 408116ae01..e58e3f35ee 100644 --- a/packages/renderless/src/fluent-editor/options.ts +++ b/packages/renderless/src/fluent-editor/options.ts @@ -57,33 +57,35 @@ const betterTable = { } } -const toolbar = () => { - const underline = ['bold', 'italic', 'underline', 'strike'] - const list = [{ list: 'ordered' }, { list: 'bullet' }] - const script = [{ script: 'sub' }, { script: 'super' }] +const underline = ['bold', 'italic', 'underline', 'strike'] +const list = [{ list: 'ordered' }, { list: 'bullet' }] +const script = [{ script: 'sub' }, { script: 'super' }] + +export const defaultToolbar = [ + ['undo', 'redo', 'clean'], + [ + { font: fontFamilyConfig }, + { size: fontSizeConfig }, + { lineheight: lineHeightConfig }, + { header: [1, 2, 3, 4, 5, 6, false] } + ], + underline, + ['blockquote', 'code-block'], + [{ header: 1 }, { header: 2 }], + list, + script, + [{ indent: '-1' }, { indent: '+1' }], + [{ direction: 'rtl' }], + [{ color: [] }, { background: [] }], + [{ align: [] }], + ['link', 'image'], + ['better-table'], + ['fullscreen'] +] +const toolbar = () => { return { - container: [ - ['undo', 'redo', 'clean'], - [ - { font: fontFamilyConfig }, - { size: fontSizeConfig }, - { lineheight: lineHeightConfig }, - { header: [1, 2, 3, 4, 5, 6, false] } - ], - underline, - ['blockquote', 'code-block'], - [{ header: 1 }, { header: 2 }], - list, - script, - [{ indent: '-1' }, { indent: '+1' }], - [{ direction: 'rtl' }], - [{ color: [] }, { background: [] }], - [{ align: [] }], - ['link', 'image'], - ['better-table'], - ['fullscreen'] - ] + container: defaultToolbar } } diff --git a/packages/vue/src/fluent-editor/src/index.ts b/packages/vue/src/fluent-editor/src/index.ts index 593e522f7b..0b35600151 100644 --- a/packages/vue/src/fluent-editor/src/index.ts +++ b/packages/vue/src/fluent-editor/src/index.ts @@ -68,6 +68,8 @@ export const fluentEditorProps = { } } +export { defaultToolbar } from '@opentiny/vue-renderless/fluent-editor/options' + export default defineComponent({ name: $prefix + 'FluentEditor', props: fluentEditorProps,