@onereach/ui-components 11.8.0 → 11.8.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.
Files changed (27) hide show
  1. package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +44 -40
  2. package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +2 -2
  3. package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +1 -1
  4. package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +1 -1
  5. package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +1 -1
  6. package/dist/bundled/v3/components/OrRichTextEditorV3/props.js +1 -1
  7. package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +1 -1
  8. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +1 -1
  9. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +1 -1
  10. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +1 -1
  11. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.js +1 -1
  12. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +1 -1
  13. package/dist/bundled/v3/components/{OrRichTextEditorV3-3d33bdf2.js → OrRichTextEditorV3-a3339ef8.js} +44 -40
  14. package/dist/bundled/v3/components/index.js +1 -1
  15. package/dist/bundled/v3/index.js +1 -1
  16. package/dist/esm/v2/{OrRichTextEditor-d25c5bfc.js → OrRichTextEditor-eb1b36fd.js} +44 -40
  17. package/dist/esm/v2/components/index.js +1 -1
  18. package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +2 -2
  19. package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +1 -1
  20. package/dist/esm/v2/index.js +1 -1
  21. package/dist/esm/v3/{OrRichTextEditor-08160d9b.js → OrRichTextEditor-522aa860.js} +44 -40
  22. package/dist/esm/v3/components/index.js +1 -1
  23. package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +1 -1
  24. package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +1 -1
  25. package/dist/esm/v3/index.js +1 -1
  26. package/package.json +2 -2
  27. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +36 -36
@@ -1,6 +1,6 @@
1
1
  import { i as useResizeObserver, o as onClickOutside } from '../../index-076c9a7d.js';
2
2
  import { u as useFocusTrap } from '../../useFocusTrap-b8d9e480.js';
3
- import { defineComponent, ref, onMounted, onBeforeUnmount, computed, watch, nextTick } from 'vue-demi';
3
+ import { defineComponent, shallowRef, ref, onMounted, onBeforeUnmount, computed, watch, nextTick } from 'vue-demi';
4
4
  import { B as Blockquote, a as Bold, b as BulletList, C as CodeBlock, H as HardBreak, c as HorizontalRule, I as Italic, L as ListItem, O as OrderedList, P as Paragraph, S as Strike, s as serialize, d as deserialize, U as Underline, e as Link, f as Highlight } from '../../markdown-62ee11bf.js';
5
5
  import { OrRichTextEditor, EditorContainer, ToolbarContainer, Toolbar, ToolbarButtonFocused, ToolbarButton, EditorInput } from './styles.js';
6
6
  import { Formats } from './props.js';
