@fastkit/vui-wysiwyg 1.0.1 → 1.1.0

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.
@@ -50,13 +50,28 @@ type WysiwygExtensionSource<Options = any, Storage = any> = Extension<Options, S
50
50
  type RawWysiwygExtension<Options = any, Storage = any> = WysiwygExtensionSource<Options, Storage> | CreatedWysiwygExtension<Options, Storage>;
51
51
  declare function createWysiwygExtension<Options = any, Storage = any>(extension: WysiwygExtensionSource<Options, Storage>): CreatedWysiwygExtension<Options, Storage>;
52
52
  declare function resolveRawWysiwygExtensions(raws: RawWysiwygExtension[], ctx: WysiwygEditorInitializeContext): AnyExtension[];
53
+ type WysiwygEditorToolIcon = IconName | ((ctx: WysiwygEditorContext) => IconName | (() => VNodeChild) | undefined);
54
+ /**
55
+ * Tool Configuration
56
+ */
53
57
  interface WysiwygEditorTool {
58
+ /**
59
+ * Tool Key
60
+ *
61
+ * Must be unique to identify the tool
62
+ */
54
63
  key: string;
55
- icon: IconName | ((ctx: WysiwygEditorContext) => IconName | (() => VNodeChild) | undefined);
64
+ /** Icons to be displayed on the toolbar */
65
+ icon: WysiwygEditorToolIcon;
66
+ /** Conditions for displaying the icon as active */
56
67
  active?: boolean | ((ctx: WysiwygEditorContext) => boolean);
68
+ /** Conditions for deactivating the icon */
57
69
  disabled?: boolean | ((ctx: WysiwygEditorContext) => boolean);
70
+ /** Handler when mark text is clicked */
58
71
  onClick: (ctx: WysiwygEditorContext, ev: MouseEvent) => any;
72
+ /** Whether to display tools in floating menu or not */
59
73
  floating?: boolean;
74
+ /** Extensions that the tool depends on */
60
75
  extensions?: Extensions;
61
76
  }
62
77
  type WysiwygEditorToolFactory<Options = void> = (vui: VuiService, options?: Options) => WysiwygEditorTool | WysiwygEditorTool[];
@@ -139,6 +154,43 @@ declare module '@tiptap/vue-3' {
139
154
  }
140
155
  declare const WysiwygColorExtension: Extension<WysiwygColorOptions, any>;
141
156
 
157
+ type WysiwygCustomTagSettings = {
158
+ /**
159
+ * tag name
160
+ *
161
+ * Either the html default tag name or a custom tag name is acceptable
162
+ *
163
+ * @default "span"
164
+ */
165
+ tag: string;
166
+ /**
167
+ * HTML Attributes
168
+ *
169
+ * Attributes to be assigned to tags such as `class`, `data-xxx`, etc.
170
+ */
171
+ attrs?: Record<any, string>;
172
+ };
173
+ declare module '@tiptap/vue-3' {
174
+ interface Commands<ReturnType> {
175
+ customTag: {
176
+ /**
177
+ * Set the custom tag
178
+ */
179
+ setCustomTag: (markName: string) => ReturnType;
180
+ /**
181
+ * Toggle the custom tag
182
+ */
183
+ toggleCustomTag: (markName: string) => ReturnType;
184
+ /**
185
+ * Unset the custom tag
186
+ */
187
+ unsetCustomTag: (markName: string) => ReturnType;
188
+ };
189
+ }
190
+ }
191
+ declare function createWysiwygCustomTagMark(name: string, settings: Partial<WysiwygCustomTagSettings>): Mark<WysiwygCustomTagSettings, any>;
192
+ declare const WysiwygCustomTagExtenstion: Extension<WysiwygCustomTagSettings, any>;
193
+
142
194
  declare const WysiwygBulletListTool: WysiwygEditorToolFactory<BulletListOptions>;
143
195
 
144
196
  declare const WysiwygFormatBoldTool: WysiwygEditorToolFactory<BoldOptions>;
