@onereach/ui-components 4.4.0-beta.2678.0 → 4.4.0-beta.2679.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 (25) hide show
  1. package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +11 -12
  2. package/dist/bundled/v2/components/OrRichTextEditorV3/index.js +1 -1
  3. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.js +1 -1
  4. package/dist/bundled/v2/components/index.js +1 -1
  5. package/dist/bundled/v2/index.js +1 -1
  6. package/dist/bundled/v2/{markdown-d704b3a8.js → markdown-ff71fff3.js} +7 -2
  7. package/dist/bundled/v3/{OrRichTextEditor.vue_vue_type_script_lang-c1cc12b1.js → OrRichTextEditor.vue_vue_type_script_lang-21bf1074.js} +11 -12
  8. package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +3 -3
  9. package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +2 -2
  10. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +1 -1
  11. package/dist/bundled/v3/components/index.js +2 -2
  12. package/dist/bundled/v3/index.js +2 -2
  13. package/dist/bundled/v3/{markdown-d704b3a8.js → markdown-ff71fff3.js} +7 -2
  14. package/dist/esm/v2/{OrRichTextEditor-c184da4b.js → OrRichTextEditor-b6522b20.js} +17 -13
  15. package/dist/esm/v2/components/index.js +1 -1
  16. package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +1 -1
  17. package/dist/esm/v2/index.js +1 -1
  18. package/dist/esm/v3/{OrRichTextEditor-592db26c.js → OrRichTextEditor-69cf03de.js} +17 -13
  19. package/dist/esm/v3/components/index.js +1 -1
  20. package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +1 -1
  21. package/dist/esm/v3/index.js +1 -1
  22. package/package.json +2 -2
  23. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +3 -11
  24. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +10 -12
  25. package/src/components/or-rich-text-editor-v3/utils/markdown.ts +5 -2
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, ref, onMounted, onBeforeUnmount, computed, watch } from 'vue-demi';
2
2
  import { u as useFocusTrap } from '../../useFocusTrap-48767a70.js';
3
3
  import { useResizeObserver, onClickOutside } from '@vueuse/core';
4
- import { B as Blockquote, a as Bold, b as BulletList, C as CodeBlock, H as HardBreak, I as Italic, L as ListItem, O as OrderedList, P as Paragraph, S as Strike, s as serialize, d as deserialize, U as Underline, c as Link, e as Highlight } from '../../markdown-d704b3a8.js';
4
+ import { B as Blockquote, a as Bold, b as BulletList, C as CodeBlock, H as HardBreak, I as Italic, L as ListItem, O as OrderedList, P as Paragraph, S as Strike, s as serialize, d as deserialize, U as Underline, c as Link, e as Highlight } from '../../markdown-ff71fff3.js';
5
5
  import { EditorContainer, ToolbarContainer, Toolbar, ToolbarButtonFocused, ToolbarButton, EditorInput } from './styles.js';
6
6
  import { Formats } from './props.js';
7
7
  import { M as Mark, m as mergeAttributes, a as markInputRule, b as markPasteRule, N as Node, E as Extension, k as keydownHandler, D as DecorationSet, c as Decoration, d as callOrReturn, g as getExtensionField, t as textblockTypeInputRule, n as nodeInputRule, e as Editor } from '../../index-1182caa8.js';
