@onereach/ui-components 11.7.2-beta.4464.0 → 11.8.1-beta.4469.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.
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 +1 -1
  27. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +36 -36
@@ -1,6 +1,6 @@
1
1
  import { useResizeObserver, useDebounceFn, onClickOutside } from '@vueuse/core';
2
2
  import { useFocusTrap } from '@vueuse/integrations/useFocusTrap';
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 { defaultMarkdownSerializer, MarkdownSerializer } from 'prosemirror-markdown';
5
5
  import { DOMParser as DOMParser$1 } from 'prosemirror-model';
6
6
  import { marked } from 'marked';
@@ -269,7 +269,7 @@ var script = defineComponent({
269
269
  emits: ['update:modelValue', 'input', 'file-upload'],
270
270
  expose: ['root', 'editor'],
271
271
  setup(props, context) {
272
- let editor = null;
272
+ let editor = shallowRef();
273
273
  // Refs
274
274
  const root = ref();
275
275
  const editorRef = ref();
@@ -358,7 +358,7 @@ var script = defineComponent({
358
358
  }
359
359
  }, 10));
360
360
  onMounted(() => {
361
- editor = new Editor({
361
+ editor.value = new Editor({
362
362
  onUpdate: _ref => {
363
363
  let {
364
364
  editor
@@ -451,7 +451,8 @@ var script = defineComponent({
451
451
  trap.activate();
452
452
  });
453
453
  onBeforeUnmount(() => {
454
- editor === null || editor === void 0 ? void 0 : editor.destroy();
454
+ var _a;
455
+ (_a = editor.value) === null || _a === void 0 ? void 0 : _a.destroy();
455
456
  });
456
457
  onClickOutside(root, () => {
457
458
  isFocused.value = false;
@@ -492,11 +493,11 @@ var script = defineComponent({
492
493
  });
493
494
  //Methods
494
495
  const handleEditorClick = () => {
495
- var _a;
496
+ var _a, _b, _c;
496
497
  setActiveFormats();
497
498
  isFocused.value = true;
498
- editor === null || editor === void 0 ? void 0 : editor.commands.focus();
499
- activeHeadingLevel.value = ((_a = editor === null || editor === void 0 ? void 0 : editor.getAttributes('heading')) === null || _a === void 0 ? void 0 : _a.level) || 0;
499
+ (_a = editor.value) === null || _a === void 0 ? void 0 : _a.commands.focus();
500
+ activeHeadingLevel.value = ((_c = (_b = editor.value) === null || _b === void 0 ? void 0 : _b.getAttributes('heading')) === null || _c === void 0 ? void 0 : _c.level) || 0;
500
501
  };
501
502
  const isVisible = value => {
502
503
  if (isArray(value)) {
@@ -506,19 +507,20 @@ var script = defineComponent({
506
507
  return !notVisibleTools.value.has(value);
507
508
  };
508
509
  const handleInput = event => {
510
+ var _a, _b, _c, _d;
509
511
  const target = event.target;
510
512
  const value = target.value;
511
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value));
512
- markdownOutput.value = serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON());
513
+ (_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));
514
+ 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());
513
515
  proxyModelValue.value = markdownOutput.value;
514
516
  };
515
517
  const handleToolbarClick = (item, level) => {
516
- var _a, _b, _c, _d;
518
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
517
519
  switch (item) {
518
520
  case 'source':
519
521
  disableMarkdown.value = !disableMarkdown.value;
520
- sourceValue.value = serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON());
521
- (_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`);
522
+ 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());
523
+ (_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`);
522
524
  nextTick(() => {
523
525
  var _a;
524
526
  return (_a = textareaRef.value) === null || _a === void 0 ? void 0 : _a.focus();
@@ -526,70 +528,70 @@ var script = defineComponent({
526
528
  break;
527
529
  case 'bulletList':
528
530
  case 'orderedList':
529
- item === 'bulletList' ? editor === null || editor === void 0 ? void 0 : editor.commands.toggleBulletList() : editor === null || editor === void 0 ? void 0 : editor.commands.toggleOrderedList();
531
+ 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();
530
532
  break;
531
533
  case 'link':
532
534
  if (editor) {
533
- const cursorPosition = (editor === null || editor === void 0 ? void 0 : editor.state.selection.$anchor.pos) || 0;
535
+ const cursorPosition = ((_g = editor.value) === null || _g === void 0 ? void 0 : _g.state.selection.$anchor.pos) || 0;
534
536
  const {
535
537
  from,
536
538
  to,
537
539
  empty
538
- } = editor.state.selection;
539
- const isLink = (_c = editor.view.state.doc.nodeAt(cursorPosition)) === null || _c === void 0 ? void 0 : _c.marks.filter(mark => mark.type.name === 'link');
540
- 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) || '' : '';
541
- text.value = empty ? existedText : editor.state.doc.textBetween(from, to, ' ');
542
- link.value = editor.getAttributes('link').href || '';
540
+ } = editor.value.state.selection;
541
+ const isLink = (_h = editor.value.view.state.doc.nodeAt(cursorPosition)) === null || _h === void 0 ? void 0 : _h.marks.filter(mark => mark.type.name === 'link');
542
+ 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) || '' : '';
543
+ text.value = empty ? existedText : editor.value.state.doc.textBetween(from, to, ' ');
544
+ link.value = editor.value.getAttributes('link').href || '';
543
545
  }
544
546
  isOpenLinkModal.value = !isOpenLinkModal.value;
545
547
  break;
546
548
  case 'blockquote':
547
- editor === null || editor === void 0 ? void 0 : editor.chain().toggleBlockquote().run();
549
+ (_k = editor.value) === null || _k === void 0 ? void 0 : _k.chain().toggleBlockquote().run();
548
550
  break;
549
551
  case 'codeBlock':
550
552
  if (!isActive.value['codeBlock']) {
551
- editor === null || editor === void 0 ? void 0 : editor.commands.setNode(item, {
553
+ (_l = editor.value) === null || _l === void 0 ? void 0 : _l.commands.setNode(item, {
552
554
  language: 'javascript'
553
555
  });
554
556
  } else {
555
- editor === null || editor === void 0 ? void 0 : editor.commands.setNode('paragraph');
557
+ (_m = editor.value) === null || _m === void 0 ? void 0 : _m.commands.setNode('paragraph');
556
558
  }
557
559
  break;
558
560
  case 'heading':
559
561
  if (!level) {
560
- editor === null || editor === void 0 ? void 0 : editor.commands.setParagraph();
562
+ (_o = editor.value) === null || _o === void 0 ? void 0 : _o.commands.setParagraph();
561
563
  activeHeadingLevel.value = 0;
562
564
  } else {
563
565
  activeHeadingLevel.value = level;
564
- editor === null || editor === void 0 ? void 0 : editor.commands.toggleHeading({
566
+ (_p = editor.value) === null || _p === void 0 ? void 0 : _p.commands.toggleHeading({
565
567
  level: level
566
568
  });
567
569
  }
568
570
  break;
569
571
  case 'undo':
570
572
  case 'redo':
571
- item === 'undo' ? editor === null || editor === void 0 ? void 0 : editor.commands.undo() : editor === null || editor === void 0 ? void 0 : editor.commands.redo();
573
+ 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();
572
574
  break;
573
575
  case 'file':
574
576
  context.emit('file-upload');
575
577
  break;
576
578
  default:
577
- editor === null || editor === void 0 ? void 0 : editor.chain().toggleMark(item).run();
579
+ (_s = editor.value) === null || _s === void 0 ? void 0 : _s.chain().toggleMark(item).run();
578
580
  break;
579
581
  }
580
582
  };
581
583
  const attachLink = async () => {
582
- var _a, _b;
584
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
583
585
  // empty
584
586
  if (link.value === '') {
585
- editor === null || editor === void 0 ? void 0 : editor.chain().focus().extendMarkRange('link').unsetLink().run();
587
+ (_a = editor.value) === null || _a === void 0 ? void 0 : _a.chain().focus().extendMarkRange('link').unsetLink().run();
586
588
  }
587
- const isEmptySelection = editor === null || editor === void 0 ? void 0 : editor.state.selection.empty;
588
- const cursorPosition = (editor === null || editor === void 0 ? void 0 : editor.state.selection.$anchor.pos) || 0;
589
- 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');
590
- 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 : '';
589
+ const isEmptySelection = (_b = editor.value) === null || _b === void 0 ? void 0 : _b.state.selection.empty;
590
+ const cursorPosition = ((_c = editor.value) === null || _c === void 0 ? void 0 : _c.state.selection.$anchor.pos) || 0;
591
+ 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');
592
+ 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 : '';
591
593
  if (link.value && isEmptySelection && !existedText) {
592
- editor === null || editor === void 0 ? void 0 : editor.chain().focus().setMark('link', {
594
+ (_h = editor.value) === null || _h === void 0 ? void 0 : _h.chain().focus().setMark('link', {
593
595
  href: link.value,
594
596
  target: '__blank'
595
597
  }).command(_ref4 => {
@@ -602,12 +604,12 @@ var script = defineComponent({
602
604
  }).run();
603
605
  }
604
606
  if (link.value && existedText === text.value && isEmptySelection) {
605
- editor === null || editor === void 0 ? void 0 : editor.chain().extendMarkRange('link').updateAttributes('link', {
607
+ (_j = editor.value) === null || _j === void 0 ? void 0 : _j.chain().extendMarkRange('link').updateAttributes('link', {
606
608
  href: link.value
607
609
  }).run();
608
610
  }
609
611
  if (link.value && !isEmptySelection) {
610
- editor === null || editor === void 0 ? void 0 : editor.chain().focus().setMark('link', {
612
+ (_k = editor.value) === null || _k === void 0 ? void 0 : _k.chain().focus().setMark('link', {
611
613
  href: link.value,
612
614
  target: '__blank'
613
615
  }).run();
@@ -622,10 +624,11 @@ var script = defineComponent({
622
624
  const setActiveFormats = () => {
623
625
  const toolbarList = props.toolbar.flat();
624
626
  toolbarList.forEach(item => {
627
+ var _a;
625
628
  if (item === 'source') {
626
629
  isActive.value[item] = disableMarkdown.value;
627
630
  } else {
628
- isActive.value[item] = (editor === null || editor === void 0 ? void 0 : editor.isActive(item)) || false;
631
+ isActive.value[item] = ((_a = editor.value) === null || _a === void 0 ? void 0 : _a.isActive(item)) || false;
629
632
  }
630
633
  });
631
634
  };
@@ -639,12 +642,13 @@ var script = defineComponent({
639
642
  const editorInputStyles = computed(() => ['tiptap-editor-v3', ...EditorInput]);
640
643
  //Effects
641
644
  watch(proxyModelValue, value => {
642
- if (value !== (editor === null || editor === void 0 ? void 0 : editor.getHTML()) && props.format !== 'markdown') {
643
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
645
+ var _a, _b, _c, _d;
646
+ if (value !== ((_a = editor.value) === null || _a === void 0 ? void 0 : _a.getHTML()) && props.format !== 'markdown') {
647
+ (_b = editor.value) === null || _b === void 0 ? void 0 : _b.commands.setContent(value);
644
648
  }
645
649
  if (props.format === 'markdown' && value !== markdownOutput.value) {
646
- const deserialized = deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value);
647
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialized);
650
+ const deserialized = deserialize((_c = editor.value) === null || _c === void 0 ? void 0 : _c.schema, value);
651
+ (_d = editor.value) === null || _d === void 0 ? void 0 : _d.commands.setContent(deserialized);
648
652
  }
649
653
  });
650
654
  return {
@@ -103,7 +103,7 @@ export { _ as OrRadioV3 } from '../OrRadio-b014fb70.js';
103
103
  export { _ as OrRangeSliderV3 } from '../OrRangeSlider-bd76150a.js';
104
104
  export { _ as OrRatingV3, R as RatingVariant } from '../OrRating-6ece9d3a.js';
105
105
  export { _ as OrResizeablePanelV3, R as ResizeablePanelPadding, a as ResizeablePanelPlacement } from '../OrResizeablePanel-9579682b.js';
106
- export { F as Formats, _ as OrRichTextEditorV3 } from '../OrRichTextEditor-d25c5bfc.js';
106
+ export { F as Formats, _ as OrRichTextEditorV3 } from '../OrRichTextEditor-eb1b36fd.js';
107
107
  export { _ as OrRichTooltipV3, R as RichTooltipBehavior } from '../OrRichTooltip-2ccde302.js';
108
108
  export { _ as OrSearch } from '../OrSearch-3f55fbee.js';
109
109
  export { _ as OrSearchV3 } from '../OrSearch-f313feb7.js';
@@ -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,4 +1,4 @@
1
- export { F as Formats, _ as OrRichTextEditorV3 } from '../../OrRichTextEditor-d25c5bfc.js';
1
+ export { F as Formats, _ as OrRichTextEditorV3 } from '../../OrRichTextEditor-eb1b36fd.js';
2
2
  import '@vueuse/core';
3
3
  import '@vueuse/integrations/useFocusTrap';
4
4
  import 'vue-demi';
@@ -103,7 +103,7 @@ export { _ as OrRadioV3 } from './OrRadio-b014fb70.js';
103
103
  export { _ as OrRangeSliderV3 } from './OrRangeSlider-bd76150a.js';
104
104
  export { _ as OrRatingV3, R as RatingVariant } from './OrRating-6ece9d3a.js';
105
105
  export { _ as OrResizeablePanelV3, R as ResizeablePanelPadding, a as ResizeablePanelPlacement } from './OrResizeablePanel-9579682b.js';
106
- export { F as Formats, _ as OrRichTextEditorV3 } from './OrRichTextEditor-d25c5bfc.js';
106
+ export { F as Formats, _ as OrRichTextEditorV3 } from './OrRichTextEditor-eb1b36fd.js';
107
107
  export { _ as OrRichTooltipV3, R as RichTooltipBehavior } from './OrRichTooltip-2ccde302.js';
108
108
  export { _ as OrSearch } from './OrSearch-3f55fbee.js';
109
109
  export { _ as OrSearchV3 } from './OrSearch-f313feb7.js';
@@ -1,6 +1,6 @@
1
1
  import { useResizeObserver, useDebounceFn, onClickOutside } from '@vueuse/core';
2
2
  import { useFocusTrap } from '@vueuse/integrations/useFocusTrap';
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 { defaultMarkdownSerializer, MarkdownSerializer } from 'prosemirror-markdown';
5
5
  import { DOMParser as DOMParser$1 } from 'prosemirror-model';
6
6
  import { marked } from 'marked';
@@ -268,7 +268,7 @@ var script = defineComponent({
268
268
  emits: ['update:modelValue', 'input', 'file-upload'],
269
269
  expose: ['root', 'editor'],
270
270
  setup(props, context) {
271
- let editor = null;
271
+ let editor = shallowRef();
272
272
  // Refs
273
273
  const root = ref();
274
274
  const editorRef = ref();
@@ -357,7 +357,7 @@ var script = defineComponent({
357
357
  }
358
358
  }, 10));
359
359
  onMounted(() => {
360
- editor = new Editor({
360
+ editor.value = new Editor({
361
361
  onUpdate: _ref => {
362
362
  let {
363
363
  editor
@@ -450,7 +450,8 @@ var script = defineComponent({
450
450
  trap.activate();
451
451
  });
452
452
  onBeforeUnmount(() => {
453
- editor === null || editor === void 0 ? void 0 : editor.destroy();
453
+ var _a;
454
+ (_a = editor.value) === null || _a === void 0 ? void 0 : _a.destroy();
454
455
  });
455
456
  onClickOutside(root, () => {
456
457
  isFocused.value = false;
@@ -491,11 +492,11 @@ var script = defineComponent({
491
492
  });
492
493
  //Methods
493
494
  const handleEditorClick = () => {
494
- var _a;
495
+ var _a, _b, _c;
495
496
  setActiveFormats();
496
497
  isFocused.value = true;
497
- editor === null || editor === void 0 ? void 0 : editor.commands.focus();
498
- activeHeadingLevel.value = ((_a = editor === null || editor === void 0 ? void 0 : editor.getAttributes('heading')) === null || _a === void 0 ? void 0 : _a.level) || 0;
498
+ (_a = editor.value) === null || _a === void 0 ? void 0 : _a.commands.focus();
499
+ activeHeadingLevel.value = ((_c = (_b = editor.value) === null || _b === void 0 ? void 0 : _b.getAttributes('heading')) === null || _c === void 0 ? void 0 : _c.level) || 0;
499
500
  };
500
501
  const isVisible = value => {
501
502
  if (isArray(value)) {
@@ -505,19 +506,20 @@ var script = defineComponent({
505
506
  return !notVisibleTools.value.has(value);
506
507
  };
507
508
  const handleInput = event => {
509
+ var _a, _b, _c, _d;
508
510
  const target = event.target;
509
511
  const value = target.value;
510
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value));
511
- markdownOutput.value = serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON());
512
+ (_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));
513
+ 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());
512
514
  proxyModelValue.value = markdownOutput.value;
513
515
  };
514
516
  const handleToolbarClick = (item, level) => {
515
- var _a, _b, _c, _d;
517
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
516
518
  switch (item) {
517
519
  case 'source':
518
520
  disableMarkdown.value = !disableMarkdown.value;
519
- sourceValue.value = serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON());
520
- (_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`);
521
+ 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());
522
+ (_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`);
521
523
  nextTick(() => {
522
524
  var _a;
523
525
  return (_a = textareaRef.value) === null || _a === void 0 ? void 0 : _a.focus();
@@ -525,70 +527,70 @@ var script = defineComponent({
525
527
  break;
526
528
  case 'bulletList':
527
529
  case 'orderedList':
528
- item === 'bulletList' ? editor === null || editor === void 0 ? void 0 : editor.commands.toggleBulletList() : editor === null || editor === void 0 ? void 0 : editor.commands.toggleOrderedList();
530
+ 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();
529
531
  break;
530
532
  case 'link':
531
533
  if (editor) {
532
- const cursorPosition = (editor === null || editor === void 0 ? void 0 : editor.state.selection.$anchor.pos) || 0;
534
+ const cursorPosition = ((_g = editor.value) === null || _g === void 0 ? void 0 : _g.state.selection.$anchor.pos) || 0;
533
535
  const {
534
536
  from,
535
537
  to,
536
538
  empty
537
- } = editor.state.selection;
538
- const isLink = (_c = editor.view.state.doc.nodeAt(cursorPosition)) === null || _c === void 0 ? void 0 : _c.marks.filter(mark => mark.type.name === 'link');
539
- 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) || '' : '';
540
- text.value = empty ? existedText : editor.state.doc.textBetween(from, to, ' ');
541
- link.value = editor.getAttributes('link').href || '';
539
+ } = editor.value.state.selection;
540
+ const isLink = (_h = editor.value.view.state.doc.nodeAt(cursorPosition)) === null || _h === void 0 ? void 0 : _h.marks.filter(mark => mark.type.name === 'link');
541
+ 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) || '' : '';
542
+ text.value = empty ? existedText : editor.value.state.doc.textBetween(from, to, ' ');
543
+ link.value = editor.value.getAttributes('link').href || '';
542
544
  }
543
545
  isOpenLinkModal.value = !isOpenLinkModal.value;
544
546
  break;
545
547
  case 'blockquote':
546
- editor === null || editor === void 0 ? void 0 : editor.chain().toggleBlockquote().run();
548
+ (_k = editor.value) === null || _k === void 0 ? void 0 : _k.chain().toggleBlockquote().run();
547
549
  break;
548
550
  case 'codeBlock':
549
551
  if (!isActive.value['codeBlock']) {
550
- editor === null || editor === void 0 ? void 0 : editor.commands.setNode(item, {
552
+ (_l = editor.value) === null || _l === void 0 ? void 0 : _l.commands.setNode(item, {
551
553
  language: 'javascript'
552
554
  });
553
555
  } else {
554
- editor === null || editor === void 0 ? void 0 : editor.commands.setNode('paragraph');
556
+ (_m = editor.value) === null || _m === void 0 ? void 0 : _m.commands.setNode('paragraph');
555
557
  }
556
558
  break;
557
559
  case 'heading':
558
560
  if (!level) {
559
- editor === null || editor === void 0 ? void 0 : editor.commands.setParagraph();
561
+ (_o = editor.value) === null || _o === void 0 ? void 0 : _o.commands.setParagraph();
560
562
  activeHeadingLevel.value = 0;
561
563
  } else {
562
564
  activeHeadingLevel.value = level;
563
- editor === null || editor === void 0 ? void 0 : editor.commands.toggleHeading({
565
+ (_p = editor.value) === null || _p === void 0 ? void 0 : _p.commands.toggleHeading({
564
566
  level: level
565
567
  });
566
568
  }
567
569
  break;
568
570
  case 'undo':
569
571
  case 'redo':
570
- item === 'undo' ? editor === null || editor === void 0 ? void 0 : editor.commands.undo() : editor === null || editor === void 0 ? void 0 : editor.commands.redo();
572
+ 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();
571
573
  break;
572
574
  case 'file':
573
575
  context.emit('file-upload');
574
576
  break;
575
577
  default:
576
- editor === null || editor === void 0 ? void 0 : editor.chain().toggleMark(item).run();
578
+ (_s = editor.value) === null || _s === void 0 ? void 0 : _s.chain().toggleMark(item).run();
577
579
  break;
578
580
  }
579
581
  };
580
582
  const attachLink = async () => {
581
- var _a, _b;
583
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
582
584
  // empty
583
585
  if (link.value === '') {
584
- editor === null || editor === void 0 ? void 0 : editor.chain().focus().extendMarkRange('link').unsetLink().run();
586
+ (_a = editor.value) === null || _a === void 0 ? void 0 : _a.chain().focus().extendMarkRange('link').unsetLink().run();
585
587
  }
586
- const isEmptySelection = editor === null || editor === void 0 ? void 0 : editor.state.selection.empty;
587
- const cursorPosition = (editor === null || editor === void 0 ? void 0 : editor.state.selection.$anchor.pos) || 0;
588
- 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');
589
- 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 : '';
588
+ const isEmptySelection = (_b = editor.value) === null || _b === void 0 ? void 0 : _b.state.selection.empty;
589
+ const cursorPosition = ((_c = editor.value) === null || _c === void 0 ? void 0 : _c.state.selection.$anchor.pos) || 0;
590
+ 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');
591
+ 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 : '';
590
592
  if (link.value && isEmptySelection && !existedText) {
591
- editor === null || editor === void 0 ? void 0 : editor.chain().focus().setMark('link', {
593
+ (_h = editor.value) === null || _h === void 0 ? void 0 : _h.chain().focus().setMark('link', {
592
594
  href: link.value,
593
595
  target: '__blank'
594
596
  }).command(_ref4 => {
@@ -601,12 +603,12 @@ var script = defineComponent({
601
603
  }).run();
602
604
  }
603
605
  if (link.value && existedText === text.value && isEmptySelection) {
604
- editor === null || editor === void 0 ? void 0 : editor.chain().extendMarkRange('link').updateAttributes('link', {
606
+ (_j = editor.value) === null || _j === void 0 ? void 0 : _j.chain().extendMarkRange('link').updateAttributes('link', {
605
607
  href: link.value
606
608
  }).run();
607
609
  }
608
610
  if (link.value && !isEmptySelection) {
609
- editor === null || editor === void 0 ? void 0 : editor.chain().focus().setMark('link', {
611
+ (_k = editor.value) === null || _k === void 0 ? void 0 : _k.chain().focus().setMark('link', {
610
612
  href: link.value,
611
613
  target: '__blank'
612
614
  }).run();
@@ -621,10 +623,11 @@ var script = defineComponent({
621
623
  const setActiveFormats = () => {
622
624
  const toolbarList = props.toolbar.flat();
623
625
  toolbarList.forEach(item => {
626
+ var _a;
624
627
  if (item === 'source') {
625
628
  isActive.value[item] = disableMarkdown.value;
626
629
  } else {
627
- isActive.value[item] = (editor === null || editor === void 0 ? void 0 : editor.isActive(item)) || false;
630
+ isActive.value[item] = ((_a = editor.value) === null || _a === void 0 ? void 0 : _a.isActive(item)) || false;
628
631
  }
629
632
  });
630
633
  };
@@ -638,12 +641,13 @@ var script = defineComponent({
638
641
  const editorInputStyles = computed(() => ['tiptap-editor-v3', ...EditorInput]);
639
642
  //Effects
640
643
  watch(proxyModelValue, value => {
641
- if (value !== (editor === null || editor === void 0 ? void 0 : editor.getHTML()) && props.format !== 'markdown') {
642
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
644
+ var _a, _b, _c, _d;
645
+ if (value !== ((_a = editor.value) === null || _a === void 0 ? void 0 : _a.getHTML()) && props.format !== 'markdown') {
646
+ (_b = editor.value) === null || _b === void 0 ? void 0 : _b.commands.setContent(value);
643
647
  }
644
648
  if (props.format === 'markdown' && value !== markdownOutput.value) {
645
- const deserialized = deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value);
646
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialized);
649
+ const deserialized = deserialize((_c = editor.value) === null || _c === void 0 ? void 0 : _c.schema, value);
650
+ (_d = editor.value) === null || _d === void 0 ? void 0 : _d.commands.setContent(deserialized);
647
651
  }
648
652
  });
649
653
  return {
@@ -100,7 +100,7 @@ export { s as OrRadioV3 } from '../OrRadio-85e4f28e.js';
100
100
  export { s as OrRangeSliderV3 } from '../OrRangeSlider-f5b3adf5.js';
101
101
  export { s as OrRatingV3, R as RatingVariant } from '../OrRating-17c793e3.js';
102
102
  export { s as OrResizeablePanelV3, R as ResizeablePanelPadding, a as ResizeablePanelPlacement } from '../OrResizeablePanel-bb155c0f.js';
103
- export { F as Formats, s as OrRichTextEditorV3 } from '../OrRichTextEditor-08160d9b.js';
103
+ export { F as Formats, s as OrRichTextEditorV3 } from '../OrRichTextEditor-522aa860.js';
104
104
  export { s as OrRichTooltipV3, R as RichTooltipBehavior } from '../OrRichTooltip-30652cfe.js';
105
105
  export { s as OrSearch } from '../OrSearch-740f931b.js';
106
106
  export { s as OrSearchV3 } from '../OrSearch-371b5286.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,4 +1,4 @@
1
- export { F as Formats, s as OrRichTextEditorV3 } from '../../OrRichTextEditor-08160d9b.js';
1
+ export { F as Formats, s as OrRichTextEditorV3 } from '../../OrRichTextEditor-522aa860.js';
2
2
  import '@vueuse/core';
3
3
  import '@vueuse/integrations/useFocusTrap';
4
4
  import 'vue-demi';
@@ -100,7 +100,7 @@ export { s as OrRadioV3 } from './OrRadio-85e4f28e.js';
100
100
  export { s as OrRangeSliderV3 } from './OrRangeSlider-f5b3adf5.js';
101
101
  export { s as OrRatingV3, R as RatingVariant } from './OrRating-17c793e3.js';
102
102
  export { s as OrResizeablePanelV3, R as ResizeablePanelPadding, a as ResizeablePanelPlacement } from './OrResizeablePanel-bb155c0f.js';
103
- export { F as Formats, s as OrRichTextEditorV3 } from './OrRichTextEditor-08160d9b.js';
103
+ export { F as Formats, s as OrRichTextEditorV3 } from './OrRichTextEditor-522aa860.js';
104
104
  export { s as OrRichTooltipV3, R as RichTooltipBehavior } from './OrRichTooltip-30652cfe.js';
105
105
  export { s as OrSearch } from './OrSearch-740f931b.js';
106
106
  export { s as OrSearchV3 } from './OrSearch-371b5286.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/ui-components",
3
- "version": "11.7.2-beta.4464.0",
3
+ "version": "11.8.1-beta.4469.0",
4
4
  "npmUnpacked": "4.15.2",
5
5
  "description": "Vue components library for v2/3",
6
6
  "sideEffects": false,