@fastkit/vui-wysiwyg 1.0.0 → 1.0.1
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/tiptap/extensions/text-align.d.ts +1 -0
- package/dist/tiptap/extensions/text-align.mjs +3 -0
- package/dist/tiptap/extensions/text-align.mjs.map +1 -0
- package/dist/vui-wysiwyg.d.ts +32 -2
- package/dist/vui-wysiwyg.mjs +98 -4
- package/dist/vui-wysiwyg.mjs.map +1 -1
- package/package.json +24 -14
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@tiptap/extension-text-align';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/dependencies/tiptap/extensions/text-align.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAc","sourcesContent":["export * from '@tiptap/extension-text-align';\n"]}
|
package/dist/vui-wysiwyg.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { UnderlineOptions } from '@tiptap/extension-underline';
|
|
|
13
13
|
import { HistoryOptions } from '@tiptap/extension-history';
|
|
14
14
|
import { LinkOptions } from '@tiptap/extension-link';
|
|
15
15
|
import { OrderedListOptions } from '@tiptap/extension-ordered-list';
|
|
16
|
+
import { TextAlignOptions } from '@tiptap/extension-text-align';
|
|
16
17
|
import * as _fastkit_vue_form_control__ from '@fastkit/vue-form-control/.';
|
|
17
18
|
import * as _fastkit_vue_utils__ from '@fastkit/vue-utils/.';
|
|
18
19
|
|
|
@@ -51,7 +52,7 @@ declare function createWysiwygExtension<Options = any, Storage = any>(extension:
|
|
|
51
52
|
declare function resolveRawWysiwygExtensions(raws: RawWysiwygExtension[], ctx: WysiwygEditorInitializeContext): AnyExtension[];
|
|
52
53
|
interface WysiwygEditorTool {
|
|
53
54
|
key: string;
|
|
54
|
-
icon: IconName | ((ctx: WysiwygEditorContext) => IconName | (() => VNodeChild));
|
|
55
|
+
icon: IconName | ((ctx: WysiwygEditorContext) => IconName | (() => VNodeChild) | undefined);
|
|
55
56
|
active?: boolean | ((ctx: WysiwygEditorContext) => boolean);
|
|
56
57
|
disabled?: boolean | ((ctx: WysiwygEditorContext) => boolean);
|
|
57
58
|
onClick: (ctx: WysiwygEditorContext, ev: MouseEvent) => any;
|
|
@@ -163,6 +164,35 @@ interface CreateWysiwygColorToolOptions {
|
|
|
163
164
|
}
|
|
164
165
|
declare function createWysiwygColorTool(opts: CreateWysiwygColorToolOptions): WysiwygEditorToolFactory;
|
|
165
166
|
|
|
167
|
+
/**
|
|
168
|
+
* A list of available options for the text align attribute.
|
|
169
|
+
* @remarks
|
|
170
|
+
* `"justify"` has not yet been adopted because of ambiguity in browser support.
|
|
171
|
+
*/
|
|
172
|
+
declare const WYSIWYG_TEXT_ALIGN_VALUES: readonly ["left", "center", "right"];
|
|
173
|
+
/** Text align value */
|
|
174
|
+
type WysiwygTextAlignValue = (typeof WYSIWYG_TEXT_ALIGN_VALUES)[number];
|
|
175
|
+
interface WysiwygTextAlignOptions {
|
|
176
|
+
/**
|
|
177
|
+
* A list of nodes where the text align attribute should be applied to. Usually something like `['heading', 'paragraph']`
|
|
178
|
+
* @default DEFAULT_TYPES
|
|
179
|
+
* @see {@link DEFAULT_TYPES}
|
|
180
|
+
*/
|
|
181
|
+
types?: TextAlignOptions['types'];
|
|
182
|
+
/**
|
|
183
|
+
* A list of available options for the text align attribute.
|
|
184
|
+
* @default WYSIWYG_TEXT_ALIGN_VALUES
|
|
185
|
+
* @see {@link WYSIWYG_TEXT_ALIGN_VALUES}
|
|
186
|
+
*/
|
|
187
|
+
alignments?: WysiwygTextAlignValue[];
|
|
188
|
+
/**
|
|
189
|
+
* The default text align.
|
|
190
|
+
* @default left
|
|
191
|
+
*/
|
|
192
|
+
defaultAlignment: WysiwygTextAlignValue;
|
|
193
|
+
}
|
|
194
|
+
declare const WysiwygTextAlignTool: WysiwygEditorToolFactory<WysiwygTextAlignOptions>;
|
|
195
|
+
|
|
166
196
|
declare const VWysiwygEditor: vue.DefineComponent<{
|
|
167
197
|
extensions: {
|
|
168
198
|
type: PropType<RawWysiwygExtension[]>;
|
|
@@ -412,4 +442,4 @@ declare const VWysiwygEditor: vue.DefineComponent<{
|
|
|
412
442
|
disabledMaxHeight: boolean;
|
|
413
443
|
}>;
|
|
414
444
|
|
|
415
|
-
export { CreateWysiwygColorToolOptions, CreatedWysiwygExtension, RawWysiwygEditorTool, RawWysiwygExtension, ResolvedWysiwygEditorSettings, VUI_WYSIWYG_EDITOR_SYMBOL, VWysiwygEditor, WysiwygBulletListTool, WysiwygColorExtension, WysiwygColorItem, WysiwygColorOptions, WysiwygEditorContext, WysiwygEditorEvent, WysiwygEditorEventsBucket, WysiwygEditorEventsOptions, WysiwygEditorInitializeContext, WysiwygEditorPrefixedEvent, WysiwygEditorTool, WysiwygEditorToolFactory, WysiwygExtensionFactory, WysiwygExtensionSource, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygLinter, WysiwygLinterBadWords, WysiwygLinterHeadingLevel, WysiwygLinterOptions, WysiwygLinterPlugin, WysiwygLinterPunctuation, WysiwygOrderedListTool, createWysiwygColorTool, createWysiwygExtension, resolveRawWysiwygEditorTools, resolveRawWysiwygExtensions };
|
|
445
|
+
export { CreateWysiwygColorToolOptions, CreatedWysiwygExtension, RawWysiwygEditorTool, RawWysiwygExtension, ResolvedWysiwygEditorSettings, VUI_WYSIWYG_EDITOR_SYMBOL, VWysiwygEditor, WYSIWYG_TEXT_ALIGN_VALUES, WysiwygBulletListTool, WysiwygColorExtension, WysiwygColorItem, WysiwygColorOptions, WysiwygEditorContext, WysiwygEditorEvent, WysiwygEditorEventsBucket, WysiwygEditorEventsOptions, WysiwygEditorInitializeContext, WysiwygEditorPrefixedEvent, WysiwygEditorTool, WysiwygEditorToolFactory, WysiwygExtensionFactory, WysiwygExtensionSource, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygLinter, WysiwygLinterBadWords, WysiwygLinterHeadingLevel, WysiwygLinterOptions, WysiwygLinterPlugin, WysiwygLinterPunctuation, WysiwygOrderedListTool, WysiwygTextAlignOptions, WysiwygTextAlignTool, WysiwygTextAlignValue, createWysiwygColorTool, createWysiwygExtension, resolveRawWysiwygEditorTools, resolveRawWysiwygExtensions };
|
package/dist/vui-wysiwyg.mjs
CHANGED
|
@@ -11,6 +11,7 @@ import { History } from '@tiptap/extension-history';
|
|
|
11
11
|
import { Link } from '@tiptap/extension-link';
|
|
12
12
|
import { createTextableProps, createFormControlProps, createControlFieldProps, createControlFieldProviderProps, createControlProps, defineSlotsProps, createTextableEmits, useVui, useControl, useControlField, TextableControl, VFormControl, VControlField, VTextCounter, validateIf, url, VButtonGroup, VButton, VIcon } from '@fastkit/vui';
|
|
13
13
|
import { OrderedList } from '@tiptap/extension-ordered-list';
|
|
14
|
+
import { TextAlign } from '@tiptap/extension-text-align';
|
|
14
15
|
import { StarterKit } from '@tiptap/starter-kit';
|
|
15
16
|
|
|
16
17
|
// src/schemes.ts
|
|
@@ -665,6 +666,99 @@ function createWysiwygColorTool(opts) {
|
|
|
665
666
|
function _isSlot(s) {
|
|
666
667
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
667
668
|
}
|
|
669
|
+
var WYSIWYG_TEXT_ALIGN_VALUES = [
|
|
670
|
+
"left",
|
|
671
|
+
"center",
|
|
672
|
+
"right"
|
|
673
|
+
// 'justify',
|
|
674
|
+
];
|
|
675
|
+
var DEFAULT_TYPES = ["heading", "paragraph"];
|
|
676
|
+
var conditions = WYSIWYG_TEXT_ALIGN_VALUES.map((value) => {
|
|
677
|
+
return [value, {
|
|
678
|
+
textAlign: value
|
|
679
|
+
}];
|
|
680
|
+
});
|
|
681
|
+
var ICON_AT = {
|
|
682
|
+
left: "editorAlignLeft",
|
|
683
|
+
center: "editorAlignCenter",
|
|
684
|
+
right: "editorAlignRight"
|
|
685
|
+
};
|
|
686
|
+
function resolveOptions(rawOptions) {
|
|
687
|
+
const types = rawOptions?.types || DEFAULT_TYPES.slice();
|
|
688
|
+
const alignments = rawOptions?.alignments || WYSIWYG_TEXT_ALIGN_VALUES.slice();
|
|
689
|
+
const defaultAlignment = rawOptions?.defaultAlignment || "left";
|
|
690
|
+
return {
|
|
691
|
+
types,
|
|
692
|
+
alignments,
|
|
693
|
+
defaultAlignment
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
function getCurrentAlign(editor, options) {
|
|
697
|
+
for (const [align, condition] of conditions) {
|
|
698
|
+
if (editor.isActive(condition))
|
|
699
|
+
return align;
|
|
700
|
+
}
|
|
701
|
+
return options.defaultAlignment;
|
|
702
|
+
}
|
|
703
|
+
var WysiwygTextAlignTool = (vui, options) => {
|
|
704
|
+
const resolvedOptions = resolveOptions(options);
|
|
705
|
+
const {
|
|
706
|
+
alignments
|
|
707
|
+
} = resolvedOptions;
|
|
708
|
+
const getIcon = (value) => {
|
|
709
|
+
const iconKey = ICON_AT[value];
|
|
710
|
+
const icon = vui.icon(iconKey);
|
|
711
|
+
if (icon === "$empty" || typeof icon === "function")
|
|
712
|
+
return;
|
|
713
|
+
return icon;
|
|
714
|
+
};
|
|
715
|
+
const variant = vui.setting("plainVariant");
|
|
716
|
+
const toolButtonActiveColor = vui.setting("primaryScope");
|
|
717
|
+
const tool = {
|
|
718
|
+
key: "textAlign",
|
|
719
|
+
icon: ({
|
|
720
|
+
editor
|
|
721
|
+
}) => {
|
|
722
|
+
return getIcon(getCurrentAlign(editor, resolvedOptions));
|
|
723
|
+
},
|
|
724
|
+
onClick: async ({
|
|
725
|
+
vui: vui2,
|
|
726
|
+
editor
|
|
727
|
+
}, ev) => {
|
|
728
|
+
vui2.menu({
|
|
729
|
+
distance: 0,
|
|
730
|
+
activator: ev,
|
|
731
|
+
content: (menu) => {
|
|
732
|
+
let _slot;
|
|
733
|
+
return createVNode(VButtonGroup, {
|
|
734
|
+
"variant": variant
|
|
735
|
+
}, _isSlot(_slot = alignments.map((value) => {
|
|
736
|
+
const isActive = editor.isActive({
|
|
737
|
+
textAlign: value
|
|
738
|
+
});
|
|
739
|
+
return createVNode(VButton, {
|
|
740
|
+
"tabindex": -1,
|
|
741
|
+
"color": isActive ? toolButtonActiveColor : void 0,
|
|
742
|
+
"key": value,
|
|
743
|
+
"icon": getIcon(value),
|
|
744
|
+
"onClick": (ev2) => {
|
|
745
|
+
editor.chain().focus().setTextAlign(value).run();
|
|
746
|
+
}
|
|
747
|
+
}, null);
|
|
748
|
+
})) ? _slot : {
|
|
749
|
+
default: () => [_slot]
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
|
+
},
|
|
754
|
+
floating: true,
|
|
755
|
+
extensions: [TextAlign.configure(resolvedOptions)]
|
|
756
|
+
};
|
|
757
|
+
return tool;
|
|
758
|
+
};
|
|
759
|
+
function _isSlot2(s) {
|
|
760
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
761
|
+
}
|
|
668
762
|
var VWysiwygEditor = defineComponent({
|
|
669
763
|
name: "VWysiwygEditor",
|
|
670
764
|
props: {
|
|
@@ -801,7 +895,7 @@ var VWysiwygEditor = defineComponent({
|
|
|
801
895
|
"v-wysiwyg-editor__floating-toolbar": props.floatingToolbar
|
|
802
896
|
}],
|
|
803
897
|
"variant": variant
|
|
804
|
-
},
|
|
898
|
+
}, _isSlot2(_slot = tools.map(({
|
|
805
899
|
key,
|
|
806
900
|
icon,
|
|
807
901
|
onClick,
|
|
@@ -833,7 +927,7 @@ var VWysiwygEditor = defineComponent({
|
|
|
833
927
|
"onClick": (ev) => onClick(context, ev),
|
|
834
928
|
"color": isActive ? toolButtonActiveColor : void 0,
|
|
835
929
|
"disabled": isDisabled
|
|
836
|
-
},
|
|
930
|
+
}, _isSlot2(child) ? child : {
|
|
837
931
|
default: () => [child]
|
|
838
932
|
});
|
|
839
933
|
})) ? _slot : {
|
|
@@ -898,7 +992,7 @@ var VWysiwygEditor = defineComponent({
|
|
|
898
992
|
class: "v-wysiwyg-editor__bubble-menu"
|
|
899
993
|
}, {
|
|
900
994
|
"editor": editor
|
|
901
|
-
}),
|
|
995
|
+
}), _isSlot2(_slot2 = this.createTools(true)) ? _slot2 : {
|
|
902
996
|
default: () => [_slot2]
|
|
903
997
|
})]);
|
|
904
998
|
}
|
|
@@ -919,6 +1013,6 @@ function resolveContextableValue(ctx, source) {
|
|
|
919
1013
|
return typeof source === "function" ? source(ctx) : source;
|
|
920
1014
|
}
|
|
921
1015
|
|
|
922
|
-
export { VUI_WYSIWYG_EDITOR_SYMBOL, VWysiwygEditor, WysiwygBulletListTool, WysiwygColorExtension, WysiwygEditorInitializeContext, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygLinter, WysiwygLinterBadWords, WysiwygLinterHeadingLevel, WysiwygLinterPlugin, WysiwygLinterPunctuation, WysiwygOrderedListTool, createWysiwygColorTool, createWysiwygExtension, resolveRawWysiwygEditorTools, resolveRawWysiwygExtensions };
|
|
1016
|
+
export { VUI_WYSIWYG_EDITOR_SYMBOL, VWysiwygEditor, WYSIWYG_TEXT_ALIGN_VALUES, WysiwygBulletListTool, WysiwygColorExtension, WysiwygEditorInitializeContext, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygLinter, WysiwygLinterBadWords, WysiwygLinterHeadingLevel, WysiwygLinterPlugin, WysiwygLinterPunctuation, WysiwygOrderedListTool, WysiwygTextAlignTool, createWysiwygColorTool, createWysiwygExtension, resolveRawWysiwygEditorTools, resolveRawWysiwygExtensions };
|
|
923
1017
|
//# sourceMappingURL=out.js.map
|
|
924
1018
|
//# sourceMappingURL=vui-wysiwyg.mjs.map
|
package/dist/vui-wysiwyg.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemes.ts","../src/injections.ts","../src/extensions/linter/Linter.tsx","../src/extensions/linter/utils.ts","../src/extensions/linter/LinterPlugin.ts","../src/extensions/linter/plugins/BadWords.tsx","../src/extensions/linter/plugins/HeadingLevel.ts","../src/extensions/linter/plugins/Punctuation.ts","../src/extensions/color.ts","../src/tools/bullet-list.ts","../src/tools/format-bold.ts","../src/tools/format-italic.ts","../src/tools/format-underline.ts","../src/tools/history.ts","../src/tools/link.ts","../src/tools/ordered-list.ts","../src/tools/color.tsx","../src/components/VWysiwygEditor/VWysiwygEditor.tsx"],"names":["_createVNode","Extension","vui","editor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,IAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIA,IAAM,oBAAoB,CACxB,WACyB;AACzB,SAAO,KAAK,OAAO,OAAO,CAAC,EAAE,YAAY,IAAI,OAAO,MAAM,CAAC;AAC7D;AAgBO,IAAM,iCAAN,MAAqC;AAAA,EACjC,YAAuC,CAAC;AAAA,EAChC;AAAA,EAEjB,IAAI,MAAM;AACR,WAAO,KAAK,KAAK;AAAA,EACnB;AAAA,EAEA,YACE,WACA,OAAmC,CAAC,GACpC;AACA,SAAK,OAAO;AAEZ,kBAAc,QAAQ,CAAC,UAAU;AAC/B,WAAK,UAAU,KAAK,IAAI,CAAC;AACzB,YAAM,WAAW,kBAAkB,KAAK;AACxC,YAAM,KAAK,KAAK,QAAQ;AACxB,YAAM,KAAK,UAAU,KAAK,EAAE,KAAK,EAAS;AAAA,IAC5C,CAAC;AAAA,EACH;AAAA,EAEA,GACE,IACA,SACA;AACA,SAAK,UAAU,EAAE,EAAE,KAAK,OAAO;AAC/B,WAAO,MAAM,KAAK,IAAI,IAAI,OAAO;AAAA,EACnC;AAAA,EAEA,IACE,IACA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AG,CAAC,KAAK,mBAAmB,CAAC,CAAC,UAAU,CAAC,KAAK,cAAcA,cAAa,YAAY,YAAY;AAAA,cACvG,OAAO;AAAA,YACT,GAAG;AAAA,cACD,UAAU;AAAA,YACZ,CAAC,GAAG,QAAQ,SAAS,KAAK,YAAY,IAAI,CAAC,IAAI,SAAS;AAAA,cACtD,SAAS,MAAM,CAAC,MAAM;AAAA,YACxB,CAAC,CAAC,CAAC;AAAA,UACL;AAAA,QACF,CAAC,CAAC,CAAC;AAAA,MACL;AAAA,MACA,aAAa,MAAM;AACjB,cAAM;AAAA,UACJ;AAAA,QACF,IAAI;AACJ,YAAI,CAAC;AAAe;AACpB,eAAOA,cAAa,cAAc,eAAe,IAAI;AAAA,MACvD;AAAA,IACF,CAAC;AAAA,EACH;AACF,CAAC;AACD,SAAS,wBAAwB,KAAK,QAAQ;AAC5C,SAAO,OAAO,WAAW,aAAa,OAAO,GAAG,IAAI;AACtD","sourcesContent":["import { type VuiService, type IconName } from '@fastkit/vui';\nimport {\n type Editor,\n type Extensions,\n type Node,\n type Extension,\n type Mark,\n type AnyExtension,\n type EditorOptions,\n} from '@tiptap/vue-3';\nimport { VNodeChild } from 'vue';\n\nconst EDITOR_EVENTS = [\n 'beforeCreate',\n 'create',\n 'update',\n 'selectionUpdate',\n 'transaction',\n 'focus',\n 'blur',\n 'destroy',\n] as const;\n\ntype PrefixedEventName<S extends string> = `on${Capitalize<S>}`;\n\nconst prefixedEventName = <S extends string>(\n source: S,\n): PrefixedEventName<S> => {\n return `on${source.charAt(0).toUpperCase()}${source.slice(1)}` as any;\n};\n\nexport type WysiwygEditorEvent = (typeof EDITOR_EVENTS)[number];\n\nexport type WysiwygEditorPrefixedEvent = PrefixedEventName<WysiwygEditorEvent>;\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface WysiwygEditorEventsOptions\n extends Partial<Pick<EditorOptions, WysiwygEditorPrefixedEvent>> {}\n\nexport type WysiwygEditorEventsBucket = {\n [EV in WysiwygEditorEvent]: NonNullable<\n WysiwygEditorEventsOptions[PrefixedEventName<EV>]\n >[];\n};\n\nexport class WysiwygEditorInitializeContext {\n readonly listeners: WysiwygEditorEventsBucket = {} as any;\n private readonly _vui: () => VuiService;\n\n get vui() {\n return this._vui();\n }\n\n constructor(\n vuiGetter: () => VuiService,\n opts: WysiwygEditorEventsOptions = {},\n ) {\n this._vui = vuiGetter;\n\n EDITOR_EVENTS.forEach((event) => {\n this.listeners[event] = [];\n const prefixed = prefixedEventName(event);\n const fn = opts[prefixed];\n fn && this.listeners[event].push(fn as any);\n });\n }\n\n on<EV extends WysiwygEditorEvent>(\n ev: EV,\n handler: NonNullable<WysiwygEditorEventsOptions[PrefixedEventName<EV>]>,\n ) {\n this.listeners[ev].push(handler);\n return () => this.off(ev, handler);\n }\n\n off<EV extends WysiwygEditorEvent>(\n ev: EV,\n handler: NonNullable<WysiwygEditorEventsOptions[PrefixedEventName<EV>]>,\n ) {\n this.listeners[ev] = this.listeners[ev].filter(\n (_handler) => _handler !== handler,\n ) as any;\n }\n\n editorOptions() {\n const opts: WysiwygEditorEventsOptions = {};\n\n EDITOR_EVENTS.forEach((event) => {\n const prefixed = prefixedEventName(event);\n opts[prefixed] = (props) => {\n const handlers = this.listeners[event];\n handlers.forEach((handler) => {\n handler(props as any);\n });\n };\n });\n\n return opts;\n }\n}\n\nexport interface WysiwygEditorContext {\n editor: Editor;\n vui: VuiService;\n}\n\nexport type WysiwygExtensionFactory<Options = any, Storage = any> = (\n ctx: WysiwygEditorInitializeContext,\n) =>\n | Extension<Options, Storage>\n | Node<Options, Storage>\n | Mark<Options, Storage>;\n\nexport interface CreatedWysiwygExtension<Options = any, Storage = any> {\n __isCreatedWysiwygExtension: true;\n _configs: Partial<Options>[];\n configure(\n options?: Partial<Options>,\n ): CreatedWysiwygExtension<Options, Storage>;\n raw: WysiwygExtensionSource<Options, Storage>;\n}\n\nexport type WysiwygExtensionSource<Options = any, Storage = any> =\n | Extension<Options, Storage>\n | Node<Options, Storage>\n | Mark<Options, Storage>\n | WysiwygExtensionFactory<Options, Storage>;\n\nexport type RawWysiwygExtension<Options = any, Storage = any> =\n | WysiwygExtensionSource<Options, Storage>\n | CreatedWysiwygExtension<Options, Storage>;\n\n// export function createWysiwygExtension<Options = any, Storage = any>(\n// extension: Extension<Options, Storage>,\n// ): Extension<Options, Storage>;\n// export function createWysiwygExtension<Options = any, Storage = any>(\n// node: Node<Options, Storage>,\n// ): Node<Options, Storage>;\n// export function createWysiwygExtension<Options = any, Storage = any>(\n// mark: Mark<Options, Storage>,\n// ): Mark<Options, Storage>;\n// export function createWysiwygExtension<Options = any, Storage = any>(\n// factory: WysiwygExtensionFactory<Options, Storage>,\n// ): WysiwygExtensionFactory<Options, Storage>;\n\nfunction isCreatedWysiwygExtension<Options = any, Storage = any>(\n source: unknown,\n): source is CreatedWysiwygExtension<Options, Storage> {\n return (\n !!source &&\n typeof source === 'object' &&\n (source as CreatedWysiwygExtension).__isCreatedWysiwygExtension === true\n );\n}\n\nexport function createWysiwygExtension<Options = any, Storage = any>(\n extension: WysiwygExtensionSource<Options, Storage>,\n) {\n const ext: CreatedWysiwygExtension<Options, Storage> = {\n __isCreatedWysiwygExtension: true,\n _configs: [],\n configure: (opts) => {\n opts && ext._configs.push(opts);\n return ext;\n },\n raw: extension,\n };\n return ext;\n}\n\nfunction resolveRawWysiwygExtension(\n raw: RawWysiwygExtension,\n ctx: WysiwygEditorInitializeContext,\n): AnyExtension {\n if (isCreatedWysiwygExtension(raw)) {\n const { raw: _raw, _configs } = raw;\n let ext = typeof _raw === 'function' ? _raw(ctx) : _raw;\n _configs.forEach((config) => {\n ext = ext.configure(config);\n });\n return ext;\n }\n return typeof raw === 'function' ? raw(ctx) : raw;\n}\n\nexport function resolveRawWysiwygExtensions(\n raws: RawWysiwygExtension[],\n ctx: WysiwygEditorInitializeContext,\n) {\n return raws.map((raw) => resolveRawWysiwygExtension(raw, ctx));\n}\n\nexport interface WysiwygEditorTool {\n key: string;\n icon:\n | IconName\n | ((ctx: WysiwygEditorContext) => IconName | (() => VNodeChild));\n active?: boolean | ((ctx: WysiwygEditorContext) => boolean);\n disabled?: boolean | ((ctx: WysiwygEditorContext) => boolean);\n onClick: (ctx: WysiwygEditorContext, ev: MouseEvent) => any;\n floating?: boolean;\n extensions?: Extensions;\n}\n\nexport type WysiwygEditorToolFactory<Options = void> = (\n vui: VuiService,\n options?: Options,\n) => WysiwygEditorTool | WysiwygEditorTool[];\n\nexport type RawWysiwygEditorTool =\n | WysiwygEditorTool\n | WysiwygEditorToolFactory<any>;\n\nfunction resolveRawWysiwygEditorTool(\n raw: RawWysiwygEditorTool,\n vui: VuiService,\n) {\n return typeof raw === 'function' ? raw(vui) : raw;\n}\n\nexport interface ResolvedWysiwygEditorSettings {\n tools: WysiwygEditorTool[];\n extensions: Extensions;\n}\n\nexport function resolveRawWysiwygEditorTools(\n rawTools: RawWysiwygEditorTool[],\n vui: VuiService,\n): ResolvedWysiwygEditorSettings {\n const tools: WysiwygEditorTool[] = [];\n const extensions: Extensions = [];\n\n rawTools.forEach((raw) => {\n let resolved = resolveRawWysiwygEditorTool(raw, vui);\n if (!Array.isArray(resolved)) {\n resolved = [resolved];\n }\n resolved.forEach((tool) => {\n tools.push(tool);\n if (tool.extensions) {\n extensions.push(...tool.extensions);\n }\n });\n });\n\n return {\n tools,\n extensions,\n };\n}\n","export const VUI_WYSIWYG_EDITOR_SYMBOL = 'vui-wysiwyg-editor';\n","import { createVNode as _createVNode } from \"vue\";\nimport './Linter.scss';\nimport { Extension } from '@tiptap/vue-3';\nimport { Decoration, DecorationSet } from '@tiptap/pm/view';\nimport { Plugin, PluginKey, TextSelection } from '@tiptap/pm/state';\nimport { createWysiwygExtension } from '../../schemes';\nconst PROBLEM_CLASS_NAME = 'v-linter__problem';\nconst ISSUE_ICON_CLASS_NAME = 'v-linter__issue-icon';\nconst ISSUE_DATASET_NAME = 'data-issue-id';\nfunction resolveWysiwygLinterFixMessage(message) {\n return typeof message === 'function' ? message() : message;\n}\nfunction renderIcon(view, issue) {\n const {\n level = 'warning'\n } = issue;\n const icon = document.createElement('div');\n const message = resolveWysiwygLinterFixMessage(issue.message);\n icon.className = `${ISSUE_ICON_CLASS_NAME} ${level}-scope`;\n icon.setAttribute(ISSUE_DATASET_NAME, issue.id);\n if (typeof message === 'string') {\n icon.title = message;\n }\n return icon;\n}\nfunction runAllLinterPlugins(doc, plugins) {\n const decorations = [];\n const issues = plugins.map(RegisteredLinterPlugin => {\n return new RegisteredLinterPlugin(doc).scan().getResults();\n }).flat();\n issues.forEach(issue => {\n const {\n level = 'warning',\n icon\n } = issue;\n const message = resolveWysiwygLinterFixMessage(issue.message);\n decorations.push(Decoration.inline(issue.from, issue.to, {\n class: `${PROBLEM_CLASS_NAME} ${level}-scope`,\n 'data-issue-id': issue.id,\n title: typeof message === 'string' ? message : undefined\n }));\n if (icon) {\n decorations.push(Decoration.widget(issue.from, view => renderIcon(view, issue)));\n }\n });\n const decorationSet = DecorationSet.create(doc, decorations);\n return {\n issues,\n decorationSet\n };\n}\nexport const WysiwygLinter = createWysiwygExtension(ctx => {\n function showMenu(view, issue, event) {\n const message = resolveWysiwygLinterFixMessage(issue.message);\n const variant = ctx.vui.setting('containedVariant');\n const scope = ctx.vui.setting(`${issue.level}Scope`);\n return ctx.vui.menu({\n activator: event,\n content: stack => _createVNode(\"div\", {\n \"class\": \"v-linter__issue-menu__body\"\n }, [_createVNode(\"div\", {\n \"class\": ['v-linter__issue-menu__message', `${scope}-scope ${variant}`]\n }, [message]), issue.fix.length && _createVNode(\"div\", {\n \"class\": \"v-linter__issue-menu__fixers\"\n }, [issue.fix.map((fixer, index) => _createVNode(\"div\", {\n \"key\": index,\n \"class\": \"v-linter__issue-menu__fixer\"\n }, [_createVNode(\"button\", {\n \"type\": \"button\",\n \"class\": \"v-linter__issue-menu__fixer__button\",\n \"onClick\": () => {\n stack.close();\n fixer.handler(view, issue);\n }\n }, [_createVNode(\"span\", {\n \"class\": \"v-linter__issue-menu__fixer__button__message\"\n }, [resolveWysiwygLinterFixMessage(fixer.message)])])]))])])\n });\n }\n return Extension.create({\n name: 'linter',\n addOptions() {\n return {\n plugins: []\n };\n },\n addStorage() {\n return {\n issues: []\n };\n },\n addProseMirrorPlugins() {\n const {\n plugins\n } = this.options;\n const {\n storage\n } = this;\n const runAll = doc => {\n const {\n issues,\n decorationSet\n } = runAllLinterPlugins(doc, plugins);\n storage.issues = issues;\n return decorationSet;\n };\n const getIssue = id => storage.issues.find(issue => issue.id === id);\n const getIssueElementByEvent = source => {\n if (!source || !(source instanceof HTMLElement)) {\n return;\n }\n const issueId = source.getAttribute(ISSUE_DATASET_NAME);\n const issue = issueId && getIssue(issueId);\n if (!issue) return;\n return {\n issue\n };\n };\n const linterPlugin = new Plugin({\n key: new PluginKey('linter'),\n state: {\n init(_, {\n doc\n }) {\n return runAll(doc);\n },\n apply(transaction, oldState) {\n return transaction.docChanged ? runAll(transaction.doc) : oldState;\n }\n },\n props: {\n decorations(state) {\n return linterPlugin.getState(state);\n },\n handleClick(view, _, event) {\n const info = getIssueElementByEvent(event.target);\n if (!info) {\n return false;\n }\n const {\n issue\n } = info;\n const {\n from,\n to\n } = issue;\n const focus = () => view.dispatch(view.state.tr.setSelection(TextSelection.create(view.state.doc, from, to)).scrollIntoView());\n focus();\n showMenu(view, issue, event);\n return true;\n }\n }\n });\n return [linterPlugin];\n }\n });\n});","let IDX = 256,\n BUFFER: any;\nconst HEX: any = [];\nwhile (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);\n\nexport function cheepUUID() {\n let i = 0,\n num,\n out = '';\n\n if (!BUFFER || IDX + 16 > 256) {\n BUFFER = Array((i = 256));\n while (i--) BUFFER[i] = (256 * Math.random()) | 0;\n i = IDX = 0;\n }\n\n for (; i < 16; i++) {\n num = BUFFER[IDX + i];\n if (i == 6) out += HEX[(num & 15) | 64];\n else if (i == 8) out += HEX[(num & 63) | 128];\n else out += HEX[num];\n\n if (i & 1 && i > 1 && i < 11) out += '-';\n }\n\n IDX++;\n return out;\n}\n","import { VNodeChild } from 'vue';\nimport { Node as ProsemirrorNode } from '@tiptap/pm/model';\nimport { EditorView } from '@tiptap/pm/view';\nimport { cheepUUID } from './utils';\n\nexport type WysiwygLinterFixFn = (\n view: EditorView,\n issue: WysiwygLinterResult,\n) => any;\n\nexport type WysiwygLinterFixMessage = string | (() => VNodeChild);\n\nexport interface WysiwygLinterFixer {\n message: WysiwygLinterFixMessage;\n handler: WysiwygLinterFixFn;\n}\n\nexport type WysiwygLinterResultLevel = 'warning' | 'error';\n\n// fixers\nexport interface WysiwygLinterResult {\n id: string;\n icon: boolean;\n level: WysiwygLinterResultLevel;\n message: WysiwygLinterFixMessage;\n from: number;\n to: number;\n fix: WysiwygLinterFixer[];\n}\n\nexport interface RawLinterResult\n extends Omit<WysiwygLinterResult, 'level' | 'fix' | 'id' | 'icon'> {\n level?: WysiwygLinterResultLevel;\n icon?: boolean;\n fix?: WysiwygLinterFixer | WysiwygLinterFixer[];\n}\n\nexport class WysiwygLinterPlugin {\n protected doc: ProsemirrorNode;\n\n private results: Array<WysiwygLinterResult> = [];\n\n constructor(doc: ProsemirrorNode) {\n this.doc = doc;\n }\n\n record(result: RawLinterResult) {\n const { fix = [], icon = false } = result;\n this.results.push({\n level: 'error',\n id: cheepUUID(),\n ...result,\n fix: Array.isArray(fix) ? fix : [fix],\n icon,\n });\n }\n\n scan() {\n return this;\n }\n\n getResults() {\n return this.results;\n }\n}\n","import { createTextVNode as _createTextVNode, createVNode as _createVNode } from \"vue\";\nimport { WysiwygLinterPlugin } from '../LinterPlugin';\nexport function WysiwygLinterBadWords(words) {\n const regex = new RegExp(`\\\\b(${words.join('|')})\\\\b`);\n return class WysiwygLinterBadWords extends WysiwygLinterPlugin {\n scan() {\n this.doc.descendants((node, position) => {\n if (!node.isText) {\n return;\n }\n const matches = regex.exec(node.text);\n if (matches) {\n const fixValue = matches[0] + '!!!!!';\n this.record({\n level: 'warning',\n message: `Try not to say '${matches[0]}'`,\n from: position + matches.index,\n to: position + matches.index + matches[0].length,\n fix: [{\n message: () => _createVNode(\"span\", null, [_createVNode(\"code\", null, [fixValue]), _createTextVNode(\"\\u306B\\u4FEE\\u6B63\\u3059\\u308B\\u3002\")]),\n handler: () => {\n console.log('hoge');\n }\n }, {\n message: 'どうにかする',\n handler: () => {\n console.log('hoge');\n }\n }]\n });\n }\n });\n return this;\n }\n };\n}","import { EditorView } from '@tiptap/pm/view';\nimport {\n WysiwygLinterPlugin,\n WysiwygLinterResult as Issue,\n} from '../LinterPlugin';\n\nexport class WysiwygLinterHeadingLevel extends WysiwygLinterPlugin {\n fixHeader(level: number) {\n return function ({ state, dispatch }: EditorView, issue: Issue) {\n dispatch(state.tr.setNodeMarkup(issue.from - 1, undefined, { level }));\n };\n }\n\n scan() {\n let lastHeadLevel: number | null = null;\n\n this.doc.descendants((node, position) => {\n if (node.type.name === 'heading') {\n // Check whether heading levels fit under the current level\n const { level } = node.attrs;\n\n if (lastHeadLevel != null && level > lastHeadLevel + 1) {\n this.record({\n message: `Heading too small (${level} under ${lastHeadLevel})`,\n from: position + 1,\n to: position + 1 + node.content.size,\n fix: {\n message: '修正する',\n handler: this.fixHeader(lastHeadLevel + 1),\n },\n });\n }\n lastHeadLevel = level;\n }\n });\n\n return this;\n }\n}\n","import { EditorView } from '@tiptap/pm/view';\nimport {\n WysiwygLinterPlugin,\n WysiwygLinterResult as Issue,\n} from '../LinterPlugin';\n\nexport class WysiwygLinterPunctuation extends WysiwygLinterPlugin {\n public regex = / ([,.!?:]) ?/g;\n\n fix(replacement: any) {\n return function ({ state, dispatch }: EditorView, issue: Issue) {\n dispatch(\n state.tr.replaceWith(\n issue.from,\n issue.to,\n state.schema.text(replacement),\n ),\n );\n };\n }\n\n scan() {\n this.doc.descendants((node, position) => {\n if (!node.isText) {\n return;\n }\n\n if (!node.text) {\n return;\n }\n\n const matches = this.regex.exec(node.text);\n\n if (matches) {\n this.record({\n message: 'Suspicious spacing around punctuation',\n from: position + matches.index,\n to: position + matches.index + matches[0].length,\n fix: {\n message: 'Fix it!!!',\n handler: this.fix(`${matches[1]} `),\n },\n });\n }\n });\n\n return this;\n }\n}\n","import { Extension } from '@tiptap/vue-3';\nimport '@tiptap/extension-text-style';\n\nexport type WysiwygColorOptions = {\n types: string[];\n};\n\ndeclare module '@tiptap/vue-3' {\n interface Commands<ReturnType> {\n color: {\n /**\n * Set the text color\n */\n setColor: (color: string) => ReturnType;\n /**\n * Unset the text color\n */\n unsetColor: () => ReturnType;\n };\n }\n}\n\nexport const WysiwygColorExtension = Extension.create<WysiwygColorOptions>({\n name: 'color',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n color: {\n default: null,\n parseHTML: (element) => element.style.color.replace(/['\"]+/g, ''),\n renderHTML: (attributes) => {\n if (!attributes.color) {\n return {};\n }\n\n return {\n style: `color: ${attributes.color}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setColor:\n (color) =>\n ({ chain }) => {\n return chain().setMark('textStyle', { color }).run();\n },\n unsetColor:\n () =>\n ({ chain }) => {\n return chain()\n .setMark('textStyle', { color: null })\n .removeEmptyTextStyle()\n .run();\n },\n };\n },\n});\n","import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { BulletList, BulletListOptions } from '@tiptap/extension-bullet-list';\n\nexport const WysiwygBulletListTool: WysiwygEditorToolFactory<\n BulletListOptions\n> = (vui, options) => {\n const tool: WysiwygEditorTool = {\n key: 'bulletList',\n icon: vui.icon('editorformatListBulleted'),\n active: ({ editor }) => editor.isActive('bulletList'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleBulletList().run();\n },\n floating: true,\n extensions: [BulletList.configure(options)],\n };\n return tool;\n};\n","import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { Bold, BoldOptions } from '@tiptap/extension-bold';\n\nexport const WysiwygFormatBoldTool: WysiwygEditorToolFactory<BoldOptions> = (\n vui,\n options,\n) => {\n const tool: WysiwygEditorTool = {\n key: 'formatBold',\n icon: vui.icon('editorformatBold'),\n active: ({ editor }) => editor.isActive('bold'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleBold().run();\n },\n floating: true,\n extensions: [Bold.configure(options)],\n };\n return tool;\n};\n","import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { Italic, ItalicOptions } from '@tiptap/extension-italic';\n\nexport const WysiwygFormatItalicTool: WysiwygEditorToolFactory<\n ItalicOptions\n> = (vui, options) => {\n const tool: WysiwygEditorTool = {\n key: 'formatItalic',\n icon: vui.icon('editorformatItalic'),\n active: ({ editor }) => editor.isActive('italic'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleItalic().run();\n },\n floating: true,\n extensions: [Italic.configure(options)],\n };\n return tool;\n};\n","import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { Underline, UnderlineOptions } from '@tiptap/extension-underline';\n\nexport const WysiwygFormatUnderlineTool: WysiwygEditorToolFactory<\n UnderlineOptions\n> = (vui, options) => {\n const tool: WysiwygEditorTool = {\n key: 'formatUnderline',\n icon: vui.icon('editorformatUnderline'),\n active: ({ editor }) => editor.isActive('underline'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleUnderline().run();\n },\n floating: true,\n extensions: [Underline.configure(options)],\n };\n return tool;\n};\n","import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { History, HistoryOptions } from '@tiptap/extension-history';\n\nexport const WysiwygHistoryTool: WysiwygEditorToolFactory<HistoryOptions> = (\n vui,\n options,\n) => {\n const undo: WysiwygEditorTool = {\n key: 'history-undo',\n icon: vui.icon('editorUndo'),\n disabled: ({ editor }) => !editor.can().undo(),\n onClick: ({ editor }) => {\n editor.chain().focus().undo().run();\n },\n extensions: [History.configure(options)],\n };\n const redo: WysiwygEditorTool = {\n key: 'history-redo',\n icon: vui.icon('editorRedo'),\n disabled: ({ editor }) => !editor.can().redo(),\n onClick: ({ editor }) => {\n editor.chain().focus().redo().run();\n },\n };\n return [undo, redo];\n};\n","import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { Link, LinkOptions } from '@tiptap/extension-link';\nimport { validateIf, url } from '@fastkit/vui';\n\nexport const WysiwygLinkTool: WysiwygEditorToolFactory<LinkOptions> = (\n vui,\n options,\n) => {\n const tool: WysiwygEditorTool = {\n key: 'link',\n // icon: ({ editor }) => {\n // return vui.icon(editor.isActive('link') ? 'editorLinkOff' : 'editorLink');\n // },\n icon: vui.icon('editorLink'),\n active: ({ editor }) => editor.isActive('link'),\n // disabled: ({ editor }) => {\n // const { $from, $to } = editor.view.state.selection;\n // return $to.pos - $from.pos === 0;\n // },\n onClick: async ({ vui, editor }) => {\n const { href = '' } = editor.getAttributes('link');\n const result = await vui.prompt({\n input: {\n label: 'Link URL',\n rules: [validateIf, url],\n initialValue: href,\n size: 'sm',\n autofocus: true,\n },\n });\n\n if (result === undefined || result === false) {\n return;\n }\n\n const range = editor.chain().focus().extendMarkRange('link');\n\n if (!result) {\n range.unsetLink().run();\n } else {\n range\n .setLink({\n href: result,\n })\n .run();\n }\n },\n floating: true,\n extensions: [\n Link.configure({\n openOnClick: false,\n ...options,\n }),\n ],\n };\n return tool;\n};\n","import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport {\n OrderedList,\n OrderedListOptions,\n} from '@tiptap/extension-ordered-list';\n\nexport const WysiwygOrderedListTool: WysiwygEditorToolFactory<\n OrderedListOptions\n> = (vui, options) => {\n const tool: WysiwygEditorTool = {\n key: 'orderedList',\n icon: vui.icon('editorformatListNumbered'),\n active: ({ editor }) => editor.isActive('orderedList'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleOrderedList().run();\n },\n floating: true,\n extensions: [OrderedList.configure(options)],\n };\n return tool;\n};\n","import { createVNode as _createVNode } from \"vue\";\nimport './color.scss';\nimport { WysiwygColorExtension } from '../extensions';\nimport { VIcon } from '@fastkit/vui';\nimport TextStyle from '@tiptap/extension-text-style';\nexport function createWysiwygColorTool(opts) {\n const WysiwygColorTool = vui => {\n const tool = {\n key: 'textColor',\n // active: ({ editor }) => editor.isActive('textStyle'),\n icon: ({\n editor\n }) => () => {\n const color = editor.getAttributes('textStyle').color;\n const style = {\n color\n };\n return _createVNode(\"span\", {\n \"class\": \"v-wysiwyg-color-tool__button\"\n }, [_createVNode(VIcon, {\n \"class\": \"v-wysiwyg-color-tool__button__icon\",\n \"name\": vui.icon('editorTextColor')\n }, null), _createVNode(\"span\", {\n \"class\": \"v-wysiwyg-color-tool__button__bar\",\n \"style\": style\n }, null)]);\n },\n onClick: (ctx, ev) => {\n ctx.vui.menu({\n class: 'v-wysiwyg-color-tool__menu',\n activator: ev,\n content: stack => _createVNode(\"div\", {\n \"class\": ['v-wysiwyg-color-tool__items', {\n 'v-wysiwyg-color-tool__items--with-label': opts.withLabel\n }]\n }, [opts.items.map((item, index) => _createVNode(\"button\", {\n \"key\": item.key == null ? index : item.key,\n \"class\": \"v-wysiwyg-color-tool__item\",\n \"type\": \"button\",\n \"onClick\": () => {\n const {\n color\n } = item;\n let command = ctx.editor.chain().focus();\n if (color) {\n command = command.setColor(color);\n } else {\n command = command.unsetColor();\n }\n command.run();\n stack.close();\n }\n }, [_createVNode(\"span\", {\n \"class\": \"v-wysiwyg-color-tool__item__color\",\n \"style\": item.color ? {\n color: item.color\n } : {}\n }, null), opts.withLabel && _createVNode(\"span\", {\n \"class\": \"v-wysiwyg-color-tool__item__name\"\n }, [item.name])]))])\n });\n },\n floating: true,\n extensions: [TextStyle, WysiwygColorExtension]\n };\n return tool;\n };\n return WysiwygColorTool;\n}","import { resolveDirective as _resolveDirective, mergeProps as _mergeProps, createVNode as _createVNode, isVNode as _isVNode } from \"vue\";\nimport './VWysiwygEditor.scss';\nimport { defineComponent, computed, ref, watch, onBeforeUnmount } from 'vue';\nimport { createFormControlProps, VFormControl, VControlField, createControlFieldProps, createTextableProps, createTextableEmits, TextableControl, createControlProps, useControl, createControlFieldProviderProps, useControlField, VTextCounter, defineSlotsProps, useVui, VButton, VButtonGroup } from '@fastkit/vui';\nimport { VUI_WYSIWYG_EDITOR_SYMBOL } from '../../injections';\nimport { EditorContent, useEditor, BubbleMenu } from '@tiptap/vue-3';\nimport { StarterKit } from '@tiptap/starter-kit';\nimport { resolveRawWysiwygExtensions, resolveRawWysiwygEditorTools,\n// EditorEventsOptions,\nWysiwygEditorInitializeContext } from '../../schemes';\nfunction _isSlot(s) {\n return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);\n}\nexport const VWysiwygEditor = defineComponent({\n name: 'VWysiwygEditor',\n props: {\n ...createTextableProps(),\n ...createFormControlProps(),\n ...createControlFieldProps(),\n ...createControlFieldProviderProps(),\n ...createControlProps(),\n ...defineSlotsProps(),\n extensions: {\n type: Array,\n default: () => []\n },\n tools: {\n type: Array,\n default: () => []\n },\n floatingToolbar: Boolean,\n disabledMinHeight: Boolean,\n disabledMaxHeight: Boolean\n },\n emits: {\n ...createTextableEmits()\n },\n setup(props, ctx) {\n const vui = useVui();\n const textRef = ref('');\n const toolButtonActiveColor = vui.setting('primaryScope');\n const wysiwygSettings = computed(() => resolveRawWysiwygEditorTools(props.tools, vui));\n const control = useControl(props);\n useControlField(props);\n const inputControl = new TextableControl(props, ctx, {\n nodeType: VUI_WYSIWYG_EDITOR_SYMBOL,\n validationValue: () => textRef.value\n });\n const initializeCtx = new WysiwygEditorInitializeContext(() => vui, {\n onCreate: ({\n editor\n }) => {\n textRef.value = editor.getText();\n updateEditable();\n },\n onFocus: ({\n event\n }) => {\n inputControl.focusHandler(event);\n },\n onBlur: ({\n event\n }) => {\n inputControl.blurHandler(event);\n },\n onUpdate: ({\n editor\n }) => {\n inputControl.value = editor.getHTML();\n textRef.value = editor.getText();\n }\n });\n const extensions = [StarterKit.configure({\n bold: false,\n bulletList: false,\n orderedList: false,\n history: false,\n italic: false\n }),\n // Linter.configure({\n // plugins: [BadWords(['abc', 'evidently']), Punctuation, HeadingLevel],\n // }),\n ...resolveRawWysiwygExtensions(props.extensions, initializeCtx), ...wysiwygSettings.value.extensions];\n const updateEditable = () => {\n if (!editor.value) return;\n editor.value.setEditable(inputControl.canOperation);\n };\n watch(() => inputControl.canOperation, updateEditable);\n watch(() => props.modelValue, modelValue => {\n const $editor = editor.value;\n if (!$editor || $editor.getHTML() === modelValue) return;\n $editor.commands.setContent(modelValue == null ? '' : modelValue, false);\n textRef.value = $editor.getText();\n });\n initializeCtx.on('create', ({\n editor\n }) => {\n textRef.value = editor.getText();\n updateEditable();\n });\n const editor = useEditor({\n ...initializeCtx.editorOptions(),\n autofocus: props.autofocus,\n content: props.modelValue,\n extensions,\n editorProps: {\n attributes: {\n class: 'v-wysiwyg-editor__input__prose'\n }\n }\n });\n\n // editor.value.state.doc.content\n\n const focus = (position, options) => {\n if (!editor.value) return;\n return editor.value.chain().focus(position, options);\n };\n const blur = () => {\n if (!editor.value) return;\n return editor.value.chain().blur();\n };\n const wysiwygContext = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const _editor = editor.value;\n // if (!_editor) {\n // throw new Error('missing editor value');\n // }\n return {\n vui,\n editor: _editor\n };\n });\n const createTools = (bubbleMenu = false) => {\n let _slot;\n const {\n value: settings\n } = wysiwygSettings;\n const {\n value: context\n } = wysiwygContext;\n const tools = bubbleMenu ? settings.tools.filter(t => !!t.floating) : settings.tools;\n const _editor = editor.value;\n const variant = vui.setting(bubbleMenu ? 'containedVariant' : 'plainVariant');\n return _createVNode(VButtonGroup, {\n \"class\": ['v-wysiwyg-editor__toolbar', {\n 'v-wysiwyg-editor__floating-toolbar': props.floatingToolbar\n }],\n \"variant\": variant\n }, _isSlot(_slot = tools.map(({\n key,\n icon,\n onClick,\n disabled,\n active\n }) => {\n const isActive = !!_editor && resolveContextableValue(context, active);\n const isDisabled = !inputControl.canOperation || !!_editor && resolveContextableValue(context, disabled);\n let iconName;\n let child;\n if (typeof icon === 'function') {\n if (_editor) {\n const _child = icon(context);\n if (typeof _child === 'function') {\n child = _child();\n } else {\n iconName = _child;\n }\n }\n } else {\n iconName = icon;\n }\n if (!iconName && child == null) return;\n return _createVNode(VButton, {\n \"tabindex\": -1,\n \"key\": key,\n \"icon\": iconName,\n \"onClick\": ev => onClick(context, ev),\n \"color\": isActive ? toolButtonActiveColor : undefined,\n \"disabled\": isDisabled\n }, _isSlot(child) ? child : {\n default: () => [child]\n });\n })) ? _slot : {\n default: () => [_slot]\n });\n };\n onBeforeUnmount(() => {\n editor.value && editor.value.destroy();\n });\n return {\n editor,\n ...inputControl.expose(),\n ...control,\n focus,\n blur,\n createTools\n };\n },\n render() {\n return _createVNode(VFormControl, {\n \"nodeControl\": this.nodeControl,\n \"focused\": this.nodeControl.focused,\n \"class\": ['v-wysiwyg-editor', this.classes, `v-wysiwyg-editor--${this.size}`, {\n 'v-wysiwyg-editor--disabled-min-heihgt': this.disabledMinHeight,\n 'v-wysiwyg-editor--disabled-max-heihgt': this.disabledMaxHeight\n }],\n \"label\": this.label,\n \"hint\": this.hint,\n \"hinttip\": this.hinttip,\n \"hiddenInfo\": this.hiddenInfo,\n \"requiredChip\": this.requiredChip,\n \"onClickLabel\": ev => {\n this.focus('start', {\n scrollIntoView: true\n });\n }\n }, {\n ...this.$slots,\n default: () => {\n const {\n editor\n } = this;\n return _createVNode(\"div\", {\n \"class\": \"v-wysiwyg-editor__wrapper\"\n }, [!this.isReadonly && this.createTools(), _createVNode(VControlField, {\n \"class\": \"v-wysiwyg-editor__input\",\n \"autoHeight\": true,\n \"startAdornment\": this.startAdornment,\n \"endAdornment\": this.endAdornment,\n \"size\": this.size\n }, {\n ...this.$slots,\n default: () => {\n let _slot2;\n return _createVNode(\"div\", {\n \"class\": \"v-wysiwyg-editor__body\"\n }, [_createVNode(EditorContent, _mergeProps({\n class: 'v-wysiwyg-editor__input__element wysiwyg'\n }, {\n \"editor\": editor\n }), null), !this.floatingToolbar && !!editor && !this.isReadonly && _createVNode(BubbleMenu, _mergeProps({\n class: 'v-wysiwyg-editor__bubble-menu'\n }, {\n \"editor\": editor\n }), _isSlot(_slot2 = this.createTools(true)) ? _slot2 : {\n default: () => [_slot2]\n })]);\n }\n })]);\n },\n infoAppends: () => {\n const {\n counterResult\n } = this;\n if (!counterResult) return;\n return _createVNode(VTextCounter, counterResult, null);\n }\n });\n }\n});\nfunction resolveContextableValue(ctx, source) {\n return typeof source === 'function' ? source(ctx) : source;\n}"]}
|
|
1
|
+
{"version":3,"sources":["../src/schemes.ts","../src/injections.ts","../src/extensions/linter/Linter.tsx","../src/extensions/linter/utils.ts","../src/extensions/linter/LinterPlugin.ts","../src/extensions/linter/plugins/BadWords.tsx","../src/extensions/linter/plugins/HeadingLevel.ts","../src/extensions/linter/plugins/Punctuation.ts","../src/extensions/color.ts","../src/tools/bullet-list.ts","../src/tools/format-bold.ts","../src/tools/format-italic.ts","../src/tools/format-underline.ts","../src/tools/history.ts","../src/tools/link.ts","../src/tools/ordered-list.ts","../src/tools/color.tsx","../src/tools/text-align.tsx","../src/components/VWysiwygEditor/VWysiwygEditor.tsx"],"names":["_createVNode","Extension","vui","ev","_isVNode","VButton","VButtonGroup","_isSlot","editor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,IAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIA,IAAM,oBAAoB,CACxB,WACyB;AACzB,SAAO,KAAK,OAAO,OAAO,CAAC,EAAE,YAAY,IAAI,OAAO,MAAM,CAAC;AAC7D;AAgBO,IAAM,iCAAN,MAAqC;AAAA,EACjC,YAAuC,CAAC;AAAA,EAChC;AAAA,EAEjB,IAAI,MAAM;AACR,WAAO,KAAK,KAAK;AAAA,EACnB;AAAA,EAEA,YACE,WACA,OAAmC,CAAC,GACpC;AACA,SAAK,OAAO;AAEZ,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;AAAA,YACT,GAAG;AAAA,cACD,UAAU;AAAA,YACZ,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,mBAAmB,CAAC,CAAC,UAAU,CAAC,KAAK,cAAcA,cAAa,YAAY,YAAY;AAAA,cACvG,OAAO;AAAA,YACT,GAAG;AAAA,cACD,UAAU;AAAA,YACZ,CAAC,GAAGO,SAAQ,SAAS,KAAK,YAAY,IAAI,CAAC,IAAI,SAAS;AAAA,cACtD,SAAS,MAAM,CAAC,MAAM;AAAA,YACxB,CAAC,CAAC,CAAC;AAAA,UACL;AAAA,QACF,CAAC,CAAC,CAAC;AAAA,MACL;AAAA,MACA,aAAa,MAAM;AACjB,cAAM;AAAA,UACJ;AAAA,QACF,IAAI;AACJ,YAAI,CAAC;AAAe;AACpB,eAAOP,cAAa,cAAc,eAAe,IAAI;AAAA,MACvD;AAAA,IACF,CAAC;AAAA,EACH;AACF,CAAC;AACD,SAAS,wBAAwB,KAAK,QAAQ;AAC5C,SAAO,OAAO,WAAW,aAAa,OAAO,GAAG,IAAI;AACtD","sourcesContent":["import { type VuiService, type IconName } from '@fastkit/vui';\nimport {\n type Editor,\n type Extensions,\n type Node,\n type Extension,\n type Mark,\n type AnyExtension,\n type EditorOptions,\n} from '@tiptap/vue-3';\nimport { VNodeChild } from 'vue';\n\nconst EDITOR_EVENTS = [\n 'beforeCreate',\n 'create',\n 'update',\n 'selectionUpdate',\n 'transaction',\n 'focus',\n 'blur',\n 'destroy',\n] as const;\n\ntype PrefixedEventName<S extends string> = `on${Capitalize<S>}`;\n\nconst prefixedEventName = <S extends string>(\n source: S,\n): PrefixedEventName<S> => {\n return `on${source.charAt(0).toUpperCase()}${source.slice(1)}` as any;\n};\n\nexport type WysiwygEditorEvent = (typeof EDITOR_EVENTS)[number];\n\nexport type WysiwygEditorPrefixedEvent = PrefixedEventName<WysiwygEditorEvent>;\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface WysiwygEditorEventsOptions\n extends Partial<Pick<EditorOptions, WysiwygEditorPrefixedEvent>> {}\n\nexport type WysiwygEditorEventsBucket = {\n [EV in WysiwygEditorEvent]: NonNullable<\n WysiwygEditorEventsOptions[PrefixedEventName<EV>]\n >[];\n};\n\nexport class WysiwygEditorInitializeContext {\n readonly listeners: WysiwygEditorEventsBucket = {} as any;\n private readonly _vui: () => VuiService;\n\n get vui() {\n return this._vui();\n }\n\n constructor(\n vuiGetter: () => VuiService,\n opts: WysiwygEditorEventsOptions = {},\n ) {\n this._vui = vuiGetter;\n\n EDITOR_EVENTS.forEach((event) => {\n this.listeners[event] = [];\n const prefixed = prefixedEventName(event);\n const fn = opts[prefixed];\n fn && this.listeners[event].push(fn as any);\n });\n }\n\n on<EV extends WysiwygEditorEvent>(\n ev: EV,\n handler: NonNullable<WysiwygEditorEventsOptions[PrefixedEventName<EV>]>,\n ) {\n this.listeners[ev].push(handler);\n return () => this.off(ev, handler);\n }\n\n off<EV extends WysiwygEditorEvent>(\n ev: EV,\n handler: NonNullable<WysiwygEditorEventsOptions[PrefixedEventName<EV>]>,\n ) {\n this.listeners[ev] = this.listeners[ev].filter(\n (_handler) => _handler !== handler,\n ) as any;\n }\n\n editorOptions() {\n const opts: WysiwygEditorEventsOptions = {};\n\n EDITOR_EVENTS.forEach((event) => {\n const prefixed = prefixedEventName(event);\n opts[prefixed] = (props) => {\n const handlers = this.listeners[event];\n handlers.forEach((handler) => {\n handler(props as any);\n });\n };\n });\n\n return opts;\n }\n}\n\nexport interface WysiwygEditorContext {\n editor: Editor;\n vui: VuiService;\n}\n\nexport type WysiwygExtensionFactory<Options = any, Storage = any> = (\n ctx: WysiwygEditorInitializeContext,\n) =>\n | Extension<Options, Storage>\n | Node<Options, Storage>\n | Mark<Options, Storage>;\n\nexport interface CreatedWysiwygExtension<Options = any, Storage = any> {\n __isCreatedWysiwygExtension: true;\n _configs: Partial<Options>[];\n configure(\n options?: Partial<Options>,\n ): CreatedWysiwygExtension<Options, Storage>;\n raw: WysiwygExtensionSource<Options, Storage>;\n}\n\nexport type WysiwygExtensionSource<Options = any, Storage = any> =\n | Extension<Options, Storage>\n | Node<Options, Storage>\n | Mark<Options, Storage>\n | WysiwygExtensionFactory<Options, Storage>;\n\nexport type RawWysiwygExtension<Options = any, Storage = any> =\n | WysiwygExtensionSource<Options, Storage>\n | CreatedWysiwygExtension<Options, Storage>;\n\n// export function createWysiwygExtension<Options = any, Storage = any>(\n// extension: Extension<Options, Storage>,\n// ): Extension<Options, Storage>;\n// export function createWysiwygExtension<Options = any, Storage = any>(\n// node: Node<Options, Storage>,\n// ): Node<Options, Storage>;\n// export function createWysiwygExtension<Options = any, Storage = any>(\n// mark: Mark<Options, Storage>,\n// ): Mark<Options, Storage>;\n// export function createWysiwygExtension<Options = any, Storage = any>(\n// factory: WysiwygExtensionFactory<Options, Storage>,\n// ): WysiwygExtensionFactory<Options, Storage>;\n\nfunction isCreatedWysiwygExtension<Options = any, Storage = any>(\n source: unknown,\n): source is CreatedWysiwygExtension<Options, Storage> {\n return (\n !!source &&\n typeof source === 'object' &&\n (source as CreatedWysiwygExtension).__isCreatedWysiwygExtension === true\n );\n}\n\nexport function createWysiwygExtension<Options = any, Storage = any>(\n extension: WysiwygExtensionSource<Options, Storage>,\n) {\n const ext: CreatedWysiwygExtension<Options, Storage> = {\n __isCreatedWysiwygExtension: true,\n _configs: [],\n configure: (opts) => {\n opts && ext._configs.push(opts);\n return ext;\n },\n raw: extension,\n };\n return ext;\n}\n\nfunction resolveRawWysiwygExtension(\n raw: RawWysiwygExtension,\n ctx: WysiwygEditorInitializeContext,\n): AnyExtension {\n if (isCreatedWysiwygExtension(raw)) {\n const { raw: _raw, _configs } = raw;\n let ext = typeof _raw === 'function' ? _raw(ctx) : _raw;\n _configs.forEach((config) => {\n ext = ext.configure(config);\n });\n return ext;\n }\n return typeof raw === 'function' ? raw(ctx) : raw;\n}\n\nexport function resolveRawWysiwygExtensions(\n raws: RawWysiwygExtension[],\n ctx: WysiwygEditorInitializeContext,\n) {\n return raws.map((raw) => resolveRawWysiwygExtension(raw, ctx));\n}\n\nexport interface WysiwygEditorTool {\n key: string;\n icon:\n | IconName\n | ((\n ctx: WysiwygEditorContext,\n ) => IconName | (() => VNodeChild) | undefined);\n active?: boolean | ((ctx: WysiwygEditorContext) => boolean);\n disabled?: boolean | ((ctx: WysiwygEditorContext) => boolean);\n onClick: (ctx: WysiwygEditorContext, ev: MouseEvent) => any;\n floating?: boolean;\n extensions?: Extensions;\n}\n\nexport type WysiwygEditorToolFactory<Options = void> = (\n vui: VuiService,\n options?: Options,\n) => WysiwygEditorTool | WysiwygEditorTool[];\n\nexport type RawWysiwygEditorTool =\n | WysiwygEditorTool\n | WysiwygEditorToolFactory<any>;\n\nfunction resolveRawWysiwygEditorTool(\n raw: RawWysiwygEditorTool,\n vui: VuiService,\n) {\n return typeof raw === 'function' ? raw(vui) : raw;\n}\n\nexport interface ResolvedWysiwygEditorSettings {\n tools: WysiwygEditorTool[];\n extensions: Extensions;\n}\n\nexport function resolveRawWysiwygEditorTools(\n rawTools: RawWysiwygEditorTool[],\n vui: VuiService,\n): ResolvedWysiwygEditorSettings {\n const tools: WysiwygEditorTool[] = [];\n const extensions: Extensions = [];\n\n rawTools.forEach((raw) => {\n let resolved = resolveRawWysiwygEditorTool(raw, vui);\n if (!Array.isArray(resolved)) {\n resolved = [resolved];\n }\n resolved.forEach((tool) => {\n tools.push(tool);\n if (tool.extensions) {\n extensions.push(...tool.extensions);\n }\n });\n });\n\n return {\n tools,\n extensions,\n };\n}\n","export const VUI_WYSIWYG_EDITOR_SYMBOL = 'vui-wysiwyg-editor';\n","import { createVNode as _createVNode } from \"vue\";\nimport './Linter.scss';\nimport { Extension } from '@tiptap/vue-3';\nimport { Decoration, DecorationSet } from '@tiptap/pm/view';\nimport { Plugin, PluginKey, TextSelection } from '@tiptap/pm/state';\nimport { createWysiwygExtension } from '../../schemes';\nconst PROBLEM_CLASS_NAME = 'v-linter__problem';\nconst ISSUE_ICON_CLASS_NAME = 'v-linter__issue-icon';\nconst ISSUE_DATASET_NAME = 'data-issue-id';\nfunction resolveWysiwygLinterFixMessage(message) {\n return typeof message === 'function' ? message() : message;\n}\nfunction renderIcon(view, issue) {\n const {\n level = 'warning'\n } = issue;\n const icon = document.createElement('div');\n const message = resolveWysiwygLinterFixMessage(issue.message);\n icon.className = `${ISSUE_ICON_CLASS_NAME} ${level}-scope`;\n icon.setAttribute(ISSUE_DATASET_NAME, issue.id);\n if (typeof message === 'string') {\n icon.title = message;\n }\n return icon;\n}\nfunction runAllLinterPlugins(doc, plugins) {\n const decorations = [];\n const issues = plugins.map(RegisteredLinterPlugin => {\n return new RegisteredLinterPlugin(doc).scan().getResults();\n }).flat();\n issues.forEach(issue => {\n const {\n level = 'warning',\n icon\n } = issue;\n const message = resolveWysiwygLinterFixMessage(issue.message);\n decorations.push(Decoration.inline(issue.from, issue.to, {\n class: `${PROBLEM_CLASS_NAME} ${level}-scope`,\n 'data-issue-id': issue.id,\n title: typeof message === 'string' ? message : undefined\n }));\n if (icon) {\n decorations.push(Decoration.widget(issue.from, view => renderIcon(view, issue)));\n }\n });\n const decorationSet = DecorationSet.create(doc, decorations);\n return {\n issues,\n decorationSet\n };\n}\nexport const WysiwygLinter = createWysiwygExtension(ctx => {\n function showMenu(view, issue, event) {\n const message = resolveWysiwygLinterFixMessage(issue.message);\n const variant = ctx.vui.setting('containedVariant');\n const scope = ctx.vui.setting(`${issue.level}Scope`);\n return ctx.vui.menu({\n activator: event,\n content: stack => _createVNode(\"div\", {\n \"class\": \"v-linter__issue-menu__body\"\n }, [_createVNode(\"div\", {\n \"class\": ['v-linter__issue-menu__message', `${scope}-scope ${variant}`]\n }, [message]), issue.fix.length && _createVNode(\"div\", {\n \"class\": \"v-linter__issue-menu__fixers\"\n }, [issue.fix.map((fixer, index) => _createVNode(\"div\", {\n \"key\": index,\n \"class\": \"v-linter__issue-menu__fixer\"\n }, [_createVNode(\"button\", {\n \"type\": \"button\",\n \"class\": \"v-linter__issue-menu__fixer__button\",\n \"onClick\": () => {\n stack.close();\n fixer.handler(view, issue);\n }\n }, [_createVNode(\"span\", {\n \"class\": \"v-linter__issue-menu__fixer__button__message\"\n }, [resolveWysiwygLinterFixMessage(fixer.message)])])]))])])\n });\n }\n return Extension.create({\n name: 'linter',\n addOptions() {\n return {\n plugins: []\n };\n },\n addStorage() {\n return {\n issues: []\n };\n },\n addProseMirrorPlugins() {\n const {\n plugins\n } = this.options;\n const {\n storage\n } = this;\n const runAll = doc => {\n const {\n issues,\n decorationSet\n } = runAllLinterPlugins(doc, plugins);\n storage.issues = issues;\n return decorationSet;\n };\n const getIssue = id => storage.issues.find(issue => issue.id === id);\n const getIssueElementByEvent = source => {\n if (!source || !(source instanceof HTMLElement)) {\n return;\n }\n const issueId = source.getAttribute(ISSUE_DATASET_NAME);\n const issue = issueId && getIssue(issueId);\n if (!issue) return;\n return {\n issue\n };\n };\n const linterPlugin = new Plugin({\n key: new PluginKey('linter'),\n state: {\n init(_, {\n doc\n }) {\n return runAll(doc);\n },\n apply(transaction, oldState) {\n return transaction.docChanged ? runAll(transaction.doc) : oldState;\n }\n },\n props: {\n decorations(state) {\n return linterPlugin.getState(state);\n },\n handleClick(view, _, event) {\n const info = getIssueElementByEvent(event.target);\n if (!info) {\n return false;\n }\n const {\n issue\n } = info;\n const {\n from,\n to\n } = issue;\n const focus = () => view.dispatch(view.state.tr.setSelection(TextSelection.create(view.state.doc, from, to)).scrollIntoView());\n focus();\n showMenu(view, issue, event);\n return true;\n }\n }\n });\n return [linterPlugin];\n }\n });\n});","let IDX = 256,\n BUFFER: any;\nconst HEX: any = [];\nwhile (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);\n\nexport function cheepUUID() {\n let i = 0,\n num,\n out = '';\n\n if (!BUFFER || IDX + 16 > 256) {\n BUFFER = Array((i = 256));\n while (i--) BUFFER[i] = (256 * Math.random()) | 0;\n i = IDX = 0;\n }\n\n for (; i < 16; i++) {\n num = BUFFER[IDX + i];\n if (i == 6) out += HEX[(num & 15) | 64];\n else if (i == 8) out += HEX[(num & 63) | 128];\n else out += HEX[num];\n\n if (i & 1 && i > 1 && i < 11) out += '-';\n }\n\n IDX++;\n return out;\n}\n","import { VNodeChild } from 'vue';\nimport { Node as ProsemirrorNode } from '@tiptap/pm/model';\nimport { EditorView } from '@tiptap/pm/view';\nimport { cheepUUID } from './utils';\n\nexport type WysiwygLinterFixFn = (\n view: EditorView,\n issue: WysiwygLinterResult,\n) => any;\n\nexport type WysiwygLinterFixMessage = string | (() => VNodeChild);\n\nexport interface WysiwygLinterFixer {\n message: WysiwygLinterFixMessage;\n handler: WysiwygLinterFixFn;\n}\n\nexport type WysiwygLinterResultLevel = 'warning' | 'error';\n\n// fixers\nexport interface WysiwygLinterResult {\n id: string;\n icon: boolean;\n level: WysiwygLinterResultLevel;\n message: WysiwygLinterFixMessage;\n from: number;\n to: number;\n fix: WysiwygLinterFixer[];\n}\n\nexport interface RawLinterResult\n extends Omit<WysiwygLinterResult, 'level' | 'fix' | 'id' | 'icon'> {\n level?: WysiwygLinterResultLevel;\n icon?: boolean;\n fix?: WysiwygLinterFixer | WysiwygLinterFixer[];\n}\n\nexport class WysiwygLinterPlugin {\n protected doc: ProsemirrorNode;\n\n private results: Array<WysiwygLinterResult> = [];\n\n constructor(doc: ProsemirrorNode) {\n this.doc = doc;\n }\n\n record(result: RawLinterResult) {\n const { fix = [], icon = false } = result;\n this.results.push({\n level: 'error',\n id: cheepUUID(),\n ...result,\n fix: Array.isArray(fix) ? fix : [fix],\n icon,\n });\n }\n\n scan() {\n return this;\n }\n\n getResults() {\n return this.results;\n }\n}\n","import { createTextVNode as _createTextVNode, createVNode as _createVNode } from \"vue\";\nimport { WysiwygLinterPlugin } from '../LinterPlugin';\nexport function WysiwygLinterBadWords(words) {\n const regex = new RegExp(`\\\\b(${words.join('|')})\\\\b`);\n return class WysiwygLinterBadWords extends WysiwygLinterPlugin {\n scan() {\n this.doc.descendants((node, position) => {\n if (!node.isText) {\n return;\n }\n const matches = regex.exec(node.text);\n if (matches) {\n const fixValue = matches[0] + '!!!!!';\n this.record({\n level: 'warning',\n message: `Try not to say '${matches[0]}'`,\n from: position + matches.index,\n to: position + matches.index + matches[0].length,\n fix: [{\n message: () => _createVNode(\"span\", null, [_createVNode(\"code\", null, [fixValue]), _createTextVNode(\"\\u306B\\u4FEE\\u6B63\\u3059\\u308B\\u3002\")]),\n handler: () => {\n console.log('hoge');\n }\n }, {\n message: 'どうにかする',\n handler: () => {\n console.log('hoge');\n }\n }]\n });\n }\n });\n return this;\n }\n };\n}","import { EditorView } from '@tiptap/pm/view';\nimport {\n WysiwygLinterPlugin,\n WysiwygLinterResult as Issue,\n} from '../LinterPlugin';\n\nexport class WysiwygLinterHeadingLevel extends WysiwygLinterPlugin {\n fixHeader(level: number) {\n return function ({ state, dispatch }: EditorView, issue: Issue) {\n dispatch(state.tr.setNodeMarkup(issue.from - 1, undefined, { level }));\n };\n }\n\n scan() {\n let lastHeadLevel: number | null = null;\n\n this.doc.descendants((node, position) => {\n if (node.type.name === 'heading') {\n // Check whether heading levels fit under the current level\n const { level } = node.attrs;\n\n if (lastHeadLevel != null && level > lastHeadLevel + 1) {\n this.record({\n message: `Heading too small (${level} under ${lastHeadLevel})`,\n from: position + 1,\n to: position + 1 + node.content.size,\n fix: {\n message: '修正する',\n handler: this.fixHeader(lastHeadLevel + 1),\n },\n });\n }\n lastHeadLevel = level;\n }\n });\n\n return this;\n }\n}\n","import { EditorView } from '@tiptap/pm/view';\nimport {\n WysiwygLinterPlugin,\n WysiwygLinterResult as Issue,\n} from '../LinterPlugin';\n\nexport class WysiwygLinterPunctuation extends WysiwygLinterPlugin {\n public regex = / ([,.!?:]) ?/g;\n\n fix(replacement: any) {\n return function ({ state, dispatch }: EditorView, issue: Issue) {\n dispatch(\n state.tr.replaceWith(\n issue.from,\n issue.to,\n state.schema.text(replacement),\n ),\n );\n };\n }\n\n scan() {\n this.doc.descendants((node, position) => {\n if (!node.isText) {\n return;\n }\n\n if (!node.text) {\n return;\n }\n\n const matches = this.regex.exec(node.text);\n\n if (matches) {\n this.record({\n message: 'Suspicious spacing around punctuation',\n from: position + matches.index,\n to: position + matches.index + matches[0].length,\n fix: {\n message: 'Fix it!!!',\n handler: this.fix(`${matches[1]} `),\n },\n });\n }\n });\n\n return this;\n }\n}\n","import { Extension } from '@tiptap/vue-3';\nimport '@tiptap/extension-text-style';\n\nexport type WysiwygColorOptions = {\n types: string[];\n};\n\ndeclare module '@tiptap/vue-3' {\n interface Commands<ReturnType> {\n color: {\n /**\n * Set the text color\n */\n setColor: (color: string) => ReturnType;\n /**\n * Unset the text color\n */\n unsetColor: () => ReturnType;\n };\n }\n}\n\nexport const WysiwygColorExtension = Extension.create<WysiwygColorOptions>({\n name: 'color',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n color: {\n default: null,\n parseHTML: (element) => element.style.color.replace(/['\"]+/g, ''),\n renderHTML: (attributes) => {\n if (!attributes.color) {\n return {};\n }\n\n return {\n style: `color: ${attributes.color}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setColor:\n (color) =>\n ({ chain }) => {\n return chain().setMark('textStyle', { color }).run();\n },\n unsetColor:\n () =>\n ({ chain }) => {\n return chain()\n .setMark('textStyle', { color: null })\n .removeEmptyTextStyle()\n .run();\n },\n };\n },\n});\n","import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { BulletList, BulletListOptions } from '@tiptap/extension-bullet-list';\n\nexport const WysiwygBulletListTool: WysiwygEditorToolFactory<\n BulletListOptions\n> = (vui, options) => {\n const tool: WysiwygEditorTool = {\n key: 'bulletList',\n icon: vui.icon('editorformatListBulleted'),\n active: ({ editor }) => editor.isActive('bulletList'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleBulletList().run();\n },\n floating: true,\n extensions: [BulletList.configure(options)],\n };\n return tool;\n};\n","import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { Bold, BoldOptions } from '@tiptap/extension-bold';\n\nexport const WysiwygFormatBoldTool: WysiwygEditorToolFactory<BoldOptions> = (\n vui,\n options,\n) => {\n const tool: WysiwygEditorTool = {\n key: 'formatBold',\n icon: vui.icon('editorformatBold'),\n active: ({ editor }) => editor.isActive('bold'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleBold().run();\n },\n floating: true,\n extensions: [Bold.configure(options)],\n };\n return tool;\n};\n","import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { Italic, ItalicOptions } from '@tiptap/extension-italic';\n\nexport const WysiwygFormatItalicTool: WysiwygEditorToolFactory<\n ItalicOptions\n> = (vui, options) => {\n const tool: WysiwygEditorTool = {\n key: 'formatItalic',\n icon: vui.icon('editorformatItalic'),\n active: ({ editor }) => editor.isActive('italic'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleItalic().run();\n },\n floating: true,\n extensions: [Italic.configure(options)],\n };\n return tool;\n};\n","import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { Underline, UnderlineOptions } from '@tiptap/extension-underline';\n\nexport const WysiwygFormatUnderlineTool: WysiwygEditorToolFactory<\n UnderlineOptions\n> = (vui, options) => {\n const tool: WysiwygEditorTool = {\n key: 'formatUnderline',\n icon: vui.icon('editorformatUnderline'),\n active: ({ editor }) => editor.isActive('underline'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleUnderline().run();\n },\n floating: true,\n extensions: [Underline.configure(options)],\n };\n return tool;\n};\n","import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { History, HistoryOptions } from '@tiptap/extension-history';\n\nexport const WysiwygHistoryTool: WysiwygEditorToolFactory<HistoryOptions> = (\n vui,\n options,\n) => {\n const undo: WysiwygEditorTool = {\n key: 'history-undo',\n icon: vui.icon('editorUndo'),\n disabled: ({ editor }) => !editor.can().undo(),\n onClick: ({ editor }) => {\n editor.chain().focus().undo().run();\n },\n extensions: [History.configure(options)],\n };\n const redo: WysiwygEditorTool = {\n key: 'history-redo',\n icon: vui.icon('editorRedo'),\n disabled: ({ editor }) => !editor.can().redo(),\n onClick: ({ editor }) => {\n editor.chain().focus().redo().run();\n },\n };\n return [undo, redo];\n};\n","import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport { Link, LinkOptions } from '@tiptap/extension-link';\nimport { validateIf, url } from '@fastkit/vui';\n\nexport const WysiwygLinkTool: WysiwygEditorToolFactory<LinkOptions> = (\n vui,\n options,\n) => {\n const tool: WysiwygEditorTool = {\n key: 'link',\n // icon: ({ editor }) => {\n // return vui.icon(editor.isActive('link') ? 'editorLinkOff' : 'editorLink');\n // },\n icon: vui.icon('editorLink'),\n active: ({ editor }) => editor.isActive('link'),\n // disabled: ({ editor }) => {\n // const { $from, $to } = editor.view.state.selection;\n // return $to.pos - $from.pos === 0;\n // },\n onClick: async ({ vui, editor }) => {\n const { href = '' } = editor.getAttributes('link');\n const result = await vui.prompt({\n input: {\n label: 'Link URL',\n rules: [validateIf, url],\n initialValue: href,\n size: 'sm',\n autofocus: true,\n },\n });\n\n if (result === undefined || result === false) {\n return;\n }\n\n const range = editor.chain().focus().extendMarkRange('link');\n\n if (!result) {\n range.unsetLink().run();\n } else {\n range\n .setLink({\n href: result,\n })\n .run();\n }\n },\n floating: true,\n extensions: [\n Link.configure({\n openOnClick: false,\n ...options,\n }),\n ],\n };\n return tool;\n};\n","import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';\nimport {\n OrderedList,\n OrderedListOptions,\n} from '@tiptap/extension-ordered-list';\n\nexport const WysiwygOrderedListTool: WysiwygEditorToolFactory<\n OrderedListOptions\n> = (vui, options) => {\n const tool: WysiwygEditorTool = {\n key: 'orderedList',\n icon: vui.icon('editorformatListNumbered'),\n active: ({ editor }) => editor.isActive('orderedList'),\n onClick: ({ editor }) => {\n editor.chain().focus().toggleOrderedList().run();\n },\n floating: true,\n extensions: [OrderedList.configure(options)],\n };\n return tool;\n};\n","import { createVNode as _createVNode } from \"vue\";\nimport './color.scss';\nimport { WysiwygColorExtension } from '../extensions';\nimport { VIcon } from '@fastkit/vui';\nimport TextStyle from '@tiptap/extension-text-style';\nexport function createWysiwygColorTool(opts) {\n const WysiwygColorTool = vui => {\n const tool = {\n key: 'textColor',\n // active: ({ editor }) => editor.isActive('textStyle'),\n icon: ({\n editor\n }) => () => {\n const color = editor.getAttributes('textStyle').color;\n const style = {\n color\n };\n return _createVNode(\"span\", {\n \"class\": \"v-wysiwyg-color-tool__button\"\n }, [_createVNode(VIcon, {\n \"class\": \"v-wysiwyg-color-tool__button__icon\",\n \"name\": vui.icon('editorTextColor')\n }, null), _createVNode(\"span\", {\n \"class\": \"v-wysiwyg-color-tool__button__bar\",\n \"style\": style\n }, null)]);\n },\n onClick: (ctx, ev) => {\n ctx.vui.menu({\n class: 'v-wysiwyg-color-tool__menu',\n activator: ev,\n content: stack => _createVNode(\"div\", {\n \"class\": ['v-wysiwyg-color-tool__items', {\n 'v-wysiwyg-color-tool__items--with-label': opts.withLabel\n }]\n }, [opts.items.map((item, index) => _createVNode(\"button\", {\n \"key\": item.key == null ? index : item.key,\n \"class\": \"v-wysiwyg-color-tool__item\",\n \"type\": \"button\",\n \"onClick\": () => {\n const {\n color\n } = item;\n let command = ctx.editor.chain().focus();\n if (color) {\n command = command.setColor(color);\n } else {\n command = command.unsetColor();\n }\n command.run();\n stack.close();\n }\n }, [_createVNode(\"span\", {\n \"class\": \"v-wysiwyg-color-tool__item__color\",\n \"style\": item.color ? {\n color: item.color\n } : {}\n }, null), opts.withLabel && _createVNode(\"span\", {\n \"class\": \"v-wysiwyg-color-tool__item__name\"\n }, [item.name])]))])\n });\n },\n floating: true,\n extensions: [TextStyle, WysiwygColorExtension]\n };\n return tool;\n };\n return WysiwygColorTool;\n}","import { isVNode as _isVNode, createVNode as _createVNode } from \"vue\";\nimport { TextAlign } from '@tiptap/extension-text-align';\nimport { VButtonGroup, VButton } from '@fastkit/vui';\n\n/**\n * A list of available options for the text align attribute.\n * @remarks\n * `\"justify\"` has not yet been adopted because of ambiguity in browser support.\n */\nfunction _isSlot(s) {\n return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);\n}\nexport const WYSIWYG_TEXT_ALIGN_VALUES = ['left', 'center', 'right'\n// 'justify',\n];\n\n/** Text align value */\n\n/**\n * A list of nodes where the text align attribute should be applied to.\n */\nconst DEFAULT_TYPES = ['heading', 'paragraph'];\nconst conditions = WYSIWYG_TEXT_ALIGN_VALUES.map(value => {\n return [value, {\n textAlign: value\n }];\n});\nconst ICON_AT = {\n left: 'editorAlignLeft',\n center: 'editorAlignCenter',\n right: 'editorAlignRight'\n};\nfunction resolveOptions(rawOptions) {\n const types = rawOptions?.types || DEFAULT_TYPES.slice();\n const alignments = rawOptions?.alignments || WYSIWYG_TEXT_ALIGN_VALUES.slice();\n const defaultAlignment = rawOptions?.defaultAlignment || 'left';\n return {\n types,\n alignments,\n defaultAlignment\n };\n}\nfunction getCurrentAlign(editor, options) {\n for (const [align, condition] of conditions) {\n if (editor.isActive(condition)) return align;\n }\n return options.defaultAlignment;\n}\nexport const WysiwygTextAlignTool = (vui, options) => {\n const resolvedOptions = resolveOptions(options);\n const {\n alignments\n } = resolvedOptions;\n const getIcon = value => {\n const iconKey = ICON_AT[value];\n const icon = vui.icon(iconKey);\n if (icon === '$empty' || typeof icon === 'function') return;\n return icon;\n };\n const variant = vui.setting('plainVariant');\n const toolButtonActiveColor = vui.setting('primaryScope');\n const tool = {\n key: 'textAlign',\n icon: ({\n editor\n }) => {\n return getIcon(getCurrentAlign(editor, resolvedOptions));\n },\n onClick: async ({\n vui,\n editor\n }, ev) => {\n vui.menu({\n distance: 0,\n activator: ev,\n content: menu => {\n let _slot;\n return _createVNode(VButtonGroup, {\n \"variant\": variant\n }, _isSlot(_slot = alignments.map(value => {\n const isActive = editor.isActive({\n textAlign: value\n });\n return _createVNode(VButton, {\n \"tabindex\": -1,\n \"color\": isActive ? toolButtonActiveColor : undefined,\n \"key\": value,\n \"icon\": getIcon(value),\n \"onClick\": ev => {\n editor.chain().focus().setTextAlign(value).run();\n }\n }, null);\n })) ? _slot : {\n default: () => [_slot]\n });\n }\n });\n },\n floating: true,\n extensions: [TextAlign.configure(resolvedOptions)]\n };\n return tool;\n};","import { resolveDirective as _resolveDirective, mergeProps as _mergeProps, createVNode as _createVNode, isVNode as _isVNode } from \"vue\";\nimport './VWysiwygEditor.scss';\nimport { defineComponent, computed, ref, watch, onBeforeUnmount } from 'vue';\nimport { createFormControlProps, VFormControl, VControlField, createControlFieldProps, createTextableProps, createTextableEmits, TextableControl, createControlProps, useControl, createControlFieldProviderProps, useControlField, VTextCounter, defineSlotsProps, useVui, VButton, VButtonGroup } from '@fastkit/vui';\nimport { VUI_WYSIWYG_EDITOR_SYMBOL } from '../../injections';\nimport { EditorContent, useEditor, BubbleMenu } from '@tiptap/vue-3';\nimport { StarterKit } from '@tiptap/starter-kit';\nimport { resolveRawWysiwygExtensions, resolveRawWysiwygEditorTools,\n// EditorEventsOptions,\nWysiwygEditorInitializeContext } from '../../schemes';\nfunction _isSlot(s) {\n return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);\n}\nexport const VWysiwygEditor = defineComponent({\n name: 'VWysiwygEditor',\n props: {\n ...createTextableProps(),\n ...createFormControlProps(),\n ...createControlFieldProps(),\n ...createControlFieldProviderProps(),\n ...createControlProps(),\n ...defineSlotsProps(),\n extensions: {\n type: Array,\n default: () => []\n },\n tools: {\n type: Array,\n default: () => []\n },\n floatingToolbar: Boolean,\n disabledMinHeight: Boolean,\n disabledMaxHeight: Boolean\n },\n emits: {\n ...createTextableEmits()\n },\n setup(props, ctx) {\n const vui = useVui();\n const textRef = ref('');\n const toolButtonActiveColor = vui.setting('primaryScope');\n const wysiwygSettings = computed(() => resolveRawWysiwygEditorTools(props.tools, vui));\n const control = useControl(props);\n useControlField(props);\n const inputControl = new TextableControl(props, ctx, {\n nodeType: VUI_WYSIWYG_EDITOR_SYMBOL,\n validationValue: () => textRef.value\n });\n const initializeCtx = new WysiwygEditorInitializeContext(() => vui, {\n onCreate: ({\n editor\n }) => {\n textRef.value = editor.getText();\n updateEditable();\n },\n onFocus: ({\n event\n }) => {\n inputControl.focusHandler(event);\n },\n onBlur: ({\n event\n }) => {\n inputControl.blurHandler(event);\n },\n onUpdate: ({\n editor\n }) => {\n inputControl.value = editor.getHTML();\n textRef.value = editor.getText();\n }\n });\n const extensions = [StarterKit.configure({\n bold: false,\n bulletList: false,\n orderedList: false,\n history: false,\n italic: false\n }),\n // Linter.configure({\n // plugins: [BadWords(['abc', 'evidently']), Punctuation, HeadingLevel],\n // }),\n ...resolveRawWysiwygExtensions(props.extensions, initializeCtx), ...wysiwygSettings.value.extensions];\n const updateEditable = () => {\n if (!editor.value) return;\n editor.value.setEditable(inputControl.canOperation);\n };\n watch(() => inputControl.canOperation, updateEditable);\n watch(() => props.modelValue, modelValue => {\n const $editor = editor.value;\n if (!$editor || $editor.getHTML() === modelValue) return;\n $editor.commands.setContent(modelValue == null ? '' : modelValue, false);\n textRef.value = $editor.getText();\n });\n initializeCtx.on('create', ({\n editor\n }) => {\n textRef.value = editor.getText();\n updateEditable();\n });\n const editor = useEditor({\n ...initializeCtx.editorOptions(),\n autofocus: props.autofocus,\n content: props.modelValue,\n extensions,\n editorProps: {\n attributes: {\n class: 'v-wysiwyg-editor__input__prose'\n }\n }\n });\n\n // editor.value.state.doc.content\n\n const focus = (position, options) => {\n if (!editor.value) return;\n return editor.value.chain().focus(position, options);\n };\n const blur = () => {\n if (!editor.value) return;\n return editor.value.chain().blur();\n };\n const wysiwygContext = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const _editor = editor.value;\n // if (!_editor) {\n // throw new Error('missing editor value');\n // }\n return {\n vui,\n editor: _editor\n };\n });\n const createTools = (bubbleMenu = false) => {\n let _slot;\n const {\n value: settings\n } = wysiwygSettings;\n const {\n value: context\n } = wysiwygContext;\n const tools = bubbleMenu ? settings.tools.filter(t => !!t.floating) : settings.tools;\n const _editor = editor.value;\n const variant = vui.setting(bubbleMenu ? 'containedVariant' : 'plainVariant');\n return _createVNode(VButtonGroup, {\n \"class\": ['v-wysiwyg-editor__toolbar', {\n 'v-wysiwyg-editor__floating-toolbar': props.floatingToolbar\n }],\n \"variant\": variant\n }, _isSlot(_slot = tools.map(({\n key,\n icon,\n onClick,\n disabled,\n active\n }) => {\n const isActive = !!_editor && resolveContextableValue(context, active);\n const isDisabled = !inputControl.canOperation || !!_editor && resolveContextableValue(context, disabled);\n let iconName;\n let child;\n if (typeof icon === 'function') {\n if (_editor) {\n const _child = icon(context);\n if (typeof _child === 'function') {\n child = _child();\n } else {\n iconName = _child;\n }\n }\n } else {\n iconName = icon;\n }\n if (!iconName && child == null) return;\n return _createVNode(VButton, {\n \"tabindex\": -1,\n \"key\": key,\n \"icon\": iconName,\n \"onClick\": ev => onClick(context, ev),\n \"color\": isActive ? toolButtonActiveColor : undefined,\n \"disabled\": isDisabled\n }, _isSlot(child) ? child : {\n default: () => [child]\n });\n })) ? _slot : {\n default: () => [_slot]\n });\n };\n onBeforeUnmount(() => {\n editor.value && editor.value.destroy();\n });\n return {\n editor,\n ...inputControl.expose(),\n ...control,\n focus,\n blur,\n createTools\n };\n },\n render() {\n return _createVNode(VFormControl, {\n \"nodeControl\": this.nodeControl,\n \"focused\": this.nodeControl.focused,\n \"class\": ['v-wysiwyg-editor', this.classes, `v-wysiwyg-editor--${this.size}`, {\n 'v-wysiwyg-editor--disabled-min-heihgt': this.disabledMinHeight,\n 'v-wysiwyg-editor--disabled-max-heihgt': this.disabledMaxHeight\n }],\n \"label\": this.label,\n \"hint\": this.hint,\n \"hinttip\": this.hinttip,\n \"hiddenInfo\": this.hiddenInfo,\n \"requiredChip\": this.requiredChip,\n \"onClickLabel\": ev => {\n this.focus('start', {\n scrollIntoView: true\n });\n }\n }, {\n ...this.$slots,\n default: () => {\n const {\n editor\n } = this;\n return _createVNode(\"div\", {\n \"class\": \"v-wysiwyg-editor__wrapper\"\n }, [!this.isReadonly && this.createTools(), _createVNode(VControlField, {\n \"class\": \"v-wysiwyg-editor__input\",\n \"autoHeight\": true,\n \"startAdornment\": this.startAdornment,\n \"endAdornment\": this.endAdornment,\n \"size\": this.size\n }, {\n ...this.$slots,\n default: () => {\n let _slot2;\n return _createVNode(\"div\", {\n \"class\": \"v-wysiwyg-editor__body\"\n }, [_createVNode(EditorContent, _mergeProps({\n class: 'v-wysiwyg-editor__input__element wysiwyg'\n }, {\n \"editor\": editor\n }), null), !this.floatingToolbar && !!editor && !this.isReadonly && _createVNode(BubbleMenu, _mergeProps({\n class: 'v-wysiwyg-editor__bubble-menu'\n }, {\n \"editor\": editor\n }), _isSlot(_slot2 = this.createTools(true)) ? _slot2 : {\n default: () => [_slot2]\n })]);\n }\n })]);\n },\n infoAppends: () => {\n const {\n counterResult\n } = this;\n if (!counterResult) return;\n return _createVNode(VTextCounter, counterResult, null);\n }\n });\n }\n});\nfunction resolveContextableValue(ctx, source) {\n return typeof source === 'function' ? source(ctx) : source;\n}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fastkit/vui-wysiwyg",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "vui-wysiwyg",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"repository": {
|
|
@@ -145,6 +145,12 @@
|
|
|
145
145
|
"default": "./dist/tiptap/extensions/text-style.mjs"
|
|
146
146
|
}
|
|
147
147
|
},
|
|
148
|
+
"./tiptap/extensions/text-align": {
|
|
149
|
+
"types": "./dist/tiptap/extensions/text-align.d.ts",
|
|
150
|
+
"import": {
|
|
151
|
+
"default": "./dist/tiptap/extensions/text-align.mjs"
|
|
152
|
+
}
|
|
153
|
+
},
|
|
148
154
|
"./tiptap/extensions/ordered-list": {
|
|
149
155
|
"types": "./dist/tiptap/extensions/ordered-list.d.ts",
|
|
150
156
|
"import": {
|
|
@@ -253,6 +259,9 @@
|
|
|
253
259
|
"tiptap/extensions/text-style": [
|
|
254
260
|
"./dist/tiptap/extensions/text-style.d.ts"
|
|
255
261
|
],
|
|
262
|
+
"tiptap/extensions/text-align": [
|
|
263
|
+
"./dist/tiptap/extensions/text-align.d.ts"
|
|
264
|
+
],
|
|
256
265
|
"tiptap/extensions/ordered-list": [
|
|
257
266
|
"./dist/tiptap/extensions/ordered-list.d.ts"
|
|
258
267
|
],
|
|
@@ -277,24 +286,25 @@
|
|
|
277
286
|
"dist"
|
|
278
287
|
],
|
|
279
288
|
"dependencies": {
|
|
280
|
-
"@tiptap/extension-bold": "^2.0.
|
|
281
|
-
"@tiptap/extension-bullet-list": "^2.0.
|
|
282
|
-
"@tiptap/extension-history": "^2.0.
|
|
283
|
-
"@tiptap/extension-italic": "^2.0.
|
|
284
|
-
"@tiptap/extension-link": "^2.0.
|
|
285
|
-
"@tiptap/extension-ordered-list": "^2.0.
|
|
286
|
-
"@tiptap/extension-text-
|
|
287
|
-
"@tiptap/extension-
|
|
288
|
-
"@tiptap/
|
|
289
|
-
"@tiptap/
|
|
290
|
-
"@tiptap/
|
|
289
|
+
"@tiptap/extension-bold": "^2.0.3",
|
|
290
|
+
"@tiptap/extension-bullet-list": "^2.0.3",
|
|
291
|
+
"@tiptap/extension-history": "^2.0.3",
|
|
292
|
+
"@tiptap/extension-italic": "^2.0.3",
|
|
293
|
+
"@tiptap/extension-link": "^2.0.3",
|
|
294
|
+
"@tiptap/extension-ordered-list": "^2.0.3",
|
|
295
|
+
"@tiptap/extension-text-align": "^2.0.3",
|
|
296
|
+
"@tiptap/extension-text-style": "^2.0.3",
|
|
297
|
+
"@tiptap/extension-underline": "^2.0.3",
|
|
298
|
+
"@tiptap/pm": "^2.0.3",
|
|
299
|
+
"@tiptap/starter-kit": "^2.0.3",
|
|
300
|
+
"@tiptap/vue-3": "^2.0.3"
|
|
291
301
|
},
|
|
292
302
|
"devDependencies": {
|
|
293
|
-
"@fastkit/vui": "0.13.
|
|
303
|
+
"@fastkit/vui": "0.13.1"
|
|
294
304
|
},
|
|
295
305
|
"peerDependencies": {
|
|
296
306
|
"vue": "^3.2.0",
|
|
297
|
-
"@fastkit/vui": "0.13.
|
|
307
|
+
"@fastkit/vui": "0.13.1"
|
|
298
308
|
},
|
|
299
309
|
"scripts": {
|
|
300
310
|
"build": "plugboy build",
|