@@ -1622,6 +1622,8 @@ var script = defineComponent({
1622
1622
  },
1623
1623
  element: editorRef.value,
1624
1624
  autofocus: props.autofocus,
1625
+ enableInputRules: true,
1626
+ enablePasteRules: true,
1625
1627
  extensions: [codemirrorNode, StarterKit.configure({
1626
1628
  heading: false,
1627
1629
  codeBlock: false
@@ -1655,6 +1657,9 @@ var script = defineComponent({
1655
1657
  attributes: {
1656
1658
  class: 'focus:outline-none'
1657
1659
  }
1660
+ },
1661
+ parseOptions: {
1662
+ preserveWhitespace: true
1658
1663
  }
1659
1664
  });
1660
1665
  setActiveFormats();
@@ -1720,17 +1725,11 @@ var script = defineComponent({
1720
1725
  switch (item) {
1721
1726
  case 'source':
1722
1727
  disableMarkdown.value = !disableMarkdown.value;
1723
- editor === null || editor === void 0 ? void 0 : editor.setOptions({
1724
- enableInputRules: !disableMarkdown.value,
1725
- enablePasteRules: !disableMarkdown.value
1726
- });
1727
- editor === null || editor === void 0 ? void 0 : editor.view.updateState(editor === null || editor === void 0 ? void 0 : editor.state.reconfigure({
1728
- plugins: editor.extensionManager.plugins
1729
- }));
1730
1728
  if (disableMarkdown.value) {
1731
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON()));
1729
+ editor === null || editor === void 0 ? void 0 : editor.commands.clearContent();
1730
+ editor === null || editor === void 0 ? void 0 : editor.commands.insertContent(proxyModelValue.value);
1732
1731
  } else {
1733
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getHTML()));
1732
+ editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getText()));
1734
1733
  }
1735
1734
  break;
1736
1735
  case 'bulletList':
@@ -1865,8 +1864,8 @@ var script = defineComponent({
1865
1864
  editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
1866
1865
  }
1867
1866
  if (props.format === 'markdown' && value !== markdownOutput.value) {
1868
- const deserialized = deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value);
1869
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialized);
1867
+ // const deserialized = deserialize(editor?.schema, value);
1868
+ editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
1870
1869
  }
1871
1870
  });