@@ -193,6 +245,17 @@ interface WysiwygTextAlignOptions {
193
245
  }
194
246
  declare const WysiwygTextAlignTool: WysiwygEditorToolFactory<WysiwygTextAlignOptions>;
195
247
 
248
+ interface WysiwygCustomTagToolSettings extends Pick<WysiwygEditorTool, 'icon' | 'floating'>, Partial<WysiwygCustomTagSettings> {
249
+ }
250
+ /**
251
+ * Generate Custom Tag Tool
252
+ *
253
+ * @param markName - Mark name
254
+ * @param settings - Tool Configuration
255
+ * @returns Generated Tool
256
+ */
257
+ declare function createWysiwygCustomTagTool(markName: string, settings: WysiwygCustomTagToolSettings): WysiwygEditorToolFactory;
258
+
196
259
  declare const VWysiwygEditor: vue.DefineComponent<{
197
260
  extensions: {
198
261
  type: PropType<RawWysiwygExtension[]>;
@@ -442,4 +505,4 @@ declare const VWysiwygEditor: vue.DefineComponent<{
442
505
  disabledMaxHeight: boolean;
443
506
  }>;
444
507
 
445
- export { CreateWysiwygColorToolOptions, CreatedWysiwygExtension, RawWysiwygEditorTool, RawWysiwygExtension, ResolvedWysiwygEditorSettings, VUI_WYSIWYG_EDITOR_SYMBOL, VWysiwygEditor, WYSIWYG_TEXT_ALIGN_VALUES, WysiwygBulletListTool, WysiwygColorExtension, WysiwygColorItem, WysiwygColorOptions, WysiwygEditorContext, WysiwygEditorEvent, WysiwygEditorEventsBucket, WysiwygEditorEventsOptions, WysiwygEditorInitializeContext, WysiwygEditorPrefixedEvent, WysiwygEditorTool, WysiwygEditorToolFactory, WysiwygExtensionFactory, WysiwygExtensionSource, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygLinter, WysiwygLinterBadWords, WysiwygLinterHeadingLevel, WysiwygLinterOptions, WysiwygLinterPlugin, WysiwygLinterPunctuation, WysiwygOrderedListTool, WysiwygTextAlignOptions, WysiwygTextAlignTool, WysiwygTextAlignValue, createWysiwygColorTool, createWysiwygExtension, resolveRawWysiwygEditorTools, resolveRawWysiwygExtensions };
508
+ export { CreateWysiwygColorToolOptions, CreatedWysiwygExtension, RawWysiwygEditorTool, RawWysiwygExtension, ResolvedWysiwygEditorSettings, VUI_WYSIWYG_EDITOR_SYMBOL, VWysiwygEditor, WYSIWYG_TEXT_ALIGN_VALUES, WysiwygBulletListTool, WysiwygColorExtension, WysiwygColorItem, WysiwygColorOptions, WysiwygCustomTagExtenstion, WysiwygCustomTagSettings, WysiwygCustomTagToolSettings, WysiwygEditorContext, WysiwygEditorEvent, WysiwygEditorEventsBucket, WysiwygEditorEventsOptions, WysiwygEditorInitializeContext, WysiwygEditorPrefixedEvent, WysiwygEditorTool, WysiwygEditorToolFactory, WysiwygEditorToolIcon, WysiwygExtensionFactory, WysiwygExtensionSource, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygLinter, WysiwygLinterBadWords, WysiwygLinterHeadingLevel, WysiwygLinterOptions, WysiwygLinterPlugin, WysiwygLinterPunctuation, WysiwygOrderedListTool, WysiwygTextAlignOptions, WysiwygTextAlignTool, WysiwygTextAlignValue, createWysiwygColorTool, createWysiwygCustomTagMark, createWysiwygCustomTagTool, createWysiwygExtension, resolveRawWysiwygEditorTools, resolveRawWysiwygExtensions };
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, ref, computed, watch, onBeforeUnmount, createVNode, mergeProps, createTextVNode, isVNode } from 'vue';
2
- import { Extension, useEditor, EditorContent, BubbleMenu } from '@tiptap/vue-3';
2
+ import { Extension, useEditor, EditorContent, BubbleMenu, Mark, mergeAttributes } from '@tiptap/vue-3';
3
3
  import { Decoration, DecorationSet } from '@tiptap/pm/view';
4
4
  import { Plugin, PluginKey, TextSelection } from '@tiptap/pm/state';
5
5
  import TextStyle from '@tiptap/extension-text-style';
@@ -469,6 +469,70 @@ var WysiwygColorExtension = Extension.create({
469
469
  };
470
470
  }
471
471
  });
