@fastkit/vui-wysiwyg 8.3.0-next.0 → 8.3.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.
- package/dist/pm/changeset.mjs +2 -3
- package/dist/pm/commands.mjs +2 -3
- package/dist/pm/dropcursor.mjs +2 -3
- package/dist/pm/gapcursor.mjs +2 -3
- package/dist/pm/history.mjs +2 -3
- package/dist/pm/inputrules.mjs +2 -3
- package/dist/pm/keymap.mjs +2 -3
- package/dist/pm/model.mjs +2 -3
- package/dist/pm/schema-list.mjs +2 -3
- package/dist/pm/state.mjs +2 -3
- package/dist/pm/tables.mjs +2 -3
- package/dist/pm/transform.mjs +2 -3
- package/dist/pm/view.mjs +2 -3
- package/dist/tiptap/core.mjs +2 -3
- package/dist/tiptap/extensions/bold.mjs +2 -3
- package/dist/tiptap/extensions/bullet-list.mjs +2 -3
- package/dist/tiptap/extensions/history.mjs +2 -3
- package/dist/tiptap/extensions/italic.mjs +2 -3
- package/dist/tiptap/extensions/link.mjs +2 -3
- package/dist/tiptap/extensions/ordered-list.mjs +2 -3
- package/dist/tiptap/extensions/text-align.mjs +2 -3
- package/dist/tiptap/extensions/text-style.mjs +2 -3
- package/dist/tiptap/extensions/underline.mjs +2 -3
- package/dist/vui-wysiwyg.css +117 -117
- package/dist/vui-wysiwyg.d.mts +38 -1407
- package/dist/vui-wysiwyg.mjs +2 -24
- package/dist/vui-wysiwyg.mjs.map +1 -1
- package/package.json +17 -62
- package/dist/pm/collab.d.mts +0 -1
- package/dist/pm/collab.mjs +0 -3
- package/dist/pm/markdown.d.mts +0 -1
- package/dist/pm/markdown.mjs +0 -3
- package/dist/pm/menu.d.mts +0 -1
- package/dist/pm/menu.mjs +0 -3
- package/dist/pm/schema-basic.d.mts +0 -1
- package/dist/pm/schema-basic.mjs +0 -3
- package/dist/pm/trailing-node.d.mts +0 -1
- package/dist/pm/trailing-node.mjs +0 -3
package/dist/vui-wysiwyg.mjs
CHANGED
|
@@ -14,7 +14,6 @@ import { OrderedList } from "@tiptap/extension-ordered-list";
|
|
|
14
14
|
import { TextAlign } from "@tiptap/extension-text-align";
|
|
15
15
|
import { BubbleMenu } from "@tiptap/vue-3/menus";
|
|
16
16
|
import { StarterKit } from "@tiptap/starter-kit";
|
|
17
|
-
|
|
18
17
|
//#region src/schemes.ts
|
|
19
18
|
const EDITOR_EVENTS = [
|
|
20
19
|
"beforeCreate",
|
|
@@ -109,11 +108,9 @@ function resolveRawWysiwygEditorTools(rawTools, vui) {
|
|
|
109
108
|
extensions
|
|
110
109
|
};
|
|
111
110
|
}
|
|
112
|
-
|
|
113
111
|
//#endregion
|
|
114
112
|
//#region src/injections.ts
|
|
115
113
|
const VUI_WYSIWYG_EDITOR_SYMBOL = "vui-wysiwyg-editor";
|
|
116
|
-
|
|
117
114
|
//#endregion
|
|
118
115
|
//#region src/extensions/linter/Linter.tsx
|
|
119
116
|
const PROBLEM_CLASS_NAME = "v-linter__problem";
|
|
@@ -223,7 +220,6 @@ const WysiwygLinter = createWysiwygExtension((ctx) => {
|
|
|
223
220
|
}
|
|
224
221
|
});
|
|
225
222
|
});
|
|
226
|
-
|
|
227
223
|
//#endregion
|
|
228
224
|
//#region src/extensions/linter/utils.ts
|
|
229
225
|
let IDX = 256;
|
|
@@ -249,7 +245,6 @@ function cheepUUID() {
|
|
|
249
245
|
IDX++;
|
|
250
246
|
return out;
|
|
251
247
|
}
|
|
252
|
-
|
|
253
248
|
//#endregion
|
|
254
249
|
//#region src/extensions/linter/LinterPlugin.ts
|
|
255
250
|
var WysiwygLinterPlugin = class {
|
|
@@ -275,7 +270,6 @@ var WysiwygLinterPlugin = class {
|
|
|
275
270
|
return this.results;
|
|
276
271
|
}
|
|
277
272
|
};
|
|
278
|
-
|
|
279
273
|
//#endregion
|
|
280
274
|
//#region src/extensions/linter/plugins/BadWords.tsx
|
|
281
275
|
function WysiwygLinterBadWords(words) {
|
|
@@ -310,7 +304,6 @@ function WysiwygLinterBadWords(words) {
|
|
|
310
304
|
}
|
|
311
305
|
};
|
|
312
306
|
}
|
|
313
|
-
|
|
314
307
|
//#endregion
|
|
315
308
|
//#region src/extensions/linter/plugins/HeadingLevel.ts
|
|
316
309
|
var WysiwygLinterHeadingLevel = class extends WysiwygLinterPlugin {
|
|
@@ -339,7 +332,6 @@ var WysiwygLinterHeadingLevel = class extends WysiwygLinterPlugin {
|
|
|
339
332
|
return this;
|
|
340
333
|
}
|
|
341
334
|
};
|
|
342
|
-
|
|
343
335
|
//#endregion
|
|
344
336
|
//#region src/extensions/linter/plugins/Punctuation.ts
|
|
345
337
|
var WysiwygLinterPunctuation = class extends WysiwygLinterPlugin {
|
|
@@ -367,7 +359,6 @@ var WysiwygLinterPunctuation = class extends WysiwygLinterPlugin {
|
|
|
367
359
|
return this;
|
|
368
360
|
}
|
|
369
361
|
};
|
|
370
|
-
|
|
371
362
|
//#endregion
|
|
372
363
|
//#region src/extensions/color.ts
|
|
373
364
|
const WysiwygColorExtension = Extension.create({
|
|
@@ -395,7 +386,6 @@ const WysiwygColorExtension = Extension.create({
|
|
|
395
386
|
};
|
|
396
387
|
}
|
|
397
388
|
});
|
|
398
|
-
|
|
399
389
|
//#endregion
|
|
400
390
|
//#region src/extensions/custom-tag.ts
|
|
401
391
|
function createWysiwygCustomTagMark(name, settings) {
|
|
@@ -450,7 +440,6 @@ const WysiwygCustomTagExtension = Extension.create({
|
|
|
450
440
|
};
|
|
451
441
|
}
|
|
452
442
|
});
|
|
453
|
-
|
|
454
443
|
//#endregion
|
|
455
444
|
//#region src/tools/bullet-list.ts
|
|
456
445
|
const WysiwygBulletListTool = (vui, options) => {
|
|
@@ -465,7 +454,6 @@ const WysiwygBulletListTool = (vui, options) => {
|
|
|
465
454
|
extensions: [BulletList.configure(options)]
|
|
466
455
|
};
|
|
467
456
|
};
|
|
468
|
-
|
|
469
457
|
//#endregion
|
|
470
458
|
//#region src/tools/format-bold.ts
|
|
471
459
|
const WysiwygFormatBoldTool = (vui, options) => {
|
|
@@ -480,7 +468,6 @@ const WysiwygFormatBoldTool = (vui, options) => {
|
|
|
480
468
|
extensions: [Bold.configure(options)]
|
|
481
469
|
};
|
|
482
470
|
};
|
|
483
|
-
|
|
484
471
|
//#endregion
|
|
485
472
|
//#region src/tools/format-italic.ts
|
|
486
473
|
const WysiwygFormatItalicTool = (vui, options) => {
|
|
@@ -495,7 +482,6 @@ const WysiwygFormatItalicTool = (vui, options) => {
|
|
|
495
482
|
extensions: [Italic.configure(options)]
|
|
496
483
|
};
|
|
497
484
|
};
|
|
498
|
-
|
|
499
485
|
//#endregion
|
|
500
486
|
//#region src/tools/format-underline.ts
|
|
501
487
|
const WysiwygFormatUnderlineTool = (vui, options) => {
|
|
@@ -510,7 +496,6 @@ const WysiwygFormatUnderlineTool = (vui, options) => {
|
|
|
510
496
|
extensions: [Underline.configure(options)]
|
|
511
497
|
};
|
|
512
498
|
};
|
|
513
|
-
|
|
514
499
|
//#endregion
|
|
515
500
|
//#region src/tools/history.ts
|
|
516
501
|
const WysiwygHistoryTool = (vui, options) => {
|
|
@@ -531,7 +516,6 @@ const WysiwygHistoryTool = (vui, options) => {
|
|
|
531
516
|
}
|
|
532
517
|
}];
|
|
533
518
|
};
|
|
534
|
-
|
|
535
519
|
//#endregion
|
|
536
520
|
//#region src/tools/link.ts
|
|
537
521
|
const WysiwygLinkTool = (vui, options) => {
|
|
@@ -560,7 +544,6 @@ const WysiwygLinkTool = (vui, options) => {
|
|
|
560
544
|
})]
|
|
561
545
|
};
|
|
562
546
|
};
|
|
563
|
-
|
|
564
547
|
//#endregion
|
|
565
548
|
//#region src/tools/ordered-list.ts
|
|
566
549
|
const WysiwygOrderedListTool = (vui, options) => {
|
|
@@ -575,7 +558,6 @@ const WysiwygOrderedListTool = (vui, options) => {
|
|
|
575
558
|
extensions: [OrderedList.configure(options)]
|
|
576
559
|
};
|
|
577
560
|
};
|
|
578
|
-
|
|
579
561
|
//#endregion
|
|
580
562
|
//#region src/tools/color.tsx
|
|
581
563
|
function createWysiwygColorTool(opts) {
|
|
@@ -621,7 +603,6 @@ function createWysiwygColorTool(opts) {
|
|
|
621
603
|
};
|
|
622
604
|
return WysiwygColorTool;
|
|
623
605
|
}
|
|
624
|
-
|
|
625
606
|
//#endregion
|
|
626
607
|
//#region src/tools/text-align.tsx
|
|
627
608
|
/**
|
|
@@ -679,10 +660,9 @@ const WysiwygTextAlignTool = (vui, options) => {
|
|
|
679
660
|
content: (menu) => {
|
|
680
661
|
let _slot;
|
|
681
662
|
return createVNode(VButtonGroup, { "variant": variant }, _isSlot$1(_slot = alignments.map((value) => {
|
|
682
|
-
const isActive = editor.isActive({ textAlign: value });
|
|
683
663
|
return createVNode(VButton, {
|
|
684
664
|
"tabindex": -1,
|
|
685
|
-
"color": isActive ? toolButtonActiveColor : void 0,
|
|
665
|
+
"color": editor.isActive({ textAlign: value }) ? toolButtonActiveColor : void 0,
|
|
686
666
|
"key": value,
|
|
687
667
|
"icon": getIcon(value),
|
|
688
668
|
"onClick": () => {
|
|
@@ -697,7 +677,6 @@ const WysiwygTextAlignTool = (vui, options) => {
|
|
|
697
677
|
extensions: [TextAlign.configure(resolvedOptions)]
|
|
698
678
|
};
|
|
699
679
|
};
|
|
700
|
-
|
|
701
680
|
//#endregion
|
|
702
681
|
//#region src/tools/custom-tag.ts
|
|
703
682
|
/**
|
|
@@ -723,7 +702,6 @@ function createWysiwygCustomTagTool(markName, settings) {
|
|
|
723
702
|
};
|
|
724
703
|
};
|
|
725
704
|
}
|
|
726
|
-
|
|
727
705
|
//#endregion
|
|
728
706
|
//#region src/components/VWysiwygEditor/VWysiwygEditor.tsx
|
|
729
707
|
function _isSlot(s) {
|
|
@@ -921,7 +899,7 @@ const VWysiwygEditor = defineComponent({
|
|
|
921
899
|
function resolveContextualValue(ctx, source) {
|
|
922
900
|
return typeof source === "function" ? source(ctx) : source;
|
|
923
901
|
}
|
|
924
|
-
|
|
925
902
|
//#endregion
|
|
926
903
|
export { VUI_WYSIWYG_EDITOR_SYMBOL, VWysiwygEditor, WYSIWYG_TEXT_ALIGN_VALUES, WysiwygBulletListTool, WysiwygColorExtension, WysiwygCustomTagExtension, WysiwygEditorInitializeContext, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygLinter, WysiwygLinterBadWords, WysiwygLinterHeadingLevel, WysiwygLinterPlugin, WysiwygLinterPunctuation, WysiwygOrderedListTool, WysiwygTextAlignTool, createWysiwygColorTool, createWysiwygCustomTagMark, createWysiwygCustomTagTool, createWysiwygExtension, resolveRawWysiwygEditorTools, resolveRawWysiwygExtensions };
|
|
904
|
+
|
|
927
905
|
//# sourceMappingURL=vui-wysiwyg.mjs.map
|
package/dist/vui-wysiwyg.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vui-wysiwyg.mjs","names":["Extension","Decoration","DecorationSet","EditorView","Plugin","PluginKey","TextSelection","Node","ProsemirrorNode","WysiwygLinterPlugin","WysiwygLinterResult","Issue","WysiwygLinterFixMessage","createWysiwygExtension","PROBLEM_CLASS_NAME","ISSUE_ICON_CLASS_NAME","ISSUE_DATASET_NAME","resolveWysiwygLinterFixMessage","message","renderIcon","view","issue","level","icon","document","createElement","className","setAttribute","id","title","runAllLinterPlugins","doc","plugins","Array","decorations","issues","map","RegisteredLinterPlugin","scan","getResults","flat","forEach","push","inline","from","to","class","undefined","widget","decorationSet","create","WysiwygLinterOptions","WysiwygLinterStorage","WysiwygLinter","ctx","showMenu","event","Event","variant","vui","setting","scope","menu","activator","content","stack","_createVNode","fix","length","fixer","index","onClick","close","handler","name","addOptions","addStorage","addProseMirrorPlugins","options","storage","runAll","getIssue","find","getIssueElementByEvent","source","EventTarget","HTMLElement","issueId","getAttribute","linterPlugin","key","state","init","_","apply","transaction","oldState","docChanged","props","getState","handleClick","info","target","focus","dispatch","tr","setSelection","scrollIntoView","WysiwygLinterPlugin","WysiwygLinterBadWords","words","regex","RegExp","join","scan","doc","descendants","node","position","isText","matches","exec","text","fixValue","record","level","message","from","index","to","length","fix","_createVNode","_createTextVNode","handler","console","log","VNodeChild","VuiService","VIcon","TextStyle","WysiwygColorExtension","WysiwygEditorToolFactory","WysiwygEditorTool","WysiwygColorItem","key","name","vui","color","CreateWysiwygColorToolOptions","items","withLabel","createWysiwygColorTool","opts","WysiwygColorTool","tool","icon","editor","getAttributes","style","_createVNode","onClick","ctx","ev","menu","class","activator","content","stack","map","item","index","command","chain","focus","setColor","unsetColor","run","close","floating","extensions","TextAlign","TextAlignOptions","Editor","VuiServiceIconSettings","VButtonGroup","VButton","WysiwygEditorToolFactory","WysiwygEditorTool","_isSlot","s","Object","prototype","toString","call","_isVNode","WYSIWYG_TEXT_ALIGN_VALUES","const","WysiwygTextAlignValue","DEFAULT_TYPES","WysiwygTextAlignOptions","types","alignments","defaultAlignment","conditions","map","textAlign","value","ICON_AT","Record","left","center","right","resolveOptions","rawOptions","Partial","Required","slice","getCurrentAlign","editor","options","align","condition","isActive","WysiwygTextAlignTool","vui","resolvedOptions","getIcon","iconKey","icon","variant","setting","toolButtonActiveColor","tool","key","onClick","ev","menu","distance","activator","content","_slot","_createVNode","undefined","chain","focus","setTextAlign","run","default","floating","extensions","configure","defineComponent","PropType","computed","ref","watch","onBeforeUnmount","VNodeChild","createFormNodeWrapperProps","FormNodeWrapperSlots","VFormControl","VControlField","createControlFieldProps","InputBoxSlots","IconName","createTextableProps","createTextableEmits","TextableControl","createControlProps","useControl","createControlFieldProviderProps","useControlField","VTextCounter","defineSlots","useVui","VButton","VButtonGroup","withCtx","EditorContent","useEditor","FocusPosition","Editor","BubbleMenu","StarterKit","VUI_WYSIWYG_EDITOR_SYMBOL","RawWysiwygExtension","resolveRawWysiwygExtensions","RawWysiwygEditorTool","resolveRawWysiwygEditorTools","WysiwygEditorContext","WysiwygEditorInitializeContext","_isSlot","s","Object","prototype","toString","call","_isVNode","slots","VWysiwygEditorAPI","editor","control","VWysiwygEditor","name","props","extensions","type","Array","default","tools","floatingToolbar","Boolean","disabledMinHeight","disabledMaxHeight","removeDefaultWrapper","emits","setup","ctx","vui","textRef","toolButtonActiveColor","setting","wysiwygSettings","classes","value","size","inputControl","nodeType","validationValue","getOutput","Pick","isEmpty","getHTML","getText","initializeCtx","onCreate","updateEditable","onFocus","event","focusHandler","onBlur","blurHandler","onUpdate","configure","bold","bulletList","orderedList","undoRedo","italic","setEditable","canOperation","modelValue","$editor","commands","setContent","emitUpdate","on","editorOptions","autofocus","content","editorProps","attributes","class","focus","position","options","scrollIntoView","chain","wysiwygContext","createTools","bubbleMenu","_slot","settings","context","filter","t","floating","_editor","variant","_createVNode","map","key","icon","onClick","disabled","active","isActive","resolveContextualValue","isDisabled","iconName","child","_child","ev","undefined","destroy","api","expose","handleClickLabel","PointerEvent","defaultSlot","isReadonly","formControlDefaultSlot","startAdornment","endAdornment","infoAppendsSlot","counterResult","label","hint","hinttip","hiddenInfo","requiredChip","infoAppends","source"],"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"],"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\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: PointerEvent) => 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 './Linter.scss';\n\nimport { Extension } from '@tiptap/vue-3';\nimport { Decoration, DecorationSet, EditorView } from '@tiptap/pm/view';\nimport { Plugin, PluginKey, TextSelection } from '@tiptap/pm/state';\nimport { Node as ProsemirrorNode } from '@tiptap/pm/model';\nimport {\n WysiwygLinterPlugin,\n WysiwygLinterResult as Issue,\n WysiwygLinterFixMessage,\n} from './LinterPlugin';\nimport { createWysiwygExtension } from '../../schemes';\n\nconst PROBLEM_CLASS_NAME = 'v-linter__problem';\nconst ISSUE_ICON_CLASS_NAME = 'v-linter__issue-icon';\nconst ISSUE_DATASET_NAME = 'data-issue-id';\n\nfunction resolveWysiwygLinterFixMessage(message: WysiwygLinterFixMessage) {\n return typeof message === 'function' ? message() : message;\n}\n\nfunction renderIcon(view: EditorView, issue: Issue) {\n const { level = 'warning' } = issue;\n const icon = document.createElement('div');\n const message = resolveWysiwygLinterFixMessage(issue.message);\n\n icon.className = `${ISSUE_ICON_CLASS_NAME} ${level}-scope`;\n icon.setAttribute(ISSUE_DATASET_NAME, issue.id);\n\n if (typeof message === 'string') {\n icon.title = message;\n }\n\n return icon;\n}\n\nfunction runAllLinterPlugins(\n doc: ProsemirrorNode,\n plugins: Array<typeof WysiwygLinterPlugin>,\n) {\n const decorations: [any?] = [];\n\n const issues = plugins\n .map((RegisteredLinterPlugin) =>\n new RegisteredLinterPlugin(doc).scan().getResults(),\n )\n .flat();\n\n issues.forEach((issue) => {\n const { level = 'warning', icon } = issue;\n const message = resolveWysiwygLinterFixMessage(issue.message);\n decorations.push(\n 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 );\n if (icon) {\n decorations.push(\n Decoration.widget(issue.from, (view) => renderIcon(view, issue)),\n );\n }\n });\n\n const decorationSet = DecorationSet.create(doc, decorations);\n\n return {\n issues,\n decorationSet,\n };\n}\n\nexport interface WysiwygLinterOptions {\n plugins: Array<typeof WysiwygLinterPlugin>;\n}\n\nexport interface WysiwygLinterStorage {\n issues: Issue[];\n}\n\nexport const WysiwygLinter = createWysiwygExtension((ctx) => {\n function showMenu(view: EditorView, issue: Issue, event: Event) {\n const message = resolveWysiwygLinterFixMessage(issue.message);\n const variant = ctx.vui.setting('containedVariant');\n const scope = ctx.vui.setting(`${issue.level}Scope`);\n\n return ctx.vui.menu({\n activator: event,\n content: (stack) => (\n <div class=\"v-linter__issue-menu__body\">\n <div\n class={[\n 'v-linter__issue-menu__message',\n `${scope}-scope ${variant}`,\n ]}>\n {message}\n </div>\n {issue.fix.length && (\n <div class=\"v-linter__issue-menu__fixers\">\n {issue.fix.map((fixer, index) => (\n <div key={index} class=\"v-linter__issue-menu__fixer\">\n <button\n type=\"button\"\n class=\"v-linter__issue-menu__fixer__button\"\n onClick={() => {\n stack.close();\n fixer.handler(view, issue);\n }}>\n <span class=\"v-linter__issue-menu__fixer__button__message\">\n {resolveWysiwygLinterFixMessage(fixer.message)}\n </span>\n </button>\n </div>\n ))}\n </div>\n )}\n </div>\n ),\n });\n }\n\n return Extension.create<WysiwygLinterOptions, WysiwygLinterStorage>({\n name: 'linter',\n\n addOptions() {\n return {\n plugins: [],\n };\n },\n addStorage() {\n return {\n issues: [],\n };\n },\n addProseMirrorPlugins() {\n const { plugins } = this.options;\n const { storage } = this;\n\n const runAll = (doc: ProsemirrorNode) => {\n const { issues, decorationSet } = runAllLinterPlugins(doc, plugins);\n storage.issues = issues;\n return decorationSet;\n };\n\n const getIssue = (id: string) =>\n storage.issues.find((issue) => issue.id === id);\n\n const getIssueElementByEvent = (\n source: EventTarget | null,\n ):\n | {\n issue: Issue;\n }\n | undefined => {\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\n return {\n issue,\n };\n };\n\n const linterPlugin: Plugin<any> = new Plugin({\n key: new PluginKey('linter'),\n state: {\n init(_, { doc }) {\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\n const { issue } = info;\n const { from, to } = issue;\n\n const focus = () =>\n view.dispatch(\n view.state.tr\n .setSelection(TextSelection.create(view.state.doc, from, to))\n .scrollIntoView(),\n );\n\n focus();\n\n showMenu(view, issue, event);\n return true;\n },\n },\n });\n\n return [linterPlugin];\n },\n });\n});\n","let 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\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 { WysiwygLinterPlugin } from '../LinterPlugin';\n\nexport function WysiwygLinterBadWords(\n words: string[],\n): typeof WysiwygLinterPlugin {\n const regex = new RegExp(`\\\\b(${words.join('|')})\\\\b`);\n\n return class WysiwygLinterBadWords extends WysiwygLinterPlugin {\n scan() {\n this.doc.descendants((node: any, position: number) => {\n if (!node.isText) {\n return;\n }\n\n const matches = regex.exec(node.text);\n\n if (matches) {\n const fixValue = `${matches[0]}!!!!!`;\n\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 {\n message: () => (\n <span>\n <code>{fixValue}</code>に修正する。\n </span>\n ),\n handler: () => {\n // eslint-disable-next-line no-console\n console.log('hoge');\n },\n },\n {\n message: 'どうにかする',\n handler: () => {\n // eslint-disable-next-line no-console\n console.log('hoge');\n },\n },\n ],\n });\n }\n });\n\n return this;\n }\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 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 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\n .getAttributeNames()\n\n .reduce((acc, name) => ({ ...acc, [name]: el.getAttribute(name) }), {});\n };\n\n const isMatchedElementAttrs = (elAttrs: Record<any, string>): boolean => {\n if (!attrEntries) return true;\n\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 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 './color.scss';\n\nimport { VNodeChild } from 'vue';\nimport { type VuiService, VIcon } from '@fastkit/vui';\nimport { TextStyle } from '@tiptap/extension-text-style';\nimport { WysiwygColorExtension } from '../extensions';\nimport { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\n\nexport interface WysiwygColorItem {\n key?: string | number;\n name?: VNodeChild | ((vui: VuiService) => VNodeChild);\n color: string | null;\n}\n\nexport interface CreateWysiwygColorToolOptions {\n items: WysiwygColorItem[];\n withLabel?: boolean;\n}\n\nexport function createWysiwygColorTool(opts: CreateWysiwygColorToolOptions) {\n const WysiwygColorTool: WysiwygEditorToolFactory = (vui) => {\n const tool: WysiwygEditorTool = {\n key: 'textColor',\n // active: ({ editor }) => editor.isActive('textStyle'),\n icon:\n ({ editor }) =>\n () => {\n const { color } = editor.getAttributes('textStyle');\n const style = { color };\n return (\n <span class=\"v-wysiwyg-color-tool__button\">\n <VIcon\n class=\"v-wysiwyg-color-tool__button__icon\"\n name={vui.icon('editorTextColor')}\n />\n <span class=\"v-wysiwyg-color-tool__button__bar\" style={style} />\n </span>\n );\n },\n onClick: (ctx, ev) => {\n ctx.vui.menu({\n class: 'v-wysiwyg-color-tool__menu',\n activator: ev,\n content: (stack) => (\n <div\n class={[\n 'v-wysiwyg-color-tool__items',\n { 'v-wysiwyg-color-tool__items--with-label': opts.withLabel },\n ]}>\n {opts.items.map((item, index) => (\n <button\n key={item.key == null ? index : item.key}\n class=\"v-wysiwyg-color-tool__item\"\n type=\"button\"\n onClick={() => {\n const { color } = 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 <span\n class=\"v-wysiwyg-color-tool__item__color\"\n style={item.color ? { color: item.color } : {}}\n />\n {opts.withLabel && (\n <span class=\"v-wysiwyg-color-tool__item__name\">\n {item.name}\n </span>\n )}\n </button>\n ))}\n </div>\n ),\n });\n },\n floating: true,\n extensions: [TextStyle, WysiwygColorExtension],\n };\n return tool;\n };\n\n return WysiwygColorTool;\n}\n","import { TextAlign, TextAlignOptions } from '@tiptap/extension-text-align';\nimport { type Editor } from '@tiptap/vue-3';\nimport { VuiServiceIconSettings, VButtonGroup, VButton } from '@fastkit/vui';\nimport { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\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 = [\n 'left',\n 'center',\n 'right',\n // 'justify',\n] as const;\n\n/** Text align value */\nexport type WysiwygTextAlignValue = (typeof WYSIWYG_TEXT_ALIGN_VALUES)[number];\n\n/**\n * A list of nodes where the text align attribute should be applied to.\n */\nconst DEFAULT_TYPES = ['heading', 'paragraph'] as const;\n\nexport interface WysiwygTextAlignOptions {\n /**\n * A list of nodes where the text align attribute should be applied to. Usually something like `['heading', 'paragraph']`\n * @default DEFAULT_TYPES\n * @see {@link DEFAULT_TYPES}\n */\n types?: TextAlignOptions['types'];\n /**\n * A list of available options for the text align attribute.\n * @default WYSIWYG_TEXT_ALIGN_VALUES\n * @see {@link WYSIWYG_TEXT_ALIGN_VALUES}\n */\n alignments?: WysiwygTextAlignValue[];\n /**\n * The default text align.\n * @default left\n */\n defaultAlignment: WysiwygTextAlignValue;\n}\n\nconst conditions = WYSIWYG_TEXT_ALIGN_VALUES.map<\n [WysiwygTextAlignValue, { textAlign: WysiwygTextAlignValue }]\n>((value) => [value, { textAlign: value }]);\n\nconst ICON_AT: Record<WysiwygTextAlignValue, keyof VuiServiceIconSettings> = {\n left: 'editorAlignLeft',\n center: 'editorAlignCenter',\n right: 'editorAlignRight',\n};\n\nfunction resolveOptions(\n rawOptions: Partial<WysiwygTextAlignOptions> | undefined,\n): Required<WysiwygTextAlignOptions> {\n const types = rawOptions?.types || DEFAULT_TYPES.slice();\n const alignments =\n rawOptions?.alignments || WYSIWYG_TEXT_ALIGN_VALUES.slice();\n const defaultAlignment = rawOptions?.defaultAlignment || 'left';\n\n return {\n types,\n alignments,\n defaultAlignment,\n };\n}\nfunction getCurrentAlign(\n editor: Editor,\n options: WysiwygTextAlignOptions,\n): WysiwygTextAlignValue {\n for (const [align, condition] of conditions) {\n if (editor.isActive(condition)) return align;\n }\n return options.defaultAlignment;\n}\n\nexport const WysiwygTextAlignTool: WysiwygEditorToolFactory<\n WysiwygTextAlignOptions\n> = (vui, options) => {\n const resolvedOptions = resolveOptions(options);\n const { alignments } = resolvedOptions;\n\n const getIcon = (value: WysiwygTextAlignValue) => {\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\n const variant = vui.setting('plainVariant');\n const toolButtonActiveColor = vui.setting('primaryScope');\n\n const tool: WysiwygEditorTool = {\n key: 'textAlign',\n icon: ({ editor }) => getIcon(getCurrentAlign(editor, resolvedOptions)),\n onClick: async ({ vui, editor }, ev) => {\n vui.menu({\n distance: 0,\n activator: ev,\n content: (menu) => (\n <VButtonGroup variant={variant}>\n {alignments.map((value) => {\n const isActive = editor.isActive({ textAlign: value });\n return (\n <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 />\n );\n })}\n </VButtonGroup>\n ),\n });\n },\n floating: true,\n extensions: [TextAlign.configure(resolvedOptions)],\n };\n return tool;\n};\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 './VWysiwygEditor.scss';\nimport {\n defineComponent,\n PropType,\n computed,\n ref,\n watch,\n onBeforeUnmount,\n VNodeChild,\n} from 'vue';\nimport {\n createFormNodeWrapperProps,\n FormNodeWrapperSlots,\n VFormControl,\n VControlField,\n createControlFieldProps,\n InputBoxSlots,\n IconName,\n createTextableProps,\n createTextableEmits,\n TextableControl,\n createControlProps,\n useControl,\n createControlFieldProviderProps,\n useControlField,\n VTextCounter,\n defineSlots,\n useVui,\n VButton,\n VButtonGroup,\n withCtx,\n} from '@fastkit/vui';\nimport {\n EditorContent,\n useEditor,\n FocusPosition,\n type Editor,\n} from '@tiptap/vue-3';\nimport { BubbleMenu } from '@tiptap/vue-3/menus';\nimport { StarterKit } from '@tiptap/starter-kit';\nimport { VUI_WYSIWYG_EDITOR_SYMBOL } from '../../injections';\nimport {\n RawWysiwygExtension,\n resolveRawWysiwygExtensions,\n RawWysiwygEditorTool,\n resolveRawWysiwygEditorTools,\n WysiwygEditorContext,\n // EditorEventsOptions,\n WysiwygEditorInitializeContext,\n} from '../../schemes';\n\nconst slots = defineSlots<FormNodeWrapperSlots & InputBoxSlots>();\n\nexport interface VWysiwygEditorAPI {\n readonly editor: Editor | undefined;\n readonly control: TextableControl;\n}\n\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 as PropType<RawWysiwygExtension[]>,\n default: () => [],\n },\n tools: {\n type: Array as PropType<RawWysiwygEditorTool[]>,\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\n const textRef = ref('');\n const toolButtonActiveColor = vui.setting('primaryScope');\n\n const wysiwygSettings = computed(() =>\n resolveRawWysiwygEditorTools(props.tools, vui),\n );\n\n const control = useControl(props);\n useControlField(props);\n\n const classes = computed(() => [\n 'v-wysiwyg-editor',\n control.classes.value,\n `v-wysiwyg-editor--${control.size.value}`,\n {\n 'v-wysiwyg-editor--disabled-min-height': props.disabledMinHeight,\n 'v-wysiwyg-editor--disabled-max-height': props.disabledMaxHeight,\n },\n ]);\n\n const inputControl = new TextableControl(props, ctx as any, {\n nodeType: VUI_WYSIWYG_EDITOR_SYMBOL,\n validationValue: () => textRef.value,\n });\n\n const getOutput = (\n editor: Pick<Editor, 'isEmpty' | 'getHTML' | 'getText'>,\n type: 'text' | 'html',\n ) => {\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\n const initializeCtx = new WysiwygEditorInitializeContext(() => vui, {\n onCreate: ({ editor }) => {\n textRef.value = getOutput(editor, 'text');\n updateEditable();\n },\n onFocus: ({ event }) => {\n inputControl.focusHandler(event);\n },\n onBlur: ({ event }) => {\n inputControl.blurHandler(event);\n },\n onUpdate: ({ editor }) => {\n inputControl.value = getOutput(editor, 'html');\n textRef.value = getOutput(editor, 'text');\n },\n });\n\n const extensions = [\n StarterKit.configure({\n bold: false,\n bulletList: false,\n orderedList: false,\n undoRedo: false,\n italic: false,\n }),\n ...resolveRawWysiwygExtensions(props.extensions, initializeCtx),\n ...wysiwygSettings.value.extensions,\n ];\n\n const updateEditable = () => {\n if (!editor.value) return;\n editor.value.setEditable(inputControl.canOperation);\n };\n\n watch(() => inputControl.canOperation, updateEditable);\n\n watch(\n () => props.modelValue,\n (modelValue) => {\n const $editor = editor.value;\n if (!$editor || getOutput($editor, 'html') === modelValue) return;\n\n $editor.commands.setContent(modelValue == null ? '' : modelValue, {\n emitUpdate: false,\n });\n textRef.value = getOutput($editor, 'text');\n },\n );\n\n initializeCtx.on('create', ({ editor }) => {\n textRef.value = getOutput(editor, 'text');\n updateEditable();\n });\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 const focus = (\n position?: FocusPosition,\n options?: {\n scrollIntoView?: boolean | undefined;\n },\n ) => editor.value?.chain().focus(position, options);\n\n const wysiwygContext = computed<WysiwygEditorContext>(() => ({\n vui,\n editor: editor.value!,\n }));\n\n const createTools = (bubbleMenu = false) => {\n const { value: settings } = wysiwygSettings;\n const { value: context } = wysiwygContext;\n const tools = bubbleMenu\n ? settings.tools.filter((t) => !!t.floating)\n : settings.tools;\n const _editor = editor.value;\n const variant = vui.setting(\n bubbleMenu ? 'containedVariant' : 'plainVariant',\n );\n\n return (\n <VButtonGroup\n class={[\n 'v-wysiwyg-editor__toolbar',\n {\n 'v-wysiwyg-editor__floating-toolbar': props.floatingToolbar,\n },\n ]}\n variant={variant}>\n {tools.map(({ key, icon, onClick, disabled, active }) => {\n const isActive =\n !!_editor && resolveContextualValue(context, active);\n const isDisabled =\n !inputControl.canOperation ||\n (!!_editor && resolveContextualValue(context, disabled));\n let iconName: IconName | undefined;\n let child: VNodeChild;\n\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 as any;\n }\n }\n } else {\n iconName = icon;\n }\n\n if (!iconName && child == null) return;\n\n return (\n <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 {child}\n </VButton>\n );\n })}\n </VButtonGroup>\n );\n };\n\n onBeforeUnmount(() => {\n editor.value?.destroy();\n });\n\n const api: VWysiwygEditorAPI = {\n get editor() {\n return editor.value;\n },\n control: inputControl,\n };\n\n ctx.expose(api);\n\n const handleClickLabel = (ev: PointerEvent) => {\n focus('start', { scrollIntoView: true });\n };\n\n const defaultSlot = () => (\n <div class=\"v-wysiwyg-editor__body\">\n <EditorContent\n class=\"v-wysiwyg-editor__input__element wysiwyg\"\n editor={editor.value}\n />\n {!props.floatingToolbar &&\n !!editor.value &&\n !inputControl.isReadonly && (\n <BubbleMenu editor={editor.value}>\n <div class=\"v-wysiwyg-editor__bubble-menu\">\n {createTools(true)}\n </div>\n </BubbleMenu>\n )}\n </div>\n );\n\n const formControlDefaultSlot = () => (\n <div class=\"v-wysiwyg-editor__wrapper\">\n {!inputControl.isReadonly && createTools()}\n <VControlField\n class=\"v-wysiwyg-editor__input\"\n autoHeight\n startAdornment={props.startAdornment}\n endAdornment={props.endAdornment}\n size={control.size.value}\n v-slots={{\n ...ctx.slots,\n default: withCtx(defaultSlot),\n }}\n />\n </div>\n );\n\n const infoAppendsSlot = () => {\n const { counterResult } = inputControl;\n if (!counterResult) return;\n return <VTextCounter {...counterResult} />;\n };\n\n return () => (\n <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 v-slots={{\n ...ctx.slots,\n default: withCtx(formControlDefaultSlot),\n infoAppends: withCtx(infoAppendsSlot),\n }}\n />\n );\n },\n});\n\nfunction resolveContextualValue(\n ctx: WysiwygEditorContext,\n source?: boolean | ((ctx: WysiwygEditorContext) => boolean),\n) {\n return typeof source === 'function' ? source(ctx) : source;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAYA,MAAM,gBAAgB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAID,MAAM,qBAAuC,WAC3C,KAAK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eAEUkE;GAAY,SAClBH,QAAQC;GAAK,SACbpB,MAAMsG;GAAK,QACZtG,MAAMuG;GAAI,WACPvG,MAAMwG;GAAO,cACVxG,MAAMyG;GAAU,gBACdzG,MAAM0G;GAAY,gBAClBb;GAAgB,EACrB;GACP,GAAGhF,IAAInB;GACPU,SAAS/B,QAAQ4H,uBAAuB;GACxCU,aAAatI,QAAQ+H,gBAAe;GACrC,CAEJ;;CAEJ,CAAC;AAEF,SAASjB,uBACPtE,KACA+F,QACA;AACA,QAAO,OAAOA,WAAW,aAAaA,OAAO/F,IAAI,GAAG+F"}
|
|
1
|
+
{"version":3,"file":"vui-wysiwyg.mjs","names":["Extension","Decoration","DecorationSet","EditorView","Plugin","PluginKey","TextSelection","Node","ProsemirrorNode","WysiwygLinterPlugin","WysiwygLinterResult","Issue","WysiwygLinterFixMessage","createWysiwygExtension","PROBLEM_CLASS_NAME","ISSUE_ICON_CLASS_NAME","ISSUE_DATASET_NAME","resolveWysiwygLinterFixMessage","message","renderIcon","view","issue","level","icon","document","createElement","className","setAttribute","id","title","runAllLinterPlugins","doc","plugins","Array","decorations","issues","map","RegisteredLinterPlugin","scan","getResults","flat","forEach","push","inline","from","to","class","undefined","widget","decorationSet","create","WysiwygLinterOptions","WysiwygLinterStorage","WysiwygLinter","ctx","showMenu","event","Event","variant","vui","setting","scope","menu","activator","content","stack","_createVNode","fix","length","fixer","index","onClick","close","handler","name","addOptions","addStorage","addProseMirrorPlugins","options","storage","runAll","getIssue","find","getIssueElementByEvent","source","EventTarget","HTMLElement","issueId","getAttribute","linterPlugin","key","state","init","_","apply","transaction","oldState","docChanged","props","getState","handleClick","info","target","focus","dispatch","tr","setSelection","scrollIntoView","WysiwygLinterPlugin","WysiwygLinterBadWords","words","regex","RegExp","join","scan","doc","descendants","node","position","isText","matches","exec","text","fixValue","record","level","message","from","index","to","length","fix","_createVNode","_createTextVNode","handler","console","log","VNodeChild","VuiService","VIcon","TextStyle","WysiwygColorExtension","WysiwygEditorToolFactory","WysiwygEditorTool","WysiwygColorItem","key","name","vui","color","CreateWysiwygColorToolOptions","items","withLabel","createWysiwygColorTool","opts","WysiwygColorTool","tool","icon","editor","getAttributes","style","_createVNode","onClick","ctx","ev","menu","class","activator","content","stack","map","item","index","command","chain","focus","setColor","unsetColor","run","close","floating","extensions","TextAlign","TextAlignOptions","Editor","VuiServiceIconSettings","VButtonGroup","VButton","WysiwygEditorToolFactory","WysiwygEditorTool","_isSlot","s","Object","prototype","toString","call","_isVNode","WYSIWYG_TEXT_ALIGN_VALUES","const","WysiwygTextAlignValue","DEFAULT_TYPES","WysiwygTextAlignOptions","types","alignments","defaultAlignment","conditions","map","textAlign","value","ICON_AT","Record","left","center","right","resolveOptions","rawOptions","Partial","Required","slice","getCurrentAlign","editor","options","align","condition","isActive","WysiwygTextAlignTool","vui","resolvedOptions","getIcon","iconKey","icon","variant","setting","toolButtonActiveColor","tool","key","onClick","ev","menu","distance","activator","content","_slot","_createVNode","undefined","chain","focus","setTextAlign","run","default","floating","extensions","configure","defineComponent","PropType","computed","ref","watch","onBeforeUnmount","VNodeChild","createFormNodeWrapperProps","FormNodeWrapperSlots","VFormControl","VControlField","createControlFieldProps","InputBoxSlots","IconName","createTextableProps","createTextableEmits","TextableControl","createControlProps","useControl","createControlFieldProviderProps","useControlField","VTextCounter","defineSlots","useVui","VButton","VButtonGroup","withCtx","EditorContent","useEditor","FocusPosition","Editor","BubbleMenu","StarterKit","VUI_WYSIWYG_EDITOR_SYMBOL","RawWysiwygExtension","resolveRawWysiwygExtensions","RawWysiwygEditorTool","resolveRawWysiwygEditorTools","WysiwygEditorContext","WysiwygEditorInitializeContext","_isSlot","s","Object","prototype","toString","call","_isVNode","slots","VWysiwygEditorAPI","editor","control","VWysiwygEditor","name","props","extensions","type","Array","default","tools","floatingToolbar","Boolean","disabledMinHeight","disabledMaxHeight","removeDefaultWrapper","emits","setup","ctx","vui","textRef","toolButtonActiveColor","setting","wysiwygSettings","classes","value","size","inputControl","nodeType","validationValue","getOutput","Pick","isEmpty","getHTML","getText","initializeCtx","onCreate","updateEditable","onFocus","event","focusHandler","onBlur","blurHandler","onUpdate","configure","bold","bulletList","orderedList","undoRedo","italic","setEditable","canOperation","modelValue","$editor","commands","setContent","emitUpdate","on","editorOptions","autofocus","content","editorProps","attributes","class","focus","position","options","scrollIntoView","chain","wysiwygContext","createTools","bubbleMenu","_slot","settings","context","filter","t","floating","_editor","variant","_createVNode","map","key","icon","onClick","disabled","active","isActive","resolveContextualValue","isDisabled","iconName","child","_child","ev","undefined","destroy","api","expose","handleClickLabel","PointerEvent","defaultSlot","isReadonly","formControlDefaultSlot","startAdornment","endAdornment","infoAppendsSlot","counterResult","label","hint","hinttip","hiddenInfo","requiredChip","infoAppends","source"],"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"],"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\nexport interface WysiwygEditorEventsOptions extends Partial<\n Pick<EditorOptions, WysiwygEditorPrefixedEvent>\n> {}\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: PointerEvent) => 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 './Linter.scss';\n\nimport { Extension } from '@tiptap/vue-3';\nimport { Decoration, DecorationSet, EditorView } from '@tiptap/pm/view';\nimport { Plugin, PluginKey, TextSelection } from '@tiptap/pm/state';\nimport { Node as ProsemirrorNode } from '@tiptap/pm/model';\nimport {\n WysiwygLinterPlugin,\n WysiwygLinterResult as Issue,\n WysiwygLinterFixMessage,\n} from './LinterPlugin';\nimport { createWysiwygExtension } from '../../schemes';\n\nconst PROBLEM_CLASS_NAME = 'v-linter__problem';\nconst ISSUE_ICON_CLASS_NAME = 'v-linter__issue-icon';\nconst ISSUE_DATASET_NAME = 'data-issue-id';\n\nfunction resolveWysiwygLinterFixMessage(message: WysiwygLinterFixMessage) {\n return typeof message === 'function' ? message() : message;\n}\n\nfunction renderIcon(view: EditorView, issue: Issue) {\n const { level = 'warning' } = issue;\n const icon = document.createElement('div');\n const message = resolveWysiwygLinterFixMessage(issue.message);\n\n icon.className = `${ISSUE_ICON_CLASS_NAME} ${level}-scope`;\n icon.setAttribute(ISSUE_DATASET_NAME, issue.id);\n\n if (typeof message === 'string') {\n icon.title = message;\n }\n\n return icon;\n}\n\nfunction runAllLinterPlugins(\n doc: ProsemirrorNode,\n plugins: Array<typeof WysiwygLinterPlugin>,\n) {\n const decorations: [any?] = [];\n\n const issues = plugins\n .map((RegisteredLinterPlugin) =>\n new RegisteredLinterPlugin(doc).scan().getResults(),\n )\n .flat();\n\n issues.forEach((issue) => {\n const { level = 'warning', icon } = issue;\n const message = resolveWysiwygLinterFixMessage(issue.message);\n decorations.push(\n 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 );\n if (icon) {\n decorations.push(\n Decoration.widget(issue.from, (view) => renderIcon(view, issue)),\n );\n }\n });\n\n const decorationSet = DecorationSet.create(doc, decorations);\n\n return {\n issues,\n decorationSet,\n };\n}\n\nexport interface WysiwygLinterOptions {\n plugins: Array<typeof WysiwygLinterPlugin>;\n}\n\nexport interface WysiwygLinterStorage {\n issues: Issue[];\n}\n\nexport const WysiwygLinter = createWysiwygExtension((ctx) => {\n function showMenu(view: EditorView, issue: Issue, event: Event) {\n const message = resolveWysiwygLinterFixMessage(issue.message);\n const variant = ctx.vui.setting('containedVariant');\n const scope = ctx.vui.setting(`${issue.level}Scope`);\n\n return ctx.vui.menu({\n activator: event,\n content: (stack) => (\n <div class=\"v-linter__issue-menu__body\">\n <div\n class={[\n 'v-linter__issue-menu__message',\n `${scope}-scope ${variant}`,\n ]}>\n {message}\n </div>\n {issue.fix.length && (\n <div class=\"v-linter__issue-menu__fixers\">\n {issue.fix.map((fixer, index) => (\n <div key={index} class=\"v-linter__issue-menu__fixer\">\n <button\n type=\"button\"\n class=\"v-linter__issue-menu__fixer__button\"\n onClick={() => {\n stack.close();\n fixer.handler(view, issue);\n }}>\n <span class=\"v-linter__issue-menu__fixer__button__message\">\n {resolveWysiwygLinterFixMessage(fixer.message)}\n </span>\n </button>\n </div>\n ))}\n </div>\n )}\n </div>\n ),\n });\n }\n\n return Extension.create<WysiwygLinterOptions, WysiwygLinterStorage>({\n name: 'linter',\n\n addOptions() {\n return {\n plugins: [],\n };\n },\n addStorage() {\n return {\n issues: [],\n };\n },\n addProseMirrorPlugins() {\n const { plugins } = this.options;\n const { storage } = this;\n\n const runAll = (doc: ProsemirrorNode) => {\n const { issues, decorationSet } = runAllLinterPlugins(doc, plugins);\n storage.issues = issues;\n return decorationSet;\n };\n\n const getIssue = (id: string) =>\n storage.issues.find((issue) => issue.id === id);\n\n const getIssueElementByEvent = (\n source: EventTarget | null,\n ):\n | {\n issue: Issue;\n }\n | undefined => {\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\n return {\n issue,\n };\n };\n\n const linterPlugin: Plugin<any> = new Plugin({\n key: new PluginKey('linter'),\n state: {\n init(_, { doc }) {\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\n const { issue } = info;\n const { from, to } = issue;\n\n const focus = () =>\n view.dispatch(\n view.state.tr\n .setSelection(TextSelection.create(view.state.doc, from, to))\n .scrollIntoView(),\n );\n\n focus();\n\n showMenu(view, issue, event);\n return true;\n },\n },\n });\n\n return [linterPlugin];\n },\n });\n});\n","let 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\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 extends Omit<\n WysiwygLinterResult,\n 'level' | 'fix' | 'id' | 'icon'\n> {\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 { WysiwygLinterPlugin } from '../LinterPlugin';\n\nexport function WysiwygLinterBadWords(\n words: string[],\n): typeof WysiwygLinterPlugin {\n const regex = new RegExp(`\\\\b(${words.join('|')})\\\\b`);\n\n return class WysiwygLinterBadWords extends WysiwygLinterPlugin {\n scan() {\n this.doc.descendants((node: any, position: number) => {\n if (!node.isText) {\n return;\n }\n\n const matches = regex.exec(node.text);\n\n if (matches) {\n const fixValue = `${matches[0]}!!!!!`;\n\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 {\n message: () => (\n <span>\n <code>{fixValue}</code>に修正する。\n </span>\n ),\n handler: () => {\n // eslint-disable-next-line no-console\n console.log('hoge');\n },\n },\n {\n message: 'どうにかする',\n handler: () => {\n // eslint-disable-next-line no-console\n console.log('hoge');\n },\n },\n ],\n });\n }\n });\n\n return this;\n }\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 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 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\n .getAttributeNames()\n\n .reduce((acc, name) => ({ ...acc, [name]: el.getAttribute(name) }), {});\n };\n\n const isMatchedElementAttrs = (elAttrs: Record<any, string>): boolean => {\n if (!attrEntries) return true;\n\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 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 './color.scss';\n\nimport { VNodeChild } from 'vue';\nimport { type VuiService, VIcon } from '@fastkit/vui';\nimport { TextStyle } from '@tiptap/extension-text-style';\nimport { WysiwygColorExtension } from '../extensions';\nimport { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\n\nexport interface WysiwygColorItem {\n key?: string | number;\n name?: VNodeChild | ((vui: VuiService) => VNodeChild);\n color: string | null;\n}\n\nexport interface CreateWysiwygColorToolOptions {\n items: WysiwygColorItem[];\n withLabel?: boolean;\n}\n\nexport function createWysiwygColorTool(opts: CreateWysiwygColorToolOptions) {\n const WysiwygColorTool: WysiwygEditorToolFactory = (vui) => {\n const tool: WysiwygEditorTool = {\n key: 'textColor',\n // active: ({ editor }) => editor.isActive('textStyle'),\n icon:\n ({ editor }) =>\n () => {\n const { color } = editor.getAttributes('textStyle');\n const style = { color };\n return (\n <span class=\"v-wysiwyg-color-tool__button\">\n <VIcon\n class=\"v-wysiwyg-color-tool__button__icon\"\n name={vui.icon('editorTextColor')}\n />\n <span class=\"v-wysiwyg-color-tool__button__bar\" style={style} />\n </span>\n );\n },\n onClick: (ctx, ev) => {\n ctx.vui.menu({\n class: 'v-wysiwyg-color-tool__menu',\n activator: ev,\n content: (stack) => (\n <div\n class={[\n 'v-wysiwyg-color-tool__items',\n { 'v-wysiwyg-color-tool__items--with-label': opts.withLabel },\n ]}>\n {opts.items.map((item, index) => (\n <button\n key={item.key == null ? index : item.key}\n class=\"v-wysiwyg-color-tool__item\"\n type=\"button\"\n onClick={() => {\n const { color } = 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 <span\n class=\"v-wysiwyg-color-tool__item__color\"\n style={item.color ? { color: item.color } : {}}\n />\n {opts.withLabel && (\n <span class=\"v-wysiwyg-color-tool__item__name\">\n {item.name}\n </span>\n )}\n </button>\n ))}\n </div>\n ),\n });\n },\n floating: true,\n extensions: [TextStyle, WysiwygColorExtension],\n };\n return tool;\n };\n\n return WysiwygColorTool;\n}\n","import { TextAlign, TextAlignOptions } from '@tiptap/extension-text-align';\nimport { type Editor } from '@tiptap/vue-3';\nimport { VuiServiceIconSettings, VButtonGroup, VButton } from '@fastkit/vui';\nimport { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\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 = [\n 'left',\n 'center',\n 'right',\n // 'justify',\n] as const;\n\n/** Text align value */\nexport type WysiwygTextAlignValue = (typeof WYSIWYG_TEXT_ALIGN_VALUES)[number];\n\n/**\n * A list of nodes where the text align attribute should be applied to.\n */\nconst DEFAULT_TYPES = ['heading', 'paragraph'] as const;\n\nexport interface WysiwygTextAlignOptions {\n /**\n * A list of nodes where the text align attribute should be applied to. Usually something like `['heading', 'paragraph']`\n * @default DEFAULT_TYPES\n * @see {@link DEFAULT_TYPES}\n */\n types?: TextAlignOptions['types'];\n /**\n * A list of available options for the text align attribute.\n * @default WYSIWYG_TEXT_ALIGN_VALUES\n * @see {@link WYSIWYG_TEXT_ALIGN_VALUES}\n */\n alignments?: WysiwygTextAlignValue[];\n /**\n * The default text align.\n * @default left\n */\n defaultAlignment: WysiwygTextAlignValue;\n}\n\nconst conditions = WYSIWYG_TEXT_ALIGN_VALUES.map<\n [WysiwygTextAlignValue, { textAlign: WysiwygTextAlignValue }]\n>((value) => [value, { textAlign: value }]);\n\nconst ICON_AT: Record<WysiwygTextAlignValue, keyof VuiServiceIconSettings> = {\n left: 'editorAlignLeft',\n center: 'editorAlignCenter',\n right: 'editorAlignRight',\n};\n\nfunction resolveOptions(\n rawOptions: Partial<WysiwygTextAlignOptions> | undefined,\n): Required<WysiwygTextAlignOptions> {\n const types = rawOptions?.types || DEFAULT_TYPES.slice();\n const alignments =\n rawOptions?.alignments || WYSIWYG_TEXT_ALIGN_VALUES.slice();\n const defaultAlignment = rawOptions?.defaultAlignment || 'left';\n\n return {\n types,\n alignments,\n defaultAlignment,\n };\n}\nfunction getCurrentAlign(\n editor: Editor,\n options: WysiwygTextAlignOptions,\n): WysiwygTextAlignValue {\n for (const [align, condition] of conditions) {\n if (editor.isActive(condition)) return align;\n }\n return options.defaultAlignment;\n}\n\nexport const WysiwygTextAlignTool: WysiwygEditorToolFactory<\n WysiwygTextAlignOptions\n> = (vui, options) => {\n const resolvedOptions = resolveOptions(options);\n const { alignments } = resolvedOptions;\n\n const getIcon = (value: WysiwygTextAlignValue) => {\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\n const variant = vui.setting('plainVariant');\n const toolButtonActiveColor = vui.setting('primaryScope');\n\n const tool: WysiwygEditorTool = {\n key: 'textAlign',\n icon: ({ editor }) => getIcon(getCurrentAlign(editor, resolvedOptions)),\n onClick: async ({ vui, editor }, ev) => {\n vui.menu({\n distance: 0,\n activator: ev,\n content: (menu) => (\n <VButtonGroup variant={variant}>\n {alignments.map((value) => {\n const isActive = editor.isActive({ textAlign: value });\n return (\n <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 />\n );\n })}\n </VButtonGroup>\n ),\n });\n },\n floating: true,\n extensions: [TextAlign.configure(resolvedOptions)],\n };\n return tool;\n};\n","import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport {\n createWysiwygCustomTagMark,\n WysiwygCustomTagSettings,\n WysiwygCustomTagExtension,\n} from '../extensions/custom-tag';\n\nexport interface WysiwygCustomTagToolSettings\n extends\n 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 './VWysiwygEditor.scss';\nimport {\n defineComponent,\n PropType,\n computed,\n ref,\n watch,\n onBeforeUnmount,\n VNodeChild,\n} from 'vue';\nimport {\n createFormNodeWrapperProps,\n FormNodeWrapperSlots,\n VFormControl,\n VControlField,\n createControlFieldProps,\n InputBoxSlots,\n IconName,\n createTextableProps,\n createTextableEmits,\n TextableControl,\n createControlProps,\n useControl,\n createControlFieldProviderProps,\n useControlField,\n VTextCounter,\n defineSlots,\n useVui,\n VButton,\n VButtonGroup,\n withCtx,\n} from '@fastkit/vui';\nimport {\n EditorContent,\n useEditor,\n FocusPosition,\n type Editor,\n} from '@tiptap/vue-3';\nimport { BubbleMenu } from '@tiptap/vue-3/menus';\nimport { StarterKit } from '@tiptap/starter-kit';\nimport { VUI_WYSIWYG_EDITOR_SYMBOL } from '../../injections';\nimport {\n RawWysiwygExtension,\n resolveRawWysiwygExtensions,\n RawWysiwygEditorTool,\n resolveRawWysiwygEditorTools,\n WysiwygEditorContext,\n // EditorEventsOptions,\n WysiwygEditorInitializeContext,\n} from '../../schemes';\n\nconst slots = defineSlots<FormNodeWrapperSlots & InputBoxSlots>();\n\nexport interface VWysiwygEditorAPI {\n readonly editor: Editor | undefined;\n readonly control: TextableControl;\n}\n\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 as PropType<RawWysiwygExtension[]>,\n default: () => [],\n },\n tools: {\n type: Array as PropType<RawWysiwygEditorTool[]>,\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\n const textRef = ref('');\n const toolButtonActiveColor = vui.setting('primaryScope');\n\n const wysiwygSettings = computed(() =>\n resolveRawWysiwygEditorTools(props.tools, vui),\n );\n\n const control = useControl(props);\n useControlField(props);\n\n const classes = computed(() => [\n 'v-wysiwyg-editor',\n control.classes.value,\n `v-wysiwyg-editor--${control.size.value}`,\n {\n 'v-wysiwyg-editor--disabled-min-height': props.disabledMinHeight,\n 'v-wysiwyg-editor--disabled-max-height': props.disabledMaxHeight,\n },\n ]);\n\n const inputControl = new TextableControl(props, ctx as any, {\n nodeType: VUI_WYSIWYG_EDITOR_SYMBOL,\n validationValue: () => textRef.value,\n });\n\n const getOutput = (\n editor: Pick<Editor, 'isEmpty' | 'getHTML' | 'getText'>,\n type: 'text' | 'html',\n ) => {\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\n const initializeCtx = new WysiwygEditorInitializeContext(() => vui, {\n onCreate: ({ editor }) => {\n textRef.value = getOutput(editor, 'text');\n updateEditable();\n },\n onFocus: ({ event }) => {\n inputControl.focusHandler(event);\n },\n onBlur: ({ event }) => {\n inputControl.blurHandler(event);\n },\n onUpdate: ({ editor }) => {\n inputControl.value = getOutput(editor, 'html');\n textRef.value = getOutput(editor, 'text');\n },\n });\n\n const extensions = [\n StarterKit.configure({\n bold: false,\n bulletList: false,\n orderedList: false,\n undoRedo: false,\n italic: false,\n }),\n ...resolveRawWysiwygExtensions(props.extensions, initializeCtx),\n ...wysiwygSettings.value.extensions,\n ];\n\n const updateEditable = () => {\n if (!editor.value) return;\n editor.value.setEditable(inputControl.canOperation);\n };\n\n watch(() => inputControl.canOperation, updateEditable);\n\n watch(\n () => props.modelValue,\n (modelValue) => {\n const $editor = editor.value;\n if (!$editor || getOutput($editor, 'html') === modelValue) return;\n\n $editor.commands.setContent(modelValue == null ? '' : modelValue, {\n emitUpdate: false,\n });\n textRef.value = getOutput($editor, 'text');\n },\n );\n\n initializeCtx.on('create', ({ editor }) => {\n textRef.value = getOutput(editor, 'text');\n updateEditable();\n });\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 const focus = (\n position?: FocusPosition,\n options?: {\n scrollIntoView?: boolean | undefined;\n },\n ) => editor.value?.chain().focus(position, options);\n\n const wysiwygContext = computed<WysiwygEditorContext>(() => ({\n vui,\n editor: editor.value!,\n }));\n\n const createTools = (bubbleMenu = false) => {\n const { value: settings } = wysiwygSettings;\n const { value: context } = wysiwygContext;\n const tools = bubbleMenu\n ? settings.tools.filter((t) => !!t.floating)\n : settings.tools;\n const _editor = editor.value;\n const variant = vui.setting(\n bubbleMenu ? 'containedVariant' : 'plainVariant',\n );\n\n return (\n <VButtonGroup\n class={[\n 'v-wysiwyg-editor__toolbar',\n {\n 'v-wysiwyg-editor__floating-toolbar': props.floatingToolbar,\n },\n ]}\n variant={variant}>\n {tools.map(({ key, icon, onClick, disabled, active }) => {\n const isActive =\n !!_editor && resolveContextualValue(context, active);\n const isDisabled =\n !inputControl.canOperation ||\n (!!_editor && resolveContextualValue(context, disabled));\n let iconName: IconName | undefined;\n let child: VNodeChild;\n\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 as any;\n }\n }\n } else {\n iconName = icon;\n }\n\n if (!iconName && child == null) return;\n\n return (\n <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 {child}\n </VButton>\n );\n })}\n </VButtonGroup>\n );\n };\n\n onBeforeUnmount(() => {\n editor.value?.destroy();\n });\n\n const api: VWysiwygEditorAPI = {\n get editor() {\n return editor.value;\n },\n control: inputControl,\n };\n\n ctx.expose(api);\n\n const handleClickLabel = (ev: PointerEvent) => {\n focus('start', { scrollIntoView: true });\n };\n\n const defaultSlot = () => (\n <div class=\"v-wysiwyg-editor__body\">\n <EditorContent\n class=\"v-wysiwyg-editor__input__element wysiwyg\"\n editor={editor.value}\n />\n {!props.floatingToolbar &&\n !!editor.value &&\n !inputControl.isReadonly && (\n <BubbleMenu editor={editor.value}>\n <div class=\"v-wysiwyg-editor__bubble-menu\">\n {createTools(true)}\n </div>\n </BubbleMenu>\n )}\n </div>\n );\n\n const formControlDefaultSlot = () => (\n <div class=\"v-wysiwyg-editor__wrapper\">\n {!inputControl.isReadonly && createTools()}\n <VControlField\n class=\"v-wysiwyg-editor__input\"\n autoHeight\n startAdornment={props.startAdornment}\n endAdornment={props.endAdornment}\n size={control.size.value}\n v-slots={{\n ...ctx.slots,\n default: withCtx(defaultSlot),\n }}\n />\n </div>\n );\n\n const infoAppendsSlot = () => {\n const { counterResult } = inputControl;\n if (!counterResult) return;\n return <VTextCounter {...counterResult} />;\n };\n\n return () => (\n <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 v-slots={{\n ...ctx.slots,\n default: withCtx(formControlDefaultSlot),\n infoAppends: withCtx(infoAppendsSlot),\n }}\n />\n );\n },\n});\n\nfunction resolveContextualValue(\n ctx: WysiwygEditorContext,\n source?: boolean | ((ctx: WysiwygEditorContext) => boolean),\n) {\n return typeof source === 'function' ? source(ctx) : source;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAYA,MAAM,gBAAgB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAIA,MAAM,qBAAuC,WAC3C,KAAK,OAAO,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,OAAO,MAAM,CAAC;AAgBtD,IAAa,iCAAb,MAA4C;CAC1C,YAAgD,CAAC;CAEjD;CAEA,IAAI,MAA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