@zipify/wysiwyg 2.0.0-8 → 2.0.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/config/build/cli.config.js +2 -0
- package/dist/cli.js +1 -1
- package/dist/wysiwyg.css +9 -9
- package/dist/wysiwyg.mjs +199 -223
- package/lib/Wysiwyg.vue +3 -2
- package/lib/assets/icons/indicator.svg +1 -1
- package/lib/cli/commands/Command.js +5 -0
- package/lib/cli/commands/ToJsonCommand.js +16 -6
- package/lib/cli/commands/VersionCommand.js +11 -0
- package/lib/cli/commands/index.js +1 -0
- package/lib/components/toolbar/controls/AlignmentControl.vue +1 -1
- package/lib/components/toolbar/controls/FontColorControl.vue +1 -1
- package/lib/components/toolbar/controls/FontFamilyControl.vue +1 -1
- package/lib/components/toolbar/controls/FontSizeControl.vue +1 -1
- package/lib/components/toolbar/controls/FontWeightControl.vue +1 -1
- package/lib/components/toolbar/controls/ItalicControl.vue +1 -1
- package/lib/components/toolbar/controls/LineHeightControl.vue +1 -1
- package/lib/composables/__tests__/useEditor.test.js +1 -1
- package/lib/composables/useEditor.js +9 -8
- package/lib/entry-cli.js +3 -2
- package/lib/entry-lib.js +1 -1
- package/lib/extensions/StylePreset.js +2 -1
- package/lib/extensions/Superscript.js +25 -12
- package/lib/extensions/__tests__/StylePreset.test.js +4 -4
- package/lib/extensions/__tests__/__snapshots__/Superscript.test.js.snap +5 -5
- package/lib/extensions/core/NodeProcessor.js +0 -4
- package/lib/extensions/core/index.js +14 -7
- package/lib/extensions/core/plugins/PastePlugin.js +4 -0
- package/lib/extensions/core/plugins/PlaceholderPlugin.js +30 -0
- package/lib/extensions/core/plugins/ProseMirrorPlugin.js +4 -3
- package/lib/extensions/core/plugins/index.js +1 -0
- package/lib/extensions/index.js +2 -1
- package/lib/extensions/list/List.js +7 -4
- package/lib/extensions/list/ListItem.js +35 -4
- package/lib/styles/content.css +1 -1
- package/package.json +10 -3
- package/lib/extensions/core/CopyPasteProcessor.js +0 -10
package/dist/wysiwyg.mjs
CHANGED
|
@@ -26,7 +26,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
26
26
|
__accessCheck(obj, member, "access private method");
|
|
27
27
|
return method;
|
|
28
28
|
};
|
|
29
|
-
var _domParser, _parser, _NodeFilter, NodeFilter_get, _Node, Node_get, _removeComments, removeComments_fn, _normalizeRootTags, normalizeRootTags_fn, _createNodeIterator, createNodeIterator_fn, _iterateNodes, iterateNodes_fn, _runIterator, runIterator_fn, _removeEmptyNodes, removeEmptyNodes_fn, _normalizeListItems, normalizeListItems_fn, _isBlockNode, isBlockNode_fn, _isRootNode, isRootNode_fn, _assignElementProperties, assignElementProperties_fn, _removeStyleProperties, removeStyleProperties_fn, _normalizeBreakLines, normalizeBreakLines_fn, _normalizeBlockTextDecoration, normalizeBlockTextDecoration_fn, _moveTextDecorationToChildren, moveTextDecorationToChildren_fn, _parseTextDecoration, parseTextDecoration_fn, _normalizeBlockBackgroundColor, normalizeBlockBackgroundColor_fn, _moveBackgroundColorToChildren, moveBackgroundColorToChildren_fn, _wrapTextNode, wrapTextNode_fn, _iterateNodes2, iterateNodes_fn2, _iterateChildNodes, iterateChildNodes_fn, _bubbleMarks, bubbleMarks_fn, _canBubbleMark, canBubbleMark_fn, _includesMark, includesMark_fn, _includesMarkType, includesMarkType_fn, _removeMark, removeMark_fn, _addMark, addMark_fn, _findMarkIndexByType, findMarkIndexByType_fn, _buildHtml, buildHtml_fn, _buildJson, buildJson_fn, _textBlock, textBlock_fn, _normalizeTextBlockArgs, normalizeTextBlockArgs_fn;
|
|
29
|
+
var _domParser, _parser, _NodeFilter, NodeFilter_get, _Node, Node_get, _removeComments, removeComments_fn, _normalizeRootTags, normalizeRootTags_fn, _createNodeIterator, createNodeIterator_fn, _iterateNodes, iterateNodes_fn, _runIterator, runIterator_fn, _removeEmptyNodes, removeEmptyNodes_fn, _normalizeListItems, normalizeListItems_fn, _isBlockNode, isBlockNode_fn, _isRootNode, isRootNode_fn, _assignElementProperties, assignElementProperties_fn, _removeStyleProperties, removeStyleProperties_fn, _normalizeBreakLines, normalizeBreakLines_fn, _normalizeBlockTextDecoration, normalizeBlockTextDecoration_fn, _moveTextDecorationToChildren, moveTextDecorationToChildren_fn, _parseTextDecoration, parseTextDecoration_fn, _normalizeBlockBackgroundColor, normalizeBlockBackgroundColor_fn, _moveBackgroundColorToChildren, moveBackgroundColorToChildren_fn, _wrapTextNode, wrapTextNode_fn, _iterateNodes2, iterateNodes_fn2, _iterateChildNodes, iterateChildNodes_fn, _bubbleMarks, bubbleMarks_fn, _canBubbleMark, canBubbleMark_fn, _includesMark, includesMark_fn, _includesMarkType, includesMarkType_fn, _removeMark, removeMark_fn, _addMark, addMark_fn, _findMarkIndexByType, findMarkIndexByType_fn, _buildHtml, buildHtml_fn, _buildJson, buildJson_fn, _textBlock, textBlock_fn, _normalizeTextBlockArgs, normalizeTextBlockArgs_fn, _buildDecorations, buildDecorations_fn;
|
|
30
30
|
import { computed, ref, watch, inject, onUnmounted, nextTick, provide, onMounted, toRef, unref, reactive } from "vue";
|
|
31
31
|
import { ColorModel, ZipifyColorPicker } from "@zipify/colorpicker";
|
|
32
32
|
function OrderedMap(content) {
|
|
@@ -14427,7 +14427,7 @@ const __vite_glob_0_4 = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" sty
|
|
|
14427
14427
|
const __vite_glob_0_5 = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" style="width:var(--zw-icon-width);height:var(--zw-icon-height)" viewBox="0 0 28 28">\n <path fill="#fff" stroke="#B3B3B3" d="M4.5 4.5h19v19h-19z"/>\n <path fill="#3B3B3B" d="M26 20.7a2.51 2.51 0 0 1-5 0c0-1.31 2.5-4.7 2.5-4.7s2.5 3.39 2.5 4.7Z"/>\n <path fill="#3B3B3B" fill-rule="evenodd" d="M19.64 19.93h-1.715a.75.75 0 0 1-.475-.145.82.82 0 0 1-.268-.359l-.89-2.433h-4.943l-.89 2.433a.78.78 0 0 1-.26.347.73.73 0 0 1-.475.157H8L12.686 8h2.269l4.686 11.93Zm-7.721-4.505h3.803l-1.452-3.968a18.048 18.048 0 0 1-.219-.623c-.08-.24-.158-.5-.235-.78-.077.28-.152.542-.227.784a8.742 8.742 0 0 1-.218.635l-1.452 3.952Z" clip-rule="evenodd"/>\n</svg>\n';
|
|
14428
14428
|
const __vite_glob_0_6 = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" style="width:var(--zw-icon-width);height:var(--zw-icon-height)" viewBox="0 0 28 28">\n <path fill="var(--zw-icon-foreground)" fill-rule="evenodd" d="M16.64 19.93h-1.715a.75.75 0 0 1-.475-.145.82.82 0 0 1-.268-.359l-.89-2.433H8.35l-.891 2.433a.78.78 0 0 1-.26.347.73.73 0 0 1-.475.157H5L9.686 8h2.269l4.686 11.93Zm-7.72-4.505h3.803l-1.452-3.968a18.048 18.048 0 0 1-.219-.623c-.08-.24-.158-.5-.235-.78-.077.28-.152.542-.227.784a8.742 8.742 0 0 1-.218.635L8.92 15.425Zm14.968 4.505h-.915a.987.987 0 0 1-.454-.087c-.11-.058-.192-.175-.248-.35l-.181-.603a7.005 7.005 0 0 1-.631.507c-.206.146-.42.269-.64.368a3.26 3.26 0 0 1-.7.222c-.248.05-.523.075-.826.075-.357 0-.687-.049-.99-.145a2.134 2.134 0 0 1-.78-.433 1.967 1.967 0 0 1-.507-.718 2.545 2.545 0 0 1-.181-.998c0-.319.084-.634.251-.945.168-.31.447-.59.838-.841.39-.25.91-.458 1.559-.623.649-.165 1.455-.258 2.417-.28v-.495c0-.567-.12-.986-.359-1.259-.239-.272-.587-.408-1.043-.408-.33 0-.605.039-.825.116a3.17 3.17 0 0 0-.574.26 25.11 25.11 0 0 1-.45.26.912.912 0 0 1-.453.115.59.59 0 0 1-.355-.107.843.843 0 0 1-.239-.264l-.371-.652c.973-.891 2.148-1.337 3.523-1.337.494 0 .936.081 1.324.244.387.162.716.387.985.676.27.289.475.634.615 1.036.14.401.21.841.21 1.32v5.346Zm-3.96-1.271c.21 0 .402-.02.578-.058.176-.038.342-.096.5-.173.156-.077.307-.172.453-.285a4.13 4.13 0 0 0 .441-.4v-1.427c-.594.027-1.09.078-1.489.153a3.967 3.967 0 0 0-.961.284c-.242.116-.414.25-.516.404a.894.894 0 0 0-.152.504c0 .357.106.613.317.767.212.154.489.231.83.231Z" clip-rule="evenodd"/>\n</svg>\n';
|
|
14429
14429
|
const __vite_glob_0_7 = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" style="width:var(--zw-icon-width);height:var(--zw-icon-height)" viewBox="0 0 28 28">\n <path fill="var(--zw-icon-foreground)" fill-rule="evenodd" d="M22 20.62a2.42 2.42 0 0 1-4.84 0c0-1.25 2.42-4.54 2.42-4.54S22 19.37 22 20.62ZM9.92 15.425l1.452-3.951c.071-.182.145-.394.219-.636.074-.242.149-.503.226-.783a17.223 17.223 0 0 0 .454 1.402l1.452 3.968H9.919Zm5.411 4.199c.226-.795.658-1.684 1.184-2.562L12.955 8h-2.269L6 19.93h1.725a.736.736 0 0 0 .474-.157.792.792 0 0 0 .26-.347l.891-2.434h4.941l.891 2.434c.031.079.097.134.148.198Z" clip-rule="evenodd"/>\n</svg>\n';
|
|
14430
|
-
const __vite_glob_0_8 = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 9 9">\n <path fill="#FFAB00" d="M0 4.5a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0Z"/>\n <path fill="#fff" fill-rule="evenodd" d="M5.063 2.25H3.938v3.375h1.124V2.25Zm-1.125 4.5a.562.562 0 1 1 1.123-.001.562.562 0 0 1-1.123.001Z" clip-rule="evenodd"/>\n</svg>\n';
|
|
14430
|
+
const __vite_glob_0_8 = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" style="width:var(--zw-icon-width);height:var(--zw-icon-height)" viewBox="0 0 9 9">\n <path fill="#FFAB00" d="M0 4.5a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0Z"/>\n <path fill="#fff" fill-rule="evenodd" d="M5.063 2.25H3.938v3.375h1.124V2.25Zm-1.125 4.5a.562.562 0 1 1 1.123-.001.562.562 0 0 1-1.123.001Z" clip-rule="evenodd"/>\n</svg>\n';
|
|
14431
14431
|
const __vite_glob_0_9 = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" style="width:var(--zw-icon-width);height:var(--zw-icon-height)" viewBox="0 0 28 28">\n <path fill="var(--zw-icon-foreground)" d="M18 9V7h-7v2h2.64l-1.22 10H10v2h7v-2h-2.83L15.4 9H18Z"/>\n</svg>\n';
|
|
14432
14432
|
const __vite_glob_0_10 = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" style="width:var(--zw-icon-width);height:var(--zw-icon-height)" viewBox="0 0 28 28">\n <path fill="var(--zw-icon-foreground)" fill-rule="evenodd" d="m5 10 3-3 3 3H9v8h2l-3 3-3-3h2v-8H5Zm8-3h10v2H13V7Zm10 6H13v2h10v-2Zm0 6H13v2h10v-2Z" clip-rule="evenodd"/>\n</svg>\n';
|
|
14433
14433
|
const __vite_glob_0_11 = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" style="width:var(--zw-icon-width);height:var(--zw-icon-height)" viewBox="0 0 28 28">\n <path fill="var(--zw-icon-foreground)" fill-rule="evenodd" d="M12 17.5h-2a3.5 3.5 0 1 1 0-7h2V9h-2a5 5 0 0 0 0 10h2v-1.5Zm6-4.5h-8v2h8v-2Zm-2-4h2a5 5 0 0 1 0 10h-2v-1.5h2a3.5 3.5 0 1 0 0-7h-2V9Z" clip-rule="evenodd"/>\n</svg>\n';
|
|
@@ -22401,7 +22401,7 @@ const __vue2_script$n = {
|
|
|
22401
22401
|
return { "--zw-font-family-option": `"${option.id}"` };
|
|
22402
22402
|
}
|
|
22403
22403
|
const currentValue = editor.commands.getFontFamily();
|
|
22404
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
22404
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSettings.FONT_FAMILY);
|
|
22405
22405
|
const apply2 = (fontFamily) => {
|
|
22406
22406
|
recentFontNames.add(fontFamily);
|
|
22407
22407
|
editor.chain().focus().applyFontFamily(fontFamily).run();
|
|
@@ -22422,7 +22422,7 @@ var __component__$n = /* @__PURE__ */ normalizeComponent(
|
|
|
22422
22422
|
staticRenderFns$n,
|
|
22423
22423
|
false,
|
|
22424
22424
|
__vue2_injectStyles$n,
|
|
22425
|
-
"
|
|
22425
|
+
"5f8e49dc",
|
|
22426
22426
|
null,
|
|
22427
22427
|
null
|
|
22428
22428
|
);
|
|
@@ -22474,7 +22474,7 @@ const __vue2_script$m = {
|
|
|
22474
22474
|
const font = editor.commands.getFont();
|
|
22475
22475
|
const options = computed(() => unref(font).weights.map((style2) => ({ id: style2 })));
|
|
22476
22476
|
const currentValue = editor.commands.getFontWeight();
|
|
22477
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
22477
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSettings.FONT_WEIGHT);
|
|
22478
22478
|
const apply2 = (value) => editor.chain().focus().applyFontWeight(value).run();
|
|
22479
22479
|
return {
|
|
22480
22480
|
options,
|
|
@@ -22491,7 +22491,7 @@ var __component__$m = /* @__PURE__ */ normalizeComponent(
|
|
|
22491
22491
|
staticRenderFns$m,
|
|
22492
22492
|
false,
|
|
22493
22493
|
__vue2_injectStyles$m,
|
|
22494
|
-
"
|
|
22494
|
+
"00378d67",
|
|
22495
22495
|
null,
|
|
22496
22496
|
null
|
|
22497
22497
|
);
|
|
@@ -22545,7 +22545,7 @@ const __vue2_script$l = {
|
|
|
22545
22545
|
return fontSizes.map((size2) => ({ id: size2, title: `${size2}px` }));
|
|
22546
22546
|
});
|
|
22547
22547
|
const currentValue = editor.commands.getFontSize();
|
|
22548
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
22548
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSettings.FONT_SIZE);
|
|
22549
22549
|
const apply2 = (value) => editor.chain().focus().applyFontSize(value).run();
|
|
22550
22550
|
return {
|
|
22551
22551
|
options,
|
|
@@ -22562,7 +22562,7 @@ var __component__$l = /* @__PURE__ */ normalizeComponent(
|
|
|
22562
22562
|
staticRenderFns$l,
|
|
22563
22563
|
false,
|
|
22564
22564
|
__vue2_injectStyles$l,
|
|
22565
|
-
"
|
|
22565
|
+
"13bfe2fe",
|
|
22566
22566
|
null,
|
|
22567
22567
|
null
|
|
22568
22568
|
);
|
|
@@ -22646,7 +22646,7 @@ const __vue2_script$k = {
|
|
|
22646
22646
|
setup() {
|
|
22647
22647
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
22648
22648
|
const currentValue = editor.commands.getFontColor();
|
|
22649
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
22649
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSettings.FONT_COLOR);
|
|
22650
22650
|
const apply2 = (color) => editor.chain().applyFontColor(color).run();
|
|
22651
22651
|
return {
|
|
22652
22652
|
currentValue,
|
|
@@ -22816,7 +22816,7 @@ const __vue2_script$i = {
|
|
|
22816
22816
|
setup() {
|
|
22817
22817
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
22818
22818
|
const currentValue = editor.commands.isItalic();
|
|
22819
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
22819
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSettings.FONT_STYLE);
|
|
22820
22820
|
const isAvailable = editor.commands.isItalicAvailable();
|
|
22821
22821
|
const apply2 = () => editor.chain().focus().toggleItalic().run();
|
|
22822
22822
|
return {
|
|
@@ -23239,7 +23239,7 @@ const __vue2_script$d = {
|
|
|
23239
23239
|
setup(_, { emit }) {
|
|
23240
23240
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
23241
23241
|
const currentValue = editor.commands.getAlignment();
|
|
23242
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
23242
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSettings.ALIGNMENT);
|
|
23243
23243
|
function apply2(value) {
|
|
23244
23244
|
editor.chain().focus().applyAlignment(value).run();
|
|
23245
23245
|
emit("applied");
|
|
@@ -23462,7 +23462,7 @@ const __vue2_script$b = {
|
|
|
23462
23462
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
23463
23463
|
const toggler = useModalToggler({ wrapperRef, modalRef });
|
|
23464
23464
|
const currentValue = editor.commands.getLineHeight();
|
|
23465
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
23465
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSettings.LINE_HEIGHT);
|
|
23466
23466
|
const apply2 = (value) => editor.commands.applyLineHeight(String(value));
|
|
23467
23467
|
return {
|
|
23468
23468
|
wrapperRef,
|
|
@@ -23482,7 +23482,7 @@ var __component__$b = /* @__PURE__ */ normalizeComponent(
|
|
|
23482
23482
|
staticRenderFns$b,
|
|
23483
23483
|
false,
|
|
23484
23484
|
__vue2_injectStyles$b,
|
|
23485
|
-
"
|
|
23485
|
+
"2f58c40f",
|
|
23486
23486
|
null,
|
|
23487
23487
|
null
|
|
23488
23488
|
);
|
|
@@ -24477,24 +24477,24 @@ const Toolbar = /* @__PURE__ */ function() {
|
|
|
24477
24477
|
return __component__$1.exports;
|
|
24478
24478
|
}();
|
|
24479
24479
|
function useEditor({ content, onChange, extensions: extensions2, isReadonlyRef }) {
|
|
24480
|
-
|
|
24480
|
+
let editor;
|
|
24481
|
+
const getContent = () => markWysiwygContent(editor.getJSON());
|
|
24482
|
+
editor = reactive(new Editor({
|
|
24481
24483
|
content: ContentNormalizer.normalize(content.value),
|
|
24482
|
-
onUpdate: () => onChange(
|
|
24484
|
+
onUpdate: () => onChange(getContent()),
|
|
24483
24485
|
extensions: extensions2,
|
|
24484
24486
|
injectCSS: false,
|
|
24485
24487
|
editable: !unref(isReadonlyRef)
|
|
24486
24488
|
}));
|
|
24487
24489
|
onUnmounted(() => editor.destroy());
|
|
24488
24490
|
watch(content, (value) => {
|
|
24489
|
-
|
|
24490
|
-
|
|
24491
|
-
|
|
24492
|
-
const content3 = ContentNormalizer.normalize(value);
|
|
24493
|
-
editor.commands.setContent(content3, false);
|
|
24491
|
+
if (JSON.stringify(getContent()) !== JSON.stringify(value)) {
|
|
24492
|
+
const content2 = ContentNormalizer.normalize(value);
|
|
24493
|
+
editor.commands.setContent(content2, false);
|
|
24494
24494
|
}
|
|
24495
24495
|
});
|
|
24496
24496
|
watch(isReadonlyRef, (isReadonly) => editor.setEditable(!isReadonly));
|
|
24497
|
-
return editor;
|
|
24497
|
+
return { editor, getContent };
|
|
24498
24498
|
}
|
|
24499
24499
|
function useToolbar({ wrapperRef, offsets, isActiveRef, placementRef }) {
|
|
24500
24500
|
const wrapperEl = useElementRef(wrapperRef);
|
|
@@ -24721,8 +24721,9 @@ const StylePreset = Extension.create({
|
|
|
24721
24721
|
};
|
|
24722
24722
|
});
|
|
24723
24723
|
}),
|
|
24724
|
-
isSettingCustomized: createCommand(({ commands: commands2 },
|
|
24724
|
+
isSettingCustomized: createCommand(({ commands: commands2 }, name) => {
|
|
24725
24725
|
const customization = commands2.getPresetCustomization();
|
|
24726
|
+
const group = TextSettings.attributes.includes(name) ? "attributes" : "marks";
|
|
24726
24727
|
return computed(() => {
|
|
24727
24728
|
var _a, _b;
|
|
24728
24729
|
return (_b = (_a = unref(customization)[group]) == null ? void 0 : _a.includes(name)) != null ? _b : false;
|
|
@@ -25476,13 +25477,38 @@ const ListItem$1 = Node.create({
|
|
|
25476
25477
|
const ListItem = ListItem$1.extend({
|
|
25477
25478
|
name: NodeTypes.LIST_ITEM,
|
|
25478
25479
|
marks: MarkGroups.SETTINGS,
|
|
25480
|
+
addCommands() {
|
|
25481
|
+
const getItemPosition = ({ selection }) => selection.$cursor.before(selection.$cursor.depth - 1);
|
|
25482
|
+
return {
|
|
25483
|
+
listItemNewline: createCommand(({ commands: commands2, tr }) => {
|
|
25484
|
+
const initialNode = tr.doc.nodeAt(getItemPosition(tr));
|
|
25485
|
+
const isEmptyParagraph = !tr.selection.$cursor.node().textContent;
|
|
25486
|
+
if (isEmptyParagraph)
|
|
25487
|
+
return false;
|
|
25488
|
+
commands2.splitListItem(this.name);
|
|
25489
|
+
const position = getItemPosition(tr);
|
|
25490
|
+
for (const mark of initialNode.marks) {
|
|
25491
|
+
tr.step(new AddNodeMarkStep(position, copyMark(mark)));
|
|
25492
|
+
}
|
|
25493
|
+
return true;
|
|
25494
|
+
})
|
|
25495
|
+
};
|
|
25496
|
+
},
|
|
25479
25497
|
addOptions: () => ({
|
|
25480
25498
|
HTMLAttributes: { class: "zw-style" }
|
|
25481
25499
|
}),
|
|
25482
|
-
addKeyboardShortcuts() {
|
|
25483
|
-
|
|
25484
|
-
|
|
25485
|
-
|
|
25500
|
+
addKeyboardShortcuts: () => ({
|
|
25501
|
+
Enter: (context) => {
|
|
25502
|
+
var _a;
|
|
25503
|
+
const { state, commands: commands2 } = context.editor;
|
|
25504
|
+
const isListSelected = (_a = state.selection.$cursor) == null ? void 0 : _a.path.some((node) => {
|
|
25505
|
+
var _a2;
|
|
25506
|
+
return ((_a2 = node.type) == null ? void 0 : _a2.name) === NodeTypes.LIST;
|
|
25507
|
+
});
|
|
25508
|
+
if (isListSelected)
|
|
25509
|
+
return commands2.listItemNewline();
|
|
25510
|
+
}
|
|
25511
|
+
})
|
|
25486
25512
|
});
|
|
25487
25513
|
const List = Node.create({
|
|
25488
25514
|
name: NodeTypes.LIST,
|
|
@@ -25493,7 +25519,8 @@ const List = Node.create({
|
|
|
25493
25519
|
ListItem
|
|
25494
25520
|
],
|
|
25495
25521
|
addOptions: () => ({
|
|
25496
|
-
baseClass: ""
|
|
25522
|
+
baseClass: "",
|
|
25523
|
+
presetClass: ""
|
|
25497
25524
|
}),
|
|
25498
25525
|
addAttributes: () => ({
|
|
25499
25526
|
bullet: {
|
|
@@ -25531,10 +25558,12 @@ const List = Node.create({
|
|
|
25531
25558
|
];
|
|
25532
25559
|
},
|
|
25533
25560
|
renderHTML({ HTMLAttributes: attrs }) {
|
|
25561
|
+
const classes = [
|
|
25562
|
+
this.options.baseClass + attrs.bullet.type,
|
|
25563
|
+
this.options.presetClass
|
|
25564
|
+
];
|
|
25534
25565
|
const isOrdered = ListTypes.ordered.includes(attrs.bullet.type);
|
|
25535
|
-
|
|
25536
|
-
const bulletClass = this.options.baseClass + attrs.bullet.type;
|
|
25537
|
-
return [tag, { class: bulletClass }, 0];
|
|
25566
|
+
return [isOrdered ? "ol" : "ul", { class: classes.join(" ") }, 0];
|
|
25538
25567
|
},
|
|
25539
25568
|
addCommands() {
|
|
25540
25569
|
return {
|
|
@@ -26668,128 +26697,43 @@ const Link = Link$1.extend({
|
|
|
26668
26697
|
return ["a", linkAttrs, 0];
|
|
26669
26698
|
}
|
|
26670
26699
|
});
|
|
26671
|
-
const Superscript
|
|
26672
|
-
name: "superscript",
|
|
26673
|
-
addOptions() {
|
|
26674
|
-
return {
|
|
26675
|
-
HTMLAttributes: {}
|
|
26676
|
-
};
|
|
26677
|
-
},
|
|
26678
|
-
parseHTML() {
|
|
26679
|
-
return [
|
|
26680
|
-
{
|
|
26681
|
-
tag: "sup"
|
|
26682
|
-
},
|
|
26683
|
-
{
|
|
26684
|
-
style: "vertical-align",
|
|
26685
|
-
getAttrs(value) {
|
|
26686
|
-
if (value !== "super") {
|
|
26687
|
-
return false;
|
|
26688
|
-
}
|
|
26689
|
-
return null;
|
|
26690
|
-
}
|
|
26691
|
-
}
|
|
26692
|
-
];
|
|
26693
|
-
},
|
|
26694
|
-
renderHTML({ HTMLAttributes }) {
|
|
26695
|
-
return ["sup", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
26696
|
-
},
|
|
26697
|
-
addCommands() {
|
|
26698
|
-
return {
|
|
26699
|
-
setSuperscript: () => ({ commands: commands2 }) => {
|
|
26700
|
-
return commands2.setMark(this.name);
|
|
26701
|
-
},
|
|
26702
|
-
toggleSuperscript: () => ({ commands: commands2 }) => {
|
|
26703
|
-
return commands2.toggleMark(this.name);
|
|
26704
|
-
},
|
|
26705
|
-
unsetSuperscript: () => ({ commands: commands2 }) => {
|
|
26706
|
-
return commands2.unsetMark(this.name);
|
|
26707
|
-
}
|
|
26708
|
-
};
|
|
26709
|
-
},
|
|
26710
|
-
addKeyboardShortcuts() {
|
|
26711
|
-
return {
|
|
26712
|
-
"Mod-.": () => this.editor.commands.toggleSuperscript()
|
|
26713
|
-
};
|
|
26714
|
-
}
|
|
26715
|
-
});
|
|
26716
|
-
const Superscript = Superscript$1.extend({
|
|
26700
|
+
const Superscript = Mark.create({
|
|
26717
26701
|
name: TextSettings.SUPERSCRIPT,
|
|
26718
|
-
addKeyboardShortcuts: null,
|
|
26719
|
-
addOptions: () => ({
|
|
26720
|
-
HTMLAttributes: { class: "zw-superscript" }
|
|
26721
|
-
}),
|
|
26722
26702
|
addCommands() {
|
|
26723
|
-
const { setSuperscript, unsetSuperscript } = this.parent();
|
|
26724
26703
|
return {
|
|
26725
|
-
applySuperscript:
|
|
26726
|
-
|
|
26704
|
+
applySuperscript: createCommand(({ commands: commands2 }) => {
|
|
26705
|
+
commands2.setMark(this.name);
|
|
26706
|
+
}),
|
|
26707
|
+
removeSuperscript: createCommand(({ commands: commands2 }) => {
|
|
26708
|
+
commands2.unsetMark(this.name);
|
|
26709
|
+
}),
|
|
26727
26710
|
toggleSuperscript: createCommand(({ commands: commands2 }) => {
|
|
26728
26711
|
const isActive2 = unref(commands2.isSuperscript());
|
|
26729
|
-
isActive2 ? commands2.
|
|
26712
|
+
isActive2 ? commands2.removeSuperscript() : commands2.applySuperscript();
|
|
26730
26713
|
}),
|
|
26731
26714
|
isSuperscript: createCommand(({ commands: commands2 }) => {
|
|
26732
26715
|
const selectionRef = commands2.getMark(this.name);
|
|
26733
26716
|
return computed(() => !!unref(selectionRef));
|
|
26734
26717
|
})
|
|
26735
26718
|
};
|
|
26719
|
+
},
|
|
26720
|
+
parseHTML() {
|
|
26721
|
+
return [
|
|
26722
|
+
{ tag: "sup" },
|
|
26723
|
+
{
|
|
26724
|
+
style: "vertical-align",
|
|
26725
|
+
getAttrs: (value) => value !== "super" ? false : null
|
|
26726
|
+
}
|
|
26727
|
+
];
|
|
26728
|
+
},
|
|
26729
|
+
renderHTML() {
|
|
26730
|
+
return ["sup", { class: "zw-superscript" }, 0];
|
|
26736
26731
|
}
|
|
26737
26732
|
});
|
|
26738
26733
|
const Text = Node.create({
|
|
26739
26734
|
name: "text",
|
|
26740
26735
|
group: "inline"
|
|
26741
26736
|
});
|
|
26742
|
-
const Placeholder = Extension.create({
|
|
26743
|
-
name: "placeholder",
|
|
26744
|
-
addOptions() {
|
|
26745
|
-
return {
|
|
26746
|
-
emptyEditorClass: "is-editor-empty",
|
|
26747
|
-
emptyNodeClass: "is-empty",
|
|
26748
|
-
placeholder: "Write something \u2026",
|
|
26749
|
-
showOnlyWhenEditable: true,
|
|
26750
|
-
showOnlyCurrent: true,
|
|
26751
|
-
includeChildren: false
|
|
26752
|
-
};
|
|
26753
|
-
},
|
|
26754
|
-
addProseMirrorPlugins() {
|
|
26755
|
-
return [
|
|
26756
|
-
new Plugin({
|
|
26757
|
-
props: {
|
|
26758
|
-
decorations: ({ doc: doc2, selection }) => {
|
|
26759
|
-
const active = this.editor.isEditable || !this.options.showOnlyWhenEditable;
|
|
26760
|
-
const { anchor } = selection;
|
|
26761
|
-
const decorations = [];
|
|
26762
|
-
if (!active) {
|
|
26763
|
-
return null;
|
|
26764
|
-
}
|
|
26765
|
-
doc2.descendants((node, pos) => {
|
|
26766
|
-
const hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;
|
|
26767
|
-
const isEmpty = !node.isLeaf && !node.childCount;
|
|
26768
|
-
if ((hasAnchor || !this.options.showOnlyCurrent) && isEmpty) {
|
|
26769
|
-
const classes = [this.options.emptyNodeClass];
|
|
26770
|
-
if (this.editor.isEmpty) {
|
|
26771
|
-
classes.push(this.options.emptyEditorClass);
|
|
26772
|
-
}
|
|
26773
|
-
const decoration = Decoration.node(pos, pos + node.nodeSize, {
|
|
26774
|
-
class: classes.join(" "),
|
|
26775
|
-
"data-placeholder": typeof this.options.placeholder === "function" ? this.options.placeholder({
|
|
26776
|
-
editor: this.editor,
|
|
26777
|
-
node,
|
|
26778
|
-
pos,
|
|
26779
|
-
hasAnchor
|
|
26780
|
-
}) : this.options.placeholder
|
|
26781
|
-
});
|
|
26782
|
-
decorations.push(decoration);
|
|
26783
|
-
}
|
|
26784
|
-
return this.options.includeChildren;
|
|
26785
|
-
});
|
|
26786
|
-
return DecorationSet.create(doc2, decorations);
|
|
26787
|
-
}
|
|
26788
|
-
}
|
|
26789
|
-
})
|
|
26790
|
-
];
|
|
26791
|
-
}
|
|
26792
|
-
});
|
|
26793
26737
|
var GOOD_LEAF_SIZE = 200;
|
|
26794
26738
|
var RopeSequence = function RopeSequence2() {
|
|
26795
26739
|
};
|
|
@@ -27456,9 +27400,6 @@ const NodeProcessor = Extension.create({
|
|
|
27456
27400
|
}
|
|
27457
27401
|
});
|
|
27458
27402
|
}),
|
|
27459
|
-
removeMark: createCommand(({ commands: commands2, state }, node, position, mark) => {
|
|
27460
|
-
commands2._removeNodeMark({ tr: state.tr, node, position, mark });
|
|
27461
|
-
}),
|
|
27462
27403
|
_removeNodeMark: createCommand((context, { tr, node, position, mark }) => {
|
|
27463
27404
|
return node.isText ? tr.removeMark(position, position + node.nodeSize, mark) : tr.step(new RemoveNodeMarkStep(position, mark));
|
|
27464
27405
|
})
|
|
@@ -27520,82 +27461,6 @@ const SelectionProcessor = Extension.create({
|
|
|
27520
27461
|
};
|
|
27521
27462
|
}
|
|
27522
27463
|
});
|
|
27523
|
-
class ProseMirrorPlugin {
|
|
27524
|
-
static create(options) {
|
|
27525
|
-
const plugin = new this(options || {});
|
|
27526
|
-
return new Plugin({
|
|
27527
|
-
key: new PluginKey(this.name),
|
|
27528
|
-
props: plugin.buildProps()
|
|
27529
|
-
});
|
|
27530
|
-
}
|
|
27531
|
-
constructor(options) {
|
|
27532
|
-
this.options = options;
|
|
27533
|
-
}
|
|
27534
|
-
buildProps() {
|
|
27535
|
-
return {};
|
|
27536
|
-
}
|
|
27537
|
-
}
|
|
27538
|
-
class PastePlugin extends ProseMirrorPlugin {
|
|
27539
|
-
buildProps() {
|
|
27540
|
-
return {
|
|
27541
|
-
transformPastedHTML: this._transformPastedHTML.bind(this),
|
|
27542
|
-
handlePaste: this._handlePaste.bind(this)
|
|
27543
|
-
};
|
|
27544
|
-
}
|
|
27545
|
-
_transformPastedHTML(html2) {
|
|
27546
|
-
const normalizer = ContentNormalizer.build(html2);
|
|
27547
|
-
normalizer.normalizeHTML();
|
|
27548
|
-
this._removeDeprecatedStyles(normalizer);
|
|
27549
|
-
return normalizer.normalizedHTML;
|
|
27550
|
-
}
|
|
27551
|
-
_removeDeprecatedStyles(normalizer) {
|
|
27552
|
-
const elements = normalizer.dom.querySelectorAll('[style*="margin"]');
|
|
27553
|
-
for (const element of Array.from(elements)) {
|
|
27554
|
-
element.style.removeProperty("margin");
|
|
27555
|
-
element.style.removeProperty("margin-top");
|
|
27556
|
-
element.style.removeProperty("margin-right");
|
|
27557
|
-
element.style.removeProperty("margin-bottom");
|
|
27558
|
-
element.style.removeProperty("margin-left");
|
|
27559
|
-
}
|
|
27560
|
-
}
|
|
27561
|
-
_handlePaste(view, _, slice2) {
|
|
27562
|
-
const transaction = this._insertPastedContent(view, slice2).scrollIntoView().setMeta("paste", true).setMeta("uiEvent", "paste");
|
|
27563
|
-
view.dispatch(transaction);
|
|
27564
|
-
return true;
|
|
27565
|
-
}
|
|
27566
|
-
_insertPastedContent({ state, input }, slice2) {
|
|
27567
|
-
if (!this._isFullBlockSelected(state)) {
|
|
27568
|
-
return state.tr.replaceSelection(slice2);
|
|
27569
|
-
}
|
|
27570
|
-
return state.tr.replaceSelectionWith(slice2.content, input.shiftKey);
|
|
27571
|
-
}
|
|
27572
|
-
_isFullBlockSelected(state) {
|
|
27573
|
-
const blocksSelection = this._expandSelectionToBlocks(state);
|
|
27574
|
-
const isFromMatch = this._isMatchPosition(blocksSelection.from, state.selection.from);
|
|
27575
|
-
const isToMatch = this._isMatchPosition(blocksSelection.to, state.selection.to);
|
|
27576
|
-
return isFromMatch && isToMatch;
|
|
27577
|
-
}
|
|
27578
|
-
_expandSelectionToBlocks({ selection, doc: doc2 }) {
|
|
27579
|
-
let from2 = selection.from;
|
|
27580
|
-
let to = selection.to;
|
|
27581
|
-
doc2.nodesBetween(from2, to, (node, position, parent) => {
|
|
27582
|
-
if (parent.type.name !== NodeTypes.DOCUMENT)
|
|
27583
|
-
return;
|
|
27584
|
-
from2 = Math.min(from2, position + 1);
|
|
27585
|
-
to = Math.max(to, position + node.nodeSize - 1);
|
|
27586
|
-
});
|
|
27587
|
-
return { from: from2, to };
|
|
27588
|
-
}
|
|
27589
|
-
_isMatchPosition(position1, position2) {
|
|
27590
|
-
return Math.abs(position1 - position2) < 5;
|
|
27591
|
-
}
|
|
27592
|
-
}
|
|
27593
|
-
const CopyPasteProcessor = Extension.create({
|
|
27594
|
-
name: "copy_paste_processor",
|
|
27595
|
-
addProseMirrorPlugins() {
|
|
27596
|
-
return [PastePlugin.create()];
|
|
27597
|
-
}
|
|
27598
|
-
});
|
|
27599
27464
|
const Document$1 = Node.create({
|
|
27600
27465
|
name: "doc",
|
|
27601
27466
|
topNode: true,
|
|
@@ -27714,12 +27579,119 @@ const Heading = Heading$1.extend({
|
|
|
27714
27579
|
HTMLAttributes: { class: "zw-style" }
|
|
27715
27580
|
})
|
|
27716
27581
|
});
|
|
27582
|
+
class ProseMirrorPlugin {
|
|
27583
|
+
static create(editor, options) {
|
|
27584
|
+
const plugin = new this(editor, options || {});
|
|
27585
|
+
return new Plugin({
|
|
27586
|
+
key: new PluginKey(this.name),
|
|
27587
|
+
props: plugin.buildProps()
|
|
27588
|
+
});
|
|
27589
|
+
}
|
|
27590
|
+
constructor(editor, options) {
|
|
27591
|
+
this.options = options;
|
|
27592
|
+
this.editor = editor;
|
|
27593
|
+
}
|
|
27594
|
+
buildProps() {
|
|
27595
|
+
return {};
|
|
27596
|
+
}
|
|
27597
|
+
}
|
|
27598
|
+
class PastePlugin extends ProseMirrorPlugin {
|
|
27599
|
+
buildProps() {
|
|
27600
|
+
return {
|
|
27601
|
+
transformPastedHTML: this._transformPastedHTML.bind(this),
|
|
27602
|
+
handlePaste: this._handlePaste.bind(this)
|
|
27603
|
+
};
|
|
27604
|
+
}
|
|
27605
|
+
_transformPastedHTML(html2) {
|
|
27606
|
+
if (html2.includes("data-pm-slice") && html2.includes("zw-style")) {
|
|
27607
|
+
return html2;
|
|
27608
|
+
}
|
|
27609
|
+
const normalizer = ContentNormalizer.build(html2);
|
|
27610
|
+
normalizer.normalizeHTML();
|
|
27611
|
+
this._removeDeprecatedStyles(normalizer);
|
|
27612
|
+
return normalizer.normalizedHTML;
|
|
27613
|
+
}
|
|
27614
|
+
_removeDeprecatedStyles(normalizer) {
|
|
27615
|
+
const elements = normalizer.dom.querySelectorAll('[style*="margin"]');
|
|
27616
|
+
for (const element of Array.from(elements)) {
|
|
27617
|
+
element.style.removeProperty("margin");
|
|
27618
|
+
element.style.removeProperty("margin-top");
|
|
27619
|
+
element.style.removeProperty("margin-right");
|
|
27620
|
+
element.style.removeProperty("margin-bottom");
|
|
27621
|
+
element.style.removeProperty("margin-left");
|
|
27622
|
+
}
|
|
27623
|
+
}
|
|
27624
|
+
_handlePaste(view, _, slice2) {
|
|
27625
|
+
const transaction = this._insertPastedContent(view, slice2).scrollIntoView().setMeta("paste", true).setMeta("uiEvent", "paste");
|
|
27626
|
+
view.dispatch(transaction);
|
|
27627
|
+
return true;
|
|
27628
|
+
}
|
|
27629
|
+
_insertPastedContent({ state, input }, slice2) {
|
|
27630
|
+
if (!this._isFullBlockSelected(state)) {
|
|
27631
|
+
return state.tr.replaceSelection(slice2);
|
|
27632
|
+
}
|
|
27633
|
+
return state.tr.replaceSelectionWith(slice2.content, input.shiftKey);
|
|
27634
|
+
}
|
|
27635
|
+
_isFullBlockSelected(state) {
|
|
27636
|
+
const blocksSelection = this._expandSelectionToBlocks(state);
|
|
27637
|
+
const isFromMatch = this._isMatchPosition(blocksSelection.from, state.selection.from);
|
|
27638
|
+
const isToMatch = this._isMatchPosition(blocksSelection.to, state.selection.to);
|
|
27639
|
+
return isFromMatch && isToMatch;
|
|
27640
|
+
}
|
|
27641
|
+
_expandSelectionToBlocks({ selection, doc: doc2 }) {
|
|
27642
|
+
let from2 = selection.from;
|
|
27643
|
+
let to = selection.to;
|
|
27644
|
+
doc2.nodesBetween(from2, to, (node, position, parent) => {
|
|
27645
|
+
if (parent.type.name !== NodeTypes.DOCUMENT)
|
|
27646
|
+
return;
|
|
27647
|
+
from2 = Math.min(from2, position + 1);
|
|
27648
|
+
to = Math.max(to, position + node.nodeSize - 1);
|
|
27649
|
+
});
|
|
27650
|
+
return { from: from2, to };
|
|
27651
|
+
}
|
|
27652
|
+
_isMatchPosition(position1, position2) {
|
|
27653
|
+
return Math.abs(position1 - position2) < 5;
|
|
27654
|
+
}
|
|
27655
|
+
}
|
|
27656
|
+
class PlaceholderPlugin extends ProseMirrorPlugin {
|
|
27657
|
+
constructor() {
|
|
27658
|
+
super(...arguments);
|
|
27659
|
+
__privateAdd(this, _buildDecorations);
|
|
27660
|
+
}
|
|
27661
|
+
buildProps() {
|
|
27662
|
+
return { decorations: __privateMethod(this, _buildDecorations, buildDecorations_fn).bind(this) };
|
|
27663
|
+
}
|
|
27664
|
+
}
|
|
27665
|
+
_buildDecorations = new WeakSet();
|
|
27666
|
+
buildDecorations_fn = function({ doc: doc2 }) {
|
|
27667
|
+
const decorations = [];
|
|
27668
|
+
if (!this.editor.isEditable)
|
|
27669
|
+
return null;
|
|
27670
|
+
if (doc2.childCount > 1)
|
|
27671
|
+
return;
|
|
27672
|
+
doc2.descendants((node, pos) => {
|
|
27673
|
+
if (!node.childCount) {
|
|
27674
|
+
const decoration = Decoration.node(pos, pos + node.nodeSize, {
|
|
27675
|
+
class: "zw-wysiwyg__placeholder",
|
|
27676
|
+
"data-placeholder": "Type your text here..."
|
|
27677
|
+
});
|
|
27678
|
+
decorations.push(decoration);
|
|
27679
|
+
}
|
|
27680
|
+
return false;
|
|
27681
|
+
});
|
|
27682
|
+
return DecorationSet.create(doc2, decorations);
|
|
27683
|
+
};
|
|
27684
|
+
const ProseMirrorPlugins = Extension.create({
|
|
27685
|
+
name: "prose_mirror_plugins",
|
|
27686
|
+
addProseMirrorPlugins() {
|
|
27687
|
+
return [
|
|
27688
|
+
PastePlugin.create(this.editor),
|
|
27689
|
+
PlaceholderPlugin.create(this.editor)
|
|
27690
|
+
];
|
|
27691
|
+
}
|
|
27692
|
+
});
|
|
27717
27693
|
const buildCoreExtensions = () => [
|
|
27718
27694
|
Document,
|
|
27719
|
-
Placeholder.configure({
|
|
27720
|
-
placeholder: "Type your text here...",
|
|
27721
|
-
emptyNodeClass: "zw-wysiwyg__placeholder"
|
|
27722
|
-
}),
|
|
27723
27695
|
Paragraph,
|
|
27724
27696
|
Heading,
|
|
27725
27697
|
Text,
|
|
@@ -27727,7 +27699,7 @@ const buildCoreExtensions = () => [
|
|
|
27727
27699
|
NodeProcessor,
|
|
27728
27700
|
TextProcessor,
|
|
27729
27701
|
SelectionProcessor,
|
|
27730
|
-
|
|
27702
|
+
ProseMirrorPlugins
|
|
27731
27703
|
];
|
|
27732
27704
|
const Margin = Extension.create({
|
|
27733
27705
|
name: TextSettings.MARGIN,
|
|
@@ -27772,7 +27744,8 @@ function buildExtensions(options) {
|
|
|
27772
27744
|
makeVariable: options.makePresetVariable
|
|
27773
27745
|
}),
|
|
27774
27746
|
List.configure({
|
|
27775
|
-
baseClass: options.baseListClass
|
|
27747
|
+
baseClass: options.baseListClass,
|
|
27748
|
+
presetClass: options.basePresetClass + options.defaultPresetId
|
|
27776
27749
|
}),
|
|
27777
27750
|
DeviceManager.configure({
|
|
27778
27751
|
device: options.deviceRef
|
|
@@ -27969,7 +27942,7 @@ const __vue2_script = {
|
|
|
27969
27942
|
updateToolbar();
|
|
27970
27943
|
}
|
|
27971
27944
|
const pageBlocks = toRef(props, "pageBlocks");
|
|
27972
|
-
const editor = useEditor({
|
|
27945
|
+
const { editor, getContent } = useEditor({
|
|
27973
27946
|
content: toRef(props, "value"),
|
|
27974
27947
|
onChange: (content) => onChange(content),
|
|
27975
27948
|
isReadonlyRef: toRef(props, "readonly"),
|
|
@@ -28005,7 +27978,8 @@ const __vue2_script = {
|
|
|
28005
27978
|
toolbarRef,
|
|
28006
27979
|
wysiwygRef,
|
|
28007
27980
|
toolbar,
|
|
28008
|
-
updateToolbar
|
|
27981
|
+
updateToolbar,
|
|
27982
|
+
getContent
|
|
28009
27983
|
};
|
|
28010
27984
|
}
|
|
28011
27985
|
};
|
|
@@ -28034,5 +28008,7 @@ export {
|
|
|
28034
28008
|
NodeTypes,
|
|
28035
28009
|
TextSettings,
|
|
28036
28010
|
Wysiwyg,
|
|
28037
|
-
isWysiwygContent
|
|
28011
|
+
isWysiwygContent,
|
|
28012
|
+
markWysiwygContent,
|
|
28013
|
+
unmarkWysiwygContent
|
|
28038
28014
|
};
|
package/lib/Wysiwyg.vue
CHANGED
|
@@ -163,7 +163,7 @@ export default {
|
|
|
163
163
|
|
|
164
164
|
const pageBlocks = toRef(props, 'pageBlocks');
|
|
165
165
|
|
|
166
|
-
const editor = useEditor({
|
|
166
|
+
const { editor, getContent } = useEditor({
|
|
167
167
|
content: toRef(props, 'value'),
|
|
168
168
|
onChange: (content) => onChange(content),
|
|
169
169
|
isReadonlyRef: toRef(props, 'readonly'),
|
|
@@ -206,7 +206,8 @@ export default {
|
|
|
206
206
|
toolbarRef,
|
|
207
207
|
wysiwygRef,
|
|
208
208
|
toolbar,
|
|
209
|
-
updateToolbar
|
|
209
|
+
updateToolbar,
|
|
210
|
+
getContent
|
|
210
211
|
};
|
|
211
212
|
}
|
|
212
213
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 9 9">
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" style="width:var(--zw-icon-width);height:var(--zw-icon-height)" viewBox="0 0 9 9">
|
|
2
2
|
<path fill="#FFAB00" d="M0 4.5a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0Z"/>
|
|
3
3
|
<path fill="#fff" fill-rule="evenodd" d="M5.063 2.25H3.938v3.375h1.124V2.25Zm-1.125 4.5a.562.562 0 1 1 1.123-.001.562.562 0 0 1-1.123.001Z" clip-rule="evenodd"/>
|
|
4
4
|
</svg>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export class Command {
|
|
2
2
|
name;
|
|
3
|
+
description;
|
|
3
4
|
argument;
|
|
4
5
|
options = [];
|
|
5
6
|
|
|
@@ -14,6 +15,10 @@ export class Command {
|
|
|
14
15
|
|
|
15
16
|
let building = program.command(this.name);
|
|
16
17
|
|
|
18
|
+
if (this.description) {
|
|
19
|
+
building = building.description(this.description);
|
|
20
|
+
}
|
|
21
|
+
|
|
17
22
|
if (this.argument) {
|
|
18
23
|
building = building.argument(this.argument);
|
|
19
24
|
}
|