472
+ function createWysiwygCustomTagMark(name, settings) {
473
+ const { tag = "span", attrs } = settings;
474
+ const attrEntries = attrs && Object.entries(attrs);
475
+ const attrNames = attrEntries && attrEntries.map(([name2]) => name2);
476
+ const getElementAttrs = (el) => {
477
+ if (!attrNames)
478
+ return;
479
+ return el.getAttributeNames().reduce((acc, name2) => {
480
+ return { ...acc, [name2]: el.getAttribute(name2) };
481
+ }, {});
482
+ };
483
+ const isMatchedElementAttrs = (elAttrs) => {
484
+ if (!attrEntries)
485
+ return true;
486
+ return attrEntries.every(([name2, value]) => elAttrs[name2] === value);
487
+ };
488
+ return Mark.create({
489
+ name,
490
+ addOptions() {
491
+ return {
492
+ tag,
493
+ attrs: attrs && { ...attrs }
494
+ };
495
+ },
496
+ parseHTML() {
497
+ return [
498
+ {
499
+ tag,
500
+ getAttrs: (el) => {
501
+ if (!attrs)
502
+ return null;
503
+ const elAttrs = getElementAttrs(el);
504
+ if (!elAttrs)
505
+ return false;
506
+ return isMatchedElementAttrs(el) && null;
507
+ }
508
+ }
509
+ ];
510
+ },
511
+ renderHTML({ HTMLAttributes }) {
512
+ return [
513
+ tag,
514
+ attrs ? mergeAttributes(attrs, HTMLAttributes) : HTMLAttributes,
515
+ 0
516
+ ];
517
+ }
518
+ });
519
+ }
520
+ var WysiwygCustomTagExtenstion = Extension.create({
521
+ name: "custom-tag",
522
+ addCommands() {
523
+ return {
524
+ setCustomTag: (markName) => ({ chain }) => {
525
+ return chain().setMark(markName).run();
526
+ },
527
+ unsetCustomTag: (markName) => ({ chain }) => {
528
+ return chain().unsetMark(markName).run();
529
+ },
530
+ toggleCustomTag: (markName) => ({ chain }) => {
531
+ return chain().toggleMark(markName).run();
532
+ }
533
+ };
534
+ }
535
+ });
472
536
  var WysiwygBulletListTool = (vui, options) => {
473
537
  const tool = {
474
538
  key: "bulletList",
@@ -756,6 +820,25 @@ var WysiwygTextAlignTool = (vui, options) => {
756
820
  };
757
821
  return tool;
758
822
  };
823
+
824
+ // src/tools/custom-tag.ts
825
+ function createWysiwygCustomTagTool(markName, settings) {
826
+ const Mark2 = createWysiwygCustomTagMark(markName, settings);
827
+ const { icon, floating = true } = settings;
828
+ return (vui) => {
829
+ const tool = {
830
+ key: `customTag:${markName}`,
831
+ icon,
832
+ floating,
833
+ active: ({ editor }) => editor.isActive(markName),
834
+ onClick: ({ editor }) => {
835
+ editor.chain().focus().toggleCustomTag(markName).run();
836
+ },
837
+ extensions: [WysiwygCustomTagExtenstion, Mark2.configure(settings)]
838
+ };
839
+ return tool;
840
+ };
841
+ }
759
842
  function _isSlot2(s) {
760
843
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
761
844
  }
@@ -1013,6 +1096,6 @@ function resolveContextableValue(ctx, source) {
1013
1096
  return typeof source === "function" ? source(ctx) : source;
1014
1097
  }
1015
1098
 
1016
- export { VUI_WYSIWYG_EDITOR_SYMBOL, VWysiwygEditor, WYSIWYG_TEXT_ALIGN_VALUES, WysiwygBulletListTool, WysiwygColorExtension, WysiwygEditorInitializeContext, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygLinter, WysiwygLinterBadWords, WysiwygLinterHeadingLevel, WysiwygLinterPlugin, WysiwygLinterPunctuation, WysiwygOrderedListTool, WysiwygTextAlignTool, createWysiwygColorTool, createWysiwygExtension, resolveRawWysiwygEditorTools, resolveRawWysiwygExtensions };
1099
+ export { VUI_WYSIWYG_EDITOR_SYMBOL, VWysiwygEditor, WYSIWYG_TEXT_ALIGN_VALUES, WysiwygBulletListTool, WysiwygColorExtension, WysiwygCustomTagExtenstion, WysiwygEditorInitializeContext, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygLinter, WysiwygLinterBadWords, WysiwygLinterHeadingLevel, WysiwygLinterPlugin, WysiwygLinterPunctuation, WysiwygOrderedListTool, WysiwygTextAlignTool, createWysiwygColorTool, createWysiwygCustomTagMark, createWysiwygCustomTagTool, createWysiwygExtension, resolveRawWysiwygEditorTools, resolveRawWysiwygExtensions };
1017
1100
  //# sourceMappingURL=out.js.map
1018
1101
  //# sourceMappingURL=vui-wysiwyg.mjs.map
@@ -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/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/components/VWysiwygEditor/VWysiwygEditor.tsx"],"names":["_createVNode","Extension","vui","ev","_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,CACxB,WACyB;AACzB,SAAO,KAAK,OAAO,OAAO,CAAC,EAAE,YAAY,IAAI,OAAO,MAAM,CAAC;AAC7D;AAgBO,IAAM,iCAAN,MAAqC;AAAA,EACjC,YAAuC,CAAC;AAAA,EAChC;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,IAAI,CAAC,UAAU;AAC1B,cAAM,WAAW,KAAK,UAAU,KAAK;AACrC,iBAAS,QAAQ,CAAC,Y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Name } 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>(\n source: S,\n): PrefixedEventName<S> => {\n return `on${source.charAt(0).toUpperCase()}${source.slice(1)}` as any;\n};\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 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 interface WysiwygEditorTool {\n key: string;\n icon:\n | IconName\n | ((\n ctx: WysiwygEditorContext,\n ) => IconName | (() => VNodeChild) | undefined);\n active?: boolean | ((ctx: WysiwygEditorContext) => boolean);\n disabled?: boolean | ((ctx: WysiwygEditorContext) => boolean);\n onClick: (ctx: WysiwygEditorContext, ev: MouseEvent) => any;\n floating?: boolean;\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 => {\n return new RegisteredLinterPlugin(doc).scan().getResults();\n }).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});","let IDX = 256,\n BUFFER: any;\nconst HEX: any = [];\nwhile (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);\n\nexport function cheepUUID() {\n let i = 0,\n num,\n out = '';\n\n if (!BUFFER || IDX + 16 > 256) {\n BUFFER = Array((i = 256));\n while (i--) BUFFER[i] = (256 * Math.random()) | 0;\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 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 console.log('hoge');\n }\n }, {\n message: 'どうにかする',\n handler: () => {\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 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 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 return chain().setMark('textStyle', { color }).run();\n },\n unsetColor:\n () =>\n ({ chain }) => {\n return chain()\n .setMark('textStyle', { color: null })\n .removeEmptyTextStyle()\n .run();\n },\n };\n },\n});\n","import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { BulletList, BulletListOptions } from '@tiptap/extension-bullet-list';\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 { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { Bold, BoldOptions } from '@tiptap/extension-bold';\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 { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { Italic, ItalicOptions } from '@tiptap/extension-italic';\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 { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { Underline, UnderlineOptions } from '@tiptap/extension-underline';\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 { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { History, HistoryOptions } from '@tiptap/extension-history';\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 { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { Link, LinkOptions } from '@tiptap/extension-link';\nimport { validateIf, url } from '@fastkit/vui';\n\nexport const WysiwygLinkTool: WysiwygEditorToolFactory<LinkOptions> = (\n vui,\n options,\n) => {\n const tool: WysiwygEditorTool = {\n key: 'link',\n // icon: ({ editor }) => {\n // return vui.icon(editor.isActive('link') ? 'editorLinkOff' : 'editorLink');\n // },\n icon: vui.icon('editorLink'),\n active: ({ editor }) => editor.isActive('link'),\n // disabled: ({ editor }) => {\n // const { $from, $to } = editor.view.state.selection;\n // return $to.pos - $from.pos === 0;\n // },\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 { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport {\n OrderedList,\n OrderedListOptions,\n} from '@tiptap/extension-ordered-list';\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 { WysiwygColorExtension } from '../extensions';\nimport { VIcon } from '@fastkit/vui';\nimport TextStyle from '@tiptap/extension-text-style';\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 color = editor.getAttributes('textStyle').color;\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';\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 */\nfunction _isSlot(s) {\n return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);\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 => {\n return [value, {\n textAlign: value\n }];\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 }) => {\n return getIcon(getCurrentAlign(editor, resolvedOptions));\n },\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\": ev => {\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 { 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 { createFormControlProps, VFormControl, VControlField, createControlFieldProps, createTextableProps, createTextableEmits, TextableControl, createControlProps, useControl, createControlFieldProviderProps, useControlField, VTextCounter, defineSlotsProps, useVui, VButton, VButtonGroup } from '@fastkit/vui';\nimport { VUI_WYSIWYG_EDITOR_SYMBOL } from '../../injections';\nimport { EditorContent, useEditor, BubbleMenu } from '@tiptap/vue-3';\nimport { StarterKit } from '@tiptap/starter-kit';\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}\nexport const VWysiwygEditor = defineComponent({\n name: 'VWysiwygEditor',\n props: {\n ...createTextableProps(),\n ...createFormControlProps(),\n ...createControlFieldProps(),\n ...createControlFieldProviderProps(),\n ...createControlProps(),\n ...defineSlotsProps(),\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 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 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) => {\n if (!editor.value) return;\n return editor.value.chain().focus(position, options);\n };\n const blur = () => {\n if (!editor.value) return;\n return editor.value.chain().blur();\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 && resolveContextableValue(context, active);\n const isDisabled = !inputControl.canOperation || !!_editor && resolveContextableValue(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 return {\n editor,\n ...inputControl.expose(),\n ...control,\n focus,\n blur,\n createTools\n };\n },\n render() {\n return _createVNode(VFormControl, {\n \"nodeControl\": this.nodeControl,\n \"focused\": this.nodeControl.focused,\n \"class\": ['v-wysiwyg-editor', this.classes, `v-wysiwyg-editor--${this.size}`, {\n 'v-wysiwyg-editor--disabled-min-heihgt': this.disabledMinHeight,\n 'v-wysiwyg-editor--disabled-max-heihgt': this.disabledMaxHeight\n }],\n \"label\": this.label,\n \"hint\": this.hint,\n \"hinttip\": this.hinttip,\n \"hiddenInfo\": this.hiddenInfo,\n \"requiredChip\": this.requiredChip,\n \"onClickLabel\": ev => {\n this.focus('start', {\n scrollIntoView: true\n });\n }\n }, {\n ...this.$slots,\n default: () => {\n const {\n editor\n } = this;\n return _createVNode(\"div\", {\n \"class\": \"v-wysiwyg-editor__wrapper\"\n }, [!this.isReadonly && this.createTools(), _createVNode(VControlField, {\n \"class\": \"v-wysiwyg-editor__input\",\n \"autoHeight\": true,\n \"startAdornment\": this.startAdornment,\n \"endAdornment\": this.endAdornment,\n \"size\": this.size\n }, {\n ...this.$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\n }), null), !this.floatingToolbar && !!editor && !this.isReadonly && _createVNode(BubbleMenu, _mergeProps({\n class: 'v-wysiwyg-editor__bubble-menu'\n }, {\n \"editor\": editor\n }), _isSlot(_slot2 = this.createTools(true)) ? _slot2 : {\n default: () => [_slot2]\n })]);\n }\n })]);\n },\n infoAppends: () => {\n const {\n counterResult\n } = this;\n if (!counterResult) return;\n return _createVNode(VTextCounter, counterResult, null);\n }\n });\n }\n});\nfunction resolveContextableValue(ctx, source) {\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","ev","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,CACxB,WACyB;AACzB,SAAO,KAAK,OAAO,OAAO,CAAC,EAAE,YAAY,IAAI,OAAO,MAAM,CAAC;AAC7D;AAgBO,IAAM,iCAAN,MAAqC;AAAA,EACjC,YAAuC,CAAC;AAAA,EAChC;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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C5C,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>(\n source: S,\n): PrefixedEventName<S> => {\n return `on${source.charAt(0).toUpperCase()}${source.slice(1)}` as any;\n};\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 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 => {\n return new RegisteredLinterPlugin(doc).scan().getResults();\n }).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});","let IDX = 256,\n BUFFER: any;\nconst HEX: any = [];\nwhile (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);\n\nexport function cheepUUID() {\n let i = 0,\n num,\n out = '';\n\n if (!BUFFER || IDX + 16 > 256) {\n BUFFER = Array((i = 256));\n while (i--) BUFFER[i] = (256 * Math.random()) | 0;\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 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 console.log('hoge');\n }\n }, {\n message: 'どうにかする',\n handler: () => {\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 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 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 return chain().setMark('textStyle', { color }).run();\n },\n unsetColor:\n () =>\n ({ chain }) => {\n return chain()\n .setMark('textStyle', { color: null })\n .removeEmptyTextStyle()\n .run();\n },\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 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 el.getAttributeNames().reduce((acc, name) => {\n return { ...acc, [name]: el.getAttribute(name) };\n }, {});\n };\n\n const isMatchedElementAttrs = (elAttrs: Record<any, string>): boolean => {\n if (!attrEntries) return true;\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 WysiwygCustomTagExtenstion =\n Extension.create<WysiwygCustomTagSettings>({\n name: 'custom-tag',\n addCommands() {\n return {\n setCustomTag:\n (markName) =>\n ({ chain }) => {\n return chain().setMark(markName).run();\n },\n unsetCustomTag:\n (markName) =>\n ({ chain }) => {\n return chain().unsetMark(markName).run();\n },\n toggleCustomTag:\n (markName) =>\n ({ chain }) => {\n return chain().toggleMark(markName).run();\n },\n };\n },\n });\n","import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { BulletList, BulletListOptions } from '@tiptap/extension-bullet-list';\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 { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { Bold, BoldOptions } from '@tiptap/extension-bold';\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 { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { Italic, ItalicOptions } from '@tiptap/extension-italic';\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 { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { Underline, UnderlineOptions } from '@tiptap/extension-underline';\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 { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { History, HistoryOptions } from '@tiptap/extension-history';\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 { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { Link, LinkOptions } from '@tiptap/extension-link';\nimport { validateIf, url } from '@fastkit/vui';\n\nexport const WysiwygLinkTool: WysiwygEditorToolFactory<LinkOptions> = (\n vui,\n options,\n) => {\n const tool: WysiwygEditorTool = {\n key: 'link',\n // icon: ({ editor }) => {\n // return vui.icon(editor.isActive('link') ? 'editorLinkOff' : 'editorLink');\n // },\n icon: vui.icon('editorLink'),\n active: ({ editor }) => editor.isActive('link'),\n // disabled: ({ editor }) => {\n // const { $from, $to } = editor.view.state.selection;\n // return $to.pos - $from.pos === 0;\n // },\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 { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport {\n OrderedList,\n OrderedListOptions,\n} from '@tiptap/extension-ordered-list';\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 { WysiwygColorExtension } from '../extensions';\nimport { VIcon } from '@fastkit/vui';\nimport TextStyle from '@tiptap/extension-text-style';\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 color = editor.getAttributes('textStyle').color;\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';\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 */\nfunction _isSlot(s) {\n return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);\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 => {\n return [value, {\n textAlign: value\n }];\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 }) => {\n return getIcon(getCurrentAlign(editor, resolvedOptions));\n },\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\": ev => {\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 WysiwygCustomTagExtenstion,\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: [WysiwygCustomTagExtenstion, 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 { createFormControlProps, VFormControl, VControlField, createControlFieldProps, createTextableProps, createTextableEmits, TextableControl, createControlProps, useControl, createControlFieldProviderProps, useControlField, VTextCounter, defineSlotsProps, useVui, VButton, VButtonGroup } from '@fastkit/vui';\nimport { VUI_WYSIWYG_EDITOR_SYMBOL } from '../../injections';\nimport { EditorContent, useEditor, BubbleMenu } from '@tiptap/vue-3';\nimport { StarterKit } from '@tiptap/starter-kit';\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}\nexport const VWysiwygEditor = defineComponent({\n name: 'VWysiwygEditor',\n props: {\n ...createTextableProps(),\n ...createFormControlProps(),\n ...createControlFieldProps(),\n ...createControlFieldProviderProps(),\n ...createControlProps(),\n ...defineSlotsProps(),\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 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 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) => {\n if (!editor.value) return;\n return editor.value.chain().focus(position, options);\n };\n const blur = () => {\n if (!editor.value) return;\n return editor.value.chain().blur();\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 && resolveContextableValue(context, active);\n const isDisabled = !inputControl.canOperation || !!_editor && resolveContextableValue(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 return {\n editor,\n ...inputControl.expose(),\n ...control,\n focus,\n blur,\n createTools\n };\n },\n render() {\n return _createVNode(VFormControl, {\n \"nodeControl\": this.nodeControl,\n \"focused\": this.nodeControl.focused,\n \"class\": ['v-wysiwyg-editor', this.classes, `v-wysiwyg-editor--${this.size}`, {\n 'v-wysiwyg-editor--disabled-min-heihgt': this.disabledMinHeight,\n 'v-wysiwyg-editor--disabled-max-heihgt': this.disabledMaxHeight\n }],\n \"label\": this.label,\n \"hint\": this.hint,\n \"hinttip\": this.hinttip,\n \"hiddenInfo\": this.hiddenInfo,\n \"requiredChip\": this.requiredChip,\n \"onClickLabel\": ev => {\n this.focus('start', {\n scrollIntoView: true\n });\n }\n }, {\n ...this.$slots,\n default: () => {\n const {\n editor\n } = this;\n return _createVNode(\"div\", {\n \"class\": \"v-wysiwyg-editor__wrapper\"\n }, [!this.isReadonly && this.createTools(), _createVNode(VControlField, {\n \"class\": \"v-wysiwyg-editor__input\",\n \"autoHeight\": true,\n \"startAdornment\": this.startAdornment,\n \"endAdornment\": this.endAdornment,\n \"size\": this.size\n }, {\n ...this.$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\n }), null), !this.floatingToolbar && !!editor && !this.isReadonly && _createVNode(BubbleMenu, _mergeProps({\n class: 'v-wysiwyg-editor__bubble-menu'\n }, {\n \"editor\": editor\n }), _isSlot(_slot2 = this.createTools(true)) ? _slot2 : {\n default: () => [_slot2]\n })]);\n }\n })]);\n },\n infoAppends: () => {\n const {\n counterResult\n } = this;\n if (!counterResult) return;\n return _createVNode(VTextCounter, counterResult, null);\n }\n });\n }\n});\nfunction resolveContextableValue(ctx, source) {\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": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "vui-wysiwyg",
5
5
  "keywords": [],
6
6
  "repository": {