@fastkit/vui-wysiwyg 7.0.2 → 7.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -271,6 +271,10 @@ declare const VWysiwygEditor: vue.DefineComponent<{
271
271
  floatingToolbar: BooleanConstructor;
272
272
  disabledMinHeight: BooleanConstructor;
273
273
  disabledMaxHeight: BooleanConstructor;
274
+ removeDefaultWrapper: {
275
+ type: BooleanConstructor;
276
+ default: boolean;
277
+ };
274
278
  'v-slots': PropType<{
275
279
  [x: `error:${string}`]: (error: _fastkit_vue_form_control.FormNodeError) => VNodeChild;
276
280
  label?: ((wrapper: _fastkit_vue_form_control.FormNodeWrapper) => VNodeChild) | undefined;
@@ -362,6 +366,10 @@ declare const VWysiwygEditor: vue.DefineComponent<{
362
366
  floatingToolbar: BooleanConstructor;
363
367
  disabledMinHeight: BooleanConstructor;
364
368
  disabledMaxHeight: BooleanConstructor;
369
+ removeDefaultWrapper: {
370
+ type: BooleanConstructor;
371
+ default: boolean;
372
+ };
365
373
  'v-slots': PropType<{
366
374
  [x: `error:${string}`]: (error: _fastkit_vue_form_control.FormNodeError) => VNodeChild;
367
375
  label?: ((wrapper: _fastkit_vue_form_control.FormNodeWrapper) => VNodeChild) | undefined;
@@ -463,6 +471,7 @@ declare const VWysiwygEditor: vue.DefineComponent<{
463
471
  floatingToolbar: boolean;
464
472
  disabledMinHeight: boolean;
465
473
  disabledMaxHeight: boolean;
474
+ removeDefaultWrapper: boolean;
466
475
  }, _fastkit_vue_utils.DefinedSlots<{
467
476
  [x: `error:${string}`]: (error: _fastkit_vue_form_control.FormNodeError) => vue.VNode<vue.RendererNode, vue.RendererElement, {
468
477
  [key: string]: any;
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, computed, watch, onBeforeUnmount, createVNode, createTextVNode, mergeProps, isVNode } from 'vue';
1
+ import { defineComponent, ref, computed, watch, onBeforeUnmount, createVNode, createTextVNode, isVNode } from 'vue';
2
2
  import { Extension, useEditor, Mark, mergeAttributes, EditorContent, BubbleMenu } from '@tiptap/vue-3';
3
3
  import { Decoration, DecorationSet } from '@tiptap/pm/view';
4
4
  import { Plugin, PluginKey, TextSelection } from '@tiptap/pm/state';
@@ -841,7 +841,11 @@ var VWysiwygEditor = defineComponent({
841
841
  },
842
842
  floatingToolbar: Boolean,
843
843
  disabledMinHeight: Boolean,
844
- disabledMaxHeight: Boolean
844
+ disabledMaxHeight: Boolean,
845
+ removeDefaultWrapper: {
846
+ type: Boolean,
847
+ default: true
848
+ }
845
849
  },
846
850
  emits: {
847
851
  ...createTextableEmits()
@@ -862,11 +866,20 @@ var VWysiwygEditor = defineComponent({
862
866
  nodeType: VUI_WYSIWYG_EDITOR_SYMBOL,
863
867
  validationValue: () => textRef.value
864
868
  });
869
+ const getOutput = (editor2, type) => {
870
+ if (props.removeDefaultWrapper && editor2.isEmpty)
871
+ return "";
872
+ if (type === "html")
873
+ return editor2.getHTML();
874
+ if (type === "text")
875
+ return editor2.getText();
876
+ return "";
877
+ };
865
878
  const initializeCtx = new WysiwygEditorInitializeContext(() => vui, {
866
879
  onCreate: ({
867
880
  editor: editor2
868
881
  }) => {
869
- textRef.value = editor2.getText();
882
+ textRef.value = getOutput(editor2, "text");
870
883
  updateEditable();
871
884
  },
872
885
  onFocus: ({
@@ -882,24 +895,17 @@ var VWysiwygEditor = defineComponent({
882
895
  onUpdate: ({
883
896
  editor: editor2
884
897
  }) => {
885
- inputControl.value = editor2.getHTML();
886
- textRef.value = editor2.getText();
898
+ inputControl.value = getOutput(editor2, "html");
899
+ textRef.value = getOutput(editor2, "text");
887
900
  }
888
901
  });
889
- const extensions = [
890
- StarterKit.configure({
891
- bold: false,
892
- bulletList: false,
893
- orderedList: false,
894
- history: false,
895
- italic: false
896
- }),
897
- // Linter.configure({
898
- // plugins: [BadWords(['abc', 'evidently']), Punctuation, HeadingLevel],
899
- // }),
900
- ...resolveRawWysiwygExtensions(props.extensions, initializeCtx),
901
- ...wysiwygSettings.value.extensions
902
- ];
902
+ const extensions = [StarterKit.configure({
903
+ bold: false,
904
+ bulletList: false,
905
+ orderedList: false,
906
+ history: false,
907
+ italic: false
908
+ }), ...resolveRawWysiwygExtensions(props.extensions, initializeCtx), ...wysiwygSettings.value.extensions];
903
909
  const updateEditable = () => {
904
910
  if (!editor.value)
905
911
  return;
@@ -908,15 +914,15 @@ var VWysiwygEditor = defineComponent({
908
914
  watch(() => inputControl.canOperation, updateEditable);
909
915
  watch(() => props.modelValue, (modelValue) => {
910
916
  const $editor = editor.value;
911
- if (!$editor || $editor.getHTML() === modelValue)
917
+ if (!$editor || getOutput($editor, "html") === modelValue)
912
918
  return;
913
919
  $editor.commands.setContent(modelValue == null ? "" : modelValue, false);
914
- textRef.value = $editor.getText();
920
+ textRef.value = getOutput($editor, "text");
915
921
  });
916
922
  initializeCtx.on("create", ({
917
923
  editor: editor2
918
924
  }) => {
919
- textRef.value = editor2.getText();
925
+ textRef.value = getOutput(editor2, "text");
920
926
  updateEditable();
921
927
  });
922
928
  const editor = useEditor({
@@ -931,13 +937,10 @@ var VWysiwygEditor = defineComponent({
931
937
  }
932
938
  });
933
939
  const focus = (position, options) => editor.value?.chain().focus(position, options);
934
- const wysiwygContext = computed(() => {
935
- const _editor = editor.value;
936
- return {
937
- vui,
938
- editor: _editor
939
- };
940
- });
940
+ const wysiwygContext = computed(() => ({
941
+ vui,
942
+ editor: editor.value
943
+ }));
941
944
  const createTools = (bubbleMenu = false) => {
942
945
  let _slot;
943
946
  const {
@@ -994,7 +997,7 @@ var VWysiwygEditor = defineComponent({
994
997
  });
995
998
  };
996
999
  onBeforeUnmount(() => {
997
- editor.value && editor.value.destroy();
1000
+ editor.value?.destroy();
998
1001
  });
999
1002
  const api = {
1000
1003
  get editor() {
@@ -1008,6 +1011,20 @@ var VWysiwygEditor = defineComponent({
1008
1011
  scrollIntoView: true
1009
1012
  });
1010
1013
  };
1014
+ const defaultSlot = () => {
1015
+ let _slot2;
1016
+ return createVNode("div", {
1017
+ "class": "v-wysiwyg-editor__body"
1018
+ }, [createVNode(EditorContent, {
1019
+ "class": "v-wysiwyg-editor__input__element wysiwyg",
1020
+ "editor": editor.value
1021
+ }, null), !props.floatingToolbar && !!editor.value && !inputControl.isReadonly && createVNode(BubbleMenu, {
1022
+ "class": "v-wysiwyg-editor__bubble-menu",
1023
+ "editor": editor.value
1024
+ }, _isSlot2(_slot2 = createTools(true)) ? _slot2 : {
1025
+ default: () => [_slot2]
1026
+ })]);
1027
+ };
1011
1028
  const formControlDefaultSlot = () => createVNode("div", {
1012
1029
  "class": "v-wysiwyg-editor__wrapper"
1013
1030
  }, [!inputControl.isReadonly && createTools(), createVNode(VControlField, {
@@ -1018,22 +1035,7 @@ var VWysiwygEditor = defineComponent({
1018
1035
  "size": control.size.value
1019
1036
  }, {
1020
1037
  ...ctx.slots,
1021
- default: () => {
1022
- let _slot2;
1023
- return createVNode("div", {
1024
- "class": "v-wysiwyg-editor__body"
1025
- }, [createVNode(EditorContent, mergeProps({
1026
- class: "v-wysiwyg-editor__input__element wysiwyg"
1027
- }, {
1028
- "editor": editor.value
1029
- }), null), !props.floatingToolbar && !!editor.value && !inputControl.isReadonly && createVNode(BubbleMenu, mergeProps({
1030
- class: "v-wysiwyg-editor__bubble-menu"
1031
- }, {
1032
- "editor": editor.value
1033
- }), _isSlot2(_slot2 = createTools(true)) ? _slot2 : {
1034
- default: () => [_slot2]
1035
- })]);
1036
- }
1038
+ default: defaultSlot
1037
1039
  })]);
1038
1040
  const infoAppendsSlot = () => {
1039
1041
  const {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schemes.ts","../src/injections.ts","../src/extensions/linter/Linter.tsx","../src/extensions/linter/utils.ts","../src/extensions/linter/LinterPlugin.ts","../src/extensions/linter/plugins/BadWords.tsx","../src/extensions/linter/plugins/HeadingLevel.ts","../src/extensions/linter/plugins/Punctuation.ts","../src/extensions/color.ts","../src/extensions/custom-tag.ts","../src/tools/bullet-list.ts","../src/tools/format-bold.ts","../src/tools/format-italic.ts","../src/tools/format-underline.ts","../src/tools/history.ts","../src/tools/link.ts","../src/tools/ordered-list.ts","../src/tools/color.tsx","../src/tools/text-align.tsx","../src/tools/custom-tag.ts","../src/components/VWysiwygEditor/VWysiwygEditor.tsx"],"names":["_createVNode","Extension","name","vui","Mark","_isVNode","VButton","VButtonGroup","_isSlot","editor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,IAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIA,IAAM,oBAAoB,CAAmB,WAC3C,KAAK,OAAO,OAAO,CAAC,EAAE,YAAY,CAAC,GAAG,OAAO,MAAM,CAAC,CAAC;AAgBhD,IAAM,iCAAN,MAAqC;AAAA,EACjC,YAAuC,CAAC;AAAA,EAEhC;AAAA,EAEjB,IAAI,MAAM;AACR,WAAO,KAAK,KAAK;AAAA,EACnB;AAAA,EAEA,YACE,WACA,OAAmC,CAAC,GACpC;AACA,SAAK,OAAO;AAEZ,kBAAc,QAAQ,CAAC,UAAU;AAC/B,WAAK,UAAU,KAAK,IAAI,CAAC;AACzB,YAAM,WAAW,kBAAkB,KAAK;AACxC,YAAM,KAAK,KAAK,QAAQ;AACxB,YAAM,KAAK,UAAU,KAAK,EAAE,KAAK,EAAS;AAAA,IAC5C,CAAC;AAAA,EACH;AAAA,EAEA,GACE,IACA,SACA;AACA,SAAK,UAAU,EAAE,EAAE,KAAK,OAAO;AAC/B,WAAO,MAAM,KAAK,IAAI,IAAI,OAAO;AAAA,EACnC;AAAA,EAEA,IACE,IACA,SACA;AACA,SAAK,UAAU,EAAE,IAAI,KAAK,UAAU,EAAE,EAAE;AAAA,MACtC,CAAC,aAAa,aAAa;AAAA,IAC7B;AAAA,EACF;AAAA,EAEA,gBAAgB;AACd,UAAM,OAAmC,CAAC;AAE1C,kBAAc,QAAQ,CAAC,UAAU;AAC/B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,QACT,GAAG;AAAA,UACD,UAAU,OAAO;AAAA,QACnB,CAAC,GAAGQ,SAAQ,SAAS,YAAY,IAAI,CAAC,IAAI,SAAS;AAAA,UACjD,SAAS,MAAM,CAAC,MAAM;AAAA,QACxB,CAAC,CAAC,CAAC;AAAA,MACL;AAAA,IACF,CAAC,CAAC,CAAC;AACH,UAAM,kBAAkB,MAAM;AAC5B,YAAM;AAAA,QACJ;AAAA,MACF,IAAI;AACJ,UAAI,CAAC;AAAe;AACpB,aAAOR,cAAa,cAAc,eAAe,IAAI;AAAA,IACvD;AACA,WAAO,MAAMA,cAAa,cAAc;AAAA,MACtC,eAAe;AAAA,MACf,SAAS,QAAQ;AAAA,MACjB,SAAS,MAAM;AAAA,MACf,QAAQ,MAAM;AAAA,MACd,WAAW,MAAM;AAAA,MACjB,cAAc,MAAM;AAAA,MACpB,gBAAgB,MAAM;AAAA,MACtB,gBAAgB;AAAA,IAClB,GAAG;AAAA,MACD,GAAG,IAAI;AAAA,MACP,SAAS;AAAA,MACT,aAAa;AAAA,IACf,CAAC;AAAA,EACH;AACF,CAAC;AACD,SAAS,uBAAuB,KAEhC,QAAQ;AACN,SAAO,OAAO,WAAW,aAAa,OAAO,GAAG,IAAI;AACtD","sourcesContent":["import { type VuiService, type IconName } from '@fastkit/vui';\nimport {\n type Editor,\n type Extensions,\n type Node,\n type Extension,\n type Mark,\n type AnyExtension,\n type EditorOptions,\n} from '@tiptap/vue-3';\nimport { VNodeChild } from 'vue';\n\nconst EDITOR_EVENTS = [\n 'beforeCreate',\n 'create',\n 'update',\n 'selectionUpdate',\n 'transaction',\n 'focus',\n 'blur',\n 'destroy',\n] as const;\n\ntype PrefixedEventName<S extends string> = `on${Capitalize<S>}`;\n\nconst prefixedEventName = <S extends string>(source: S): PrefixedEventName<S> =>\n `on${source.charAt(0).toUpperCase()}${source.slice(1)}` as any;\n\nexport type WysiwygEditorEvent = (typeof EDITOR_EVENTS)[number];\n\nexport type WysiwygEditorPrefixedEvent = PrefixedEventName<WysiwygEditorEvent>;\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface WysiwygEditorEventsOptions\n extends Partial<Pick<EditorOptions, WysiwygEditorPrefixedEvent>> {}\n\nexport type WysiwygEditorEventsBucket = {\n [EV in WysiwygEditorEvent]: NonNullable<\n WysiwygEditorEventsOptions[PrefixedEventName<EV>]\n >[];\n};\n\nexport class WysiwygEditorInitializeContext {\n readonly listeners: WysiwygEditorEventsBucket = {} as any;\n\n private readonly _vui: () => VuiService;\n\n get vui() {\n return this._vui();\n }\n\n constructor(\n vuiGetter: () => VuiService,\n opts: WysiwygEditorEventsOptions = {},\n ) {\n this._vui = vuiGetter;\n\n EDITOR_EVENTS.forEach((event) => {\n this.listeners[event] = [];\n const prefixed = prefixedEventName(event);\n const fn = opts[prefixed];\n fn && this.listeners[event].push(fn as any);\n });\n }\n\n on<EV extends WysiwygEditorEvent>(\n ev: EV,\n handler: NonNullable<WysiwygEditorEventsOptions[PrefixedEventName<EV>]>,\n ) {\n this.listeners[ev].push(handler);\n return () => this.off(ev, handler);\n }\n\n off<EV extends WysiwygEditorEvent>(\n ev: EV,\n handler: NonNullable<WysiwygEditorEventsOptions[PrefixedEventName<EV>]>,\n ) {\n this.listeners[ev] = this.listeners[ev].filter(\n (_handler) => _handler !== handler,\n ) as any;\n }\n\n editorOptions() {\n const opts: WysiwygEditorEventsOptions = {};\n\n EDITOR_EVENTS.forEach((event) => {\n const prefixed = prefixedEventName(event);\n opts[prefixed] = (props) => {\n const handlers = this.listeners[event];\n handlers.forEach((handler) => {\n handler(props as any);\n });\n };\n });\n\n return opts;\n }\n}\n\nexport interface WysiwygEditorContext {\n editor: Editor;\n vui: VuiService;\n}\n\nexport type WysiwygExtensionFactory<Options = any, Storage = any> = (\n ctx: WysiwygEditorInitializeContext,\n) =>\n | Extension<Options, Storage>\n | Node<Options, Storage>\n | Mark<Options, Storage>;\n\nexport interface CreatedWysiwygExtension<Options = any, Storage = any> {\n __isCreatedWysiwygExtension: true;\n _configs: Partial<Options>[];\n configure(\n options?: Partial<Options>,\n ): CreatedWysiwygExtension<Options, Storage>;\n raw: WysiwygExtensionSource<Options, Storage>;\n}\n\nexport type WysiwygExtensionSource<Options = any, Storage = any> =\n | Extension<Options, Storage>\n | Node<Options, Storage>\n | Mark<Options, Storage>\n | WysiwygExtensionFactory<Options, Storage>;\n\nexport type RawWysiwygExtension<Options = any, Storage = any> =\n | WysiwygExtensionSource<Options, Storage>\n | CreatedWysiwygExtension<Options, Storage>;\n\n// export function createWysiwygExtension<Options = any, Storage = any>(\n// extension: Extension<Options, Storage>,\n// ): Extension<Options, Storage>;\n// export function createWysiwygExtension<Options = any, Storage = any>(\n// node: Node<Options, Storage>,\n// ): Node<Options, Storage>;\n// export function createWysiwygExtension<Options = any, Storage = any>(\n// mark: Mark<Options, Storage>,\n// ): Mark<Options, Storage>;\n// export function createWysiwygExtension<Options = any, Storage = any>(\n// factory: WysiwygExtensionFactory<Options, Storage>,\n// ): WysiwygExtensionFactory<Options, Storage>;\n\nfunction isCreatedWysiwygExtension<Options = any, Storage = any>(\n source: unknown,\n): source is CreatedWysiwygExtension<Options, Storage> {\n return (\n !!source &&\n typeof source === 'object' &&\n (source as CreatedWysiwygExtension).__isCreatedWysiwygExtension === true\n );\n}\n\nexport function createWysiwygExtension<Options = any, Storage = any>(\n extension: WysiwygExtensionSource<Options, Storage>,\n) {\n const ext: CreatedWysiwygExtension<Options, Storage> = {\n __isCreatedWysiwygExtension: true,\n _configs: [],\n configure: (opts) => {\n opts && ext._configs.push(opts);\n return ext;\n },\n raw: extension,\n };\n return ext;\n}\n\nfunction resolveRawWysiwygExtension(\n raw: RawWysiwygExtension,\n ctx: WysiwygEditorInitializeContext,\n): AnyExtension {\n if (isCreatedWysiwygExtension(raw)) {\n const { raw: _raw, _configs } = raw;\n let ext = typeof _raw === 'function' ? _raw(ctx) : _raw;\n _configs.forEach((config) => {\n ext = ext.configure(config);\n });\n return ext;\n }\n return typeof raw === 'function' ? raw(ctx) : raw;\n}\n\nexport function resolveRawWysiwygExtensions(\n raws: RawWysiwygExtension[],\n ctx: WysiwygEditorInitializeContext,\n) {\n return raws.map((raw) => resolveRawWysiwygExtension(raw, ctx));\n}\n\nexport type WysiwygEditorToolIcon =\n | IconName\n | ((ctx: WysiwygEditorContext) => IconName | (() => VNodeChild) | undefined);\n\n/**\n * Tool Configuration\n */\nexport interface WysiwygEditorTool {\n /**\n * Tool Key\n *\n * Must be unique to identify the tool\n */\n key: string;\n /** Icons to be displayed on the toolbar */\n icon: WysiwygEditorToolIcon;\n /** Conditions for displaying the icon as active */\n active?: boolean | ((ctx: WysiwygEditorContext) => boolean);\n /** Conditions for deactivating the icon */\n disabled?: boolean | ((ctx: WysiwygEditorContext) => boolean);\n /** Handler when mark text is clicked */\n onClick: (ctx: WysiwygEditorContext, ev: MouseEvent) => any;\n /** Whether to display tools in floating menu or not */\n floating?: boolean;\n /** Extensions that the tool depends on */\n extensions?: Extensions;\n}\n\nexport type WysiwygEditorToolFactory<Options = void> = (\n vui: VuiService,\n options?: Options,\n) => WysiwygEditorTool | WysiwygEditorTool[];\n\nexport type RawWysiwygEditorTool =\n | WysiwygEditorTool\n | WysiwygEditorToolFactory<any>;\n\nfunction resolveRawWysiwygEditorTool(\n raw: RawWysiwygEditorTool,\n vui: VuiService,\n) {\n return typeof raw === 'function' ? raw(vui) : raw;\n}\n\nexport interface ResolvedWysiwygEditorSettings {\n tools: WysiwygEditorTool[];\n extensions: Extensions;\n}\n\nexport function resolveRawWysiwygEditorTools(\n rawTools: RawWysiwygEditorTool[],\n vui: VuiService,\n): ResolvedWysiwygEditorSettings {\n const tools: WysiwygEditorTool[] = [];\n const extensions: Extensions = [];\n\n rawTools.forEach((raw) => {\n let resolved = resolveRawWysiwygEditorTool(raw, vui);\n if (!Array.isArray(resolved)) {\n resolved = [resolved];\n }\n resolved.forEach((tool) => {\n tools.push(tool);\n if (tool.extensions) {\n extensions.push(...tool.extensions);\n }\n });\n });\n\n return {\n tools,\n extensions,\n };\n}\n","export const VUI_WYSIWYG_EDITOR_SYMBOL = 'vui-wysiwyg-editor';\n","import { createVNode as _createVNode } from \"vue\";\nimport './Linter.scss';\nimport { Extension } from '@tiptap/vue-3';\nimport { Decoration, DecorationSet } from '@tiptap/pm/view';\nimport { Plugin, PluginKey, TextSelection } from '@tiptap/pm/state';\nimport { createWysiwygExtension } from '../../schemes';\nconst PROBLEM_CLASS_NAME = 'v-linter__problem';\nconst ISSUE_ICON_CLASS_NAME = 'v-linter__issue-icon';\nconst ISSUE_DATASET_NAME = 'data-issue-id';\nfunction resolveWysiwygLinterFixMessage(message) {\n return typeof message === 'function' ? message() : message;\n}\nfunction renderIcon(view, issue) {\n const {\n level = 'warning'\n } = issue;\n const icon = document.createElement('div');\n const message = resolveWysiwygLinterFixMessage(issue.message);\n icon.className = `${ISSUE_ICON_CLASS_NAME} ${level}-scope`;\n icon.setAttribute(ISSUE_DATASET_NAME, issue.id);\n if (typeof message === 'string') {\n icon.title = message;\n }\n return icon;\n}\nfunction runAllLinterPlugins(doc, plugins) {\n const decorations = [];\n const issues = plugins.map(RegisteredLinterPlugin => new RegisteredLinterPlugin(doc).scan().getResults()).flat();\n issues.forEach(issue => {\n const {\n level = 'warning',\n icon\n } = issue;\n const message = resolveWysiwygLinterFixMessage(issue.message);\n decorations.push(Decoration.inline(issue.from, issue.to, {\n class: `${PROBLEM_CLASS_NAME} ${level}-scope`,\n 'data-issue-id': issue.id,\n title: typeof message === 'string' ? message : undefined\n }));\n if (icon) {\n decorations.push(Decoration.widget(issue.from, view => renderIcon(view, issue)));\n }\n });\n const decorationSet = DecorationSet.create(doc, decorations);\n return {\n issues,\n decorationSet\n };\n}\nexport const WysiwygLinter = createWysiwygExtension(ctx => {\n function showMenu(view, issue, event) {\n const message = resolveWysiwygLinterFixMessage(issue.message);\n const variant = ctx.vui.setting('containedVariant');\n const scope = ctx.vui.setting(`${issue.level}Scope`);\n return ctx.vui.menu({\n activator: event,\n content: stack => _createVNode(\"div\", {\n \"class\": \"v-linter__issue-menu__body\"\n }, [_createVNode(\"div\", {\n \"class\": ['v-linter__issue-menu__message', `${scope}-scope ${variant}`]\n }, [message]), issue.fix.length && _createVNode(\"div\", {\n \"class\": \"v-linter__issue-menu__fixers\"\n }, [issue.fix.map((fixer, index) => _createVNode(\"div\", {\n \"key\": index,\n \"class\": \"v-linter__issue-menu__fixer\"\n }, [_createVNode(\"button\", {\n \"type\": \"button\",\n \"class\": \"v-linter__issue-menu__fixer__button\",\n \"onClick\": () => {\n stack.close();\n fixer.handler(view, issue);\n }\n }, [_createVNode(\"span\", {\n \"class\": \"v-linter__issue-menu__fixer__button__message\"\n }, [resolveWysiwygLinterFixMessage(fixer.message)])])]))])])\n });\n }\n return Extension.create({\n name: 'linter',\n addOptions() {\n return {\n plugins: []\n };\n },\n addStorage() {\n return {\n issues: []\n };\n },\n addProseMirrorPlugins() {\n const {\n plugins\n } = this.options;\n const {\n storage\n } = this;\n const runAll = doc => {\n const {\n issues,\n decorationSet\n } = runAllLinterPlugins(doc, plugins);\n storage.issues = issues;\n return decorationSet;\n };\n const getIssue = id => storage.issues.find(issue => issue.id === id);\n const getIssueElementByEvent = source => {\n if (!source || !(source instanceof HTMLElement)) {\n return;\n }\n const issueId = source.getAttribute(ISSUE_DATASET_NAME);\n const issue = issueId && getIssue(issueId);\n if (!issue) return;\n return {\n issue\n };\n };\n const linterPlugin = new Plugin({\n key: new PluginKey('linter'),\n state: {\n init(_, {\n doc\n }) {\n return runAll(doc);\n },\n apply(transaction, oldState) {\n return transaction.docChanged ? runAll(transaction.doc) : oldState;\n }\n },\n props: {\n decorations(state) {\n return linterPlugin.getState(state);\n },\n handleClick(view, _, event) {\n const info = getIssueElementByEvent(event.target);\n if (!info) {\n return false;\n }\n const {\n issue\n } = info;\n const {\n from,\n to\n } = issue;\n const focus = () => view.dispatch(view.state.tr.setSelection(TextSelection.create(view.state.doc, from, to)).scrollIntoView());\n focus();\n showMenu(view, issue, event);\n return true;\n }\n }\n });\n return [linterPlugin];\n }\n });\n});","/* eslint-disable eqeqeq */\n/* eslint-disable no-bitwise */\nlet IDX = 256;\nlet BUFFER: any;\nconst HEX: any = [];\nwhile (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);\n\nexport function cheepUUID() {\n let i = 0;\n let num;\n let out = '';\n\n if (!BUFFER || IDX + 16 > 256) {\n BUFFER = Array((i = 256));\n while (i--) BUFFER[i] = (256 * Math.random()) | 0;\n // eslint-disable-next-line no-multi-assign\n i = IDX = 0;\n }\n\n for (; i < 16; i++) {\n num = BUFFER[IDX + i];\n if (i == 6) out += HEX[(num & 15) | 64];\n else if (i == 8) out += HEX[(num & 63) | 128];\n else out += HEX[num];\n\n if (i & 1 && i > 1 && i < 11) out += '-';\n }\n\n IDX++;\n return out;\n}\n","import { VNodeChild } from 'vue';\nimport { Node as ProsemirrorNode } from '@tiptap/pm/model';\nimport { EditorView } from '@tiptap/pm/view';\nimport { cheepUUID } from './utils';\n\nexport type WysiwygLinterFixFn = (\n view: EditorView,\n issue: WysiwygLinterResult,\n) => any;\n\nexport type WysiwygLinterFixMessage = string | (() => VNodeChild);\n\nexport interface WysiwygLinterFixer {\n message: WysiwygLinterFixMessage;\n handler: WysiwygLinterFixFn;\n}\n\nexport type WysiwygLinterResultLevel = 'warning' | 'error';\n\n// fixers\nexport interface WysiwygLinterResult {\n id: string;\n icon: boolean;\n level: WysiwygLinterResultLevel;\n message: WysiwygLinterFixMessage;\n from: number;\n to: number;\n fix: WysiwygLinterFixer[];\n}\n\nexport interface RawLinterResult\n extends Omit<WysiwygLinterResult, 'level' | 'fix' | 'id' | 'icon'> {\n level?: WysiwygLinterResultLevel;\n icon?: boolean;\n fix?: WysiwygLinterFixer | WysiwygLinterFixer[];\n}\n\nexport class WysiwygLinterPlugin {\n protected doc: ProsemirrorNode;\n\n private results: Array<WysiwygLinterResult> = [];\n\n constructor(doc: ProsemirrorNode) {\n this.doc = doc;\n }\n\n record(result: RawLinterResult) {\n const { fix = [], icon = false } = result;\n this.results.push({\n level: 'error',\n id: cheepUUID(),\n ...result,\n fix: Array.isArray(fix) ? fix : [fix],\n icon,\n });\n }\n\n scan() {\n return this;\n }\n\n getResults() {\n return this.results;\n }\n}\n","import { createTextVNode as _createTextVNode, createVNode as _createVNode } from \"vue\";\nimport { WysiwygLinterPlugin } from '../LinterPlugin';\nexport function WysiwygLinterBadWords(words) {\n const regex = new RegExp(`\\\\b(${words.join('|')})\\\\b`);\n\n // eslint-disable-next-line no-shadow\n return class WysiwygLinterBadWords extends WysiwygLinterPlugin {\n scan() {\n this.doc.descendants((node, position) => {\n if (!node.isText) {\n return;\n }\n const matches = regex.exec(node.text);\n if (matches) {\n const fixValue = `${matches[0]}!!!!!`;\n this.record({\n level: 'warning',\n message: `Try not to say '${matches[0]}'`,\n from: position + matches.index,\n to: position + matches.index + matches[0].length,\n fix: [{\n message: () => _createVNode(\"span\", null, [_createVNode(\"code\", null, [fixValue]), _createTextVNode(\"\\u306B\\u4FEE\\u6B63\\u3059\\u308B\\u3002\")]),\n handler: () => {\n // eslint-disable-next-line no-console\n console.log('hoge');\n }\n }, {\n message: 'どうにかする',\n handler: () => {\n // eslint-disable-next-line no-console\n console.log('hoge');\n }\n }]\n });\n }\n });\n return this;\n }\n };\n}","import { EditorView } from '@tiptap/pm/view';\nimport {\n WysiwygLinterPlugin,\n WysiwygLinterResult as Issue,\n} from '../LinterPlugin';\n\nexport class WysiwygLinterHeadingLevel extends WysiwygLinterPlugin {\n fixHeader(level: number) {\n // eslint-disable-next-line func-names\n return function ({ state, dispatch }: EditorView, issue: Issue) {\n dispatch(state.tr.setNodeMarkup(issue.from - 1, undefined, { level }));\n };\n }\n\n scan() {\n let lastHeadLevel: number | null = null;\n\n this.doc.descendants((node, position) => {\n if (node.type.name === 'heading') {\n // Check whether heading levels fit under the current level\n const { level } = node.attrs;\n\n if (lastHeadLevel != null && level > lastHeadLevel + 1) {\n this.record({\n message: `Heading too small (${level} under ${lastHeadLevel})`,\n from: position + 1,\n to: position + 1 + node.content.size,\n fix: {\n message: '修正する',\n handler: this.fixHeader(lastHeadLevel + 1),\n },\n });\n }\n lastHeadLevel = level;\n }\n });\n\n return this;\n }\n}\n","import { EditorView } from '@tiptap/pm/view';\nimport {\n WysiwygLinterPlugin,\n WysiwygLinterResult as Issue,\n} from '../LinterPlugin';\n\nexport class WysiwygLinterPunctuation extends WysiwygLinterPlugin {\n public regex = / ([,.!?:]) ?/g;\n\n fix(replacement: any) {\n // eslint-disable-next-line func-names\n return function ({ state, dispatch }: EditorView, issue: Issue) {\n dispatch(\n state.tr.replaceWith(\n issue.from,\n issue.to,\n state.schema.text(replacement),\n ),\n );\n };\n }\n\n scan() {\n this.doc.descendants((node, position) => {\n if (!node.isText) {\n return;\n }\n\n if (!node.text) {\n return;\n }\n\n const matches = this.regex.exec(node.text);\n\n if (matches) {\n this.record({\n message: 'Suspicious spacing around punctuation',\n from: position + matches.index,\n to: position + matches.index + matches[0].length,\n fix: {\n message: 'Fix it!!!',\n handler: this.fix(`${matches[1]} `),\n },\n });\n }\n });\n\n return this;\n }\n}\n","import { Extension } from '@tiptap/vue-3';\nimport '@tiptap/extension-text-style';\n\nexport type WysiwygColorOptions = {\n types: string[];\n};\n\ndeclare module '@tiptap/vue-3' {\n interface Commands<ReturnType> {\n color: {\n /**\n * Set the text color\n */\n setColor: (color: string) => ReturnType;\n /**\n * Unset the text color\n */\n unsetColor: () => ReturnType;\n };\n }\n}\n\nexport const WysiwygColorExtension = Extension.create<WysiwygColorOptions>({\n name: 'color',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n color: {\n default: null,\n parseHTML: (element) => element.style.color.replace(/['\"]+/g, ''),\n renderHTML: (attributes) => {\n if (!attributes.color) {\n return {};\n }\n\n return {\n style: `color: ${attributes.color}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setColor:\n (color) =>\n ({ chain }) =>\n chain().setMark('textStyle', { color }).run(),\n unsetColor:\n () =>\n ({ chain }) =>\n chain()\n .setMark('textStyle', { color: null })\n .removeEmptyTextStyle()\n .run(),\n };\n },\n});\n","import { Extension, mergeAttributes, Mark } from '@tiptap/vue-3';\nimport '@tiptap/extension-text-style';\n// import '@tiptap/vue-3';\n\nexport type WysiwygCustomTagSettings = {\n /**\n * tag name\n *\n * Either the html default tag name or a custom tag name is acceptable\n *\n * @default \"span\"\n */\n tag: string;\n\n /**\n * HTML Attributes\n *\n * Attributes to be assigned to tags such as `class`, `data-xxx`, etc.\n */\n attrs?: Record<any, string>;\n};\n\ndeclare module '@tiptap/vue-3' {\n interface Commands<ReturnType> {\n customTag: {\n /**\n * Set the custom tag\n */\n setCustomTag: (markName: string) => ReturnType;\n /**\n * Toggle the custom tag\n */\n toggleCustomTag: (markName: string) => ReturnType;\n /**\n * Unset the custom tag\n */\n unsetCustomTag: (markName: string) => ReturnType;\n };\n }\n}\n\n// export type WysiwygCustomTagSettings = WysiwygCustomTagOptions & {\n// /**\n// * extension name\n// */\n// name: string;\n// };\n\nexport function createWysiwygCustomTagMark(\n name: string,\n settings: Partial<WysiwygCustomTagSettings>,\n) {\n const { tag = 'span', attrs } = settings;\n const attrEntries = attrs && Object.entries(attrs);\n // eslint-disable-next-line no-shadow\n const attrNames = attrEntries && attrEntries.map(([name]) => name);\n\n const getElementAttrs = (\n el: HTMLElement,\n ): Record<any, string> | undefined => {\n if (!attrNames) return;\n\n return (\n el\n .getAttributeNames()\n // eslint-disable-next-line no-shadow\n .reduce((acc, name) => ({ ...acc, [name]: el.getAttribute(name) }), {})\n );\n };\n\n const isMatchedElementAttrs = (elAttrs: Record<any, string>): boolean => {\n if (!attrEntries) return true;\n // eslint-disable-next-line no-shadow\n return attrEntries.every(([name, value]) => elAttrs[name] === value);\n };\n\n return Mark.create<WysiwygCustomTagSettings>({\n name,\n\n addOptions() {\n return {\n tag,\n attrs: attrs && { ...attrs },\n };\n },\n parseHTML() {\n return [\n {\n tag,\n getAttrs: (el: any) => {\n if (!attrs) return null;\n const elAttrs = getElementAttrs(el);\n if (!elAttrs) return false;\n return isMatchedElementAttrs(el) && null;\n },\n },\n ];\n },\n renderHTML({ HTMLAttributes }) {\n return [\n tag,\n attrs ? mergeAttributes(attrs, HTMLAttributes) : HTMLAttributes,\n 0,\n ];\n },\n });\n}\n\nexport const WysiwygCustomTagExtension =\n Extension.create<WysiwygCustomTagSettings>({\n name: 'custom-tag',\n addCommands() {\n return {\n setCustomTag:\n (markName) =>\n ({ chain }) =>\n chain().setMark(markName).run(),\n unsetCustomTag:\n (markName) =>\n ({ chain }) =>\n chain().unsetMark(markName).run(),\n toggleCustomTag:\n (markName) =>\n ({ chain }) =>\n chain().toggleMark(markName).run(),\n };\n },\n });\n","import { BulletList, BulletListOptions } from '@tiptap/extension-bullet-list';\nimport { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\n\nexport const WysiwygBulletListTool: WysiwygEditorToolFactory<\n BulletListOptions\n> = (vui, options) => {\n const tool: WysiwygEditorTool = {\n key: 'bulletList',\n icon: vui.icon('editorformatListBulleted'),\n active: ({ editor }) => editor.isActive('bulletList'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleBulletList().run();\n },\n floating: true,\n extensions: [BulletList.configure(options)],\n };\n return tool;\n};\n","import { Bold, BoldOptions } from '@tiptap/extension-bold';\nimport { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\n\nexport const WysiwygFormatBoldTool: WysiwygEditorToolFactory<BoldOptions> = (\n vui,\n options,\n) => {\n const tool: WysiwygEditorTool = {\n key: 'formatBold',\n icon: vui.icon('editorformatBold'),\n active: ({ editor }) => editor.isActive('bold'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleBold().run();\n },\n floating: true,\n extensions: [Bold.configure(options)],\n };\n return tool;\n};\n","import { Italic, ItalicOptions } from '@tiptap/extension-italic';\nimport { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\n\nexport const WysiwygFormatItalicTool: WysiwygEditorToolFactory<\n ItalicOptions\n> = (vui, options) => {\n const tool: WysiwygEditorTool = {\n key: 'formatItalic',\n icon: vui.icon('editorformatItalic'),\n active: ({ editor }) => editor.isActive('italic'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleItalic().run();\n },\n floating: true,\n extensions: [Italic.configure(options)],\n };\n return tool;\n};\n","import { Underline, UnderlineOptions } from '@tiptap/extension-underline';\nimport { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\n\nexport const WysiwygFormatUnderlineTool: WysiwygEditorToolFactory<\n UnderlineOptions\n> = (vui, options) => {\n const tool: WysiwygEditorTool = {\n key: 'formatUnderline',\n icon: vui.icon('editorformatUnderline'),\n active: ({ editor }) => editor.isActive('underline'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleUnderline().run();\n },\n floating: true,\n extensions: [Underline.configure(options)],\n };\n return tool;\n};\n","import { History, HistoryOptions } from '@tiptap/extension-history';\nimport { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\n\nexport const WysiwygHistoryTool: WysiwygEditorToolFactory<HistoryOptions> = (\n vui,\n options,\n) => {\n const undo: WysiwygEditorTool = {\n key: 'history-undo',\n icon: vui.icon('editorUndo'),\n disabled: ({ editor }) => !editor.can().undo(),\n onClick: ({ editor }) => {\n editor.chain().focus().undo().run();\n },\n extensions: [History.configure(options)],\n };\n const redo: WysiwygEditorTool = {\n key: 'history-redo',\n icon: vui.icon('editorRedo'),\n disabled: ({ editor }) => !editor.can().redo(),\n onClick: ({ editor }) => {\n editor.chain().focus().redo().run();\n },\n };\n return [undo, redo];\n};\n","import { Link, LinkOptions } from '@tiptap/extension-link';\nimport { validateIf, url } from '@fastkit/vui';\nimport { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\n\nexport const WysiwygLinkTool: WysiwygEditorToolFactory<LinkOptions> = (\n vui,\n options,\n) => {\n const tool: WysiwygEditorTool = {\n key: 'link',\n icon: vui.icon('editorLink'),\n active: ({ editor }) => editor.isActive('link'),\n // eslint-disable-next-line no-shadow\n onClick: async ({ vui, editor }) => {\n const { href = '' } = editor.getAttributes('link');\n const result = await vui.prompt({\n input: {\n label: 'Link URL',\n rules: [validateIf, url],\n initialValue: href,\n size: 'sm',\n autofocus: true,\n },\n });\n\n if (result === undefined || result === false) {\n return;\n }\n\n const range = editor.chain().focus().extendMarkRange('link');\n\n if (!result) {\n range.unsetLink().run();\n } else {\n range\n .setLink({\n href: result,\n })\n .run();\n }\n },\n floating: true,\n extensions: [\n Link.configure({\n openOnClick: false,\n ...options,\n }),\n ],\n };\n return tool;\n};\n","import {\n OrderedList,\n OrderedListOptions,\n} from '@tiptap/extension-ordered-list';\nimport { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\n\nexport const WysiwygOrderedListTool: WysiwygEditorToolFactory<\n OrderedListOptions\n> = (vui, options) => {\n const tool: WysiwygEditorTool = {\n key: 'orderedList',\n icon: vui.icon('editorformatListNumbered'),\n active: ({ editor }) => editor.isActive('orderedList'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleOrderedList().run();\n },\n floating: true,\n extensions: [OrderedList.configure(options)],\n };\n return tool;\n};\n","import { createVNode as _createVNode } from \"vue\";\nimport './color.scss';\nimport { VIcon } from '@fastkit/vui';\nimport TextStyle from '@tiptap/extension-text-style';\nimport { WysiwygColorExtension } from '../extensions';\nexport function createWysiwygColorTool(opts) {\n const WysiwygColorTool = vui => {\n const tool = {\n key: 'textColor',\n // active: ({ editor }) => editor.isActive('textStyle'),\n icon: ({\n editor\n }) => () => {\n const {\n color\n } = editor.getAttributes('textStyle');\n const style = {\n color\n };\n return _createVNode(\"span\", {\n \"class\": \"v-wysiwyg-color-tool__button\"\n }, [_createVNode(VIcon, {\n \"class\": \"v-wysiwyg-color-tool__button__icon\",\n \"name\": vui.icon('editorTextColor')\n }, null), _createVNode(\"span\", {\n \"class\": \"v-wysiwyg-color-tool__button__bar\",\n \"style\": style\n }, null)]);\n },\n onClick: (ctx, ev) => {\n ctx.vui.menu({\n class: 'v-wysiwyg-color-tool__menu',\n activator: ev,\n content: stack => _createVNode(\"div\", {\n \"class\": ['v-wysiwyg-color-tool__items', {\n 'v-wysiwyg-color-tool__items--with-label': opts.withLabel\n }]\n }, [opts.items.map((item, index) => _createVNode(\"button\", {\n \"key\": item.key == null ? index : item.key,\n \"class\": \"v-wysiwyg-color-tool__item\",\n \"type\": \"button\",\n \"onClick\": () => {\n const {\n color\n } = item;\n let command = ctx.editor.chain().focus();\n if (color) {\n command = command.setColor(color);\n } else {\n command = command.unsetColor();\n }\n command.run();\n stack.close();\n }\n }, [_createVNode(\"span\", {\n \"class\": \"v-wysiwyg-color-tool__item__color\",\n \"style\": item.color ? {\n color: item.color\n } : {}\n }, null), opts.withLabel && _createVNode(\"span\", {\n \"class\": \"v-wysiwyg-color-tool__item__name\"\n }, [item.name])]))])\n });\n },\n floating: true,\n extensions: [TextStyle, WysiwygColorExtension]\n };\n return tool;\n };\n return WysiwygColorTool;\n}","import { isVNode as _isVNode, createVNode as _createVNode } from \"vue\";\nimport { TextAlign } from '@tiptap/extension-text-align';\nimport { VButtonGroup, VButton } from '@fastkit/vui';\nfunction _isSlot(s) {\n return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);\n}\n/**\n * A list of available options for the text align attribute.\n * @remarks\n * `\"justify\"` has not yet been adopted because of ambiguity in browser support.\n */\nexport const WYSIWYG_TEXT_ALIGN_VALUES = ['left', 'center', 'right'\n// 'justify',\n];\n\n/** Text align value */\n\n/**\n * A list of nodes where the text align attribute should be applied to.\n */\nconst DEFAULT_TYPES = ['heading', 'paragraph'];\nconst conditions = WYSIWYG_TEXT_ALIGN_VALUES.map(value => [value, {\n textAlign: value\n}]);\nconst ICON_AT = {\n left: 'editorAlignLeft',\n center: 'editorAlignCenter',\n right: 'editorAlignRight'\n};\nfunction resolveOptions(rawOptions) {\n const types = rawOptions?.types || DEFAULT_TYPES.slice();\n const alignments = rawOptions?.alignments || WYSIWYG_TEXT_ALIGN_VALUES.slice();\n const defaultAlignment = rawOptions?.defaultAlignment || 'left';\n return {\n types,\n alignments,\n defaultAlignment\n };\n}\nfunction getCurrentAlign(editor, options) {\n for (const [align, condition] of conditions) {\n if (editor.isActive(condition)) return align;\n }\n return options.defaultAlignment;\n}\nexport const WysiwygTextAlignTool = (vui, options) => {\n const resolvedOptions = resolveOptions(options);\n const {\n alignments\n } = resolvedOptions;\n const getIcon = value => {\n const iconKey = ICON_AT[value];\n const icon = vui.icon(iconKey);\n if (icon === '$empty' || typeof icon === 'function') return;\n return icon;\n };\n const variant = vui.setting('plainVariant');\n const toolButtonActiveColor = vui.setting('primaryScope');\n const tool = {\n key: 'textAlign',\n icon: ({\n editor\n }) => getIcon(getCurrentAlign(editor, resolvedOptions)),\n // eslint-disable-next-line no-shadow\n onClick: async ({\n vui,\n editor\n }, ev) => {\n vui.menu({\n distance: 0,\n activator: ev,\n content: menu => {\n let _slot;\n return _createVNode(VButtonGroup, {\n \"variant\": variant\n }, _isSlot(_slot = alignments.map(value => {\n const isActive = editor.isActive({\n textAlign: value\n });\n return _createVNode(VButton, {\n \"tabindex\": -1,\n \"color\": isActive ? toolButtonActiveColor : undefined,\n \"key\": value,\n \"icon\": getIcon(value),\n \"onClick\": () => {\n editor.chain().focus().setTextAlign(value).run();\n }\n }, null);\n })) ? _slot : {\n default: () => [_slot]\n });\n }\n });\n },\n floating: true,\n extensions: [TextAlign.configure(resolvedOptions)]\n };\n return tool;\n};","import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport {\n createWysiwygCustomTagMark,\n WysiwygCustomTagSettings,\n WysiwygCustomTagExtension,\n} from '../extensions/custom-tag';\n\nexport interface WysiwygCustomTagToolSettings\n extends Pick<WysiwygEditorTool, 'icon' | 'floating'>,\n Partial<WysiwygCustomTagSettings> {}\n\n/**\n * Generate Custom Tag Tool\n *\n * @param markName - Mark name\n * @param settings - Tool Configuration\n * @returns Generated Tool\n */\nexport function createWysiwygCustomTagTool(\n markName: string,\n settings: WysiwygCustomTagToolSettings,\n): WysiwygEditorToolFactory {\n const Mark = createWysiwygCustomTagMark(markName, settings);\n const { icon, floating = true } = settings;\n\n return (vui) => {\n const tool: WysiwygEditorTool = {\n key: `customTag:${markName}`,\n icon,\n floating,\n active: ({ editor }) => editor.isActive(markName),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleCustomTag(markName).run();\n },\n extensions: [WysiwygCustomTagExtension, Mark.configure(settings)],\n };\n return tool;\n };\n}\n","import { resolveDirective as _resolveDirective, mergeProps as _mergeProps, createVNode as _createVNode, isVNode as _isVNode } from \"vue\";\nimport './VWysiwygEditor.scss';\nimport { defineComponent, computed, ref, watch, onBeforeUnmount } from 'vue';\nimport { createFormNodeWrapperProps, VFormControl, VControlField, createControlFieldProps, createTextableProps, createTextableEmits, TextableControl, createControlProps, useControl, createControlFieldProviderProps, useControlField, VTextCounter, defineSlots, useVui, VButton, VButtonGroup } from '@fastkit/vui';\nimport { EditorContent, useEditor, BubbleMenu } from '@tiptap/vue-3';\nimport { StarterKit } from '@tiptap/starter-kit';\nimport { VUI_WYSIWYG_EDITOR_SYMBOL } from '../../injections';\nimport { resolveRawWysiwygExtensions, resolveRawWysiwygEditorTools,\n// EditorEventsOptions,\nWysiwygEditorInitializeContext } from '../../schemes';\nfunction _isSlot(s) {\n return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);\n}\nconst slots = defineSlots();\nexport const VWysiwygEditor = defineComponent({\n name: 'VWysiwygEditor',\n props: {\n ...createTextableProps(),\n ...createFormNodeWrapperProps(),\n ...createControlFieldProps(),\n ...createControlFieldProviderProps(),\n ...createControlProps(),\n ...slots(),\n extensions: {\n type: Array,\n default: () => []\n },\n tools: {\n type: Array,\n default: () => []\n },\n floatingToolbar: Boolean,\n disabledMinHeight: Boolean,\n disabledMaxHeight: Boolean\n },\n emits: {\n ...createTextableEmits()\n },\n slots,\n setup(props, ctx) {\n const vui = useVui();\n const textRef = ref('');\n const toolButtonActiveColor = vui.setting('primaryScope');\n const wysiwygSettings = computed(() => resolveRawWysiwygEditorTools(props.tools, vui));\n const control = useControl(props);\n useControlField(props);\n const classes = computed(() => ['v-wysiwyg-editor', control.classes.value, `v-wysiwyg-editor--${control.size.value}`, {\n 'v-wysiwyg-editor--disabled-min-height': props.disabledMinHeight,\n 'v-wysiwyg-editor--disabled-max-height': props.disabledMaxHeight\n }]);\n const inputControl = new TextableControl(props, ctx, {\n nodeType: VUI_WYSIWYG_EDITOR_SYMBOL,\n validationValue: () => textRef.value\n });\n const initializeCtx = new WysiwygEditorInitializeContext(() => vui, {\n onCreate: ({\n editor\n }) => {\n textRef.value = editor.getText();\n updateEditable();\n },\n onFocus: ({\n event\n }) => {\n inputControl.focusHandler(event);\n },\n onBlur: ({\n event\n }) => {\n inputControl.blurHandler(event);\n },\n onUpdate: ({\n editor\n }) => {\n inputControl.value = editor.getHTML();\n textRef.value = editor.getText();\n }\n });\n const extensions = [StarterKit.configure({\n bold: false,\n bulletList: false,\n orderedList: false,\n history: false,\n italic: false\n }),\n // Linter.configure({\n // plugins: [BadWords(['abc', 'evidently']), Punctuation, HeadingLevel],\n // }),\n ...resolveRawWysiwygExtensions(props.extensions, initializeCtx), ...wysiwygSettings.value.extensions];\n const updateEditable = () => {\n if (!editor.value) return;\n editor.value.setEditable(inputControl.canOperation);\n };\n watch(() => inputControl.canOperation, updateEditable);\n watch(() => props.modelValue, modelValue => {\n const $editor = editor.value;\n if (!$editor || $editor.getHTML() === modelValue) return;\n $editor.commands.setContent(modelValue == null ? '' : modelValue, false);\n textRef.value = $editor.getText();\n });\n initializeCtx.on('create', ({\n editor\n }) => {\n textRef.value = editor.getText();\n updateEditable();\n });\n const editor = useEditor({\n ...initializeCtx.editorOptions(),\n autofocus: props.autofocus,\n content: props.modelValue,\n extensions,\n editorProps: {\n attributes: {\n class: 'v-wysiwyg-editor__input__prose'\n }\n }\n });\n\n // editor.value.state.doc.content\n\n const focus = (position, options) => editor.value?.chain().focus(position, options);\n\n // const blur = () => {\n // if (!editor.value) return;\n // return editor.value.chain().blur();\n // };\n\n const wysiwygContext = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const _editor = editor.value;\n // if (!_editor) {\n // throw new Error('missing editor value');\n // }\n return {\n vui,\n editor: _editor\n };\n });\n const createTools = (bubbleMenu = false) => {\n let _slot;\n const {\n value: settings\n } = wysiwygSettings;\n const {\n value: context\n } = wysiwygContext;\n const tools = bubbleMenu ? settings.tools.filter(t => !!t.floating) : settings.tools;\n const _editor = editor.value;\n const variant = vui.setting(bubbleMenu ? 'containedVariant' : 'plainVariant');\n return _createVNode(VButtonGroup, {\n \"class\": ['v-wysiwyg-editor__toolbar', {\n 'v-wysiwyg-editor__floating-toolbar': props.floatingToolbar\n }],\n \"variant\": variant\n }, _isSlot(_slot = tools.map(({\n key,\n icon,\n onClick,\n disabled,\n active\n }) => {\n const isActive = !!_editor && resolveContextualValue(context, active);\n const isDisabled = !inputControl.canOperation || !!_editor && resolveContextualValue(context, disabled);\n let iconName;\n let child;\n if (typeof icon === 'function') {\n if (_editor) {\n const _child = icon(context);\n if (typeof _child === 'function') {\n child = _child();\n } else {\n iconName = _child;\n }\n }\n } else {\n iconName = icon;\n }\n if (!iconName && child == null) return;\n return _createVNode(VButton, {\n \"tabindex\": -1,\n \"key\": key,\n \"icon\": iconName,\n \"onClick\": ev => onClick(context, ev),\n \"color\": isActive ? toolButtonActiveColor : undefined,\n \"disabled\": isDisabled\n }, _isSlot(child) ? child : {\n default: () => [child]\n });\n })) ? _slot : {\n default: () => [_slot]\n });\n };\n onBeforeUnmount(() => {\n editor.value && editor.value.destroy();\n });\n const api = {\n get editor() {\n return editor.value;\n },\n control: inputControl\n };\n ctx.expose(api);\n const handleClickLabel = ev => {\n focus('start', {\n scrollIntoView: true\n });\n };\n const formControlDefaultSlot = () => _createVNode(\"div\", {\n \"class\": \"v-wysiwyg-editor__wrapper\"\n }, [!inputControl.isReadonly && createTools(), _createVNode(VControlField, {\n \"class\": \"v-wysiwyg-editor__input\",\n \"autoHeight\": true,\n \"startAdornment\": props.startAdornment,\n \"endAdornment\": props.endAdornment,\n \"size\": control.size.value\n }, {\n ...ctx.slots,\n default: () => {\n let _slot2;\n return _createVNode(\"div\", {\n \"class\": \"v-wysiwyg-editor__body\"\n }, [_createVNode(EditorContent, _mergeProps({\n class: 'v-wysiwyg-editor__input__element wysiwyg'\n }, {\n \"editor\": editor.value\n }), null), !props.floatingToolbar && !!editor.value && !inputControl.isReadonly && _createVNode(BubbleMenu, _mergeProps({\n class: 'v-wysiwyg-editor__bubble-menu'\n }, {\n \"editor\": editor.value\n }), _isSlot(_slot2 = createTools(true)) ? _slot2 : {\n default: () => [_slot2]\n })]);\n }\n })]);\n const infoAppendsSlot = () => {\n const {\n counterResult\n } = inputControl;\n if (!counterResult) return;\n return _createVNode(VTextCounter, counterResult, null);\n };\n return () => _createVNode(VFormControl, {\n \"nodeControl\": inputControl,\n \"class\": classes.value,\n \"label\": props.label,\n \"hint\": props.hint,\n \"hinttip\": props.hinttip,\n \"hiddenInfo\": props.hiddenInfo,\n \"requiredChip\": props.requiredChip,\n \"onClickLabel\": handleClickLabel\n }, {\n ...ctx.slots,\n default: formControlDefaultSlot,\n infoAppends: infoAppendsSlot\n });\n }\n});\nfunction resolveContextualValue(ctx,\n// eslint-disable-next-line no-shadow\nsource) {\n return typeof source === 'function' ? source(ctx) : source;\n}"]}
1
+ {"version":3,"sources":["../src/schemes.ts","../src/injections.ts","../src/extensions/linter/Linter.tsx","../src/extensions/linter/utils.ts","../src/extensions/linter/LinterPlugin.ts","../src/extensions/linter/plugins/BadWords.tsx","../src/extensions/linter/plugins/HeadingLevel.ts","../src/extensions/linter/plugins/Punctuation.ts","../src/extensions/color.ts","../src/extensions/custom-tag.ts","../src/tools/bullet-list.ts","../src/tools/format-bold.ts","../src/tools/format-italic.ts","../src/tools/format-underline.ts","../src/tools/history.ts","../src/tools/link.ts","../src/tools/ordered-list.ts","../src/tools/color.tsx","../src/tools/text-align.tsx","../src/tools/custom-tag.ts","../src/components/VWysiwygEditor/VWysiwygEditor.tsx"],"names":["_createVNode","Extension","name","vui","Mark","_isVNode","VButton","VButtonGroup","_isSlot","editor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,IAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIA,IAAM,oBAAoB,CAAmB,WAC3C,KAAK,OAAO,OAAO,CAAC,EAAE,YAAY,CAAC,GAAG,OAAO,MAAM,CAAC,CAAC;AAgBhD,IAAM,iCAAN,MAAqC;AAAA,EACjC,YAAuC,CAAC;AAAA,EAEhC;AAAA,EAEjB,IAAI,MAAM;AACR,WAAO,KAAK,KAAK;AAAA,EACnB;AAAA,EAEA,YACE,WACA,OAAmC,CAAC,GACpC;AACA,SAAK,OAAO;AAEZ,kBAAc,QAAQ,CAAC,UAAU;AAC/B,WAAK,UAAU,KAAK,IAAI,CAAC;AACzB,YAAM,WAAW,kBAAkB,KAAK;AACxC,YAAM,KAAK,KAAK,QAAQ;AACxB,YAAM,KAAK,UAAU,KAAK,EAAE,KAAK,EAAS;AAAA,IAC5C,CAAC;AAAA,EACH;AAAA,EAEA,GACE,IACA,SACA;AACA,SAAK,UAAU,EAAE,EAAE,KAAK,OAAO;AAC/B,WAAO,MAAM,KAAK,IAAI,IAAI,OAAO;AAAA,EACnC;AAAA,EAEA,IACE,IACA,SACA;AACA,SAAK,UAAU,EAAE,IAAI,KAAK,UAAU,EAAE,EAAE;AAAA,MACtC,CAAC,aAAa,aAAa;AAAA,IAC7B;AAAA,EACF;AAAA,EAEA,gBAAgB;AACd,UAAM,OAAmC,CAAC;AAE1C,kBAAc,QAAQ,CAAC,UAAU;AAC/B,YAAM,WAAW,kBAAkB,KAAK;AACxC,WAAK,QAAQ,IA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AAyB,MAAMR,cAAa,OAAO;AAAA,MACvD,SAAS;AAAA,IACX,GAAG,CAAC,CAAC,aAAa,cAAc,YAAY,GAAGA,cAAa,eAAe;AAAA,MACzE,SAAS;AAAA,MACT,cAAc;AAAA,MACd,kBAAkB,MAAM;AAAA,MACxB,gBAAgB,MAAM;AAAA,MACtB,QAAQ,QAAQ,KAAK;AAAA,IACvB,GAAG;AAAA,MACD,GAAG,IAAI;AAAA,MACP,SAAS;AAAA,IACX,CAAC,CAAC,CAAC;AACH,UAAM,kBAAkB,MAAM;AAC5B,YAAM;AAAA,QACJ;AAAA,MACF,IAAI;AACJ,UAAI,CAAC;AAAe;AACpB,aAAOA,cAAa,cAAc,eAAe,IAAI;AAAA,IACvD;AACA,WAAO,MAAMA,cAAa,cAAc;AAAA,MACtC,eAAe;AAAA,MACf,SAAS,QAAQ;AAAA,MACjB,SAAS,MAAM;AAAA,MACf,QAAQ,MAAM;AAAA,MACd,WAAW,MAAM;AAAA,MACjB,cAAc,MAAM;AAAA,MACpB,gBAAgB,MAAM;AAAA,MACtB,gBAAgB;AAAA,IAClB,GAAG;AAAA,MACD,GAAG,IAAI;AAAA,MACP,SAAS;AAAA,MACT,aAAa;AAAA,IACf,CAAC;AAAA,EACH;AACF,CAAC;AACD,SAAS,uBAAuB,KAEhC,QAAQ;AACN,SAAO,OAAO,WAAW,aAAa,OAAO,GAAG,IAAI;AACtD","sourcesContent":["import { type VuiService, type IconName } from '@fastkit/vui';\nimport {\n type Editor,\n type Extensions,\n type Node,\n type Extension,\n type Mark,\n type AnyExtension,\n type EditorOptions,\n} from '@tiptap/vue-3';\nimport { VNodeChild } from 'vue';\n\nconst EDITOR_EVENTS = [\n 'beforeCreate',\n 'create',\n 'update',\n 'selectionUpdate',\n 'transaction',\n 'focus',\n 'blur',\n 'destroy',\n] as const;\n\ntype PrefixedEventName<S extends string> = `on${Capitalize<S>}`;\n\nconst prefixedEventName = <S extends string>(source: S): PrefixedEventName<S> =>\n `on${source.charAt(0).toUpperCase()}${source.slice(1)}` as any;\n\nexport type WysiwygEditorEvent = (typeof EDITOR_EVENTS)[number];\n\nexport type WysiwygEditorPrefixedEvent = PrefixedEventName<WysiwygEditorEvent>;\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface WysiwygEditorEventsOptions\n extends Partial<Pick<EditorOptions, WysiwygEditorPrefixedEvent>> {}\n\nexport type WysiwygEditorEventsBucket = {\n [EV in WysiwygEditorEvent]: NonNullable<\n WysiwygEditorEventsOptions[PrefixedEventName<EV>]\n >[];\n};\n\nexport class WysiwygEditorInitializeContext {\n readonly listeners: WysiwygEditorEventsBucket = {} as any;\n\n private readonly _vui: () => VuiService;\n\n get vui() {\n return this._vui();\n }\n\n constructor(\n vuiGetter: () => VuiService,\n opts: WysiwygEditorEventsOptions = {},\n ) {\n this._vui = vuiGetter;\n\n EDITOR_EVENTS.forEach((event) => {\n this.listeners[event] = [];\n const prefixed = prefixedEventName(event);\n const fn = opts[prefixed];\n fn && this.listeners[event].push(fn as any);\n });\n }\n\n on<EV extends WysiwygEditorEvent>(\n ev: EV,\n handler: NonNullable<WysiwygEditorEventsOptions[PrefixedEventName<EV>]>,\n ) {\n this.listeners[ev].push(handler);\n return () => this.off(ev, handler);\n }\n\n off<EV extends WysiwygEditorEvent>(\n ev: EV,\n handler: NonNullable<WysiwygEditorEventsOptions[PrefixedEventName<EV>]>,\n ) {\n this.listeners[ev] = this.listeners[ev].filter(\n (_handler) => _handler !== handler,\n ) as any;\n }\n\n editorOptions() {\n const opts: WysiwygEditorEventsOptions = {};\n\n EDITOR_EVENTS.forEach((event) => {\n const prefixed = prefixedEventName(event);\n opts[prefixed] = (props) => {\n const handlers = this.listeners[event];\n handlers.forEach((handler) => {\n handler(props as any);\n });\n };\n });\n\n return opts;\n }\n}\n\nexport interface WysiwygEditorContext {\n editor: Editor;\n vui: VuiService;\n}\n\nexport type WysiwygExtensionFactory<Options = any, Storage = any> = (\n ctx: WysiwygEditorInitializeContext,\n) =>\n | Extension<Options, Storage>\n | Node<Options, Storage>\n | Mark<Options, Storage>;\n\nexport interface CreatedWysiwygExtension<Options = any, Storage = any> {\n __isCreatedWysiwygExtension: true;\n _configs: Partial<Options>[];\n configure(\n options?: Partial<Options>,\n ): CreatedWysiwygExtension<Options, Storage>;\n raw: WysiwygExtensionSource<Options, Storage>;\n}\n\nexport type WysiwygExtensionSource<Options = any, Storage = any> =\n | Extension<Options, Storage>\n | Node<Options, Storage>\n | Mark<Options, Storage>\n | WysiwygExtensionFactory<Options, Storage>;\n\nexport type RawWysiwygExtension<Options = any, Storage = any> =\n | WysiwygExtensionSource<Options, Storage>\n | CreatedWysiwygExtension<Options, Storage>;\n\n// export function createWysiwygExtension<Options = any, Storage = any>(\n// extension: Extension<Options, Storage>,\n// ): Extension<Options, Storage>;\n// export function createWysiwygExtension<Options = any, Storage = any>(\n// node: Node<Options, Storage>,\n// ): Node<Options, Storage>;\n// export function createWysiwygExtension<Options = any, Storage = any>(\n// mark: Mark<Options, Storage>,\n// ): Mark<Options, Storage>;\n// export function createWysiwygExtension<Options = any, Storage = any>(\n// factory: WysiwygExtensionFactory<Options, Storage>,\n// ): WysiwygExtensionFactory<Options, Storage>;\n\nfunction isCreatedWysiwygExtension<Options = any, Storage = any>(\n source: unknown,\n): source is CreatedWysiwygExtension<Options, Storage> {\n return (\n !!source &&\n typeof source === 'object' &&\n (source as CreatedWysiwygExtension).__isCreatedWysiwygExtension === true\n );\n}\n\nexport function createWysiwygExtension<Options = any, Storage = any>(\n extension: WysiwygExtensionSource<Options, Storage>,\n) {\n const ext: CreatedWysiwygExtension<Options, Storage> = {\n __isCreatedWysiwygExtension: true,\n _configs: [],\n configure: (opts) => {\n opts && ext._configs.push(opts);\n return ext;\n },\n raw: extension,\n };\n return ext;\n}\n\nfunction resolveRawWysiwygExtension(\n raw: RawWysiwygExtension,\n ctx: WysiwygEditorInitializeContext,\n): AnyExtension {\n if (isCreatedWysiwygExtension(raw)) {\n const { raw: _raw, _configs } = raw;\n let ext = typeof _raw === 'function' ? _raw(ctx) : _raw;\n _configs.forEach((config) => {\n ext = ext.configure(config);\n });\n return ext;\n }\n return typeof raw === 'function' ? raw(ctx) : raw;\n}\n\nexport function resolveRawWysiwygExtensions(\n raws: RawWysiwygExtension[],\n ctx: WysiwygEditorInitializeContext,\n) {\n return raws.map((raw) => resolveRawWysiwygExtension(raw, ctx));\n}\n\nexport type WysiwygEditorToolIcon =\n | IconName\n | ((ctx: WysiwygEditorContext) => IconName | (() => VNodeChild) | undefined);\n\n/**\n * Tool Configuration\n */\nexport interface WysiwygEditorTool {\n /**\n * Tool Key\n *\n * Must be unique to identify the tool\n */\n key: string;\n /** Icons to be displayed on the toolbar */\n icon: WysiwygEditorToolIcon;\n /** Conditions for displaying the icon as active */\n active?: boolean | ((ctx: WysiwygEditorContext) => boolean);\n /** Conditions for deactivating the icon */\n disabled?: boolean | ((ctx: WysiwygEditorContext) => boolean);\n /** Handler when mark text is clicked */\n onClick: (ctx: WysiwygEditorContext, ev: MouseEvent) => any;\n /** Whether to display tools in floating menu or not */\n floating?: boolean;\n /** Extensions that the tool depends on */\n extensions?: Extensions;\n}\n\nexport type WysiwygEditorToolFactory<Options = void> = (\n vui: VuiService,\n options?: Options,\n) => WysiwygEditorTool | WysiwygEditorTool[];\n\nexport type RawWysiwygEditorTool =\n | WysiwygEditorTool\n | WysiwygEditorToolFactory<any>;\n\nfunction resolveRawWysiwygEditorTool(\n raw: RawWysiwygEditorTool,\n vui: VuiService,\n) {\n return typeof raw === 'function' ? raw(vui) : raw;\n}\n\nexport interface ResolvedWysiwygEditorSettings {\n tools: WysiwygEditorTool[];\n extensions: Extensions;\n}\n\nexport function resolveRawWysiwygEditorTools(\n rawTools: RawWysiwygEditorTool[],\n vui: VuiService,\n): ResolvedWysiwygEditorSettings {\n const tools: WysiwygEditorTool[] = [];\n const extensions: Extensions = [];\n\n rawTools.forEach((raw) => {\n let resolved = resolveRawWysiwygEditorTool(raw, vui);\n if (!Array.isArray(resolved)) {\n resolved = [resolved];\n }\n resolved.forEach((tool) => {\n tools.push(tool);\n if (tool.extensions) {\n extensions.push(...tool.extensions);\n }\n });\n });\n\n return {\n tools,\n extensions,\n };\n}\n","export const VUI_WYSIWYG_EDITOR_SYMBOL = 'vui-wysiwyg-editor';\n","import { createVNode as _createVNode } from \"vue\";\nimport './Linter.scss';\nimport { Extension } from '@tiptap/vue-3';\nimport { Decoration, DecorationSet } from '@tiptap/pm/view';\nimport { Plugin, PluginKey, TextSelection } from '@tiptap/pm/state';\nimport { createWysiwygExtension } from '../../schemes';\nconst PROBLEM_CLASS_NAME = 'v-linter__problem';\nconst ISSUE_ICON_CLASS_NAME = 'v-linter__issue-icon';\nconst ISSUE_DATASET_NAME = 'data-issue-id';\nfunction resolveWysiwygLinterFixMessage(message) {\n return typeof message === 'function' ? message() : message;\n}\nfunction renderIcon(view, issue) {\n const {\n level = 'warning'\n } = issue;\n const icon = document.createElement('div');\n const message = resolveWysiwygLinterFixMessage(issue.message);\n icon.className = `${ISSUE_ICON_CLASS_NAME} ${level}-scope`;\n icon.setAttribute(ISSUE_DATASET_NAME, issue.id);\n if (typeof message === 'string') {\n icon.title = message;\n }\n return icon;\n}\nfunction runAllLinterPlugins(doc, plugins) {\n const decorations = [];\n const issues = plugins.map(RegisteredLinterPlugin => new RegisteredLinterPlugin(doc).scan().getResults()).flat();\n issues.forEach(issue => {\n const {\n level = 'warning',\n icon\n } = issue;\n const message = resolveWysiwygLinterFixMessage(issue.message);\n decorations.push(Decoration.inline(issue.from, issue.to, {\n class: `${PROBLEM_CLASS_NAME} ${level}-scope`,\n 'data-issue-id': issue.id,\n title: typeof message === 'string' ? message : undefined\n }));\n if (icon) {\n decorations.push(Decoration.widget(issue.from, view => renderIcon(view, issue)));\n }\n });\n const decorationSet = DecorationSet.create(doc, decorations);\n return {\n issues,\n decorationSet\n };\n}\nexport const WysiwygLinter = createWysiwygExtension(ctx => {\n function showMenu(view, issue, event) {\n const message = resolveWysiwygLinterFixMessage(issue.message);\n const variant = ctx.vui.setting('containedVariant');\n const scope = ctx.vui.setting(`${issue.level}Scope`);\n return ctx.vui.menu({\n activator: event,\n content: stack => _createVNode(\"div\", {\n \"class\": \"v-linter__issue-menu__body\"\n }, [_createVNode(\"div\", {\n \"class\": ['v-linter__issue-menu__message', `${scope}-scope ${variant}`]\n }, [message]), issue.fix.length && _createVNode(\"div\", {\n \"class\": \"v-linter__issue-menu__fixers\"\n }, [issue.fix.map((fixer, index) => _createVNode(\"div\", {\n \"key\": index,\n \"class\": \"v-linter__issue-menu__fixer\"\n }, [_createVNode(\"button\", {\n \"type\": \"button\",\n \"class\": \"v-linter__issue-menu__fixer__button\",\n \"onClick\": () => {\n stack.close();\n fixer.handler(view, issue);\n }\n }, [_createVNode(\"span\", {\n \"class\": \"v-linter__issue-menu__fixer__button__message\"\n }, [resolveWysiwygLinterFixMessage(fixer.message)])])]))])])\n });\n }\n return Extension.create({\n name: 'linter',\n addOptions() {\n return {\n plugins: []\n };\n },\n addStorage() {\n return {\n issues: []\n };\n },\n addProseMirrorPlugins() {\n const {\n plugins\n } = this.options;\n const {\n storage\n } = this;\n const runAll = doc => {\n const {\n issues,\n decorationSet\n } = runAllLinterPlugins(doc, plugins);\n storage.issues = issues;\n return decorationSet;\n };\n const getIssue = id => storage.issues.find(issue => issue.id === id);\n const getIssueElementByEvent = source => {\n if (!source || !(source instanceof HTMLElement)) {\n return;\n }\n const issueId = source.getAttribute(ISSUE_DATASET_NAME);\n const issue = issueId && getIssue(issueId);\n if (!issue) return;\n return {\n issue\n };\n };\n const linterPlugin = new Plugin({\n key: new PluginKey('linter'),\n state: {\n init(_, {\n doc\n }) {\n return runAll(doc);\n },\n apply(transaction, oldState) {\n return transaction.docChanged ? runAll(transaction.doc) : oldState;\n }\n },\n props: {\n decorations(state) {\n return linterPlugin.getState(state);\n },\n handleClick(view, _, event) {\n const info = getIssueElementByEvent(event.target);\n if (!info) {\n return false;\n }\n const {\n issue\n } = info;\n const {\n from,\n to\n } = issue;\n const focus = () => view.dispatch(view.state.tr.setSelection(TextSelection.create(view.state.doc, from, to)).scrollIntoView());\n focus();\n showMenu(view, issue, event);\n return true;\n }\n }\n });\n return [linterPlugin];\n }\n });\n});","/* eslint-disable eqeqeq */\n/* eslint-disable no-bitwise */\nlet IDX = 256;\nlet BUFFER: any;\nconst HEX: any = [];\nwhile (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);\n\nexport function cheepUUID() {\n let i = 0;\n let num;\n let out = '';\n\n if (!BUFFER || IDX + 16 > 256) {\n BUFFER = Array((i = 256));\n while (i--) BUFFER[i] = (256 * Math.random()) | 0;\n // eslint-disable-next-line no-multi-assign\n i = IDX = 0;\n }\n\n for (; i < 16; i++) {\n num = BUFFER[IDX + i];\n if (i == 6) out += HEX[(num & 15) | 64];\n else if (i == 8) out += HEX[(num & 63) | 128];\n else out += HEX[num];\n\n if (i & 1 && i > 1 && i < 11) out += '-';\n }\n\n IDX++;\n return out;\n}\n","import { VNodeChild } from 'vue';\nimport { Node as ProsemirrorNode } from '@tiptap/pm/model';\nimport { EditorView } from '@tiptap/pm/view';\nimport { cheepUUID } from './utils';\n\nexport type WysiwygLinterFixFn = (\n view: EditorView,\n issue: WysiwygLinterResult,\n) => any;\n\nexport type WysiwygLinterFixMessage = string | (() => VNodeChild);\n\nexport interface WysiwygLinterFixer {\n message: WysiwygLinterFixMessage;\n handler: WysiwygLinterFixFn;\n}\n\nexport type WysiwygLinterResultLevel = 'warning' | 'error';\n\n// fixers\nexport interface WysiwygLinterResult {\n id: string;\n icon: boolean;\n level: WysiwygLinterResultLevel;\n message: WysiwygLinterFixMessage;\n from: number;\n to: number;\n fix: WysiwygLinterFixer[];\n}\n\nexport interface RawLinterResult\n extends Omit<WysiwygLinterResult, 'level' | 'fix' | 'id' | 'icon'> {\n level?: WysiwygLinterResultLevel;\n icon?: boolean;\n fix?: WysiwygLinterFixer | WysiwygLinterFixer[];\n}\n\nexport class WysiwygLinterPlugin {\n protected doc: ProsemirrorNode;\n\n private results: Array<WysiwygLinterResult> = [];\n\n constructor(doc: ProsemirrorNode) {\n this.doc = doc;\n }\n\n record(result: RawLinterResult) {\n const { fix = [], icon = false } = result;\n this.results.push({\n level: 'error',\n id: cheepUUID(),\n ...result,\n fix: Array.isArray(fix) ? fix : [fix],\n icon,\n });\n }\n\n scan() {\n return this;\n }\n\n getResults() {\n return this.results;\n }\n}\n","import { createTextVNode as _createTextVNode, createVNode as _createVNode } from \"vue\";\nimport { WysiwygLinterPlugin } from '../LinterPlugin';\nexport function WysiwygLinterBadWords(words) {\n const regex = new RegExp(`\\\\b(${words.join('|')})\\\\b`);\n\n // eslint-disable-next-line no-shadow\n return class WysiwygLinterBadWords extends WysiwygLinterPlugin {\n scan() {\n this.doc.descendants((node, position) => {\n if (!node.isText) {\n return;\n }\n const matches = regex.exec(node.text);\n if (matches) {\n const fixValue = `${matches[0]}!!!!!`;\n this.record({\n level: 'warning',\n message: `Try not to say '${matches[0]}'`,\n from: position + matches.index,\n to: position + matches.index + matches[0].length,\n fix: [{\n message: () => _createVNode(\"span\", null, [_createVNode(\"code\", null, [fixValue]), _createTextVNode(\"\\u306B\\u4FEE\\u6B63\\u3059\\u308B\\u3002\")]),\n handler: () => {\n // eslint-disable-next-line no-console\n console.log('hoge');\n }\n }, {\n message: 'どうにかする',\n handler: () => {\n // eslint-disable-next-line no-console\n console.log('hoge');\n }\n }]\n });\n }\n });\n return this;\n }\n };\n}","import { EditorView } from '@tiptap/pm/view';\nimport {\n WysiwygLinterPlugin,\n WysiwygLinterResult as Issue,\n} from '../LinterPlugin';\n\nexport class WysiwygLinterHeadingLevel extends WysiwygLinterPlugin {\n fixHeader(level: number) {\n // eslint-disable-next-line func-names\n return function ({ state, dispatch }: EditorView, issue: Issue) {\n dispatch(state.tr.setNodeMarkup(issue.from - 1, undefined, { level }));\n };\n }\n\n scan() {\n let lastHeadLevel: number | null = null;\n\n this.doc.descendants((node, position) => {\n if (node.type.name === 'heading') {\n // Check whether heading levels fit under the current level\n const { level } = node.attrs;\n\n if (lastHeadLevel != null && level > lastHeadLevel + 1) {\n this.record({\n message: `Heading too small (${level} under ${lastHeadLevel})`,\n from: position + 1,\n to: position + 1 + node.content.size,\n fix: {\n message: '修正する',\n handler: this.fixHeader(lastHeadLevel + 1),\n },\n });\n }\n lastHeadLevel = level;\n }\n });\n\n return this;\n }\n}\n","import { EditorView } from '@tiptap/pm/view';\nimport {\n WysiwygLinterPlugin,\n WysiwygLinterResult as Issue,\n} from '../LinterPlugin';\n\nexport class WysiwygLinterPunctuation extends WysiwygLinterPlugin {\n public regex = / ([,.!?:]) ?/g;\n\n fix(replacement: any) {\n // eslint-disable-next-line func-names\n return function ({ state, dispatch }: EditorView, issue: Issue) {\n dispatch(\n state.tr.replaceWith(\n issue.from,\n issue.to,\n state.schema.text(replacement),\n ),\n );\n };\n }\n\n scan() {\n this.doc.descendants((node, position) => {\n if (!node.isText) {\n return;\n }\n\n if (!node.text) {\n return;\n }\n\n const matches = this.regex.exec(node.text);\n\n if (matches) {\n this.record({\n message: 'Suspicious spacing around punctuation',\n from: position + matches.index,\n to: position + matches.index + matches[0].length,\n fix: {\n message: 'Fix it!!!',\n handler: this.fix(`${matches[1]} `),\n },\n });\n }\n });\n\n return this;\n }\n}\n","import { Extension } from '@tiptap/vue-3';\nimport '@tiptap/extension-text-style';\n\nexport type WysiwygColorOptions = {\n types: string[];\n};\n\ndeclare module '@tiptap/vue-3' {\n interface Commands<ReturnType> {\n color: {\n /**\n * Set the text color\n */\n setColor: (color: string) => ReturnType;\n /**\n * Unset the text color\n */\n unsetColor: () => ReturnType;\n };\n }\n}\n\nexport const WysiwygColorExtension = Extension.create<WysiwygColorOptions>({\n name: 'color',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n color: {\n default: null,\n parseHTML: (element) => element.style.color.replace(/['\"]+/g, ''),\n renderHTML: (attributes) => {\n if (!attributes.color) {\n return {};\n }\n\n return {\n style: `color: ${attributes.color}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setColor:\n (color) =>\n ({ chain }) =>\n chain().setMark('textStyle', { color }).run(),\n unsetColor:\n () =>\n ({ chain }) =>\n chain()\n .setMark('textStyle', { color: null })\n .removeEmptyTextStyle()\n .run(),\n };\n },\n});\n","import { Extension, mergeAttributes, Mark } from '@tiptap/vue-3';\nimport '@tiptap/extension-text-style';\n// import '@tiptap/vue-3';\n\nexport type WysiwygCustomTagSettings = {\n /**\n * tag name\n *\n * Either the html default tag name or a custom tag name is acceptable\n *\n * @default \"span\"\n */\n tag: string;\n\n /**\n * HTML Attributes\n *\n * Attributes to be assigned to tags such as `class`, `data-xxx`, etc.\n */\n attrs?: Record<any, string>;\n};\n\ndeclare module '@tiptap/vue-3' {\n interface Commands<ReturnType> {\n customTag: {\n /**\n * Set the custom tag\n */\n setCustomTag: (markName: string) => ReturnType;\n /**\n * Toggle the custom tag\n */\n toggleCustomTag: (markName: string) => ReturnType;\n /**\n * Unset the custom tag\n */\n unsetCustomTag: (markName: string) => ReturnType;\n };\n }\n}\n\n// export type WysiwygCustomTagSettings = WysiwygCustomTagOptions & {\n// /**\n// * extension name\n// */\n// name: string;\n// };\n\nexport function createWysiwygCustomTagMark(\n name: string,\n settings: Partial<WysiwygCustomTagSettings>,\n) {\n const { tag = 'span', attrs } = settings;\n const attrEntries = attrs && Object.entries(attrs);\n // eslint-disable-next-line no-shadow\n const attrNames = attrEntries && attrEntries.map(([name]) => name);\n\n const getElementAttrs = (\n el: HTMLElement,\n ): Record<any, string> | undefined => {\n if (!attrNames) return;\n\n return (\n el\n .getAttributeNames()\n // eslint-disable-next-line no-shadow\n .reduce((acc, name) => ({ ...acc, [name]: el.getAttribute(name) }), {})\n );\n };\n\n const isMatchedElementAttrs = (elAttrs: Record<any, string>): boolean => {\n if (!attrEntries) return true;\n // eslint-disable-next-line no-shadow\n return attrEntries.every(([name, value]) => elAttrs[name] === value);\n };\n\n return Mark.create<WysiwygCustomTagSettings>({\n name,\n\n addOptions() {\n return {\n tag,\n attrs: attrs && { ...attrs },\n };\n },\n parseHTML() {\n return [\n {\n tag,\n getAttrs: (el: any) => {\n if (!attrs) return null;\n const elAttrs = getElementAttrs(el);\n if (!elAttrs) return false;\n return isMatchedElementAttrs(el) && null;\n },\n },\n ];\n },\n renderHTML({ HTMLAttributes }) {\n return [\n tag,\n attrs ? mergeAttributes(attrs, HTMLAttributes) : HTMLAttributes,\n 0,\n ];\n },\n });\n}\n\nexport const WysiwygCustomTagExtension =\n Extension.create<WysiwygCustomTagSettings>({\n name: 'custom-tag',\n addCommands() {\n return {\n setCustomTag:\n (markName) =>\n ({ chain }) =>\n chain().setMark(markName).run(),\n unsetCustomTag:\n (markName) =>\n ({ chain }) =>\n chain().unsetMark(markName).run(),\n toggleCustomTag:\n (markName) =>\n ({ chain }) =>\n chain().toggleMark(markName).run(),\n };\n },\n });\n","import { BulletList, BulletListOptions } from '@tiptap/extension-bullet-list';\nimport { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\n\nexport const WysiwygBulletListTool: WysiwygEditorToolFactory<\n BulletListOptions\n> = (vui, options) => {\n const tool: WysiwygEditorTool = {\n key: 'bulletList',\n icon: vui.icon('editorformatListBulleted'),\n active: ({ editor }) => editor.isActive('bulletList'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleBulletList().run();\n },\n floating: true,\n extensions: [BulletList.configure(options)],\n };\n return tool;\n};\n","import { Bold, BoldOptions } from '@tiptap/extension-bold';\nimport { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\n\nexport const WysiwygFormatBoldTool: WysiwygEditorToolFactory<BoldOptions> = (\n vui,\n options,\n) => {\n const tool: WysiwygEditorTool = {\n key: 'formatBold',\n icon: vui.icon('editorformatBold'),\n active: ({ editor }) => editor.isActive('bold'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleBold().run();\n },\n floating: true,\n extensions: [Bold.configure(options)],\n };\n return tool;\n};\n","import { Italic, ItalicOptions } from '@tiptap/extension-italic';\nimport { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\n\nexport const WysiwygFormatItalicTool: WysiwygEditorToolFactory<\n ItalicOptions\n> = (vui, options) => {\n const tool: WysiwygEditorTool = {\n key: 'formatItalic',\n icon: vui.icon('editorformatItalic'),\n active: ({ editor }) => editor.isActive('italic'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleItalic().run();\n },\n floating: true,\n extensions: [Italic.configure(options)],\n };\n return tool;\n};\n","import { Underline, UnderlineOptions } from '@tiptap/extension-underline';\nimport { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\n\nexport const WysiwygFormatUnderlineTool: WysiwygEditorToolFactory<\n UnderlineOptions\n> = (vui, options) => {\n const tool: WysiwygEditorTool = {\n key: 'formatUnderline',\n icon: vui.icon('editorformatUnderline'),\n active: ({ editor }) => editor.isActive('underline'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleUnderline().run();\n },\n floating: true,\n extensions: [Underline.configure(options)],\n };\n return tool;\n};\n","import { History, HistoryOptions } from '@tiptap/extension-history';\nimport { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\n\nexport const WysiwygHistoryTool: WysiwygEditorToolFactory<HistoryOptions> = (\n vui,\n options,\n) => {\n const undo: WysiwygEditorTool = {\n key: 'history-undo',\n icon: vui.icon('editorUndo'),\n disabled: ({ editor }) => !editor.can().undo(),\n onClick: ({ editor }) => {\n editor.chain().focus().undo().run();\n },\n extensions: [History.configure(options)],\n };\n const redo: WysiwygEditorTool = {\n key: 'history-redo',\n icon: vui.icon('editorRedo'),\n disabled: ({ editor }) => !editor.can().redo(),\n onClick: ({ editor }) => {\n editor.chain().focus().redo().run();\n },\n };\n return [undo, redo];\n};\n","import { Link, LinkOptions } from '@tiptap/extension-link';\nimport { validateIf, url } from '@fastkit/vui';\nimport { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\n\nexport const WysiwygLinkTool: WysiwygEditorToolFactory<LinkOptions> = (\n vui,\n options,\n) => {\n const tool: WysiwygEditorTool = {\n key: 'link',\n icon: vui.icon('editorLink'),\n active: ({ editor }) => editor.isActive('link'),\n // eslint-disable-next-line no-shadow\n onClick: async ({ vui, editor }) => {\n const { href = '' } = editor.getAttributes('link');\n const result = await vui.prompt({\n input: {\n label: 'Link URL',\n rules: [validateIf, url],\n initialValue: href,\n size: 'sm',\n autofocus: true,\n },\n });\n\n if (result === undefined || result === false) {\n return;\n }\n\n const range = editor.chain().focus().extendMarkRange('link');\n\n if (!result) {\n range.unsetLink().run();\n } else {\n range\n .setLink({\n href: result,\n })\n .run();\n }\n },\n floating: true,\n extensions: [\n Link.configure({\n openOnClick: false,\n ...options,\n }),\n ],\n };\n return tool;\n};\n","import {\n OrderedList,\n OrderedListOptions,\n} from '@tiptap/extension-ordered-list';\nimport { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\n\nexport const WysiwygOrderedListTool: WysiwygEditorToolFactory<\n OrderedListOptions\n> = (vui, options) => {\n const tool: WysiwygEditorTool = {\n key: 'orderedList',\n icon: vui.icon('editorformatListNumbered'),\n active: ({ editor }) => editor.isActive('orderedList'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleOrderedList().run();\n },\n floating: true,\n extensions: [OrderedList.configure(options)],\n };\n return tool;\n};\n","import { createVNode as _createVNode } from \"vue\";\nimport './color.scss';\nimport { VIcon } from '@fastkit/vui';\nimport TextStyle from '@tiptap/extension-text-style';\nimport { WysiwygColorExtension } from '../extensions';\nexport function createWysiwygColorTool(opts) {\n const WysiwygColorTool = vui => {\n const tool = {\n key: 'textColor',\n // active: ({ editor }) => editor.isActive('textStyle'),\n icon: ({\n editor\n }) => () => {\n const {\n color\n } = editor.getAttributes('textStyle');\n const style = {\n color\n };\n return _createVNode(\"span\", {\n \"class\": \"v-wysiwyg-color-tool__button\"\n }, [_createVNode(VIcon, {\n \"class\": \"v-wysiwyg-color-tool__button__icon\",\n \"name\": vui.icon('editorTextColor')\n }, null), _createVNode(\"span\", {\n \"class\": \"v-wysiwyg-color-tool__button__bar\",\n \"style\": style\n }, null)]);\n },\n onClick: (ctx, ev) => {\n ctx.vui.menu({\n class: 'v-wysiwyg-color-tool__menu',\n activator: ev,\n content: stack => _createVNode(\"div\", {\n \"class\": ['v-wysiwyg-color-tool__items', {\n 'v-wysiwyg-color-tool__items--with-label': opts.withLabel\n }]\n }, [opts.items.map((item, index) => _createVNode(\"button\", {\n \"key\": item.key == null ? index : item.key,\n \"class\": \"v-wysiwyg-color-tool__item\",\n \"type\": \"button\",\n \"onClick\": () => {\n const {\n color\n } = item;\n let command = ctx.editor.chain().focus();\n if (color) {\n command = command.setColor(color);\n } else {\n command = command.unsetColor();\n }\n command.run();\n stack.close();\n }\n }, [_createVNode(\"span\", {\n \"class\": \"v-wysiwyg-color-tool__item__color\",\n \"style\": item.color ? {\n color: item.color\n } : {}\n }, null), opts.withLabel && _createVNode(\"span\", {\n \"class\": \"v-wysiwyg-color-tool__item__name\"\n }, [item.name])]))])\n });\n },\n floating: true,\n extensions: [TextStyle, WysiwygColorExtension]\n };\n return tool;\n };\n return WysiwygColorTool;\n}","import { isVNode as _isVNode, createVNode as _createVNode } from \"vue\";\nimport { TextAlign } from '@tiptap/extension-text-align';\nimport { VButtonGroup, VButton } from '@fastkit/vui';\nfunction _isSlot(s) {\n return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);\n}\n/**\n * A list of available options for the text align attribute.\n * @remarks\n * `\"justify\"` has not yet been adopted because of ambiguity in browser support.\n */\nexport const WYSIWYG_TEXT_ALIGN_VALUES = ['left', 'center', 'right'\n// 'justify',\n];\n\n/** Text align value */\n\n/**\n * A list of nodes where the text align attribute should be applied to.\n */\nconst DEFAULT_TYPES = ['heading', 'paragraph'];\nconst conditions = WYSIWYG_TEXT_ALIGN_VALUES.map(value => [value, {\n textAlign: value\n}]);\nconst ICON_AT = {\n left: 'editorAlignLeft',\n center: 'editorAlignCenter',\n right: 'editorAlignRight'\n};\nfunction resolveOptions(rawOptions) {\n const types = rawOptions?.types || DEFAULT_TYPES.slice();\n const alignments = rawOptions?.alignments || WYSIWYG_TEXT_ALIGN_VALUES.slice();\n const defaultAlignment = rawOptions?.defaultAlignment || 'left';\n return {\n types,\n alignments,\n defaultAlignment\n };\n}\nfunction getCurrentAlign(editor, options) {\n for (const [align, condition] of conditions) {\n if (editor.isActive(condition)) return align;\n }\n return options.defaultAlignment;\n}\nexport const WysiwygTextAlignTool = (vui, options) => {\n const resolvedOptions = resolveOptions(options);\n const {\n alignments\n } = resolvedOptions;\n const getIcon = value => {\n const iconKey = ICON_AT[value];\n const icon = vui.icon(iconKey);\n if (icon === '$empty' || typeof icon === 'function') return;\n return icon;\n };\n const variant = vui.setting('plainVariant');\n const toolButtonActiveColor = vui.setting('primaryScope');\n const tool = {\n key: 'textAlign',\n icon: ({\n editor\n }) => getIcon(getCurrentAlign(editor, resolvedOptions)),\n // eslint-disable-next-line no-shadow\n onClick: async ({\n vui,\n editor\n }, ev) => {\n vui.menu({\n distance: 0,\n activator: ev,\n content: menu => {\n let _slot;\n return _createVNode(VButtonGroup, {\n \"variant\": variant\n }, _isSlot(_slot = alignments.map(value => {\n const isActive = editor.isActive({\n textAlign: value\n });\n return _createVNode(VButton, {\n \"tabindex\": -1,\n \"color\": isActive ? toolButtonActiveColor : undefined,\n \"key\": value,\n \"icon\": getIcon(value),\n \"onClick\": () => {\n editor.chain().focus().setTextAlign(value).run();\n }\n }, null);\n })) ? _slot : {\n default: () => [_slot]\n });\n }\n });\n },\n floating: true,\n extensions: [TextAlign.configure(resolvedOptions)]\n };\n return tool;\n};","import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport {\n createWysiwygCustomTagMark,\n WysiwygCustomTagSettings,\n WysiwygCustomTagExtension,\n} from '../extensions/custom-tag';\n\nexport interface WysiwygCustomTagToolSettings\n extends Pick<WysiwygEditorTool, 'icon' | 'floating'>,\n Partial<WysiwygCustomTagSettings> {}\n\n/**\n * Generate Custom Tag Tool\n *\n * @param markName - Mark name\n * @param settings - Tool Configuration\n * @returns Generated Tool\n */\nexport function createWysiwygCustomTagTool(\n markName: string,\n settings: WysiwygCustomTagToolSettings,\n): WysiwygEditorToolFactory {\n const Mark = createWysiwygCustomTagMark(markName, settings);\n const { icon, floating = true } = settings;\n\n return (vui) => {\n const tool: WysiwygEditorTool = {\n key: `customTag:${markName}`,\n icon,\n floating,\n active: ({ editor }) => editor.isActive(markName),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleCustomTag(markName).run();\n },\n extensions: [WysiwygCustomTagExtension, Mark.configure(settings)],\n };\n return tool;\n };\n}\n","import { resolveDirective as _resolveDirective, createVNode as _createVNode, isVNode as _isVNode } from \"vue\";\nimport './VWysiwygEditor.scss';\nimport { defineComponent, computed, ref, watch, onBeforeUnmount } from 'vue';\nimport { createFormNodeWrapperProps, VFormControl, VControlField, createControlFieldProps, createTextableProps, createTextableEmits, TextableControl, createControlProps, useControl, createControlFieldProviderProps, useControlField, VTextCounter, defineSlots, useVui, VButton, VButtonGroup } from '@fastkit/vui';\nimport { EditorContent, useEditor, BubbleMenu } from '@tiptap/vue-3';\nimport { StarterKit } from '@tiptap/starter-kit';\nimport { VUI_WYSIWYG_EDITOR_SYMBOL } from '../../injections';\nimport { resolveRawWysiwygExtensions, resolveRawWysiwygEditorTools,\n// EditorEventsOptions,\nWysiwygEditorInitializeContext } from '../../schemes';\nfunction _isSlot(s) {\n return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);\n}\nconst slots = defineSlots();\nexport const VWysiwygEditor = defineComponent({\n name: 'VWysiwygEditor',\n props: {\n ...createTextableProps(),\n ...createFormNodeWrapperProps(),\n ...createControlFieldProps(),\n ...createControlFieldProviderProps(),\n ...createControlProps(),\n ...slots(),\n extensions: {\n type: Array,\n default: () => []\n },\n tools: {\n type: Array,\n default: () => []\n },\n floatingToolbar: Boolean,\n disabledMinHeight: Boolean,\n disabledMaxHeight: Boolean,\n removeDefaultWrapper: {\n type: Boolean,\n default: true\n }\n },\n emits: {\n ...createTextableEmits()\n },\n slots,\n setup(props, ctx) {\n const vui = useVui();\n const textRef = ref('');\n const toolButtonActiveColor = vui.setting('primaryScope');\n const wysiwygSettings = computed(() => resolveRawWysiwygEditorTools(props.tools, vui));\n const control = useControl(props);\n useControlField(props);\n const classes = computed(() => ['v-wysiwyg-editor', control.classes.value, `v-wysiwyg-editor--${control.size.value}`, {\n 'v-wysiwyg-editor--disabled-min-height': props.disabledMinHeight,\n 'v-wysiwyg-editor--disabled-max-height': props.disabledMaxHeight\n }]);\n const inputControl = new TextableControl(props, ctx, {\n nodeType: VUI_WYSIWYG_EDITOR_SYMBOL,\n validationValue: () => textRef.value\n });\n const getOutput = (editor, type) => {\n if (props.removeDefaultWrapper && editor.isEmpty) return '';\n if (type === 'html') return editor.getHTML();\n if (type === 'text') return editor.getText();\n return '';\n };\n const initializeCtx = new WysiwygEditorInitializeContext(() => vui, {\n onCreate: ({\n editor\n }) => {\n textRef.value = getOutput(editor, 'text');\n updateEditable();\n },\n onFocus: ({\n event\n }) => {\n inputControl.focusHandler(event);\n },\n onBlur: ({\n event\n }) => {\n inputControl.blurHandler(event);\n },\n onUpdate: ({\n editor\n }) => {\n inputControl.value = getOutput(editor, 'html');\n textRef.value = getOutput(editor, 'text');\n }\n });\n const extensions = [StarterKit.configure({\n bold: false,\n bulletList: false,\n orderedList: false,\n history: false,\n italic: false\n }), ...resolveRawWysiwygExtensions(props.extensions, initializeCtx), ...wysiwygSettings.value.extensions];\n const updateEditable = () => {\n if (!editor.value) return;\n editor.value.setEditable(inputControl.canOperation);\n };\n watch(() => inputControl.canOperation, updateEditable);\n watch(() => props.modelValue, modelValue => {\n const $editor = editor.value;\n if (!$editor || getOutput($editor, 'html') === modelValue) return;\n $editor.commands.setContent(modelValue == null ? '' : modelValue, false);\n textRef.value = getOutput($editor, 'text');\n });\n initializeCtx.on('create', ({\n editor\n }) => {\n textRef.value = getOutput(editor, 'text');\n updateEditable();\n });\n const editor = useEditor({\n ...initializeCtx.editorOptions(),\n autofocus: props.autofocus,\n content: props.modelValue,\n extensions,\n editorProps: {\n attributes: {\n class: 'v-wysiwyg-editor__input__prose'\n }\n }\n });\n const focus = (position, options) => editor.value?.chain().focus(position, options);\n const wysiwygContext = computed(() => ({\n vui,\n editor: editor.value\n }));\n const createTools = (bubbleMenu = false) => {\n let _slot;\n const {\n value: settings\n } = wysiwygSettings;\n const {\n value: context\n } = wysiwygContext;\n const tools = bubbleMenu ? settings.tools.filter(t => !!t.floating) : settings.tools;\n const _editor = editor.value;\n const variant = vui.setting(bubbleMenu ? 'containedVariant' : 'plainVariant');\n return _createVNode(VButtonGroup, {\n \"class\": ['v-wysiwyg-editor__toolbar', {\n 'v-wysiwyg-editor__floating-toolbar': props.floatingToolbar\n }],\n \"variant\": variant\n }, _isSlot(_slot = tools.map(({\n key,\n icon,\n onClick,\n disabled,\n active\n }) => {\n const isActive = !!_editor && resolveContextualValue(context, active);\n const isDisabled = !inputControl.canOperation || !!_editor && resolveContextualValue(context, disabled);\n let iconName;\n let child;\n if (typeof icon === 'function') {\n if (_editor) {\n const _child = icon(context);\n if (typeof _child === 'function') {\n child = _child();\n } else {\n iconName = _child;\n }\n }\n } else {\n iconName = icon;\n }\n if (!iconName && child == null) return;\n return _createVNode(VButton, {\n \"tabindex\": -1,\n \"key\": key,\n \"icon\": iconName,\n \"onClick\": ev => onClick(context, ev),\n \"color\": isActive ? toolButtonActiveColor : undefined,\n \"disabled\": isDisabled\n }, _isSlot(child) ? child : {\n default: () => [child]\n });\n })) ? _slot : {\n default: () => [_slot]\n });\n };\n onBeforeUnmount(() => {\n editor.value?.destroy();\n });\n const api = {\n get editor() {\n return editor.value;\n },\n control: inputControl\n };\n ctx.expose(api);\n const handleClickLabel = ev => {\n focus('start', {\n scrollIntoView: true\n });\n };\n const defaultSlot = () => {\n let _slot2;\n return _createVNode(\"div\", {\n \"class\": \"v-wysiwyg-editor__body\"\n }, [_createVNode(EditorContent, {\n \"class\": \"v-wysiwyg-editor__input__element wysiwyg\",\n \"editor\": editor.value\n }, null), !props.floatingToolbar && !!editor.value && !inputControl.isReadonly && _createVNode(BubbleMenu, {\n \"class\": \"v-wysiwyg-editor__bubble-menu\",\n \"editor\": editor.value\n }, _isSlot(_slot2 = createTools(true)) ? _slot2 : {\n default: () => [_slot2]\n })]);\n };\n const formControlDefaultSlot = () => _createVNode(\"div\", {\n \"class\": \"v-wysiwyg-editor__wrapper\"\n }, [!inputControl.isReadonly && createTools(), _createVNode(VControlField, {\n \"class\": \"v-wysiwyg-editor__input\",\n \"autoHeight\": true,\n \"startAdornment\": props.startAdornment,\n \"endAdornment\": props.endAdornment,\n \"size\": control.size.value\n }, {\n ...ctx.slots,\n default: defaultSlot\n })]);\n const infoAppendsSlot = () => {\n const {\n counterResult\n } = inputControl;\n if (!counterResult) return;\n return _createVNode(VTextCounter, counterResult, null);\n };\n return () => _createVNode(VFormControl, {\n \"nodeControl\": inputControl,\n \"class\": classes.value,\n \"label\": props.label,\n \"hint\": props.hint,\n \"hinttip\": props.hinttip,\n \"hiddenInfo\": props.hiddenInfo,\n \"requiredChip\": props.requiredChip,\n \"onClickLabel\": handleClickLabel\n }, {\n ...ctx.slots,\n default: formControlDefaultSlot,\n infoAppends: infoAppendsSlot\n });\n }\n});\nfunction resolveContextualValue(ctx,\n// eslint-disable-next-line no-shadow\nsource) {\n return typeof source === 'function' ? source(ctx) : source;\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastkit/vui-wysiwyg",
3
- "version": "7.0.2",
3
+ "version": "7.0.4",
4
4
  "description": "vui-wysiwyg",
5
5
  "keywords": [],
6
6
  "repository": {
@@ -301,11 +301,11 @@
301
301
  "@types/markdown-it": "^13.0.7"
302
302
  },
303
303
  "devDependencies": {
304
- "@fastkit/vui": "0.19.2"
304
+ "@fastkit/vui": "0.19.3"
305
305
  },
306
306
  "peerDependencies": {
307
307
  "vue": "^3.4.0",
308
- "@fastkit/vui": "0.19.2"
308
+ "@fastkit/vui": "0.19.3"
309
309
  },
310
310
  "scripts": {
311
311
  "build": "plugboy build",