1872
1871
  return {
@@ -2,7 +2,7 @@ export { default as OrRichTextEditorV3 } from './OrRichTextEditor.js';
2
2
  import 'vue-demi';
3
3
  import '../../useFocusTrap-48767a70.js';
4
4
  import '@vueuse/core';
5
- import '../../markdown-d704b3a8.js';
5
+ import '../../markdown-ff71fff3.js';
6
6
  import '../../index-85c2efe8.js';
7
7
  import 'node:punycode';
8
8
  import '../../index-1182caa8.js';
@@ -1,4 +1,4 @@
1
- export { d as deserialize, s as serialize } from '../../../markdown-d704b3a8.js';
1
+ export { d as deserialize, s as serialize } from '../../../markdown-ff71fff3.js';
2
2
  import '../../../index-85c2efe8.js';
3
3
  import 'node:punycode';
4
4
  import '../../../index-1182caa8.js';
@@ -252,7 +252,7 @@ import './OrToast/Timer.js';
252
252
  import './OrToastV3/styles.js';
253
253
  import './OrToastV3/composable/useToastEventBus.js';
254
254
  import './OrToastV3/Timer.js';
255
- import '../markdown-d704b3a8.js';
255
+ import '../markdown-ff71fff3.js';
256
256
  import '../index-85c2efe8.js';
257
257
  import 'node:punycode';
258
258
  import '../index-1182caa8.js';
@@ -227,7 +227,7 @@ import './components/OrToastV3/composable/useToastEventBus.js';
227
227
  import './components/OrToastV3/styles.js';
228
228
  import './components/OrToastV3/Timer.js';
229
229
  import './useFocusTrap-48767a70.js';
230
- import './markdown-d704b3a8.js';
230
+ import './markdown-ff71fff3.js';
231
231
  import './index-85c2efe8.js';
232
232
  import 'node:punycode';
233
233
  import './index-1182caa8.js';
@@ -17956,11 +17956,16 @@ const isPlainURL = (link, parent, index, side) => {
17956
17956
  const serialize = (schema, content) => {
17957
17957
  const proseMirrorDocument = schema.nodeFromJSON(content);
17958
17958
  const serializer = new MarkdownSerializer(serializerNodes, serializerMarks);
17959
- return serializer.serialize(proseMirrorDocument);
17959
+ return serializer.serialize(proseMirrorDocument, {
17960
+ tightLists: true
17961
+ });
17960
17962
  };
17961
17963
  const deserialize = (schema, content) => {
17962
17964
  if (!content) return null;
17963
- const html = marked.parse(content);
17965
+ const html = marked(content, {
17966
+ gfm: true,
17967
+ breaks: true
17968
+ });
17964
17969
  if (!html) return null;
17965
17970
  const parser = new DOMParser();
17966
17971
  const {
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, ref, onMounted, onBeforeUnmount, computed, watch } from 'vue-demi';
2
2
  import { u as useFocusTrap } from './useFocusTrap-48767a70.js';
3
3
  import { useResizeObserver, onClickOutside } from '@vueuse/core';
4
- import { B as Blockquote, a as Bold, b as BulletList, C as CodeBlock, H as HardBreak, I as Italic, L as ListItem, O as OrderedList, P as Paragraph, S as Strike, s as serialize, d as deserialize, U as Underline, c as Link, e as Highlight } from './markdown-d704b3a8.js';
4
+ import { B as Blockquote, a as Bold, b as BulletList, C as CodeBlock, H as HardBreak, I as Italic, L as ListItem, O as OrderedList, P as Paragraph, S as Strike, s as serialize, d as deserialize, U as Underline, c as Link, e as Highlight } from './markdown-ff71fff3.js';
5
5
  import { EditorContainer, ToolbarContainer, Toolbar, ToolbarButtonFocused, ToolbarButton, EditorInput } from './components/OrRichTextEditorV3/styles.js';
6
6
  import { Formats } from './components/OrRichTextEditorV3/props.js';
7
7
  import { M as Mark, m as mergeAttributes, a as markInputRule, b as markPasteRule, N as Node, E as Extension, k as keydownHandler, D as DecorationSet, c as Decoration, d as callOrReturn, g as getExtensionField, t as textblockTypeInputRule, n as nodeInputRule, e as Editor } from './index-1182caa8.js';
@@ -1576,6 +1576,8 @@ var script = defineComponent({
1576
1576
  },
1577
1577
  element: editorRef.value,
1578
1578
  autofocus: props.autofocus,
1579
+ enableInputRules: true,
1580
+ enablePasteRules: true,
1579
1581
  extensions: [codemirrorNode, StarterKit.configure({
1580
1582
  heading: false,
1581
1583
  codeBlock: false
@@ -1609,6 +1611,9 @@ var script = defineComponent({
1609
1611
  attributes: {
1610
1612
  class: 'focus:outline-none'
1611
1613
  }
1614
+ },
1615
+ parseOptions: {
1616
+ preserveWhitespace: true
1612
1617
  }
1613
1618
  });
1614
1619
  setActiveFormats();
@@ -1674,17 +1679,11 @@ var script = defineComponent({
1674
1679
  switch (item) {
1675
1680
  case 'source':
1676
1681
  disableMarkdown.value = !disableMarkdown.value;
1677
- editor === null || editor === void 0 ? void 0 : editor.setOptions({
1678
- enableInputRules: !disableMarkdown.value,
1679
- enablePasteRules: !disableMarkdown.value
1680
- });
1681
- editor === null || editor === void 0 ? void 0 : editor.view.updateState(editor === null || editor === void 0 ? void 0 : editor.state.reconfigure({
1682
- plugins: editor.extensionManager.plugins
1683
- }));
1684
1682
  if (disableMarkdown.value) {
1685
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON()));
1683
+ editor === null || editor === void 0 ? void 0 : editor.commands.clearContent();
1684
+ editor === null || editor === void 0 ? void 0 : editor.commands.insertContent(proxyModelValue.value);
1686
1685
  } else {
1687
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getHTML()));
1686
+ editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getText()));
1688
1687
  }
1689
1688
  break;
1690
1689
  case 'bulletList':
@@ -1819,8 +1818,8 @@ var script = defineComponent({
1819
1818
  editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
1820
1819
  }
1821
1820
  if (props.format === 'markdown' && value !== markdownOutput.value) {
1822
- const deserialized = deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value);
1823
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialized);
1821
+ // const deserialized = deserialize(editor?.schema, value);
1822
+ editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
1824
1823
  }
1825
1824
  });