@@ -1423,7 +1423,7 @@ var script = defineComponent({
1423
1423
  emits: ['update:modelValue', 'input', 'file-upload'],
1424
1424
  expose: ['root', 'editor'],
1425
1425
  setup(props, context) {
1426
- let editor = null;
1426
+ let editor = shallowRef();
1427
1427
  // Refs
1428
1428
  const root = ref();
1429
1429
  const editorRef = ref();
@@ -1512,7 +1512,7 @@ var script = defineComponent({
1512
1512
  }
1513
1513
  }, 10));
1514
1514
  onMounted(() => {
1515
- editor = new Editor({
1515
+ editor.value = new Editor({
1516
1516
  onUpdate: _ref => {
1517
1517
  let {
1518
1518
  editor
@@ -1605,7 +1605,8 @@ var script = defineComponent({
1605
1605
  trap.activate();
1606
1606
  });
1607
1607
  onBeforeUnmount(() => {
1608
- editor === null || editor === void 0 ? void 0 : editor.destroy();
1608
+ var _a;
1609
+ (_a = editor.value) === null || _a === void 0 ? void 0 : _a.destroy();
1609
1610
  });
1610
1611
  onClickOutside(root, () => {
1611
1612
  isFocused.value = false;
@@ -1646,11 +1647,11 @@ var script = defineComponent({
1646
1647
  });
1647
1648
  //Methods
1648
1649
  const handleEditorClick = () => {
1649
- var _a;
1650
+ var _a, _b, _c;
1650
1651
  setActiveFormats();
1651
1652
  isFocused.value = true;
1652
- editor === null || editor === void 0 ? void 0 : editor.commands.focus();
1653
- activeHeadingLevel.value = ((_a = editor === null || editor === void 0 ? void 0 : editor.getAttributes('heading')) === null || _a === void 0 ? void 0 : _a.level) || 0;
1653
+ (_a = editor.value) === null || _a === void 0 ? void 0 : _a.commands.focus();
1654
+ activeHeadingLevel.value = ((_c = (_b = editor.value) === null || _b === void 0 ? void 0 : _b.getAttributes('heading')) === null || _c === void 0 ? void 0 : _c.level) || 0;
1654
1655
  };
1655
1656
  const isVisible = value => {
1656
1657
  if (isArray(value)) {
@@ -1660,19 +1661,20 @@ var script = defineComponent({
1660
1661
  return !notVisibleTools.value.has(value);
1661
1662
  };
1662
1663
  const handleInput = event => {
1664
+ var _a, _b, _c, _d;
1663
1665
  const target = event.target;
1664
1666
  const value = target.value;
1665
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value));
1666
- markdownOutput.value = serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON());
1667
+ (_a = editor.value) === null || _a === void 0 ? void 0 : _a.commands.setContent(deserialize((_b = editor.value) === null || _b === void 0 ? void 0 : _b.schema, value));
1668
+ markdownOutput.value = serialize((_c = editor.value) === null || _c === void 0 ? void 0 : _c.schema, (_d = editor.value) === null || _d === void 0 ? void 0 : _d.getJSON());
1667
1669
  proxyModelValue.value = markdownOutput.value;
1668
1670
  };
1669
1671
  const handleToolbarClick = (item, level) => {
1670
- var _a, _b, _c, _d;
1672
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
1671
1673
  switch (item) {
1672
1674
  case 'source':
1673
1675
  disableMarkdown.value = !disableMarkdown.value;
1674
- sourceValue.value = serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON());
1675
- (_a = textareaRef.value) === null || _a === void 0 ? void 0 : _a.style.setProperty('height', `${((_b = editorRef.value) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 88}px`);
1676
+ sourceValue.value = serialize((_a = editor.value) === null || _a === void 0 ? void 0 : _a.schema, (_b = editor.value) === null || _b === void 0 ? void 0 : _b.getJSON());
1677
+ (_c = textareaRef.value) === null || _c === void 0 ? void 0 : _c.style.setProperty('height', `${((_d = editorRef.value) === null || _d === void 0 ? void 0 : _d.offsetHeight) || 88}px`);
1676
1678
  nextTick(() => {
1677
1679
  var _a;
1678
1680
  return (_a = textareaRef.value) === null || _a === void 0 ? void 0 : _a.focus();
@@ -1680,70 +1682,70 @@ var script = defineComponent({
1680
1682
  break;
1681
1683
  case 'bulletList':
1682
1684
  case 'orderedList':
1683
- item === 'bulletList' ? editor === null || editor === void 0 ? void 0 : editor.commands.toggleBulletList() : editor === null || editor === void 0 ? void 0 : editor.commands.toggleOrderedList();
1685
+ item === 'bulletList' ? (_e = editor.value) === null || _e === void 0 ? void 0 : _e.commands.toggleBulletList() : (_f = editor.value) === null || _f === void 0 ? void 0 : _f.commands.toggleOrderedList();
1684
1686
  break;
1685
1687
  case 'link':
1686
1688
  if (editor) {
1687
- const cursorPosition = (editor === null || editor === void 0 ? void 0 : editor.state.selection.$anchor.pos) || 0;
1689
+ const cursorPosition = ((_g = editor.value) === null || _g === void 0 ? void 0 : _g.state.selection.$anchor.pos) || 0;
1688
1690
  const {
1689
1691
  from,
1690
1692
  to,
1691
1693
  empty
1692
- } = editor.state.selection;
1693
- const isLink = (_c = editor.view.state.doc.nodeAt(cursorPosition)) === null || _c === void 0 ? void 0 : _c.marks.filter(mark => mark.type.name === 'link');
1694
- const existedText = (isLink === null || isLink === void 0 ? void 0 : isLink.length) ? ((_d = editor.view.state.doc.nodeAt(cursorPosition)) === null || _d === void 0 ? void 0 : _d.text) || '' : '';
1695
- text.value = empty ? existedText : editor.state.doc.textBetween(from, to, ' ');
1696
- link.value = editor.getAttributes('link').href || '';
1694
+ } = editor.value.state.selection;
1695
+ const isLink = (_h = editor.value.view.state.doc.nodeAt(cursorPosition)) === null || _h === void 0 ? void 0 : _h.marks.filter(mark => mark.type.name === 'link');
1696
+ const existedText = (isLink === null || isLink === void 0 ? void 0 : isLink.length) ? ((_j = editor.value.view.state.doc.nodeAt(cursorPosition)) === null || _j === void 0 ? void 0 : _j.text) || '' : '';
1697
+ text.value = empty ? existedText : editor.value.state.doc.textBetween(from, to, ' ');
1698
+ link.value = editor.value.getAttributes('link').href || '';
1697
1699
  }
1698
1700
  isOpenLinkModal.value = !isOpenLinkModal.value;
1699
1701
  break;
1700
1702
  case 'blockquote':
1701
- editor === null || editor === void 0 ? void 0 : editor.chain().toggleBlockquote().run();
1703
+ (_k = editor.value) === null || _k === void 0 ? void 0 : _k.chain().toggleBlockquote().run();
1702
1704
  break;
1703
1705
  case 'codeBlock':
1704
1706
  if (!isActive.value['codeBlock']) {
1705
- editor === null || editor === void 0 ? void 0 : editor.commands.setNode(item, {
1707
+ (_l = editor.value) === null || _l === void 0 ? void 0 : _l.commands.setNode(item, {
1706
1708
  language: 'javascript'
1707
1709
  });
1708
1710
  } else {
1709
- editor === null || editor === void 0 ? void 0 : editor.commands.setNode('paragraph');
1711
+ (_m = editor.value) === null || _m === void 0 ? void 0 : _m.commands.setNode('paragraph');
1710
1712
  }
1711
1713
  break;
1712
1714
  case 'heading':
1713
1715
  if (!level) {
1714
- editor === null || editor === void 0 ? void 0 : editor.commands.setParagraph();
1716
+ (_o = editor.value) === null || _o === void 0 ? void 0 : _o.commands.setParagraph();
1715
1717
  activeHeadingLevel.value = 0;
1716
1718
  } else {
1717
1719
  activeHeadingLevel.value = level;
1718
- editor === null || editor === void 0 ? void 0 : editor.commands.toggleHeading({
1720
+ (_p = editor.value) === null || _p === void 0 ? void 0 : _p.commands.toggleHeading({
1719
1721
  level: level
1720
1722
  });
1721
1723
  }
1722
1724
  break;
1723
1725
  case 'undo':
1724
1726
  case 'redo':
1725
- item === 'undo' ? editor === null || editor === void 0 ? void 0 : editor.commands.undo() : editor === null || editor === void 0 ? void 0 : editor.commands.redo();
1727
+ item === 'undo' ? (_q = editor.value) === null || _q === void 0 ? void 0 : _q.commands.undo() : (_r = editor.value) === null || _r === void 0 ? void 0 : _r.commands.redo();
1726
1728
  break;
1727
1729
  case 'file':
1728
1730
  context.emit('file-upload');
1729
1731
  break;
1730
1732
  default:
1731
- editor === null || editor === void 0 ? void 0 : editor.chain().toggleMark(item).run();
1733
+ (_s = editor.value) === null || _s === void 0 ? void 0 : _s.chain().toggleMark(item).run();
1732
1734
  break;
1733
1735
  }
1734
1736
  };
1735
1737
  const attachLink = async () => {
1736
- var _a, _b;
1738
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1737
1739
  // empty
1738
1740
  if (link.value === '') {
1739
- editor === null || editor === void 0 ? void 0 : editor.chain().focus().extendMarkRange('link').unsetLink().run();
1741
+ (_a = editor.value) === null || _a === void 0 ? void 0 : _a.chain().focus().extendMarkRange('link').unsetLink().run();
1740
1742
  }
1741
- const isEmptySelection = editor === null || editor === void 0 ? void 0 : editor.state.selection.empty;
1742
- const cursorPosition = (editor === null || editor === void 0 ? void 0 : editor.state.selection.$anchor.pos) || 0;
1743
- const isLink = (_a = editor === null || editor === void 0 ? void 0 : editor.view.state.doc.nodeAt(cursorPosition)) === null || _a === void 0 ? void 0 : _a.marks.filter(mark => mark.type.name === 'link');
1744
- const existedText = (isLink === null || isLink === void 0 ? void 0 : isLink.length) ? (_b = editor === null || editor === void 0 ? void 0 : editor.view.state.doc.nodeAt(cursorPosition)) === null || _b === void 0 ? void 0 : _b.text : '';
1743
+ const isEmptySelection = (_b = editor.value) === null || _b === void 0 ? void 0 : _b.state.selection.empty;
1744
+ const cursorPosition = ((_c = editor.value) === null || _c === void 0 ? void 0 : _c.state.selection.$anchor.pos) || 0;
1745
+ const isLink = (_e = (_d = editor.value) === null || _d === void 0 ? void 0 : _d.view.state.doc.nodeAt(cursorPosition)) === null || _e === void 0 ? void 0 : _e.marks.filter(mark => mark.type.name === 'link');
1746
+ const existedText = (isLink === null || isLink === void 0 ? void 0 : isLink.length) ? (_g = (_f = editor.value) === null || _f === void 0 ? void 0 : _f.view.state.doc.nodeAt(cursorPosition)) === null || _g === void 0 ? void 0 : _g.text : '';
1745
1747
  if (link.value && isEmptySelection && !existedText) {
1746
- editor === null || editor === void 0 ? void 0 : editor.chain().focus().setMark('link', {
1748
+ (_h = editor.value) === null || _h === void 0 ? void 0 : _h.chain().focus().setMark('link', {
1747
1749
  href: link.value,
1748
1750
  target: '__blank'
1749
1751
  }).command(_ref4 => {
@@ -1756,12 +1758,12 @@ var script = defineComponent({
1756
1758
  }).run();
1757
1759
  }
1758
1760
  if (link.value && existedText === text.value && isEmptySelection) {
1759
- editor === null || editor === void 0 ? void 0 : editor.chain().extendMarkRange('link').updateAttributes('link', {
1761
+ (_j = editor.value) === null || _j === void 0 ? void 0 : _j.chain().extendMarkRange('link').updateAttributes('link', {
1760
1762
  href: link.value
1761
1763
  }).run();
1762
1764
  }
1763
1765
  if (link.value && !isEmptySelection) {
1764
- editor === null || editor === void 0 ? void 0 : editor.chain().focus().setMark('link', {
1766
+ (_k = editor.value) === null || _k === void 0 ? void 0 : _k.chain().focus().setMark('link', {
1765
1767
  href: link.value,
1766
1768
  target: '__blank'
1767
1769
  }).run();
@@ -1776,10 +1778,11 @@ var script = defineComponent({
1776
1778
  const setActiveFormats = () => {
1777
1779
  const toolbarList = props.toolbar.flat();
1778
1780
  toolbarList.forEach(item => {
1781
+ var _a;
1779
1782
  if (item === 'source') {
1780
1783
  isActive.value[item] = disableMarkdown.value;
1781
1784
  } else {
1782
- isActive.value[item] = (editor === null || editor === void 0 ? void 0 : editor.isActive(item)) || false;
1785
+ isActive.value[item] = ((_a = editor.value) === null || _a === void 0 ? void 0 : _a.isActive(item)) || false;
1783
1786
  }
1784
1787
  });
1785
1788
  };
@@ -1793,12 +1796,13 @@ var script = defineComponent({
1793
1796
  const editorInputStyles = computed(() => ['tiptap-editor-v3', ...EditorInput]);
1794
1797
  //Effects
1795
1798
  watch(proxyModelValue, value => {
1796
- if (value !== (editor === null || editor === void 0 ? void 0 : editor.getHTML()) && props.format !== 'markdown') {
1797
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
1799
+ var _a, _b, _c, _d;
1800
+ if (value !== ((_a = editor.value) === null || _a === void 0 ? void 0 : _a.getHTML()) && props.format !== 'markdown') {
1801
+ (_b = editor.value) === null || _b === void 0 ? void 0 : _b.commands.setContent(value);
1798
1802
  }
1799
1803
  if (props.format === 'markdown' && value !== markdownOutput.value) {
1800
- const deserialized = deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value);
1801
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialized);
1804
+ const deserialized = deserialize((_c = editor.value) === null || _c === void 0 ? void 0 : _c.schema, value);
1805
+ (_d = editor.value) === null || _d === void 0 ? void 0 : _d.commands.setContent(deserialized);
1802
1806
  }
1803
1807
  });
1804
1808
  return {
@@ -3,7 +3,7 @@ import { Formats, Tools } from './props';
3
3
  import { Editor } from '@tiptap/core';
4
4
  import { Level } from '@tiptap/extension-heading';
5
5
  declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
6
- editor: Editor | null;
6
+ editor: import("@vue/composition-api").Ref<Editor | undefined>;
7
7
  editorRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
8
8
  toolbarRef: import("@vue/composition-api").Ref<ComponentPublicInstance<HTMLInputElement, {}, {}, {}, {}, {}, HTMLInputElement, {}, false> | undefined>;
9
9
  containerRef: import("@vue/composition-api").Ref<ComponentPublicInstance<HTMLInputElement, {}, {}, {}, {}, {}, HTMLInputElement, {}, false> | undefined>;
@@ -158,7 +158,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
158
158
  } & {} & {
159
159
  [x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
160
160
  }, import("@vue/composition-api").ShallowUnwrapRef<{
161
- editor: Editor | null;
161
+ editor: import("@vue/composition-api").Ref<Editor | undefined>;
162
162
  editorRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
163
163
  toolbarRef: import("@vue/composition-api").Ref<ComponentPublicInstance<HTMLInputElement, {}, {}, {}, {}, {}, HTMLInputElement, {}, false> | undefined>;
164
164
  containerRef: import("@vue/composition-api").Ref<ComponentPublicInstance<HTMLInputElement, {}, {}, {}, {}, {}, HTMLInputElement, {}, false> | undefined>;
@@ -1 +1 @@
1
- export { s as default } from '../OrRichTextEditorV3-3d33bdf2.js';
1
+ export { s as default } from '../OrRichTextEditorV3-a3339ef8.js';
@@ -44,7 +44,7 @@ declare const _default: import("vue-demi").DefineComponent<{
44
44
  default: undefined;
45
45
  };
46
46
  }, {
47
- editor: Editor | null;
47
+ editor: import("vue-demi").ShallowRef<Editor | undefined>;
48
48
  editorRef: import("vue-demi").Ref<HTMLDivElement | undefined>;
49
49
  toolbarRef: import("vue-demi").Ref<ComponentPublicInstance<HTMLInputElement, {}, {}, {}, {}, {}, HTMLInputElement, {}, false, import("vue-demi").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | undefined>;
50
50
  containerRef: import("vue-demi").Ref<ComponentPublicInstance<HTMLInputElement, {}, {}, {}, {}, {}, HTMLInputElement, {}, false, import("vue-demi").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | undefined>;
@@ -1 +1 @@
1
- export { F as Formats, s as OrRichTextEditorV3 } from '../OrRichTextEditorV3-3d33bdf2.js';
1
+ export { F as Formats, s as OrRichTextEditorV3 } from '../OrRichTextEditorV3-a3339ef8.js';
@@ -1 +1 @@
1
- export { F as Formats } from '../OrRichTextEditorV3-3d33bdf2.js';
1
+ export { F as Formats } from '../OrRichTextEditorV3-a3339ef8.js';
@@ -1 +1 @@
1
- export { E as EditorContainer, f as EditorInput, O as OrRichTextEditor, b as Toolbar, c as ToolbarButton, e as ToolbarButtonFocused, T as ToolbarContainer } from '../OrRichTextEditorV3-3d33bdf2.js';
1
+ export { E as EditorContainer, f as EditorInput, O as OrRichTextEditor, b as Toolbar, c as ToolbarButton, e as ToolbarButtonFocused, T as ToolbarContainer } from '../OrRichTextEditorV3-a3339ef8.js';
@@ -1,2 +1,2 @@
1
- export { i as default } from '../../../OrRichTextEditorV3-3d33bdf2.js';
1
+ export { i as default } from '../../../OrRichTextEditorV3-a3339ef8.js';
2
2
  import '../../../OrCode-ac7a6f4b.js';
@@ -1,2 +1,2 @@
1
- export { C as default } from '../../../OrRichTextEditorV3-3d33bdf2.js';
1
+ export { C as default } from '../../../OrRichTextEditorV3-a3339ef8.js';
2
2
  import '../../../OrCode-ac7a6f4b.js';
@@ -1 +1 @@
1
- export { C as CodeMirrorView } from '../../../OrRichTextEditorV3-3d33bdf2.js';
1
+ export { C as CodeMirrorView } from '../../../OrRichTextEditorV3-a3339ef8.js';
@@ -1,3 +1,3 @@
1
1
  import '../../../OrCode-ac7a6f4b.js';
2
2
  import '../../../../hooks/useTheme.js';
3
- export { g as color, t as default, h as orCodeHighlightStyle, o as orCodeTheme } from '../../../OrRichTextEditorV3-3d33bdf2.js';
3
+ export { g as color, t as default, h as orCodeHighlightStyle, o as orCodeTheme } from '../../../OrRichTextEditorV3-a3339ef8.js';
@@ -1 +1 @@
1
- export { d as deserialize, a as serialize } from '../../OrRichTextEditorV3-3d33bdf2.js';
1
+ export { d as deserialize, a as serialize } from '../../OrRichTextEditorV3-a3339ef8.js';
@@ -2,7 +2,7 @@ import { resolveComponent, openBlock, createElementBlock, normalizeClass, create
2
2
  import { s as styleInject } from './OrAvatar-fb3ef36c.js';
3
3
  import { n as useResizeObserver, p as useDebounceFn, o as onClickOutside } from './OrAutocompleteV3-68763db7.js';
4
4
  import { u as useFocusTrap } from './OrModal-6f54322b.js';
5
- import { defineComponent, ref, onMounted, onBeforeUnmount, computed, watch, nextTick } from 'vue-demi';
5
+ import { defineComponent, shallowRef, ref, onMounted, onBeforeUnmount, computed, watch, nextTick } from 'vue-demi';
6
6
  import { j as commonjsGlobal, k as getDefaultExportFromCjs } from './OrDateTimePicker-96bf33ce.js';
7
7
  import { f as keyName, g as base, E as EditorView$1, H as HighlightStyle, t as tags, s as syntaxHighlighting, a as EditorState$1, m as highlightActiveLine, n as highlightActiveLineGutter, o as lineNumbers, k as keymap$1, p as minimalSetup, j as javascript } from './OrCode-ac7a6f4b.js';
8
8
  import { s as script$1 } from './OrIconButtonV3-b577a8c8.js';
@@ -29338,7 +29338,7 @@ var script = defineComponent({
29338
29338
  emits: ['update:modelValue', 'input', 'file-upload'],
29339
29339
  expose: ['root', 'editor'],
29340
29340
  setup(props, context) {
29341
- let editor = null;
29341
+ let editor = shallowRef();
29342
29342
  // Refs
29343
29343
  const root = ref();
29344
29344
  const editorRef = ref();
@@ -29427,7 +29427,7 @@ var script = defineComponent({
29427
29427
  }
29428
29428
  }, 10));
29429
29429
  onMounted(() => {
29430
- editor = new Editor({
29430
+ editor.value = new Editor({
29431
29431
  onUpdate: _ref => {
29432
29432
  let {
29433
29433
  editor
@@ -29520,7 +29520,8 @@ var script = defineComponent({
29520
29520
  trap.activate();
29521
29521
  });
29522
29522
  onBeforeUnmount(() => {
29523
- editor === null || editor === void 0 ? void 0 : editor.destroy();
29523
+ var _a;
29524
+ (_a = editor.value) === null || _a === void 0 ? void 0 : _a.destroy();
29524
29525
  });
29525
29526
  onClickOutside(root, () => {
29526
29527
  isFocused.value = false;
@@ -29561,11 +29562,11 @@ var script = defineComponent({
29561
29562
  });
29562
29563
  //Methods
29563
29564
  const handleEditorClick = () => {
29564
- var _a;
29565
+ var _a, _b, _c;
29565
29566
  setActiveFormats();
29566
29567
  isFocused.value = true;
29567
- editor === null || editor === void 0 ? void 0 : editor.commands.focus();
29568
- activeHeadingLevel.value = ((_a = editor === null || editor === void 0 ? void 0 : editor.getAttributes('heading')) === null || _a === void 0 ? void 0 : _a.level) || 0;
29568
+ (_a = editor.value) === null || _a === void 0 ? void 0 : _a.commands.focus();
29569
+ activeHeadingLevel.value = ((_c = (_b = editor.value) === null || _b === void 0 ? void 0 : _b.getAttributes('heading')) === null || _c === void 0 ? void 0 : _c.level) || 0;
29569
29570
  };
29570
29571
  const isVisible = value => {
29571
29572
  if (isArray(value)) {
@@ -29575,19 +29576,20 @@ var script = defineComponent({
29575
29576
  return !notVisibleTools.value.has(value);
29576
29577
  };
29577
29578
  const handleInput = event => {
29579
+ var _a, _b, _c, _d;
29578
29580
  const target = event.target;
29579
29581
  const value = target.value;
29580
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value));
29581
- markdownOutput.value = serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON());
29582
+ (_a = editor.value) === null || _a === void 0 ? void 0 : _a.commands.setContent(deserialize((_b = editor.value) === null || _b === void 0 ? void 0 : _b.schema, value));
29583
+ markdownOutput.value = serialize((_c = editor.value) === null || _c === void 0 ? void 0 : _c.schema, (_d = editor.value) === null || _d === void 0 ? void 0 : _d.getJSON());
29582
29584
  proxyModelValue.value = markdownOutput.value;
29583
29585
  };
29584
29586
  const handleToolbarClick = (item, level) => {
29585
- var _a, _b, _c, _d;
29587
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
29586
29588
  switch (item) {
29587
29589
  case 'source':
29588
29590
  disableMarkdown.value = !disableMarkdown.value;
29589
- sourceValue.value = serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON());
29590
- (_a = textareaRef.value) === null || _a === void 0 ? void 0 : _a.style.setProperty('height', `${((_b = editorRef.value) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 88}px`);
29591
+ sourceValue.value = serialize((_a = editor.value) === null || _a === void 0 ? void 0 : _a.schema, (_b = editor.value) === null || _b === void 0 ? void 0 : _b.getJSON());
29592
+ (_c = textareaRef.value) === null || _c === void 0 ? void 0 : _c.style.setProperty('height', `${((_d = editorRef.value) === null || _d === void 0 ? void 0 : _d.offsetHeight) || 88}px`);
29591
29593
  nextTick(() => {
29592
29594
  var _a;
29593
29595
  return (_a = textareaRef.value) === null || _a === void 0 ? void 0 : _a.focus();
@@ -29595,70 +29597,70 @@ var script = defineComponent({
29595
29597
  break;
29596
29598
  case 'bulletList':
29597
29599
  case 'orderedList':
29598
- item === 'bulletList' ? editor === null || editor === void 0 ? void 0 : editor.commands.toggleBulletList() : editor === null || editor === void 0 ? void 0 : editor.commands.toggleOrderedList();
29600
+ item === 'bulletList' ? (_e = editor.value) === null || _e === void 0 ? void 0 : _e.commands.toggleBulletList() : (_f = editor.value) === null || _f === void 0 ? void 0 : _f.commands.toggleOrderedList();
29599
29601
  break;
29600
29602
  case 'link':
29601
29603
  if (editor) {
29602
- const cursorPosition = (editor === null || editor === void 0 ? void 0 : editor.state.selection.$anchor.pos) || 0;
29604
+ const cursorPosition = ((_g = editor.value) === null || _g === void 0 ? void 0 : _g.state.selection.$anchor.pos) || 0;
29603
29605
  const {
29604
29606
  from,
29605
29607
  to,
29606
29608
  empty
29607
- } = editor.state.selection;
29608
- const isLink = (_c = editor.view.state.doc.nodeAt(cursorPosition)) === null || _c === void 0 ? void 0 : _c.marks.filter(mark => mark.type.name === 'link');
29609
- const existedText = (isLink === null || isLink === void 0 ? void 0 : isLink.length) ? ((_d = editor.view.state.doc.nodeAt(cursorPosition)) === null || _d === void 0 ? void 0 : _d.text) || '' : '';
29610
- text.value = empty ? existedText : editor.state.doc.textBetween(from, to, ' ');
29611
- link.value = editor.getAttributes('link').href || '';
29609
+ } = editor.value.state.selection;
29610
+ const isLink = (_h = editor.value.view.state.doc.nodeAt(cursorPosition)) === null || _h === void 0 ? void 0 : _h.marks.filter(mark => mark.type.name === 'link');
29611
+ const existedText = (isLink === null || isLink === void 0 ? void 0 : isLink.length) ? ((_j = editor.value.view.state.doc.nodeAt(cursorPosition)) === null || _j === void 0 ? void 0 : _j.text) || '' : '';
29612
+ text.value = empty ? existedText : editor.value.state.doc.textBetween(from, to, ' ');
29613
+ link.value = editor.value.getAttributes('link').href || '';
29612
29614
  }
29613
29615
  isOpenLinkModal.value = !isOpenLinkModal.value;
29614
29616
  break;
29615
29617
  case 'blockquote':
29616
- editor === null || editor === void 0 ? void 0 : editor.chain().toggleBlockquote().run();
29618
+ (_k = editor.value) === null || _k === void 0 ? void 0 : _k.chain().toggleBlockquote().run();
29617
29619
  break;
29618
29620
  case 'codeBlock':
29619
29621
  if (!isActive.value['codeBlock']) {
29620
- editor === null || editor === void 0 ? void 0 : editor.commands.setNode(item, {
29622
+ (_l = editor.value) === null || _l === void 0 ? void 0 : _l.commands.setNode(item, {
29621
29623
  language: 'javascript'
29622
29624
  });
29623
29625
  } else {
29624
- editor === null || editor === void 0 ? void 0 : editor.commands.setNode('paragraph');
29626
+ (_m = editor.value) === null || _m === void 0 ? void 0 : _m.commands.setNode('paragraph');
29625
29627
  }
29626
29628
  break;
29627
29629
  case 'heading':
29628
29630
  if (!level) {
29629
- editor === null || editor === void 0 ? void 0 : editor.commands.setParagraph();
29631
+ (_o = editor.value) === null || _o === void 0 ? void 0 : _o.commands.setParagraph();
29630
29632
  activeHeadingLevel.value = 0;
29631
29633
  } else {
29632
29634
  activeHeadingLevel.value = level;
29633
- editor === null || editor === void 0 ? void 0 : editor.commands.toggleHeading({
29635
+ (_p = editor.value) === null || _p === void 0 ? void 0 : _p.commands.toggleHeading({
29634
29636
  level: level
29635
29637
  });
29636
29638
  }
29637
29639
  break;
29638
29640
  case 'undo':
29639
29641
  case 'redo':
29640
- item === 'undo' ? editor === null || editor === void 0 ? void 0 : editor.commands.undo() : editor === null || editor === void 0 ? void 0 : editor.commands.redo();
29642
+ item === 'undo' ? (_q = editor.value) === null || _q === void 0 ? void 0 : _q.commands.undo() : (_r = editor.value) === null || _r === void 0 ? void 0 : _r.commands.redo();
29641
29643
  break;
29642
29644
  case 'file':
29643
29645
  context.emit('file-upload');
29644
29646
  break;
29645
29647
  default:
29646
- editor === null || editor === void 0 ? void 0 : editor.chain().toggleMark(item).run();
29648
+ (_s = editor.value) === null || _s === void 0 ? void 0 : _s.chain().toggleMark(item).run();
29647
29649
  break;
29648
29650
  }
29649
29651
  };
29650
29652
  const attachLink = async () => {
29651
- var _a, _b;
29653
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
29652
29654
  // empty
29653
29655
  if (link.value === '') {
29654
- editor === null || editor === void 0 ? void 0 : editor.chain().focus().extendMarkRange('link').unsetLink().run();
29656
+ (_a = editor.value) === null || _a === void 0 ? void 0 : _a.chain().focus().extendMarkRange('link').unsetLink().run();
29655
29657
  }
29656
- const isEmptySelection = editor === null || editor === void 0 ? void 0 : editor.state.selection.empty;
29657
- const cursorPosition = (editor === null || editor === void 0 ? void 0 : editor.state.selection.$anchor.pos) || 0;
29658
- const isLink = (_a = editor === null || editor === void 0 ? void 0 : editor.view.state.doc.nodeAt(cursorPosition)) === null || _a === void 0 ? void 0 : _a.marks.filter(mark => mark.type.name === 'link');
29659
- const existedText = (isLink === null || isLink === void 0 ? void 0 : isLink.length) ? (_b = editor === null || editor === void 0 ? void 0 : editor.view.state.doc.nodeAt(cursorPosition)) === null || _b === void 0 ? void 0 : _b.text : '';
29658
+ const isEmptySelection = (_b = editor.value) === null || _b === void 0 ? void 0 : _b.state.selection.empty;
29659
+ const cursorPosition = ((_c = editor.value) === null || _c === void 0 ? void 0 : _c.state.selection.$anchor.pos) || 0;
29660
+ const isLink = (_e = (_d = editor.value) === null || _d === void 0 ? void 0 : _d.view.state.doc.nodeAt(cursorPosition)) === null || _e === void 0 ? void 0 : _e.marks.filter(mark => mark.type.name === 'link');
29661
+ const existedText = (isLink === null || isLink === void 0 ? void 0 : isLink.length) ? (_g = (_f = editor.value) === null || _f === void 0 ? void 0 : _f.view.state.doc.nodeAt(cursorPosition)) === null || _g === void 0 ? void 0 : _g.text : '';
29660
29662
  if (link.value && isEmptySelection && !existedText) {
29661
- editor === null || editor === void 0 ? void 0 : editor.chain().focus().setMark('link', {
29663
+ (_h = editor.value) === null || _h === void 0 ? void 0 : _h.chain().focus().setMark('link', {
29662
29664
  href: link.value,
29663
29665
  target: '__blank'
29664
29666
  }).command(_ref4 => {
@@ -29671,12 +29673,12 @@ var script = defineComponent({
29671
29673
  }).run();
29672
29674
  }
29673
29675
  if (link.value && existedText === text.value && isEmptySelection) {
29674
- editor === null || editor === void 0 ? void 0 : editor.chain().extendMarkRange('link').updateAttributes('link', {
29676
+ (_j = editor.value) === null || _j === void 0 ? void 0 : _j.chain().extendMarkRange('link').updateAttributes('link', {
29675
29677
  href: link.value
29676
29678
  }).run();
29677
29679
  }
29678
29680
  if (link.value && !isEmptySelection) {
29679
- editor === null || editor === void 0 ? void 0 : editor.chain().focus().setMark('link', {
29681
+ (_k = editor.value) === null || _k === void 0 ? void 0 : _k.chain().focus().setMark('link', {
29680
29682
  href: link.value,
29681
29683
  target: '__blank'
29682
29684
  }).run();
@@ -29691,10 +29693,11 @@ var script = defineComponent({
29691
29693
  const setActiveFormats = () => {
29692
29694
  const toolbarList = props.toolbar.flat();
29693
29695
  toolbarList.forEach(item => {
29696
+ var _a;
29694
29697
  if (item === 'source') {
29695
29698
  isActive.value[item] = disableMarkdown.value;
29696
29699
  } else {
29697
- isActive.value[item] = (editor === null || editor === void 0 ? void 0 : editor.isActive(item)) || false;
29700
+ isActive.value[item] = ((_a = editor.value) === null || _a === void 0 ? void 0 : _a.isActive(item)) || false;
29698
29701
  }
29699
29702
  });
29700
29703
  };
@@ -29708,12 +29711,13 @@ var script = defineComponent({
29708
29711
  const editorInputStyles = computed(() => ['tiptap-editor-v3', ...EditorInput]);
29709
29712
  //Effects
29710
29713
  watch(proxyModelValue, value => {
29711
- if (value !== (editor === null || editor === void 0 ? void 0 : editor.getHTML()) && props.format !== 'markdown') {
29712
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
29714
+ var _a, _b, _c, _d;
29715
+ if (value !== ((_a = editor.value) === null || _a === void 0 ? void 0 : _a.getHTML()) && props.format !== 'markdown') {
29716
+ (_b = editor.value) === null || _b === void 0 ? void 0 : _b.commands.setContent(value);
29713
29717
  }
29714
29718
  if (props.format === 'markdown' && value !== markdownOutput.value) {
29715
- const deserialized = deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value);
29716
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialized);
29719
+ const deserialized = deserialize((_c = editor.value) === null || _c === void 0 ? void 0 : _c.schema, value);
29720
+ (_d = editor.value) === null || _d === void 0 ? void 0 : _d.commands.setContent(deserialized);
29717
29721
  }
29718
29722
  });
29719
29723
  return {
@@ -84,7 +84,7 @@ export { s as OrRadioV3 } from './OrRadioV3-1bec0dd2.js';
84
84
  export { s as OrRangeSliderV3 } from './OrRangeSliderV3-fe16fb8b.js';
85
85
  export { s as OrRatingV3, R as RatingVariant } from './OrRatingV3-1004142b.js';
86
86
  export { s as OrResizeablePanelV3, R as ResizeablePanelPadding, a as ResizeablePanelPlacement } from './OrResizeablePanelV3-48976a88.js';
87
- export { F as Formats, s as OrRichTextEditorV3 } from './OrRichTextEditorV3-3d33bdf2.js';
87
+ export { F as Formats, s as OrRichTextEditorV3 } from './OrRichTextEditorV3-a3339ef8.js';
88
88
  export { s as OrRichTooltipV3, R as RichTooltipBehavior } from './OrRichTooltipV3-297c15bc.js';
89
89
  export { default as OrSearch } from './OrSearch/OrSearch.js';
90
90
  export { default as OrSearchV3 } from './OrSearchV3/OrSearch.js';
@@ -46,7 +46,7 @@ export { default as OrRadioGroup } from './components/OrRadioGroup/OrRadioGroup.
46
46
  export { default as OrRadioGroupV3 } from './components/OrRadioGroupV3/OrRadioGroup.js';
47
47
  export { s as OrRangeSliderV3 } from './components/OrRangeSliderV3-fe16fb8b.js';
48
48
  export { s as OrRatingV3, R as RatingVariant } from './components/OrRatingV3-1004142b.js';
49
- export { F as Formats, s as OrRichTextEditorV3 } from './components/OrRichTextEditorV3-3d33bdf2.js';
49
+ export { F as Formats, s as OrRichTextEditorV3 } from './components/OrRichTextEditorV3-a3339ef8.js';
50
50
  export { s as OrRichTooltipV3, R as RichTooltipBehavior } from './components/OrRichTooltipV3-297c15bc.js';
51
51
  export { s as OrSegmentedControlV3, S as SegmentedControlSize } from './components/OrSegmentedControlV3-bedef411.js';
52
52
  export { s as OrSelect } from './components/OrSelect-14455b4d.js';