@zipify/wysiwyg 1.1.1-0 → 1.1.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/cli.js +2 -2
- package/dist/wysiwyg.css +11 -11
- package/dist/wysiwyg.mjs +46 -53
- package/lib/components/toolbar/controls/link/LinkControl.vue +4 -5
- package/lib/components/toolbar/controls/link/LinkControlHeader.vue +2 -2
- package/lib/components/toolbar/controls/link/__tests__/LinkControl.test.js +1 -1
- package/lib/components/toolbar/controls/link/__tests__/LinkControlHeader.test.js +1 -1
- package/lib/components/toolbar/controls/link/composables/useLink.js +5 -7
- package/lib/enums/TextSettings.js +0 -2
- package/lib/extensions/Alignment.js +10 -8
- package/lib/extensions/FontSize.js +8 -3
- package/lib/extensions/FontStyle.js +2 -2
- package/lib/extensions/LineHeight.js +10 -4
- package/lib/extensions/Link.js +15 -13
- package/lib/extensions/TextDecoration.js +13 -12
- package/lib/extensions/__tests__/FontFamily.test.js +6 -7
- package/lib/extensions/__tests__/FontWeight.test.js +10 -11
- package/lib/extensions/__tests__/TextDecoration.test.js +42 -73
- package/lib/extensions/__tests__/__snapshots__/Alignment.test.js.snap +3 -3
- package/lib/extensions/__tests__/__snapshots__/FontFamily.test.js.snap +0 -18
- package/lib/extensions/__tests__/__snapshots__/FontSize.test.js.snap +9 -9
- package/lib/extensions/__tests__/__snapshots__/FontStyle.test.js.snap +0 -16
- package/lib/extensions/__tests__/__snapshots__/LineHeight.test.js.snap +5 -5
- package/lib/extensions/__tests__/__snapshots__/TextDecoration.test.js.snap +43 -0
- package/lib/services/NodeFactory.js +4 -1
- package/node_modules_lambda/acorn-globals/node_modules/.bin/acorn +4 -0
- package/node_modules_lambda/acorn-globals/node_modules/acorn/CHANGELOG.md +620 -0
- package/node_modules_lambda/acorn-globals/node_modules/acorn/LICENSE +21 -0
- package/node_modules_lambda/acorn-globals/node_modules/acorn/README.md +269 -0
- package/node_modules_lambda/acorn-globals/node_modules/acorn/bin/acorn +4 -0
- package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.d.ts +209 -0
- package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.js +5186 -0
- package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.js.map +1 -0
- package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.mjs +5155 -0
- package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.mjs.d.ts +2 -0
- package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.mjs.map +1 -0
- package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/bin.js +64 -0
- package/node_modules_lambda/acorn-globals/node_modules/acorn/package.json +35 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/LICENSE.txt +20 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/README.mdown +67 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSDocumentRule.js +39 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSFontFaceRule.js +36 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSHostRule.js +37 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSImportRule.js +132 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSKeyframeRule.js +37 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSKeyframesRule.js +39 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSMediaRule.js +41 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSOM.js +3 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSRule.js +43 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSStyleDeclaration.js +148 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSStyleRule.js +190 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSStyleSheet.js +88 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSSupportsRule.js +36 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSValue.js +43 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSValueExpression.js +344 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/MatcherList.js +62 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/MediaList.js +61 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/StyleSheet.js +17 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/clone.js +82 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/index.js +21 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/parse.js +464 -0
- package/node_modules_lambda/cssstyle/node_modules/cssom/package.json +18 -0
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/LICENSE.txt +21 -0
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/README.md +106 -0
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/index.js +27 -0
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/Function.js +42 -0
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URL-impl.js +209 -0
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URL.js +442 -0
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URLSearchParams-impl.js +130 -0
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URLSearchParams.js +472 -0
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/VoidFunction.js +26 -0
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/encoding.js +16 -0
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/infra.js +26 -0
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/percent-encoding.js +142 -0
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/url-state-machine.js +1244 -0
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/urlencoded.js +106 -0
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/utils.js +190 -0
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/package.json +58 -0
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/webidl2js-wrapper.js +7 -0
- package/node_modules_lambda/escodegen/node_modules/estraverse/.jshintrc +16 -0
- package/node_modules_lambda/escodegen/node_modules/estraverse/LICENSE.BSD +19 -0
- package/node_modules_lambda/escodegen/node_modules/estraverse/README.md +153 -0
- package/node_modules_lambda/escodegen/node_modules/estraverse/estraverse.js +805 -0
- package/node_modules_lambda/escodegen/node_modules/estraverse/gulpfile.js +70 -0
- package/node_modules_lambda/escodegen/node_modules/estraverse/package.json +40 -0
- package/node_modules_lambda/escodegen/node_modules/levn/LICENSE +22 -0
- package/node_modules_lambda/escodegen/node_modules/levn/README.md +196 -0
- package/node_modules_lambda/escodegen/node_modules/levn/lib/cast.js +298 -0
- package/node_modules_lambda/escodegen/node_modules/levn/lib/coerce.js +285 -0
- package/node_modules_lambda/escodegen/node_modules/levn/lib/index.js +22 -0
- package/node_modules_lambda/escodegen/node_modules/levn/lib/parse-string.js +113 -0
- package/node_modules_lambda/escodegen/node_modules/levn/lib/parse.js +102 -0
- package/node_modules_lambda/escodegen/node_modules/levn/package.json +47 -0
- package/node_modules_lambda/escodegen/node_modules/optionator/CHANGELOG.md +56 -0
- package/node_modules_lambda/escodegen/node_modules/optionator/LICENSE +22 -0
- package/node_modules_lambda/escodegen/node_modules/optionator/README.md +238 -0
- package/node_modules_lambda/escodegen/node_modules/optionator/lib/help.js +260 -0
- package/node_modules_lambda/escodegen/node_modules/optionator/lib/index.js +465 -0
- package/node_modules_lambda/escodegen/node_modules/optionator/lib/util.js +54 -0
- package/node_modules_lambda/escodegen/node_modules/optionator/package.json +44 -0
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/CHANGELOG.md +99 -0
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/LICENSE +22 -0
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/README.md +15 -0
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Func.js +65 -0
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/List.js +686 -0
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Num.js +130 -0
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Obj.js +154 -0
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Str.js +92 -0
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/index.js +178 -0
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/package.json +52 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/CHANGELOG.md +301 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/LICENSE +28 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/README.md +742 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.debug.js +3234 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.js +3233 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.min.js +2 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.min.js.map +1 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/array-set.js +121 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/base64-vlq.js +140 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/base64.js +67 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/binary-search.js +111 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/mapping-list.js +79 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/quick-sort.js +114 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/source-map-consumer.js +1145 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/source-map-generator.js +425 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/source-node.js +413 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/util.js +488 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/package.json +73 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/source-map.d.ts +98 -0
- package/node_modules_lambda/escodegen/node_modules/source-map/source-map.js +8 -0
- package/node_modules_lambda/escodegen/node_modules/type-check/LICENSE +22 -0
- package/node_modules_lambda/escodegen/node_modules/type-check/README.md +210 -0
- package/node_modules_lambda/escodegen/node_modules/type-check/lib/check.js +126 -0
- package/node_modules_lambda/escodegen/node_modules/type-check/lib/index.js +16 -0
- package/node_modules_lambda/escodegen/node_modules/type-check/lib/parse-type.js +196 -0
- package/node_modules_lambda/escodegen/node_modules/type-check/package.json +40 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/.github/dependabot.yml +11 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/Changelog.md +212 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/LICENSE +21 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/README.md +130 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/dbcs-codec.js +597 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/dbcs-data.js +188 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/index.js +23 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/internal.js +198 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/sbcs-codec.js +72 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/sbcs-data.js +179 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/gbk-added.json +56 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/utf16.js +197 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/utf32.js +319 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/utf7.js +290 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/bom-handling.js +52 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/index.d.ts +41 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/index.js +180 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/streams.js +109 -0
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/package.json +44 -0
- package/package.json +1 -1
package/dist/wysiwyg.css
CHANGED
|
@@ -591,34 +591,34 @@
|
|
|
591
591
|
display: flex;
|
|
592
592
|
}
|
|
593
593
|
|
|
594
|
-
.zw-link-modal-header[data-v-
|
|
594
|
+
.zw-link-modal-header[data-v-0a202ba4] {
|
|
595
595
|
display: flex;
|
|
596
596
|
align-items: center;
|
|
597
597
|
justify-content: space-between;
|
|
598
598
|
padding: var(--zw-offset-sm);
|
|
599
599
|
border-bottom: 2px solid rgb(var(--zw-color-n5));
|
|
600
600
|
}
|
|
601
|
-
.zw-link-modal-header__title[data-v-
|
|
601
|
+
.zw-link-modal-header__title[data-v-0a202ba4] {
|
|
602
602
|
text-transform: uppercase;
|
|
603
603
|
font-weight: var(--zw-font-weight-semibold);
|
|
604
604
|
font-size: var(--zw-font-size-xxs);
|
|
605
605
|
color: rgb(var(--zw-color-white));
|
|
606
606
|
}
|
|
607
|
-
.zw-link-modal-header__unlink-icon[data-v-
|
|
607
|
+
.zw-link-modal-header__unlink-icon[data-v-0a202ba4] {
|
|
608
608
|
margin-right: var(--zw-offset-xxs);
|
|
609
609
|
}
|
|
610
|
-
.zw-link-modal-header__unlink-button[data-v-
|
|
610
|
+
.zw-link-modal-header__unlink-button[data-v-0a202ba4] {
|
|
611
611
|
color: rgb(var(--zw-color-n80));
|
|
612
612
|
font-size: var(--zw-font-size-xxs);
|
|
613
613
|
transition: 0.1s opacity ease-out, 0.1s color ease-out;
|
|
614
614
|
will-change: opacity, color;
|
|
615
615
|
}
|
|
616
|
-
.zw-link-modal-header__unlink-button[data-v-
|
|
616
|
+
.zw-link-modal-header__unlink-button[data-v-0a202ba4]:disabled {
|
|
617
617
|
opacity: 0.35;
|
|
618
618
|
}
|
|
619
|
-
.zw-link-modal-header__unlink-button[data-v-
|
|
620
|
-
.zw-link-modal-header__unlink-button[data-v-
|
|
621
|
-
.zw-link-modal-header__unlink-button[data-v-
|
|
619
|
+
.zw-link-modal-header__unlink-button[data-v-0a202ba4]:focus,
|
|
620
|
+
.zw-link-modal-header__unlink-button[data-v-0a202ba4]:focus-within,
|
|
621
|
+
.zw-link-modal-header__unlink-button[data-v-0a202ba4]:hover {
|
|
622
622
|
color: rgb(var(--zw-color-white));
|
|
623
623
|
}
|
|
624
624
|
|
|
@@ -627,13 +627,13 @@
|
|
|
627
627
|
justify-content: flex-end;
|
|
628
628
|
}
|
|
629
629
|
|
|
630
|
-
.zw-link-modal[data-v-
|
|
630
|
+
.zw-link-modal[data-v-28e9497e] {
|
|
631
631
|
width: 266px;
|
|
632
632
|
}
|
|
633
|
-
.zw-link-modal__body[data-v-
|
|
633
|
+
.zw-link-modal__body[data-v-28e9497e] {
|
|
634
634
|
padding: var(--zw-offset-sm);
|
|
635
635
|
}
|
|
636
|
-
[data-v-
|
|
636
|
+
[data-v-28e9497e] .zw-link-modal-dropdown__option {
|
|
637
637
|
width: 234px;
|
|
638
638
|
}
|
|
639
639
|
|
package/dist/wysiwyg.mjs
CHANGED
|
@@ -13986,8 +13986,6 @@ const TextSettings = Object.freeze({
|
|
|
13986
13986
|
TEXT_DECORATION: "text_decoration",
|
|
13987
13987
|
SUPERSCRIPT: "superscript",
|
|
13988
13988
|
MARGIN: "margin",
|
|
13989
|
-
LINK: "link",
|
|
13990
|
-
STYLE_PRESET: "style_preset",
|
|
13991
13989
|
get attributes() {
|
|
13992
13990
|
return [
|
|
13993
13991
|
this.ALIGNMENT,
|
|
@@ -19754,7 +19752,7 @@ class NodeFactory {
|
|
|
19754
19752
|
return { type, attrs };
|
|
19755
19753
|
}
|
|
19756
19754
|
static populateAllDevices(value) {
|
|
19757
|
-
return { mobile:
|
|
19755
|
+
return { mobile: null, tablet: value, desktop: value };
|
|
19758
19756
|
}
|
|
19759
19757
|
}
|
|
19760
19758
|
const dataStorage = /* @__PURE__ */ new WeakMap();
|
|
@@ -22090,7 +22088,7 @@ const __vue2_script$9 = {
|
|
|
22090
22088
|
components: { Icon, Button },
|
|
22091
22089
|
setup(_, { emit }) {
|
|
22092
22090
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
22093
|
-
const isLink = editor.
|
|
22091
|
+
const isLink = computed(() => editor.isActive("link"));
|
|
22094
22092
|
const removeLink = () => emit("remove-link");
|
|
22095
22093
|
return { isLink, removeLink };
|
|
22096
22094
|
}
|
|
@@ -22102,7 +22100,7 @@ var __component__$9 = /* @__PURE__ */ normalizeComponent(
|
|
|
22102
22100
|
staticRenderFns$9,
|
|
22103
22101
|
false,
|
|
22104
22102
|
__vue2_injectStyles$9,
|
|
22105
|
-
"
|
|
22103
|
+
"0a202ba4",
|
|
22106
22104
|
null,
|
|
22107
22105
|
null
|
|
22108
22106
|
);
|
|
@@ -22177,12 +22175,11 @@ function useLink() {
|
|
|
22177
22175
|
linkData.value.target = isChecked ? LinkTargets.BLANK : LinkTargets.SELF;
|
|
22178
22176
|
}
|
|
22179
22177
|
function prepareInitialFields() {
|
|
22180
|
-
const link = editor.getAttributes(TextSettings.LINK);
|
|
22181
22178
|
linkData.value.text = editor.commands.getSelectedText();
|
|
22182
|
-
currentDestination.value.id = link.destination || LinkDestinations.URL;
|
|
22183
|
-
linkData.value.target = link.target || LinkTargets.SELF;
|
|
22184
|
-
if (link.href) {
|
|
22185
|
-
destinationHrefs.value[currentDestination.value.id] = link.href;
|
|
22179
|
+
currentDestination.value.id = editor.getAttributes("link").destination || LinkDestinations.URL;
|
|
22180
|
+
linkData.value.target = editor.getAttributes("link").target || LinkTargets.SELF;
|
|
22181
|
+
if (editor.getAttributes("link").href) {
|
|
22182
|
+
destinationHrefs.value[currentDestination.value.id] = editor.getAttributes("link").href;
|
|
22186
22183
|
}
|
|
22187
22184
|
}
|
|
22188
22185
|
function resetDestinations() {
|
|
@@ -22593,7 +22590,7 @@ const __vue2_script$4 = {
|
|
|
22593
22590
|
urlValidator.reset();
|
|
22594
22591
|
};
|
|
22595
22592
|
const onBeforeOpened = () => {
|
|
22596
|
-
editor.commands.extendMarkRange(
|
|
22593
|
+
editor.commands.extendMarkRange("link");
|
|
22597
22594
|
resetErrors();
|
|
22598
22595
|
link.prepareInitialFields();
|
|
22599
22596
|
};
|
|
@@ -22602,8 +22599,7 @@ const __vue2_script$4 = {
|
|
|
22602
22599
|
wrapperRef,
|
|
22603
22600
|
modalRef
|
|
22604
22601
|
});
|
|
22605
|
-
const
|
|
22606
|
-
const isActive2 = computed(() => toggler.isOpened.value || unref(isLink));
|
|
22602
|
+
const isActive2 = computed(() => toggler.isOpened.value || editor.isActive("link"));
|
|
22607
22603
|
const updateLinkText = (value) => {
|
|
22608
22604
|
resetErrors();
|
|
22609
22605
|
link.updateText(value);
|
|
@@ -22643,7 +22639,7 @@ var __component__$4 = /* @__PURE__ */ normalizeComponent(
|
|
|
22643
22639
|
staticRenderFns$4,
|
|
22644
22640
|
false,
|
|
22645
22641
|
__vue2_injectStyles$4,
|
|
22646
|
-
"
|
|
22642
|
+
"28e9497e",
|
|
22647
22643
|
null,
|
|
22648
22644
|
null
|
|
22649
22645
|
);
|
|
@@ -23295,8 +23291,7 @@ const FontSize = Mark.create({
|
|
|
23295
23291
|
return computed(() => unref(preset)[unref(device)].font_size.replace("px", ""));
|
|
23296
23292
|
}),
|
|
23297
23293
|
applyFontSize: createCommand(({ commands: commands2 }, value) => {
|
|
23298
|
-
|
|
23299
|
-
commands2.setMark(this.name, { [device]: value });
|
|
23294
|
+
commands2.setMark(this.name, { desktop: value, tablet: value, mobile: null });
|
|
23300
23295
|
}),
|
|
23301
23296
|
increaseFontSize: createCommand(({ commands: commands2 }) => {
|
|
23302
23297
|
const size2 = Number(unref(commands2.getFontSize()));
|
|
@@ -23335,7 +23330,7 @@ const FontSize = Mark.create({
|
|
|
23335
23330
|
style: "font-size",
|
|
23336
23331
|
getAttrs: (input) => {
|
|
23337
23332
|
const value = parseSize(input);
|
|
23338
|
-
return { desktop: value, tablet: value, mobile:
|
|
23333
|
+
return { desktop: value, tablet: value, mobile: null };
|
|
23339
23334
|
}
|
|
23340
23335
|
}
|
|
23341
23336
|
];
|
|
@@ -23467,7 +23462,7 @@ const FontStyle = Mark.create({
|
|
|
23467
23462
|
commands2.setMark(this.name, { italic: true });
|
|
23468
23463
|
}),
|
|
23469
23464
|
removeItalic: createCommand(({ commands: commands2 }) => {
|
|
23470
|
-
commands2.
|
|
23465
|
+
commands2.unsetMark(this.name);
|
|
23471
23466
|
})
|
|
23472
23467
|
};
|
|
23473
23468
|
},
|
|
@@ -23493,22 +23488,21 @@ const FontStyle = Mark.create({
|
|
|
23493
23488
|
];
|
|
23494
23489
|
},
|
|
23495
23490
|
renderHTML({ HTMLAttributes: attrs }) {
|
|
23496
|
-
const font_style = attrs.italic ? "italic" :
|
|
23491
|
+
const font_style = attrs.italic ? "italic" : null;
|
|
23497
23492
|
return renderMark({ font_style });
|
|
23498
23493
|
}
|
|
23499
23494
|
});
|
|
23500
23495
|
const TextDecoration = Mark.create({
|
|
23501
23496
|
name: TextSettings.TEXT_DECORATION,
|
|
23502
|
-
priority: 1e3,
|
|
23503
23497
|
addAttributes: () => ({
|
|
23504
23498
|
underline: { default: false },
|
|
23505
23499
|
strike_through: { default: false }
|
|
23506
23500
|
}),
|
|
23507
23501
|
addCommands() {
|
|
23508
23502
|
return {
|
|
23509
|
-
isUnderline: createCommand(({ commands: commands2 }) => {
|
|
23503
|
+
isUnderline: createCommand(({ commands: commands2, editor }) => {
|
|
23510
23504
|
const decoration = commands2.getTextDecoration();
|
|
23511
|
-
return computed(() => unref(decoration).underline);
|
|
23505
|
+
return computed(() => editor.isActive("link") || unref(decoration).underline);
|
|
23512
23506
|
}),
|
|
23513
23507
|
isStrikeThrough: createCommand(({ commands: commands2 }) => {
|
|
23514
23508
|
const decoration = commands2.getTextDecoration();
|
|
@@ -23527,20 +23521,17 @@ const TextDecoration = Mark.create({
|
|
|
23527
23521
|
}),
|
|
23528
23522
|
getDefaultTextDecoration: createCommand(({ commands: commands2 }) => {
|
|
23529
23523
|
const preset = commands2.getPreset();
|
|
23530
|
-
const isLink = commands2.isLink();
|
|
23531
|
-
const linkPreset = commands2.getLinkPreset();
|
|
23532
23524
|
return computed(() => {
|
|
23533
|
-
const decoration =
|
|
23534
|
-
unref(preset).common.text_decoration,
|
|
23535
|
-
unref(isLink) ? unref(linkPreset).common.text_decoration : ""
|
|
23536
|
-
].join(" ");
|
|
23525
|
+
const decoration = unref(preset).common.text_decoration;
|
|
23537
23526
|
return {
|
|
23538
23527
|
underline: decoration.includes("underline"),
|
|
23539
23528
|
strike_through: decoration.includes("line-through")
|
|
23540
23529
|
};
|
|
23541
23530
|
});
|
|
23542
23531
|
}),
|
|
23543
|
-
toggleUnderline: createCommand(({ commands: commands2 }) => {
|
|
23532
|
+
toggleUnderline: createCommand(({ commands: commands2, editor }) => {
|
|
23533
|
+
if (editor.isActive("link"))
|
|
23534
|
+
return;
|
|
23544
23535
|
commands2.toggleTextDecoration("underline");
|
|
23545
23536
|
}),
|
|
23546
23537
|
toggleStrikeThrough: createCommand(({ commands: commands2 }) => {
|
|
@@ -23554,7 +23545,12 @@ const TextDecoration = Mark.create({
|
|
|
23554
23545
|
commands2.setMark(this.name, { [name]: true });
|
|
23555
23546
|
}),
|
|
23556
23547
|
removeTextDecoration: createCommand(({ commands: commands2 }, name) => {
|
|
23557
|
-
|
|
23548
|
+
const mark = {
|
|
23549
|
+
...unref(commands2.getTextDecoration()),
|
|
23550
|
+
[name]: false
|
|
23551
|
+
};
|
|
23552
|
+
const isRemoveMark = !mark.underline && !mark.strike_through;
|
|
23553
|
+
isRemoveMark ? commands2.unsetMark(this.name) : commands2.setMark(this.name, mark);
|
|
23558
23554
|
})
|
|
23559
23555
|
};
|
|
23560
23556
|
},
|
|
@@ -23606,8 +23602,6 @@ const TextDecoration = Mark.create({
|
|
|
23606
23602
|
decorations.push("underline");
|
|
23607
23603
|
if (attrs.strike_through)
|
|
23608
23604
|
decorations.push("line-through");
|
|
23609
|
-
if (!decorations.length)
|
|
23610
|
-
decorations.push("none");
|
|
23611
23605
|
return renderMark({ text_decoration: decorations.join(" ") });
|
|
23612
23606
|
}
|
|
23613
23607
|
});
|
|
@@ -23653,16 +23647,12 @@ const Alignment = Extension.create({
|
|
|
23653
23647
|
parseHTML({ style: style2 }) {
|
|
23654
23648
|
const textAlign = convertAlignment(style2.textAlign);
|
|
23655
23649
|
if (textAlign) {
|
|
23656
|
-
return {
|
|
23657
|
-
desktop: textAlign,
|
|
23658
|
-
tablet: textAlign,
|
|
23659
|
-
mobile: textAlign
|
|
23660
|
-
};
|
|
23650
|
+
return { desktop: textAlign, tablet: textAlign, mobile: null };
|
|
23661
23651
|
}
|
|
23662
|
-
const mobile =
|
|
23652
|
+
const mobile = null;
|
|
23663
23653
|
const tablet = style2.getPropertyValue("--zw-text-align-tablet") || null;
|
|
23664
23654
|
const desktop = style2.getPropertyValue("--zw-text-align-desktop") || null;
|
|
23665
|
-
if (!
|
|
23655
|
+
if (!tablet && !desktop)
|
|
23666
23656
|
return null;
|
|
23667
23657
|
return { desktop, tablet, mobile };
|
|
23668
23658
|
},
|
|
@@ -23682,8 +23672,7 @@ const Alignment = Extension.create({
|
|
|
23682
23672
|
addCommands() {
|
|
23683
23673
|
return {
|
|
23684
23674
|
applyAlignment: createCommand(({ commands: commands2 }, value) => {
|
|
23685
|
-
|
|
23686
|
-
commands2.setBlockAttributes(this.name, { [device]: value }, DEFAULTS$1);
|
|
23675
|
+
commands2.setBlockAttributes(this.name, { desktop: value, tablet: value, mobile: null }, DEFAULTS$1);
|
|
23687
23676
|
}),
|
|
23688
23677
|
getAlignment: createCommand(({ commands: commands2 }) => {
|
|
23689
23678
|
const attribute = commands2.getBlockAttributes(this.name, DEFAULTS$1);
|
|
@@ -23724,7 +23713,7 @@ const LineHeight = Extension.create({
|
|
|
23724
23713
|
isRequired: false,
|
|
23725
23714
|
parseHTML: (element) => {
|
|
23726
23715
|
if (element.matches('[style*="--zw-line-height"]')) {
|
|
23727
|
-
const mobile =
|
|
23716
|
+
const mobile = null;
|
|
23728
23717
|
const tablet = element.style.getPropertyValue("--zw-line-height-tablet") || null;
|
|
23729
23718
|
const desktop = element.style.getPropertyValue("--zw-line-height-desktop") || null;
|
|
23730
23719
|
return { mobile, tablet, desktop };
|
|
@@ -23734,7 +23723,7 @@ const LineHeight = Extension.create({
|
|
|
23734
23723
|
return null;
|
|
23735
23724
|
const wrapperEl = unref(this.options.wrapperRef);
|
|
23736
23725
|
const converted = convertLineHeight(value, element, wrapperEl);
|
|
23737
|
-
return { desktop: converted, tablet: converted, mobile:
|
|
23726
|
+
return { desktop: converted, tablet: converted, mobile: null };
|
|
23738
23727
|
},
|
|
23739
23728
|
renderHTML(attrs) {
|
|
23740
23729
|
if (!attrs.line_height)
|
|
@@ -23767,8 +23756,7 @@ const LineHeight = Extension.create({
|
|
|
23767
23756
|
return computed(() => unref(preset)[unref(device)].line_height);
|
|
23768
23757
|
}),
|
|
23769
23758
|
applyLineHeight: createCommand(({ commands: commands2 }, value) => {
|
|
23770
|
-
|
|
23771
|
-
commands2.setBlockAttributes(this.name, { [device]: value }, DEFAULTS);
|
|
23759
|
+
commands2.setBlockAttributes(this.name, { desktop: value, tablet: value, mobile: null }, DEFAULTS);
|
|
23772
23760
|
})
|
|
23773
23761
|
};
|
|
23774
23762
|
}
|
|
@@ -24871,7 +24859,7 @@ const Link$1 = Mark.create({
|
|
|
24871
24859
|
}
|
|
24872
24860
|
});
|
|
24873
24861
|
const Link = Link$1.extend({
|
|
24874
|
-
name:
|
|
24862
|
+
name: "link",
|
|
24875
24863
|
addOptions() {
|
|
24876
24864
|
var _a;
|
|
24877
24865
|
return {
|
|
@@ -24914,14 +24902,19 @@ const Link = Link$1.extend({
|
|
|
24914
24902
|
...(_a = this.parent) == null ? void 0 : _a.call(this),
|
|
24915
24903
|
applyLink: createCommand(({ commands: commands2, chain }, attributes) => {
|
|
24916
24904
|
if (!commands2.getSelectedText()) {
|
|
24917
|
-
return commands2.insertContent(
|
|
24918
|
-
|
|
24919
|
-
|
|
24905
|
+
return commands2.insertContent({
|
|
24906
|
+
type: "text",
|
|
24907
|
+
marks: [
|
|
24908
|
+
{
|
|
24909
|
+
type: "link",
|
|
24910
|
+
attrs: { ...attributes }
|
|
24911
|
+
}
|
|
24912
|
+
],
|
|
24913
|
+
text: attributes.text
|
|
24914
|
+
});
|
|
24920
24915
|
}
|
|
24921
|
-
return chain().setMark(this.name, attributes).transformText(() => attributes.text).extendMarkRange(
|
|
24922
|
-
})
|
|
24923
|
-
isLink: createCommand(({ editor }) => computed(() => editor.isActive(TextSettings.LINK))),
|
|
24924
|
-
getLinkPreset: createCommand(() => computed(() => this.options.preset))
|
|
24916
|
+
return chain().setMark(this.name, attributes).transformText(() => attributes.text).extendMarkRange("link").run();
|
|
24917
|
+
})
|
|
24925
24918
|
};
|
|
24926
24919
|
},
|
|
24927
24920
|
renderHTML({ HTMLAttributes: attrs }) {
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
</template>
|
|
32
32
|
|
|
33
33
|
<script>
|
|
34
|
-
import { computed, ref, inject
|
|
35
|
-
import { LinkDestinations
|
|
34
|
+
import { computed, ref, inject } from 'vue';
|
|
35
|
+
import { LinkDestinations } from '../../../../enums';
|
|
36
36
|
import { InjectionTokens } from '../../../../injectionTokens';
|
|
37
37
|
import { tooltip } from '../../../../directives';
|
|
38
38
|
import { useValidator } from '../../../base/composables';
|
|
@@ -94,7 +94,7 @@ export default {
|
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
const onBeforeOpened = () => {
|
|
97
|
-
editor.commands.extendMarkRange(
|
|
97
|
+
editor.commands.extendMarkRange('link');
|
|
98
98
|
resetErrors();
|
|
99
99
|
link.prepareInitialFields();
|
|
100
100
|
};
|
|
@@ -105,8 +105,7 @@ export default {
|
|
|
105
105
|
modalRef
|
|
106
106
|
});
|
|
107
107
|
|
|
108
|
-
const
|
|
109
|
-
const isActive = computed(() => toggler.isOpened.value || unref(isLink));
|
|
108
|
+
const isActive = computed(() => toggler.isOpened.value || editor.isActive('link'));
|
|
110
109
|
|
|
111
110
|
const updateLinkText = (value) => {
|
|
112
111
|
resetErrors();
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
12
|
<script>
|
|
13
|
-
import { inject } from 'vue';
|
|
13
|
+
import { computed, inject } from 'vue';
|
|
14
14
|
import { Icon, Button } from '../../../base';
|
|
15
15
|
import { InjectionTokens } from '../../../../injectionTokens';
|
|
16
16
|
|
|
@@ -21,7 +21,7 @@ export default {
|
|
|
21
21
|
|
|
22
22
|
setup(_, { emit }) {
|
|
23
23
|
const editor = inject(InjectionTokens.EDITOR);
|
|
24
|
-
const isLink = editor.
|
|
24
|
+
const isLink = computed(() => editor.isActive('link'));
|
|
25
25
|
|
|
26
26
|
const removeLink = () => emit('remove-link');
|
|
27
27
|
|
|
@@ -7,7 +7,7 @@ import LinkControlApply from '../LinkControlApply';
|
|
|
7
7
|
import { LinkControlDestination } from '../destination';
|
|
8
8
|
|
|
9
9
|
const createEditor = (isActive) => ({
|
|
10
|
-
|
|
10
|
+
isActive: () => isActive ?? false
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
function createComponent({ editor }) {
|
|
@@ -4,7 +4,7 @@ import { Button } from '../../../../base';
|
|
|
4
4
|
import LinkControlHeader from '../LinkControlHeader';
|
|
5
5
|
|
|
6
6
|
const createEditor = (isActive) => ({
|
|
7
|
-
|
|
7
|
+
isActive: () => isActive ?? false
|
|
8
8
|
});
|
|
9
9
|
|
|
10
10
|
function createComponent({ editor }) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref, inject } from 'vue';
|
|
2
|
-
import { LinkTargets, LinkDestinations
|
|
2
|
+
import { LinkTargets, LinkDestinations } from '../../../../../enums';
|
|
3
3
|
import { InjectionTokens } from '../../../../../injectionTokens';
|
|
4
4
|
|
|
5
5
|
export function useLink() {
|
|
@@ -15,14 +15,12 @@ export function useLink() {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function prepareInitialFields() {
|
|
18
|
-
const link = editor.getAttributes(TextSettings.LINK);
|
|
19
|
-
|
|
20
18
|
linkData.value.text = editor.commands.getSelectedText();
|
|
21
|
-
currentDestination.value.id = link.destination || LinkDestinations.URL;
|
|
22
|
-
linkData.value.target = link.target || LinkTargets.SELF;
|
|
19
|
+
currentDestination.value.id = editor.getAttributes('link').destination || LinkDestinations.URL;
|
|
20
|
+
linkData.value.target = editor.getAttributes('link').target || LinkTargets.SELF;
|
|
23
21
|
|
|
24
|
-
if (link.href) {
|
|
25
|
-
destinationHrefs.value[currentDestination.value.id] = link.href;
|
|
22
|
+
if (editor.getAttributes('link').href) {
|
|
23
|
+
destinationHrefs.value[currentDestination.value.id] = editor.getAttributes('link').href;
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
|
|
@@ -23,14 +23,13 @@ export const Alignment = Extension.create({
|
|
|
23
23
|
const textAlign = convertAlignment(style.textAlign);
|
|
24
24
|
|
|
25
25
|
if (textAlign) {
|
|
26
|
-
return {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
26
|
+
// return { desktop: textAlign, tablet: textAlign, mobile: textAlign };
|
|
27
|
+
|
|
28
|
+
// Temporary until release BUILDER_MODES
|
|
29
|
+
return { desktop: textAlign, tablet: textAlign, mobile: null };
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
const mobile = style.getPropertyValue('--zw-text-align-mobile') || null;
|
|
32
|
+
const mobile = null; //style.getPropertyValue('--zw-text-align-mobile') || null;
|
|
34
33
|
const tablet = style.getPropertyValue('--zw-text-align-tablet') || null;
|
|
35
34
|
const desktop = style.getPropertyValue('--zw-text-align-desktop') || null;
|
|
36
35
|
|
|
@@ -56,9 +55,12 @@ export const Alignment = Extension.create({
|
|
|
56
55
|
addCommands() {
|
|
57
56
|
return {
|
|
58
57
|
applyAlignment: createCommand(({ commands }, value) => {
|
|
59
|
-
const device = unref(commands.getDevice());
|
|
58
|
+
// const device = unref(commands.getDevice());
|
|
59
|
+
//
|
|
60
|
+
// commands.setBlockAttributes(this.name, { [device]: value }, DEFAULTS);
|
|
60
61
|
|
|
61
|
-
|
|
62
|
+
// Temporary until release BUILDER_MODES
|
|
63
|
+
commands.setBlockAttributes(this.name, { desktop: value, tablet: value, mobile: null }, DEFAULTS);
|
|
62
64
|
}),
|
|
63
65
|
|
|
64
66
|
getAlignment: createCommand(({ commands }) => {
|
|
@@ -36,9 +36,12 @@ export const FontSize = Mark.create({
|
|
|
36
36
|
}),
|
|
37
37
|
|
|
38
38
|
applyFontSize: createCommand(({ commands }, value) => {
|
|
39
|
-
const device = unref(commands.getDevice());
|
|
39
|
+
// const device = unref(commands.getDevice());
|
|
40
40
|
|
|
41
|
-
commands.setMark(this.name, { [device]: value });
|
|
41
|
+
// commands.setMark(this.name, { [device]: value });
|
|
42
|
+
|
|
43
|
+
// Temporary until release BUILDER_MODES
|
|
44
|
+
commands.setMark(this.name, { desktop: value, tablet: value, mobile: null });
|
|
42
45
|
}),
|
|
43
46
|
|
|
44
47
|
increaseFontSize: createCommand(({ commands }) => {
|
|
@@ -88,7 +91,9 @@ export const FontSize = Mark.create({
|
|
|
88
91
|
getAttrs: (input) => {
|
|
89
92
|
const value = parseSize(input);
|
|
90
93
|
|
|
91
|
-
return { desktop: value, tablet: value, mobile: value };
|
|
94
|
+
// return { desktop: value, tablet: value, mobile: value };
|
|
95
|
+
// Temporary until release BUILDER_MODES
|
|
96
|
+
return { desktop: value, tablet: value, mobile: null };
|
|
92
97
|
}
|
|
93
98
|
}
|
|
94
99
|
];
|
|
@@ -46,7 +46,7 @@ export const FontStyle = Mark.create({
|
|
|
46
46
|
}),
|
|
47
47
|
|
|
48
48
|
removeItalic: createCommand(({ commands }) => {
|
|
49
|
-
commands.
|
|
49
|
+
commands.unsetMark(this.name);
|
|
50
50
|
})
|
|
51
51
|
};
|
|
52
52
|
},
|
|
@@ -76,7 +76,7 @@ export const FontStyle = Mark.create({
|
|
|
76
76
|
},
|
|
77
77
|
|
|
78
78
|
renderHTML({ HTMLAttributes: attrs }) {
|
|
79
|
-
const font_style = attrs.italic ? 'italic' :
|
|
79
|
+
const font_style = attrs.italic ? 'italic' : null;
|
|
80
80
|
|
|
81
81
|
return renderMark({ font_style });
|
|
82
82
|
}
|
|
@@ -22,7 +22,7 @@ export const LineHeight = Extension.create({
|
|
|
22
22
|
|
|
23
23
|
parseHTML: (element) => {
|
|
24
24
|
if (element.matches('[style*="--zw-line-height"]')) {
|
|
25
|
-
const mobile = element.style.getPropertyValue('--zw-line-height-mobile') || null;
|
|
25
|
+
const mobile = null; // element.style.getPropertyValue('--zw-line-height-mobile') || null;
|
|
26
26
|
const tablet = element.style.getPropertyValue('--zw-line-height-tablet') || null;
|
|
27
27
|
const desktop = element.style.getPropertyValue('--zw-line-height-desktop') || null;
|
|
28
28
|
|
|
@@ -36,7 +36,10 @@ export const LineHeight = Extension.create({
|
|
|
36
36
|
const wrapperEl = unref(this.options.wrapperRef);
|
|
37
37
|
const converted = convertLineHeight(value, element, wrapperEl);
|
|
38
38
|
|
|
39
|
-
return { desktop: converted, tablet: converted, mobile: converted };
|
|
39
|
+
// return { desktop: converted, tablet: converted, mobile: converted };
|
|
40
|
+
|
|
41
|
+
// Temporary until release BUILDER_MODES
|
|
42
|
+
return { desktop: converted, tablet: converted, mobile: null };
|
|
40
43
|
},
|
|
41
44
|
|
|
42
45
|
renderHTML(attrs) {
|
|
@@ -72,9 +75,12 @@ export const LineHeight = Extension.create({
|
|
|
72
75
|
}),
|
|
73
76
|
|
|
74
77
|
applyLineHeight: createCommand(({ commands }, value) => {
|
|
75
|
-
const device = unref(commands.getDevice());
|
|
78
|
+
// const device = unref(commands.getDevice());
|
|
79
|
+
//
|
|
80
|
+
// commands.setBlockAttributes(this.name, { [device]: value }, DEFAULTS);
|
|
76
81
|
|
|
77
|
-
|
|
82
|
+
// Temporary until release BUILDER_MODES
|
|
83
|
+
commands.setBlockAttributes(this.name, { desktop: value, tablet: value, mobile: null }, DEFAULTS);
|
|
78
84
|
})
|
|
79
85
|
};
|
|
80
86
|
}
|
package/lib/extensions/Link.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import Base from '@tiptap/extension-link';
|
|
2
|
-
import {
|
|
2
|
+
import { unref } from 'vue';
|
|
3
3
|
import { createCommand } from '../utils';
|
|
4
|
-
import { LinkDestinations, LinkTargets
|
|
5
|
-
import { NodeFactory } from '../services';
|
|
4
|
+
import { LinkDestinations, LinkTargets } from '../enums';
|
|
6
5
|
|
|
7
6
|
export const Link = Base.extend({
|
|
8
|
-
name:
|
|
7
|
+
name: 'link',
|
|
9
8
|
|
|
10
9
|
addOptions() {
|
|
11
10
|
return {
|
|
@@ -53,23 +52,26 @@ export const Link = Base.extend({
|
|
|
53
52
|
addCommands() {
|
|
54
53
|
return {
|
|
55
54
|
...this.parent?.(),
|
|
56
|
-
|
|
57
55
|
applyLink: createCommand(({ commands, chain }, attributes) => {
|
|
58
56
|
if (!commands.getSelectedText()) {
|
|
59
|
-
return commands.insertContent(
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
return commands.insertContent({
|
|
58
|
+
type: 'text',
|
|
59
|
+
marks: [
|
|
60
|
+
{
|
|
61
|
+
type: 'link',
|
|
62
|
+
attrs: { ...attributes }
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
text: attributes.text
|
|
66
|
+
});
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
return chain()
|
|
65
70
|
.setMark(this.name, attributes)
|
|
66
71
|
.transformText(() => attributes.text)
|
|
67
|
-
.extendMarkRange(
|
|
72
|
+
.extendMarkRange('link')
|
|
68
73
|
.run();
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
isLink: createCommand(({ editor }) => computed(() => editor.isActive(TextSettings.LINK))),
|
|
72
|
-
getLinkPreset: createCommand(() => computed(() => this.options.preset))
|
|
74
|
+
})
|
|
73
75
|
};
|
|
74
76
|
},
|
|
75
77
|
|