1826
1825
  return {
@@ -1,11 +1,11 @@
1
- import { s as script } from '../../OrRichTextEditor.vue_vue_type_script_lang-c1cc12b1.js';
2
- export { s as default } from '../../OrRichTextEditor.vue_vue_type_script_lang-c1cc12b1.js';
1
+ import { s as script } from '../../OrRichTextEditor.vue_vue_type_script_lang-21bf1074.js';
2
+ export { s as default } from '../../OrRichTextEditor.vue_vue_type_script_lang-21bf1074.js';
3
3
  import { resolveComponent, openBlock, createElementBlock, normalizeClass, createVNode, withCtx, createTextVNode, toDisplayString, createElementVNode, Fragment, renderList, createBlock, createCommentVNode, renderSlot } from 'vue';
4
4
  import { s as styleInject } from '../../style-inject.es-4c6f2515.js';
5
5
  import 'vue-demi';
6
6
  import '../../useFocusTrap-48767a70.js';
7
7
  import '@vueuse/core';
8
- import '../../markdown-d704b3a8.js';
8
+ import '../../markdown-ff71fff3.js';
9
9
  import '../../index-85c2efe8.js';
10
10
  import 'node:punycode';
11
11
  import '../../index-1182caa8.js';
@@ -1,8 +1,8 @@
1
- export { s as OrRichTextEditorV3 } from '../../OrRichTextEditor.vue_vue_type_script_lang-c1cc12b1.js';
1
+ export { s as OrRichTextEditorV3 } from '../../OrRichTextEditor.vue_vue_type_script_lang-21bf1074.js';
2
2
  import 'vue-demi';
3
3
  import '../../useFocusTrap-48767a70.js';
4
4
  import '@vueuse/core';
5
- import '../../markdown-d704b3a8.js';
5
+ import '../../markdown-ff71fff3.js';
6
6
  import '../../index-85c2efe8.js';
7
7
  import 'node:punycode';
8
8
  import '../../index-1182caa8.js';
@@ -1,4 +1,4 @@
1
- export { d as deserialize, s as serialize } from '../../../markdown-d704b3a8.js';
1
+ export { d as deserialize, s as serialize } from '../../../markdown-ff71fff3.js';
2
2
  import '../../../index-85c2efe8.js';
3
3
  import 'node:punycode';
4
4
  import '../../../index-1182caa8.js';
@@ -155,7 +155,7 @@ export { p as PropsV3 } from '../props-7be029c7.js';
155
155
  export { s as OrTooltip } from '../OrTooltip.vue_vue_type_script_lang-76a6b7f4.js';
156
156
  export { s as OrTooltipContent } from '../OrTooltipContent.vue_vue_type_script_lang-969c20ed.js';
157
157
  export { s as OrTooltipV3 } from '../OrTooltip.vue_vue_type_script_lang-56496d67.js';
158
- export { s as OrRichTextEditorV3 } from '../OrRichTextEditor.vue_vue_type_script_lang-c1cc12b1.js';
158
+ export { s as OrRichTextEditorV3 } from '../OrRichTextEditor.vue_vue_type_script_lang-21bf1074.js';
159
159
  import 'vue-demi';
160
160
  import 'lodash';
161
161
  import './OrIcon/OrIcon.js';
@@ -293,7 +293,7 @@ import './OrToast/Timer.js';
293
293
  import './OrToastV3/styles.js';
294
294
  import './OrToastV3/composable/useToastEventBus.js';
295
295
  import './OrToastV3/Timer.js';
296
- import '../markdown-d704b3a8.js';
296
+ import '../markdown-ff71fff3.js';
297
297
  import '../index-85c2efe8.js';
298
298
  import 'node:punycode';
299
299
  import '../index-1182caa8.js';
@@ -124,7 +124,7 @@ import './components/OrToastContainerV3/OrToastContainer.js';
124
124
  export { s as OrToastContainerV3 } from './OrToastContainer.vue_vue_type_script_lang-9a91e4ab.js';
125
125
  export { default as useToastV3 } from './components/OrToastV3/composable/useToast.js';
126
126
  import './components/OrRichTextEditorV3/OrRichTextEditor.js';
127
- export { s as OrRichTextEditorV3 } from './OrRichTextEditor.vue_vue_type_script_lang-c1cc12b1.js';
127
+ export { s as OrRichTextEditorV3 } from './OrRichTextEditor.vue_vue_type_script_lang-21bf1074.js';
128
128
  export { OR_AVATAR_SIZE } from './components/OrAvatar/constants.js';
129
129
  export { AvatarColor, AvatarSize } from './components/OrAvatarV3/props.js';
130
130
  export { s as OrBottomSheetV3 } from './OrBottomSheet.vue_vue_type_script_lang-a81b2abb.js';
@@ -325,7 +325,7 @@ import './components/OrToastV3/styles.js';
325
325
  import './components/OrTeleportV3/OrTeleport.js';
326
326
  import './components/OrToastV3/Timer.js';
327
327
  import './useFocusTrap-48767a70.js';
328
- import './markdown-d704b3a8.js';
328
+ import './markdown-ff71fff3.js';
329
329
  import './index-85c2efe8.js';
330
330
  import 'node:punycode';
331
331
  import './index-1182caa8.js';
@@ -17956,11 +17956,16 @@ const isPlainURL = (link, parent, index, side) => {
17956
17956
  const serialize = (schema, content) => {
17957
17957
  const proseMirrorDocument = schema.nodeFromJSON(content);
17958
17958
  const serializer = new MarkdownSerializer(serializerNodes, serializerMarks);
17959
- return serializer.serialize(proseMirrorDocument);
17959
+ return serializer.serialize(proseMirrorDocument, {
17960
+ tightLists: true
17961
+ });
17960
17962
  };
17961
17963
  const deserialize = (schema, content) => {
17962
17964
  if (!content) return null;
17963
- const html = marked.parse(content);
17965
+ const html = marked(content, {
17966
+ gfm: true,
17967
+ breaks: true
17968
+ });
17964
17969
  if (!html) return null;
17965
17970
  const parser = new DOMParser();
17966
17971
  const {
@@ -93,11 +93,16 @@ const isPlainURL = (link, parent, index, side) => {
93
93
  const serialize = (schema, content) => {
94
94
  const proseMirrorDocument = schema.nodeFromJSON(content);
95
95
  const serializer = new MarkdownSerializer(serializerNodes, serializerMarks);
96
- return serializer.serialize(proseMirrorDocument);
96
+ return serializer.serialize(proseMirrorDocument, {
97
+ tightLists: true
98
+ });
97
99
  };
98
100
  const deserialize = (schema, content) => {
99
101
  if (!content) return null;
100
- const html = marked.parse(content);
102
+ const html = marked(content, {
103
+ gfm: true,
104
+ breaks: true
105
+ });
101
106
  if (!html) return null;
102
107
  const parser = new DOMParser();
103
108
  const {
@@ -340,6 +345,8 @@ var script = defineComponent({
340
345
  },
341
346
  element: editorRef.value,
342
347
  autofocus: props.autofocus,
348
+ enableInputRules: true,
349
+ enablePasteRules: true,
343
350
  extensions: [codemirrorNode, StarterKit.configure({
344
351
  heading: false,
345
352
  codeBlock: false
@@ -373,6 +380,9 @@ var script = defineComponent({
373
380
  attributes: {
374
381
  class: 'focus:outline-none'
375
382
  }
383
+ },
384
+ parseOptions: {
385
+ preserveWhitespace: true
376
386
  }
377
387
  });
378
388
  setActiveFormats();
@@ -438,17 +448,11 @@ var script = defineComponent({
438
448
  switch (item) {
439
449
  case 'source':
440
450
  disableMarkdown.value = !disableMarkdown.value;
441
- editor === null || editor === void 0 ? void 0 : editor.setOptions({
442
- enableInputRules: !disableMarkdown.value,
443
- enablePasteRules: !disableMarkdown.value
444
- });
445
- editor === null || editor === void 0 ? void 0 : editor.view.updateState(editor === null || editor === void 0 ? void 0 : editor.state.reconfigure({
446
- plugins: editor.extensionManager.plugins
447
- }));
448
451
  if (disableMarkdown.value) {
449
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON()));
452
+ editor === null || editor === void 0 ? void 0 : editor.commands.clearContent();
453
+ editor === null || editor === void 0 ? void 0 : editor.commands.insertContent(proxyModelValue.value);
450
454
  } else {
451
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getHTML()));
455
+ editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getText()));
452
456
  }
453
457
  break;
454
458
  case 'bulletList':
@@ -583,8 +587,8 @@ var script = defineComponent({
583
587
  editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
584
588
  }
585
589
  if (props.format === 'markdown' && value !== markdownOutput.value) {
586
- const deserialized = deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value);
587
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialized);
590
+ // const deserialized = deserialize(editor?.schema, value);
591
+ editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
588
592
  }
589
593
  });
590
594
  return {
@@ -110,7 +110,7 @@ export { p as PropsV3, a as useQueueV3, u as useToastV3 } from '../useToast-a133
110
110
  export { _ as OrTooltip } from '../OrTooltip-97a42707.js';
111
111
  export { _ as OrTooltipContent } from '../OrTooltipContent-d85e1071.js';
112
112
  export { _ as OrTooltipV3 } from '../OrTooltip-93a3eefb.js';
113
- export { _ as OrRichTextEditorV3 } from '../OrRichTextEditor-c184da4b.js';
113
+ export { _ as OrRichTextEditorV3 } from '../OrRichTextEditor-b6522b20.js';
114
114
  import 'vue-demi';
115
115
  import 'lodash';
116
116
  import '../style-inject.es-4c6f2515.js';
@@ -1,4 +1,4 @@
1
- export { _ as OrRichTextEditorV3 } from '../../OrRichTextEditor-c184da4b.js';
1
+ export { _ as OrRichTextEditorV3 } from '../../OrRichTextEditor-b6522b20.js';
2
2
  import 'vue-demi';
3
3
  import '@vueuse/integrations/useFocusTrap';
4
4
  import '@vueuse/core';
@@ -110,7 +110,7 @@ export { p as PropsV3, a as useQueueV3, u as useToastV3 } from './useToast-a1332
110
110
  export { _ as OrTooltip } from './OrTooltip-97a42707.js';
111
111
  export { _ as OrTooltipContent } from './OrTooltipContent-d85e1071.js';
112
112
  export { _ as OrTooltipV3 } from './OrTooltip-93a3eefb.js';
113
- export { _ as OrRichTextEditorV3 } from './OrRichTextEditor-c184da4b.js';
113
+ export { _ as OrRichTextEditorV3 } from './OrRichTextEditor-b6522b20.js';
114
114
  export { D as DropdownClose, a as DropdownOpen } from './dropdown-open-e1f90e0a.js';
115
115
  export { u as useControlAttributes, a as useIdAttribute } from './useIdAttribute-859439f0.js';
116
116
  export { u as useElevation } from './useElevation-b5a49746.js';
@@ -93,11 +93,16 @@ const isPlainURL = (link, parent, index, side) => {
93
93
  const serialize = (schema, content) => {
94
94
  const proseMirrorDocument = schema.nodeFromJSON(content);
95
95
  const serializer = new MarkdownSerializer(serializerNodes, serializerMarks);
96
- return serializer.serialize(proseMirrorDocument);
96
+ return serializer.serialize(proseMirrorDocument, {
97
+ tightLists: true
98
+ });
97
99
  };
98
100
  const deserialize = (schema, content) => {
99
101
  if (!content) return null;
100
- const html = marked.parse(content);
102
+ const html = marked(content, {
103
+ gfm: true,
104
+ breaks: true
105
+ });
101
106
  if (!html) return null;
102
107
  const parser = new DOMParser();
103
108
  const {
@@ -340,6 +345,8 @@ var script = defineComponent({
340
345
  },
341
346
  element: editorRef.value,
342
347
  autofocus: props.autofocus,
348
+ enableInputRules: true,
349
+ enablePasteRules: true,
343
350
  extensions: [codemirrorNode, StarterKit.configure({
344
351
  heading: false,
345
352
  codeBlock: false
@@ -373,6 +380,9 @@ var script = defineComponent({
373
380
  attributes: {
374
381
  class: 'focus:outline-none'
375
382
  }
383
+ },
384
+ parseOptions: {
385
+ preserveWhitespace: true
376
386
  }
377
387
  });
378
388
  setActiveFormats();
@@ -438,17 +448,11 @@ var script = defineComponent({
438
448
  switch (item) {
439
449
  case 'source':
440
450
  disableMarkdown.value = !disableMarkdown.value;
441
- editor === null || editor === void 0 ? void 0 : editor.setOptions({
442
- enableInputRules: !disableMarkdown.value,
443
- enablePasteRules: !disableMarkdown.value
444
- });
445
- editor === null || editor === void 0 ? void 0 : editor.view.updateState(editor === null || editor === void 0 ? void 0 : editor.state.reconfigure({
446
- plugins: editor.extensionManager.plugins
447
- }));
448
451
  if (disableMarkdown.value) {
449
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON()));
452
+ editor === null || editor === void 0 ? void 0 : editor.commands.clearContent();
453
+ editor === null || editor === void 0 ? void 0 : editor.commands.insertContent(proxyModelValue.value);
450
454
  } else {
451
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getHTML()));
455
+ editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getText()));
452
456
  }
453
457
  break;
454
458
  case 'bulletList':
@@ -583,8 +587,8 @@ var script = defineComponent({
583
587
  editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
584
588
  }
585
589
  if (props.format === 'markdown' && value !== markdownOutput.value) {
586
- const deserialized = deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value);
587
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialized);
590
+ // const deserialized = deserialize(editor?.schema, value);
591
+ editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
588
592
  }
589
593
  });
590
594
  return {
@@ -108,7 +108,7 @@ export { p as PropsV3, a as useQueueV3, u as useToastV3 } from '../useToast-a133
108
108
  export { s as OrTooltip } from '../OrTooltip-89ce98e8.js';
109
109
  export { s as OrTooltipContent } from '../OrTooltipContent-37a5f562.js';
110
110
  export { s as OrTooltipV3 } from '../OrTooltip-4bb0054a.js';
111
- export { s as OrRichTextEditorV3 } from '../OrRichTextEditor-592db26c.js';
111
+ export { s as OrRichTextEditorV3 } from '../OrRichTextEditor-69cf03de.js';
112
112
  import 'vue-demi';
113
113
  import 'lodash';
114
114
  import 'vue';
@@ -1,4 +1,4 @@
1
- export { s as OrRichTextEditorV3 } from '../../OrRichTextEditor-592db26c.js';
1
+ export { s as OrRichTextEditorV3 } from '../../OrRichTextEditor-69cf03de.js';
2
2
  import 'vue-demi';
3
3
  import '@vueuse/integrations/useFocusTrap';
4
4
  import '@vueuse/core';
@@ -108,7 +108,7 @@ export { p as PropsV3, a as useQueueV3, u as useToastV3 } from './useToast-a1332
108
108
  export { s as OrTooltip } from './OrTooltip-89ce98e8.js';
109
109
  export { s as OrTooltipContent } from './OrTooltipContent-37a5f562.js';
110
110
  export { s as OrTooltipV3 } from './OrTooltip-4bb0054a.js';
111
- export { s as OrRichTextEditorV3 } from './OrRichTextEditor-592db26c.js';
111
+ export { s as OrRichTextEditorV3 } from './OrRichTextEditor-69cf03de.js';
112
112
  export { D as DropdownClose, a as DropdownOpen } from './dropdown-open-e1f90e0a.js';
113
113
  export { u as useControlAttributes, a as useIdAttribute } from './useIdAttribute-859439f0.js';
114
114
  export { u as useElevation } from './useElevation-b5a49746.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/ui-components",
3
- "version": "4.4.0-beta.2678.0",
3
+ "version": "4.4.0-beta.2679.0",
4
4
  "description": "Vue components library for v2/3",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/auto/index.js",
@@ -38,7 +38,7 @@
38
38
  "@codemirror/lang-json": "6.0.0",
39
39
  "@codemirror/lang-markdown": "6.0.1",
40
40
  "@floating-ui/dom": "0.3.1",
41
- "@onereach/styles": "^2.39.4-beta.2678.0",
41
+ "@onereach/styles": "^2.39.4-beta.2679.0",
42
42
  "@splidejs/splide": "4.0.6",
43
43
  "@tiptap/core": "2.0.2",
44
44
  "@tiptap/extension-blockquote": "2.0.2",
@@ -131,16 +131,8 @@ Markdown.args = {
131
131
  placeholder: 'Write something...',
132
132
  format: 'markdown',
133
133
  modelValue: `
134
- export async function beforeSaveFlow() {}
135
-
136
- export async function beforeActivateFlow() {}
137
-
138
- export async function flowDeactivated() {}
139
-
140
- export async function flowDeleted() {}
141
-
142
- export async function stepAddedToCanvas() {}
143
-
144
- export async function stepRemovedFromCanvas() {}
134
+ **export** async function beforeSaveFlow() {}
135
+ _export_ async function beforeActivateFlow() {}
136
+ ~export~ async function flowDeactivated() {}
145
137
  `,
146
138
  };
@@ -341,6 +341,8 @@ export default defineComponent({
341
341
  },
342
342
  element: editorRef.value,
343
343
  autofocus: props.autofocus,
344
+ enableInputRules: true,
345
+ enablePasteRules: true,
344
346
  extensions: [
345
347
  codemirrorNode,
346
348
  StarterKit.configure({
@@ -382,6 +384,9 @@ export default defineComponent({
382
384
  class: 'focus:outline-none',
383
385
  },
384
386
  },
387
+ parseOptions: {
388
+ preserveWhitespace: true,
389
+ },
385
390
  });
386
391
  setActiveFormats();
387
392
  trap.activate();
@@ -455,19 +460,12 @@ export default defineComponent({
455
460
  switch (item) {
456
461
  case 'source':
457
462
  disableMarkdown.value = !disableMarkdown.value;
458
- editor?.setOptions({
459
- enableInputRules: !disableMarkdown.value,
460
- enablePasteRules: !disableMarkdown.value,
461
- });
462
-
463
- editor?.view.updateState(editor?.state.reconfigure({
464
- plugins: editor.extensionManager.plugins,
465
- }));
466
463
 
467
464
  if (disableMarkdown.value) {
468
- editor?.commands.setContent(serialize(editor?.schema, editor?.getJSON()));
465
+ editor?.commands.clearContent();
466
+ editor?.commands.insertContent(proxyModelValue.value as string);
469
467
  } else {
470
- editor?.commands.setContent(deserialize(editor?.schema, editor?.getHTML()));
468
+ editor?.commands.setContent(deserialize(editor?.schema, editor?.getText()));
471
469
  }
472
470
  break;
473
471
  case 'bulletList':
@@ -628,8 +626,8 @@ export default defineComponent({
628
626
  editor?.commands.setContent(value as string);
629
627
  }
630
628
  if (props.format === 'markdown' && value !== markdownOutput.value) {
631
- const deserialized = deserialize(editor?.schema, value);
632
- editor?.commands.setContent(deserialized);
629
+ // const deserialized = deserialize(editor?.schema, value);
630
+ editor?.commands.setContent(value as string);
633
631
  }
634
632
  });
635
633
 
@@ -94,13 +94,16 @@ const serialize = (schema: any, content: any) => {
94
94
  serializerMarks,
95
95
  );
96
96
 
97
- return serializer.serialize(proseMirrorDocument);
97
+ return serializer.serialize(proseMirrorDocument, { tightLists: true });
98
98
  };
99
99
 
100
100
  const deserialize = (schema: any, content: any) => {
101
101
  if (!content) return null;
102
102
 
103
- const html = marked.parse(content);
103
+ const html = marked(content, {
104
+ gfm: true,
105
+ breaks: true,
106
+ });
104
107
 
105
108
  if (!html) return null;
106
109