@limetech/lime-elements 37.45.1 → 37.46.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/CHANGELOG.md +18 -0
- package/dist/cjs/component-cba208a8.js +2448 -0
- package/dist/cjs/component-cba208a8.js.map +1 -0
- package/dist/cjs/{dom-ee8ee17d.js → debounce-2e5f4b7e.js} +1 -31
- package/dist/cjs/debounce-2e5f4b7e.js.map +1 -0
- package/dist/cjs/dom-81eaa633.js +34 -0
- package/dist/cjs/dom-81eaa633.js.map +1 -0
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/{limel-action-bar_3.cjs.entry.js → limel-action-bar_4.cjs.entry.js} +68 -1
- package/dist/cjs/limel-action-bar_4.cjs.entry.js.map +1 -0
- package/dist/cjs/{limel-breadcrumbs_7.cjs.entry.js → limel-breadcrumbs_5.cjs.entry.js} +412 -3357
- package/dist/cjs/limel-breadcrumbs_5.cjs.entry.js.map +1 -0
- package/dist/cjs/limel-callout.cjs.entry.js +1 -1
- package/dist/cjs/limel-chip_2.cjs.entry.js +2 -2
- package/dist/cjs/limel-dynamic-label_4.cjs.entry.js +610 -0
- package/dist/cjs/limel-dynamic-label_4.cjs.entry.js.map +1 -0
- package/dist/cjs/limel-file-viewer.cjs.entry.js +1 -1
- package/dist/cjs/limel-file.cjs.entry.js +1 -1
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +1 -1
- package/dist/cjs/limel-form.cjs.entry.js +1 -1
- package/dist/cjs/limel-form.cjs.entry.js.map +1 -1
- package/dist/cjs/{limel-portal.cjs.entry.js → limel-icon_2.cjs.entry.js} +201 -1
- package/dist/cjs/limel-icon_2.cjs.entry.js.map +1 -0
- package/dist/cjs/limel-picker.cjs.entry.js +3 -2
- package/dist/cjs/limel-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +303 -16
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-snackbar.cjs.entry.js +1 -1
- package/dist/cjs/{link-helper-b7e6c8df.js → link-helper-563b01c0.js} +3 -1
- package/dist/cjs/link-helper-563b01c0.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{translations-988a3f51.js → translations-83a68e56.js} +25 -1
- package/dist/cjs/translations-83a68e56.js.map +1 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/chip/chip.js +2 -2
- package/dist/collection/components/text-editor/link-menu/editor-link-menu.css +12 -0
- package/dist/collection/components/text-editor/link-menu/editor-link-menu.js +201 -0
- package/dist/collection/components/text-editor/link-menu/editor-link-menu.js.map +1 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-commands.js +72 -11
- package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-commands.js.map +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-items.js +6 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-items.js.map +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/menu/types.js.map +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/link-plugin.js +172 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/link-plugin.js.map +1 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.css +4 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +62 -6
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js.map +1 -1
- package/dist/collection/translations/da.js +4 -0
- package/dist/collection/translations/da.js.map +1 -1
- package/dist/collection/translations/en.js +4 -0
- package/dist/collection/translations/en.js.map +1 -1
- package/dist/collection/translations/fi.js +4 -0
- package/dist/collection/translations/fi.js.map +1 -1
- package/dist/collection/translations/nl.js +4 -0
- package/dist/collection/translations/nl.js.map +1 -1
- package/dist/collection/translations/no.js +4 -0
- package/dist/collection/translations/no.js.map +1 -1
- package/dist/collection/translations/sv.js +4 -0
- package/dist/collection/translations/sv.js.map +1 -1
- package/dist/collection/util/link-helper.js +1 -1
- package/dist/collection/util/link-helper.js.map +1 -1
- package/dist/esm/component-db286494.js +2440 -0
- package/dist/esm/component-db286494.js.map +1 -0
- package/dist/esm/{dom-ae531ebc.js → debounce-9a05c91c.js} +2 -31
- package/dist/esm/debounce-9a05c91c.js.map +1 -0
- package/dist/esm/dom-0b0170a0.js +32 -0
- package/dist/esm/dom-0b0170a0.js.map +1 -0
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/{limel-action-bar_3.entry.js → limel-action-bar_4.entry.js} +68 -2
- package/dist/esm/limel-action-bar_4.entry.js.map +1 -0
- package/dist/esm/{limel-breadcrumbs_7.entry.js → limel-breadcrumbs_5.entry.js} +404 -3347
- package/dist/esm/limel-breadcrumbs_5.entry.js.map +1 -0
- package/dist/esm/limel-callout.entry.js +1 -1
- package/dist/esm/limel-chip_2.entry.js +2 -2
- package/dist/esm/limel-dynamic-label_4.entry.js +603 -0
- package/dist/esm/limel-dynamic-label_4.entry.js.map +1 -0
- package/dist/esm/limel-file-viewer.entry.js +1 -1
- package/dist/esm/limel-file.entry.js +1 -1
- package/dist/esm/limel-flatpickr-adapter.entry.js +1 -1
- package/dist/esm/limel-form.entry.js +1 -1
- package/dist/esm/limel-form.entry.js.map +1 -1
- package/dist/esm/{limel-portal.entry.js → limel-icon_2.entry.js} +201 -2
- package/dist/esm/limel-icon_2.entry.js.map +1 -0
- package/dist/esm/limel-picker.entry.js +2 -1
- package/dist/esm/limel-picker.entry.js.map +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +303 -16
- package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
- package/dist/esm/limel-snackbar.entry.js +1 -1
- package/dist/esm/{link-helper-725a9166.js → link-helper-2a16b323.js} +2 -2
- package/dist/esm/link-helper-2a16b323.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{translations-e73d7840.js → translations-5ae8ec7b.js} +25 -1
- package/dist/esm/translations-5ae8ec7b.js.map +1 -0
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js.map +1 -1
- package/dist/lime-elements/p-18c97232.js +2 -0
- package/dist/lime-elements/p-18c97232.js.map +1 -0
- package/dist/lime-elements/{p-5cfed8a8.entry.js → p-26a43fd9.entry.js} +5 -5
- package/dist/lime-elements/p-29e0e5bd.js +2 -0
- package/dist/lime-elements/p-29e0e5bd.js.map +1 -0
- package/dist/lime-elements/{p-dfc28411.entry.js → p-42b6ba6d.entry.js} +2 -2
- package/dist/lime-elements/{p-c8ce7cd4.entry.js → p-4bd0b7fb.entry.js} +2 -2
- package/dist/lime-elements/p-50b604b9.entry.js +2 -0
- package/dist/lime-elements/p-50b604b9.entry.js.map +1 -0
- package/dist/lime-elements/{p-ab13cb4a.entry.js → p-5e2604e5.entry.js} +2 -2
- package/dist/lime-elements/p-5e7b7b03.js +2 -0
- package/dist/lime-elements/p-5e7b7b03.js.map +1 -0
- package/dist/lime-elements/{p-516619d3.js → p-6465625e.js} +2 -2
- package/dist/lime-elements/p-6465625e.js.map +1 -0
- package/dist/lime-elements/{p-7681dae8.entry.js → p-70bfa812.entry.js} +2 -2
- package/dist/lime-elements/p-8d71c9e5.entry.js +2 -0
- package/dist/lime-elements/p-8d71c9e5.entry.js.map +1 -0
- package/dist/lime-elements/{p-e3eb403a.entry.js → p-91a8c244.entry.js} +2 -2
- package/dist/lime-elements/p-b8bfe44d.entry.js +2 -0
- package/dist/lime-elements/{p-3f4d2f62.entry.js.map → p-b8bfe44d.entry.js.map} +1 -1
- package/dist/lime-elements/p-bcfb5db5.entry.js +68 -0
- package/dist/lime-elements/p-bcfb5db5.entry.js.map +1 -0
- package/dist/lime-elements/p-d4d2593b.entry.js +2 -0
- package/dist/lime-elements/p-d4d2593b.entry.js.map +1 -0
- package/dist/lime-elements/p-eb9ab3d4.entry.js +2 -0
- package/dist/lime-elements/p-eb9ab3d4.entry.js.map +1 -0
- package/dist/lime-elements/p-f764b655.js +200 -0
- package/dist/lime-elements/p-f764b655.js.map +1 -0
- package/dist/lime-elements/{p-cfe4e725.entry.js → p-fe5e8f22.entry.js} +2 -2
- package/dist/lime-elements/{p-cfe4e725.entry.js.map → p-fe5e8f22.entry.js.map} +1 -1
- package/dist/types/components/file-viewer/file-viewer.d.ts +126 -0
- package/dist/types/components/progress-flow/progress-flow-item/progress-flow-item.d.ts +36 -0
- package/dist/types/components/progress-flow/progress-flow.d.ts +49 -0
- package/dist/types/components/text-editor/link-menu/editor-link-menu.d.ts +47 -0
- package/dist/types/components/text-editor/prosemirror-adapter/menu/menu-commands.d.ts +5 -2
- package/dist/types/components/text-editor/prosemirror-adapter/menu/types.d.ts +49 -0
- package/dist/types/components/text-editor/prosemirror-adapter/plugins/link-plugin.d.ts +9 -0
- package/dist/types/components/text-editor/prosemirror-adapter/prosemirror-adapter.d.ts +15 -3
- package/dist/types/components.d.ts +79 -0
- package/dist/types/translations/da.d.ts +4 -0
- package/dist/types/translations/en.d.ts +4 -0
- package/dist/types/translations/fi.d.ts +4 -0
- package/dist/types/translations/nl.d.ts +4 -0
- package/dist/types/translations/no.d.ts +4 -0
- package/dist/types/translations/sv.d.ts +4 -0
- package/dist/types/util/link-helper.d.ts +1 -0
- package/package.json +2 -2
- package/dist/cjs/dom-ee8ee17d.js.map +0 -1
- package/dist/cjs/limel-action-bar_3.cjs.entry.js.map +0 -1
- package/dist/cjs/limel-breadcrumbs_7.cjs.entry.js.map +0 -1
- package/dist/cjs/limel-dynamic-label_2.cjs.entry.js +0 -91
- package/dist/cjs/limel-dynamic-label_2.cjs.entry.js.map +0 -1
- package/dist/cjs/limel-icon.cjs.entry.js +0 -208
- package/dist/cjs/limel-icon.cjs.entry.js.map +0 -1
- package/dist/cjs/limel-portal.cjs.entry.js.map +0 -1
- package/dist/cjs/link-helper-b7e6c8df.js.map +0 -1
- package/dist/cjs/translations-988a3f51.js.map +0 -1
- package/dist/esm/dom-ae531ebc.js.map +0 -1
- package/dist/esm/limel-action-bar_3.entry.js.map +0 -1
- package/dist/esm/limel-breadcrumbs_7.entry.js.map +0 -1
- package/dist/esm/limel-dynamic-label_2.entry.js +0 -86
- package/dist/esm/limel-dynamic-label_2.entry.js.map +0 -1
- package/dist/esm/limel-icon.entry.js +0 -204
- package/dist/esm/limel-icon.entry.js.map +0 -1
- package/dist/esm/limel-portal.entry.js.map +0 -1
- package/dist/esm/link-helper-725a9166.js.map +0 -1
- package/dist/esm/translations-e73d7840.js.map +0 -1
- package/dist/lime-elements/p-2f453044.entry.js +0 -266
- package/dist/lime-elements/p-2f453044.entry.js.map +0 -1
- package/dist/lime-elements/p-35a4a846.entry.js +0 -2
- package/dist/lime-elements/p-35a4a846.entry.js.map +0 -1
- package/dist/lime-elements/p-3ae3b23e.entry.js +0 -2
- package/dist/lime-elements/p-3ae3b23e.entry.js.map +0 -1
- package/dist/lime-elements/p-3f4d2f62.entry.js +0 -2
- package/dist/lime-elements/p-516619d3.js.map +0 -1
- package/dist/lime-elements/p-5c9fbe6f.entry.js +0 -2
- package/dist/lime-elements/p-5c9fbe6f.entry.js.map +0 -1
- package/dist/lime-elements/p-714d6937.js +0 -2
- package/dist/lime-elements/p-714d6937.js.map +0 -1
- package/dist/lime-elements/p-a2d19673.entry.js +0 -2
- package/dist/lime-elements/p-a2d19673.entry.js.map +0 -1
- package/dist/lime-elements/p-cd6b9ff0.js +0 -2
- package/dist/lime-elements/p-cd6b9ff0.js.map +0 -1
- package/dist/lime-elements/p-f548d996.entry.js +0 -2
- package/dist/lime-elements/p-f548d996.entry.js.map +0 -1
- /package/dist/lime-elements/{p-5cfed8a8.entry.js.map → p-26a43fd9.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-dfc28411.entry.js.map → p-42b6ba6d.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-c8ce7cd4.entry.js.map → p-4bd0b7fb.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-ab13cb4a.entry.js.map → p-5e2604e5.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-7681dae8.entry.js.map → p-70bfa812.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-e3eb403a.entry.js.map → p-91a8c244.entry.js.map} +0 -0
|
@@ -10,7 +10,8 @@ const isObject$1 = require('./isObject-e28b7997.js');
|
|
|
10
10
|
const isArray = require('./isArray-d188a04f.js');
|
|
11
11
|
const isObjectLike = require('./isObjectLike-3e3f0cba.js');
|
|
12
12
|
const markdownParser = require('./markdown-parser-1686b0d7.js');
|
|
13
|
-
const translations = require('./translations-
|
|
13
|
+
const translations = require('./translations-83a68e56.js');
|
|
14
|
+
const randomString = require('./random-string-c8445652.js');
|
|
14
15
|
const isItem = require('./isItem-3f8ad629.js');
|
|
15
16
|
require('./eq-9a943b00.js');
|
|
16
17
|
require('./_getNative-60328036.js');
|
|
@@ -16600,21 +16601,51 @@ const setActiveMethodForWrap = (command, nodeType) => {
|
|
|
16600
16601
|
return false;
|
|
16601
16602
|
};
|
|
16602
16603
|
};
|
|
16603
|
-
const
|
|
16604
|
+
const createInsertLinkCommand = (schema, _, link) => {
|
|
16605
|
+
const command = (state, dispatch) => {
|
|
16606
|
+
const { from, to } = state.selection;
|
|
16607
|
+
if (from === to) {
|
|
16608
|
+
// If no text is selected, insert new text with link
|
|
16609
|
+
const linkMark = schema.marks.link.create({
|
|
16610
|
+
href: link.href,
|
|
16611
|
+
title: link.href,
|
|
16612
|
+
target: isExternalLink(link.href) ? '_blank' : null,
|
|
16613
|
+
});
|
|
16614
|
+
const linkText = link.text || link.href;
|
|
16615
|
+
const newLink = schema.text(linkText, [linkMark]);
|
|
16616
|
+
dispatch(state.tr.insert(from, newLink));
|
|
16617
|
+
}
|
|
16618
|
+
else {
|
|
16619
|
+
// If text is selected, replace selected text with link text
|
|
16620
|
+
const linkMark = schema.marks.link.create({
|
|
16621
|
+
href: link.href,
|
|
16622
|
+
title: link.href,
|
|
16623
|
+
target: isExternalLink(link.href) ? '_blank' : null,
|
|
16624
|
+
});
|
|
16625
|
+
const selectedText = state.doc.textBetween(from, to, ' ');
|
|
16626
|
+
const newLink = schema.text(link.text || selectedText, [linkMark]);
|
|
16627
|
+
dispatch(state.tr.replaceWith(from, to, newLink));
|
|
16628
|
+
}
|
|
16629
|
+
return true;
|
|
16630
|
+
};
|
|
16631
|
+
setActiveMethodForMark(command, schema.marks.link);
|
|
16632
|
+
return command;
|
|
16633
|
+
};
|
|
16634
|
+
const createToggleMarkCommand = (schema, markName, link) => {
|
|
16604
16635
|
const markType = schema.marks[markName];
|
|
16605
16636
|
if (!markType) {
|
|
16606
16637
|
throw new Error(`Mark "${markName}" not found in schema`);
|
|
16607
16638
|
}
|
|
16608
|
-
const attrs = getAttributes(markName,
|
|
16639
|
+
const attrs = getAttributes(markName, link);
|
|
16609
16640
|
const command = toggleMark(markType, attrs);
|
|
16610
16641
|
setActiveMethodForMark(command, markType);
|
|
16611
16642
|
return command;
|
|
16612
16643
|
};
|
|
16613
|
-
const getAttributes = (markName,
|
|
16614
|
-
if (markName === EditorMenuTypes.Link &&
|
|
16644
|
+
const getAttributes = (markName, link) => {
|
|
16645
|
+
if (markName === EditorMenuTypes.Link && link.href) {
|
|
16615
16646
|
return {
|
|
16616
|
-
href:
|
|
16617
|
-
target: isExternalLink(
|
|
16647
|
+
href: link.href,
|
|
16648
|
+
target: isExternalLink(link.href) ? '_blank' : null,
|
|
16618
16649
|
};
|
|
16619
16650
|
}
|
|
16620
16651
|
return undefined;
|
|
@@ -16647,6 +16678,15 @@ const toggleBlockType = (schema, type, attrs = {}, wrap = false) => {
|
|
|
16647
16678
|
return false;
|
|
16648
16679
|
};
|
|
16649
16680
|
};
|
|
16681
|
+
const isValidUrl = (text) => {
|
|
16682
|
+
try {
|
|
16683
|
+
new URL(text);
|
|
16684
|
+
}
|
|
16685
|
+
catch (_a) {
|
|
16686
|
+
return false;
|
|
16687
|
+
}
|
|
16688
|
+
return true;
|
|
16689
|
+
};
|
|
16650
16690
|
const createSetNodeTypeCommand = (schema, nodeType, level) => {
|
|
16651
16691
|
const type = schema.nodes[nodeType];
|
|
16652
16692
|
if (!type) {
|
|
@@ -16719,13 +16759,34 @@ const createListCommand = (schema, listType) => {
|
|
|
16719
16759
|
setActiveMethodForWrap(command, type);
|
|
16720
16760
|
return command;
|
|
16721
16761
|
};
|
|
16762
|
+
const copyPasteLinkCommand = (state, dispatch) => {
|
|
16763
|
+
const { from, to } = state.selection;
|
|
16764
|
+
if (from === to) {
|
|
16765
|
+
return false;
|
|
16766
|
+
}
|
|
16767
|
+
const clipboardData = window.clipboardData;
|
|
16768
|
+
if (!clipboardData) {
|
|
16769
|
+
return false;
|
|
16770
|
+
}
|
|
16771
|
+
const copyPastedText = clipboardData.getData('text');
|
|
16772
|
+
if (!isValidUrl(copyPastedText)) {
|
|
16773
|
+
return false;
|
|
16774
|
+
}
|
|
16775
|
+
const linkMark = state.schema.marks.link.create({
|
|
16776
|
+
href: copyPastedText,
|
|
16777
|
+
target: isExternalLink(copyPastedText) ? '_blank' : null,
|
|
16778
|
+
});
|
|
16779
|
+
const selectedText = state.doc.textBetween(from, to, ' ');
|
|
16780
|
+
const newLink = state.schema.text(selectedText, [linkMark]);
|
|
16781
|
+
dispatch(state.tr.replaceWith(from, to, newLink));
|
|
16782
|
+
};
|
|
16722
16783
|
const commandMapping = {
|
|
16723
16784
|
strong: createToggleMarkCommand,
|
|
16724
16785
|
em: createToggleMarkCommand,
|
|
16725
16786
|
underline: createToggleMarkCommand,
|
|
16726
16787
|
strikethrough: createToggleMarkCommand,
|
|
16727
16788
|
code: createToggleMarkCommand,
|
|
16728
|
-
link:
|
|
16789
|
+
link: createInsertLinkCommand,
|
|
16729
16790
|
headerlevel1: (schema) => createSetNodeTypeCommand(schema, LevelMapping.Heading, LevelMapping.one),
|
|
16730
16791
|
headerlevel2: (schema) => createSetNodeTypeCommand(schema, LevelMapping.Heading, LevelMapping.two),
|
|
16731
16792
|
headerlevel3: (schema) => createSetNodeTypeCommand(schema, LevelMapping.Heading, LevelMapping.three),
|
|
@@ -16740,12 +16801,12 @@ class MenuCommandFactory {
|
|
|
16740
16801
|
constructor(schema) {
|
|
16741
16802
|
this.schema = schema;
|
|
16742
16803
|
}
|
|
16743
|
-
getCommand(mark,
|
|
16804
|
+
getCommand(mark, link) {
|
|
16744
16805
|
const commandFunc = commandMapping[mark];
|
|
16745
16806
|
if (!commandFunc) {
|
|
16746
16807
|
throw new Error(`The Mark "${mark}" is not supported`);
|
|
16747
16808
|
}
|
|
16748
|
-
return commandFunc(this.schema, mark,
|
|
16809
|
+
return commandFunc(this.schema, mark, link);
|
|
16749
16810
|
}
|
|
16750
16811
|
buildKeymap() {
|
|
16751
16812
|
return {
|
|
@@ -16757,6 +16818,7 @@ class MenuCommandFactory {
|
|
|
16757
16818
|
'Mod-Shift-X': this.getCommand(EditorMenuTypes.Strikethrough),
|
|
16758
16819
|
'Mod-`': this.getCommand(EditorMenuTypes.Code),
|
|
16759
16820
|
'Mod-Shift-C': this.getCommand(EditorMenuTypes.CodeBlock),
|
|
16821
|
+
'Mod-v': copyPasteLinkCommand,
|
|
16760
16822
|
};
|
|
16761
16823
|
}
|
|
16762
16824
|
}
|
|
@@ -16857,6 +16919,12 @@ const textEditorMenuItems = [
|
|
|
16857
16919
|
iconOnly: true,
|
|
16858
16920
|
selected: false,
|
|
16859
16921
|
},
|
|
16922
|
+
{
|
|
16923
|
+
value: EditorMenuTypes.Link,
|
|
16924
|
+
text: 'Link',
|
|
16925
|
+
icon: '-lime-text-link',
|
|
16926
|
+
iconOnly: true,
|
|
16927
|
+
},
|
|
16860
16928
|
];
|
|
16861
16929
|
const getTextEditorMenuItems = () => cloneDeep(textEditorMenuItems);
|
|
16862
16930
|
const menuTranslationIDs = {
|
|
@@ -25554,12 +25622,182 @@ const strikethrough = {
|
|
|
25554
25622
|
},
|
|
25555
25623
|
};
|
|
25556
25624
|
|
|
25557
|
-
const
|
|
25625
|
+
const linkPluginKey = new PluginKey('linkPlugin');
|
|
25626
|
+
const updateLink = (view, updateLinkCallback) => {
|
|
25627
|
+
const { from, to } = view.state.selection;
|
|
25628
|
+
let text = '';
|
|
25629
|
+
let href = '';
|
|
25630
|
+
view.state.doc.nodesBetween(from, to, (node) => {
|
|
25631
|
+
if (node.type.name === 'text') {
|
|
25632
|
+
text = node.text;
|
|
25633
|
+
node.marks.forEach((mark) => {
|
|
25634
|
+
if (mark.type.name === 'link') {
|
|
25635
|
+
href = mark.attrs.href;
|
|
25636
|
+
}
|
|
25637
|
+
});
|
|
25638
|
+
}
|
|
25639
|
+
});
|
|
25640
|
+
if (updateLinkCallback) {
|
|
25641
|
+
updateLinkCallback(text, href);
|
|
25642
|
+
}
|
|
25643
|
+
};
|
|
25644
|
+
/**
|
|
25645
|
+
* Finds the start position of the link node ensuring the href matches the original link's href.
|
|
25646
|
+
* @param doc - The ProseMirror document.
|
|
25647
|
+
* @param pos - The position to start searching from.
|
|
25648
|
+
* @param href - The href attribute of the original link mark.
|
|
25649
|
+
* @returns The start position of the link node.
|
|
25650
|
+
*/
|
|
25651
|
+
const findStart = (doc, pos, href) => {
|
|
25652
|
+
while (pos > 0) {
|
|
25653
|
+
const node = doc.nodeAt(pos - 1);
|
|
25654
|
+
if (!(node === null || node === void 0 ? void 0 : node.isText) ||
|
|
25655
|
+
!node.marks.some((mark) => mark.type.name === EditorMenuTypes.Link &&
|
|
25656
|
+
mark.attrs.href === href)) {
|
|
25657
|
+
break;
|
|
25658
|
+
}
|
|
25659
|
+
pos--;
|
|
25660
|
+
}
|
|
25661
|
+
return pos;
|
|
25662
|
+
};
|
|
25663
|
+
/**
|
|
25664
|
+
* Finds the end position of the link node ensuring the href matches the original link's href.
|
|
25665
|
+
* @param doc - The ProseMirror document.
|
|
25666
|
+
* @param pos - The position to start searching from.
|
|
25667
|
+
* @param href - The href attribute of the original link mark.
|
|
25668
|
+
* @returns The end position of the link node.
|
|
25669
|
+
*/
|
|
25670
|
+
const findEnd = (doc, pos, href) => {
|
|
25671
|
+
while (pos < doc.content.size) {
|
|
25672
|
+
const node = doc.nodeAt(pos);
|
|
25673
|
+
if (!(node === null || node === void 0 ? void 0 : node.isText) ||
|
|
25674
|
+
!node.marks.some((mark) => mark.type.name === EditorMenuTypes.Link &&
|
|
25675
|
+
mark.attrs.href === href)) {
|
|
25676
|
+
break;
|
|
25677
|
+
}
|
|
25678
|
+
pos++;
|
|
25679
|
+
}
|
|
25680
|
+
return pos;
|
|
25681
|
+
};
|
|
25682
|
+
/**
|
|
25683
|
+
* Gets the link data at the specified position.
|
|
25684
|
+
* @param view - The ProseMirror editor view.
|
|
25685
|
+
* @param event - The mouse event.
|
|
25686
|
+
* @returns An object containing the link data or null if no link is found.
|
|
25687
|
+
*/
|
|
25688
|
+
const getLinkDataAtPosition = (view, event) => {
|
|
25689
|
+
const pos = view.posAtCoords({ left: event.clientX, top: event.clientY });
|
|
25690
|
+
const node = view.state.doc.nodeAt(pos.pos);
|
|
25691
|
+
if (!node) {
|
|
25692
|
+
return null;
|
|
25693
|
+
}
|
|
25694
|
+
const linkMark = node.marks.find((mark) => mark.type.name === EditorMenuTypes.Link);
|
|
25695
|
+
if (!linkMark) {
|
|
25696
|
+
return null;
|
|
25697
|
+
}
|
|
25698
|
+
const href = linkMark.attrs.href;
|
|
25699
|
+
const from = findStart(view.state.doc, pos.pos, href);
|
|
25700
|
+
const to = findEnd(view.state.doc, pos.pos, href);
|
|
25701
|
+
const text = view.state.doc.textBetween(from, to, ' ');
|
|
25702
|
+
return { href: href, text: text, from: from, to: to };
|
|
25703
|
+
};
|
|
25704
|
+
const processModClickEvent = (view, event) => {
|
|
25705
|
+
const { href } = getLinkDataAtPosition(view, event);
|
|
25706
|
+
if (href) {
|
|
25707
|
+
window.open(href, '_blank');
|
|
25708
|
+
return true;
|
|
25709
|
+
}
|
|
25710
|
+
return false;
|
|
25711
|
+
};
|
|
25712
|
+
const openLinkMenu = (view, href, text) => {
|
|
25713
|
+
const event = new CustomEvent('open-editor-link-menu', {
|
|
25714
|
+
detail: { href: href, text: text },
|
|
25715
|
+
bubbles: true,
|
|
25716
|
+
composed: true,
|
|
25717
|
+
});
|
|
25718
|
+
view.dom.dispatchEvent(event);
|
|
25719
|
+
};
|
|
25720
|
+
let lastClickTime = 0;
|
|
25721
|
+
const DOUBLE_CLICK_DELAY = 200;
|
|
25722
|
+
let clickTimeout;
|
|
25723
|
+
const processDoubleClickEvent = (view, event) => {
|
|
25724
|
+
const now = Date.now();
|
|
25725
|
+
if (now - lastClickTime < DOUBLE_CLICK_DELAY) {
|
|
25726
|
+
clearTimeout(clickTimeout);
|
|
25727
|
+
lastClickTime = now; // Reset lastClickTime to prevent single-click action
|
|
25728
|
+
return false;
|
|
25729
|
+
}
|
|
25730
|
+
lastClickTime = now;
|
|
25731
|
+
clickTimeout = setTimeout(() => {
|
|
25732
|
+
const linkData = getLinkDataAtPosition(view, event);
|
|
25733
|
+
if (linkData) {
|
|
25734
|
+
const { href, text, from, to } = linkData;
|
|
25735
|
+
const transaction = view.state.tr.setSelection(TextSelection.create(view.state.doc, from, to));
|
|
25736
|
+
view.dispatch(transaction);
|
|
25737
|
+
openLinkMenu(view, href, text);
|
|
25738
|
+
}
|
|
25739
|
+
}, DOUBLE_CLICK_DELAY);
|
|
25740
|
+
return true;
|
|
25741
|
+
};
|
|
25742
|
+
const processPasteEvent = (view, event) => {
|
|
25743
|
+
const clipboardData = event.clipboardData;
|
|
25744
|
+
if (!clipboardData) {
|
|
25745
|
+
return false;
|
|
25746
|
+
}
|
|
25747
|
+
const text = clipboardData.getData('text/plain');
|
|
25748
|
+
if (!isValidUrl(text)) {
|
|
25749
|
+
return false;
|
|
25750
|
+
}
|
|
25751
|
+
pasteAsLink(view, text);
|
|
25752
|
+
return true;
|
|
25753
|
+
};
|
|
25754
|
+
const pasteAsLink = (view, href) => {
|
|
25755
|
+
const { state, dispatch } = view;
|
|
25756
|
+
const { from, to } = state.selection;
|
|
25757
|
+
const linkMark = schema$1.marks.link.create({
|
|
25758
|
+
href: href,
|
|
25759
|
+
title: href,
|
|
25760
|
+
target: isExternalLink(href) ? '_blank' : null,
|
|
25761
|
+
});
|
|
25762
|
+
const selectedText = state.doc.textBetween(from, to, ' ') || href;
|
|
25763
|
+
const transaction = state.tr
|
|
25764
|
+
.insertText(selectedText, from, to)
|
|
25765
|
+
.addMark(from, from + selectedText.length, linkMark);
|
|
25766
|
+
dispatch(transaction);
|
|
25767
|
+
};
|
|
25768
|
+
const createLinkPlugin = (updateLinkCallback) => {
|
|
25769
|
+
return new Plugin({
|
|
25770
|
+
key: linkPluginKey,
|
|
25771
|
+
props: {
|
|
25772
|
+
handlePaste: (view, event) => {
|
|
25773
|
+
return processPasteEvent(view, event);
|
|
25774
|
+
},
|
|
25775
|
+
handleDOMEvents: {
|
|
25776
|
+
mousedown: (view, event) => {
|
|
25777
|
+
if ((event.metaKey || event.ctrlKey) &&
|
|
25778
|
+
event.button === 0) {
|
|
25779
|
+
return processModClickEvent(view, event);
|
|
25780
|
+
}
|
|
25781
|
+
return processDoubleClickEvent(view, event);
|
|
25782
|
+
},
|
|
25783
|
+
},
|
|
25784
|
+
},
|
|
25785
|
+
view: () => ({
|
|
25786
|
+
update: (view) => {
|
|
25787
|
+
updateLink(view, updateLinkCallback);
|
|
25788
|
+
},
|
|
25789
|
+
}),
|
|
25790
|
+
});
|
|
25791
|
+
};
|
|
25792
|
+
|
|
25793
|
+
const prosemirrorAdapterCss = "@charset \"UTF-8\";:host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--mdc-theme-error:var(\n --lime-error-background-color,\n rgb(var(--color-red-dark))\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n rgb(var(--contrast-1500))\n )}:host(limel-prosemirror-adapter){display:flex;flex-direction:column}:host(limel-prosemirror-adapter) limel-action-bar{order:1}:host(limel-prosemirror-adapter) div#editor{order:2;height:100%}:host(limel-prosemirror-adapter) div[contenteditable=true]{height:100%}*{box-sizing:border-box}.ProseMirror-menubar-wrapper{display:grid;grid-template-rows:auto 1fr}.ProseMirror-textblock-dropdown{min-width:3em}.ProseMirror-tooltip .ProseMirror-menu{width:-webkit-fit-content;width:fit-content;white-space:pre}limel-action-bar{--action-bar-border-radius:0.25rem;position:sticky;z-index:1;top:1px;background-color:rgba(var(--contrast-200), 0.5);backdrop-filter:blur(0.5rem);-webkit-backdrop-filter:blur(0.5rem);opacity:0.6;transition:opacity 0.5s ease;margin:0 1px;width:calc(100% - 2px)}:host(limel-prosemirror-adapter:focus-within) limel-action-bar,:host(limel-prosemirror-adapter:hover) limel-action-bar{opacity:1}.ProseMirror{position:relative;word-wrap:break-word;white-space:pre-wrap;white-space:break-spaces;-webkit-font-variant-ligatures:none;font-variant-ligatures:none;font-feature-settings:\"liga\" 0;padding:var(--limel-text-editor-padding)}.ProseMirror [draggable][contenteditable=false]{user-select:text}.ProseMirror:focus-visible{outline:none}.ProseMirror-hideselection{caret-color:transparent}.ProseMirror-hideselection *::selection{background:transparent}.ProseMirror-hideselection *::-moz-selection{background:transparent}.ProseMirror-selectednode{outline:0.125rem solid rgb(var(--color-sky-light))}li.ProseMirror-selectednode{outline:none}li.ProseMirror-selectednode:after{content:\"\";position:absolute;left:-2rem;right:-0.125rem;top:-0.125rem;bottom:-0.125rem;border:0.125rem solid rgb(var(--color-sky-light));pointer-events:none}img.ProseMirror-separator{display:inline !important;border:none !important;margin:0 !important}limel-portal{width:25rem}blockquote{position:relative;font-weight:100;font-size:0.875rem;max-width:100%;line-height:1.4;margin:0;padding:0.5rem 1.25rem;border-radius:0.05rem 0.75rem;background-color:rgb(var(--contrast-300))}blockquote:before,blockquote:after{position:absolute;font-size:2.75rem;opacity:0.4}blockquote:before{content:\"“\";left:0;top:-0.75rem}blockquote:after{content:\"”\";right:0;bottom:-2rem}:host(limel-markdown.truncate-paragraphs) p{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}p,li{font-size:0.875rem;word-break:break-word;hyphens:auto;-webkit-hyphens:auto}a{word-break:break-all}p{margin-top:0;margin-bottom:0.5rem}p:only-child{margin-bottom:0}a{transition:color 0.2s ease;color:var(--markdown-hyperlink-color, rgb(var(--color-blue-dark)));text-decoration:none}a:hover{color:var(--markdown-hyperlink-color--hovered, rgb(var(--color-blue-default)))}hr{margin:1.75rem 0 2rem 0;border-width:0;border-top:1px solid rgb(var(--contrast-500))}dl{display:grid;grid-template-columns:1fr 2fr;grid-template-rows:1fr;margin-bottom:2rem;border:1px solid rgb(var(--contrast-400));border-radius:0.375rem;background-color:rgb(var(--contrast-200))}dl dt,dl dd{padding:0.375rem 0.5rem;font-size:0.875rem;margin:0}dl dt:nth-of-type(even),dl dd:nth-of-type(even){background-color:rgb(var(--contrast-300))}dl dt:first-child{border-top-left-radius:0.375rem}dl dt:last-child{border-bottom-left-radius:0.375rem}dl dd:first-child{border-top-right-radius:0.375rem}dl dd:last-child{border-bottom-right-radius:0.375rem}h1{font-size:1.5rem}h2{font-size:1.25rem}h3{font-size:1.125rem}h4{font-size:1rem}h5{font-size:0.875rem}h6{font-size:0.75rem}h1,h2{margin-top:0.5rem;margin-bottom:0.5rem;letter-spacing:-0.03125rem;font-weight:500}h3,h4{margin-top:0.75rem;margin-bottom:0.25rem;font-weight:600}h5,h6{margin-top:0.5rem;margin-bottom:0.125rem;font-weight:600}h1,h2,h3,h4,h5,h6{word-break:break-word;hyphens:auto;-webkit-hyphens:auto}:not([contenteditable=true]) h1,:not([contenteditable=true]) h2,:not([contenteditable=true]) h3,:not([contenteditable=true]) h4,:not([contenteditable=true]) h5,:not([contenteditable=true]) h6{text-wrap:balance}[contenteditable=true] h1,[contenteditable=true] h2,[contenteditable=true] h3,[contenteditable=true] h4,[contenteditable=true] h5,[contenteditable=true] h6{text-wrap:initial}ul{list-style:none}ul li{position:relative;margin-left:0.75rem}ul li:before{content:\"\";position:absolute;left:-0.5rem;top:0.5rem;width:0.25rem;height:0.25rem;border-radius:50%;background-color:rgb(var(--contrast-700));display:block}ol{margin-top:0.25rem;padding-left:1rem}ul{margin-top:0.25rem;padding-left:0}ul ul,ul ol,ol ol,ol ul{margin-left:0}li{margin-bottom:0.25rem}code{font-family:ui-monospace, \"Cascadia Code\", \"Source Code Pro\", Menlo, Consolas, \"DejaVu Sans Mono\", monospace;font-size:0.8125rem;letter-spacing:-0.0125rem;color:rgb(var(--contrast-1300));-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none;display:inline-block;border-radius:0.25rem;padding:0.03125rem 0.25rem;background-color:rgb(var(--contrast-600))}pre>code{display:block;margin:0.5rem 0;padding:0.5rem 0.75rem;overflow:auto;white-space:pre-wrap}:host(limel-markdown:not(.no-table-styles)) table{table-layout:auto;min-width:100%;border-collapse:collapse;border-spacing:0;background:transparent;margin:0.75rem 0;border:1px solid rgb(var(--contrast-400))}:host(limel-markdown:not(.no-table-styles)) th,:host(limel-markdown:not(.no-table-styles)) td{text-align:left;vertical-align:top;transition:background-color 0.2s ease;font-size:0.875rem}:host(limel-markdown:not(.no-table-styles)) td{padding:0.5rem 0.375rem 0.75rem 0.375rem}:host(limel-markdown:not(.no-table-styles)) tr th{background-color:rgb(var(--contrast-400));padding:0.25rem 0.375rem;font-weight:normal}:host(limel-markdown:not(.no-table-styles)) tr th:only-child{text-align:center}:host(limel-markdown:not(.no-table-styles)) tbody tr:nth-child(odd) td{background-color:rgb(var(--contrast-200))}:host(limel-markdown:not(.no-table-styles)) tbody tr:hover td{background-color:rgb(var(--contrast-300))}";
|
|
25558
25794
|
|
|
25559
25795
|
const ProsemirrorAdapter = class {
|
|
25560
25796
|
constructor(hostRef) {
|
|
25561
25797
|
index.registerInstance(this, hostRef);
|
|
25562
25798
|
this.change = index.createEvent(this, "change", 7);
|
|
25799
|
+
this.suppressChangeEvent = false;
|
|
25800
|
+
this.actionBarPluginKey = new PluginKey('actionBarPlugin');
|
|
25563
25801
|
this.getActionBarItems = () => {
|
|
25564
25802
|
this.actionBarItems = getTextEditorMenuItems().map(this.getTranslatedItem);
|
|
25565
25803
|
};
|
|
@@ -25576,11 +25814,22 @@ const ProsemirrorAdapter = class {
|
|
|
25576
25814
|
this.handleTransaction = (transaction) => {
|
|
25577
25815
|
const newState = this.view.state.apply(transaction);
|
|
25578
25816
|
this.view.updateState(newState);
|
|
25817
|
+
if (this.suppressChangeEvent) {
|
|
25818
|
+
return;
|
|
25819
|
+
}
|
|
25820
|
+
if (transaction.getMeta('pointer')) {
|
|
25821
|
+
return;
|
|
25822
|
+
}
|
|
25579
25823
|
this.change.emit(this.contentConverter.serialize(this.view, this.schema));
|
|
25580
25824
|
};
|
|
25581
25825
|
this.handleActionBarItem = (event) => {
|
|
25582
25826
|
event.preventDefault();
|
|
25827
|
+
event.stopImmediatePropagation();
|
|
25583
25828
|
const { value } = event.detail;
|
|
25829
|
+
if (value === EditorMenuTypes.Link) {
|
|
25830
|
+
this.isLinkMenuOpen = true;
|
|
25831
|
+
return;
|
|
25832
|
+
}
|
|
25584
25833
|
try {
|
|
25585
25834
|
const command = this.menuCommandFactory.getCommand(value);
|
|
25586
25835
|
this.dispatchMenuCommand(command);
|
|
@@ -25589,7 +25838,23 @@ const ProsemirrorAdapter = class {
|
|
|
25589
25838
|
throw new Error(`Error executing command: ${error}`);
|
|
25590
25839
|
}
|
|
25591
25840
|
};
|
|
25592
|
-
this.
|
|
25841
|
+
this.handleCancelLinkMenu = () => {
|
|
25842
|
+
this.isLinkMenuOpen = false;
|
|
25843
|
+
};
|
|
25844
|
+
this.handleSaveLinkMenu = () => {
|
|
25845
|
+
this.isLinkMenuOpen = false;
|
|
25846
|
+
try {
|
|
25847
|
+
const command = this.menuCommandFactory.getCommand('link', this.link);
|
|
25848
|
+
this.dispatchMenuCommand(command);
|
|
25849
|
+
}
|
|
25850
|
+
catch (error) {
|
|
25851
|
+
throw new Error(`Error executing command: ${error}`);
|
|
25852
|
+
}
|
|
25853
|
+
this.link = { href: '' };
|
|
25854
|
+
};
|
|
25855
|
+
this.handleLinkChange = (event) => {
|
|
25856
|
+
this.link = event.detail;
|
|
25857
|
+
};
|
|
25593
25858
|
this.updateActionBarItems = (actionBarItems, view) => {
|
|
25594
25859
|
const updatedItems = cloneDeep(actionBarItems);
|
|
25595
25860
|
updatedItems.forEach((item) => {
|
|
@@ -25615,11 +25880,24 @@ const ProsemirrorAdapter = class {
|
|
|
25615
25880
|
}),
|
|
25616
25881
|
});
|
|
25617
25882
|
};
|
|
25883
|
+
this.handleNewLinkSelection = (text, href) => {
|
|
25884
|
+
this.link.text = text;
|
|
25885
|
+
this.link.href = href;
|
|
25886
|
+
};
|
|
25887
|
+
this.handleOpenLinkMenu = (event) => {
|
|
25888
|
+
event.stopImmediatePropagation();
|
|
25889
|
+
const { href, text } = event.detail;
|
|
25890
|
+
this.link = { href: href, text: text };
|
|
25891
|
+
this.isLinkMenuOpen = true;
|
|
25892
|
+
};
|
|
25618
25893
|
this.contentType = 'markdown';
|
|
25619
25894
|
this.value = undefined;
|
|
25620
25895
|
this.language = undefined;
|
|
25621
25896
|
this.view = undefined;
|
|
25622
25897
|
this.actionBarItems = [];
|
|
25898
|
+
this.link = { href: '' };
|
|
25899
|
+
this.isLinkMenuOpen = false;
|
|
25900
|
+
this.portalId = randomString.createRandomString();
|
|
25623
25901
|
}
|
|
25624
25902
|
watchValue(newValue) {
|
|
25625
25903
|
if (!this.view ||
|
|
@@ -25639,16 +25917,22 @@ const ProsemirrorAdapter = class {
|
|
|
25639
25917
|
setTimeout(() => {
|
|
25640
25918
|
this.initializeTextEditor();
|
|
25641
25919
|
}, 0);
|
|
25920
|
+
this.host.addEventListener('open-editor-link-menu', this.handleOpenLinkMenu);
|
|
25921
|
+
}
|
|
25922
|
+
disconnectedCallback() {
|
|
25923
|
+
this.host.removeEventListener('open-editor-link-menu', this.handleOpenLinkMenu);
|
|
25924
|
+
this.view.destroy();
|
|
25642
25925
|
}
|
|
25643
25926
|
render() {
|
|
25644
25927
|
return [
|
|
25645
25928
|
index.h("div", { id: "editor" }),
|
|
25646
|
-
index.h("limel-action-bar", { accessibleLabel: "Toolbar", actions: this.actionBarItems, onItemSelected: this.handleActionBarItem }),
|
|
25929
|
+
index.h("limel-action-bar", { slot: "trigger", accessibleLabel: "Toolbar", actions: this.actionBarItems, onItemSelected: this.handleActionBarItem }),
|
|
25930
|
+
index.h("limel-portal", { containerId: this.portalId, visible: this.isLinkMenuOpen, openDirection: "top", inheritParentWidth: true, containerStyle: { 'z-index': 1 } }, index.h("limel-menu-surface", { open: this.isLinkMenuOpen, onDismiss: this.handleCancelLinkMenu, style: {
|
|
25931
|
+
'--mdc-menu-min-width': '100%',
|
|
25932
|
+
'max-height': 'inherit',
|
|
25933
|
+
} }, index.h("limel-text-editor-link-menu", { link: this.link, isOpen: this.isLinkMenuOpen, onLinkChange: this.handleLinkChange, onCancel: this.handleCancelLinkMenu, onSave: this.handleSaveLinkMenu }))),
|
|
25647
25934
|
];
|
|
25648
25935
|
}
|
|
25649
|
-
disconnectedCallback() {
|
|
25650
|
-
this.view.destroy();
|
|
25651
|
-
}
|
|
25652
25936
|
setupContentConverter() {
|
|
25653
25937
|
if (this.contentType === 'markdown') {
|
|
25654
25938
|
this.contentConverter = new markdownConverter();
|
|
@@ -25698,10 +25982,12 @@ const ProsemirrorAdapter = class {
|
|
|
25698
25982
|
...exampleSetup({ schema: this.schema, menuBar: false }),
|
|
25699
25983
|
keymap(this.menuCommandFactory.buildKeymap()),
|
|
25700
25984
|
this.createMenuStateTrackingPlugin(this.actionBarItems),
|
|
25985
|
+
createLinkPlugin(this.handleNewLinkSelection),
|
|
25701
25986
|
],
|
|
25702
25987
|
});
|
|
25703
25988
|
}
|
|
25704
25989
|
async updateView(content) {
|
|
25990
|
+
this.suppressChangeEvent = true;
|
|
25705
25991
|
const html = await this.contentConverter.parseAsHTML(content, this.schema);
|
|
25706
25992
|
const prosemirrorDOMparser = DOMParser.fromSchema(this.view.state.schema);
|
|
25707
25993
|
const domParser = new window.DOMParser();
|
|
@@ -25710,6 +25996,7 @@ const ProsemirrorAdapter = class {
|
|
|
25710
25996
|
const tr = this.view.state.tr;
|
|
25711
25997
|
tr.replaceWith(0, tr.doc.content.size, prosemirrorDoc.content);
|
|
25712
25998
|
this.view.dispatch(tr);
|
|
25999
|
+
this.suppressChangeEvent = false;
|
|
25713
26000
|
}
|
|
25714
26001
|
dispatchMenuCommand(command) {
|
|
25715
26002
|
const { state } = this.view;
|