@onereach/ui-components 2.68.0-beta.2001.0 → 2.68.0-beta.2002.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 (28) hide show
  1. package/dist/bundled/v2/OrRichTextEditor-898d67d5.js +36828 -0
  2. package/dist/bundled/v2/components/index.d.ts +1 -0
  3. package/dist/bundled/v2/components/index.js +2 -0
  4. package/dist/bundled/v2/components/or-rich-text-editor-v3/index.d.ts +1 -1
  5. package/dist/bundled/v2/components/or-rich-text-editor-v3/index.js +11 -36827
  6. package/dist/bundled/v2/index.js +2 -0
  7. package/dist/bundled/v3/OrRichTextEditor.vue_vue_type_script_lang-2e607f79.js +36708 -0
  8. package/dist/bundled/v3/components/index.d.ts +1 -0
  9. package/dist/bundled/v3/components/index.js +2 -0
  10. package/dist/bundled/v3/components/or-rich-text-editor-v3/index.d.ts +1 -1
  11. package/dist/bundled/v3/components/or-rich-text-editor-v3/index.js +12 -36798
  12. package/dist/bundled/v3/index.js +267 -174
  13. package/dist/esm/v2/OrRichTextEditor-6bc37dc4.js +516 -0
  14. package/dist/esm/v2/components/index.d.ts +1 -0
  15. package/dist/esm/v2/components/index.js +19 -0
  16. package/dist/esm/v2/components/or-rich-text-editor-v3/index.d.ts +1 -1
  17. package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +28 -514
  18. package/dist/esm/v2/index.js +19 -0
  19. package/dist/esm/v3/OrRichTextEditor-a5d38e89.js +486 -0
  20. package/dist/esm/v3/components/index.d.ts +1 -0
  21. package/dist/esm/v3/components/index.js +19 -0
  22. package/dist/esm/v3/components/or-rich-text-editor-v3/index.d.ts +1 -1
  23. package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +28 -484
  24. package/dist/esm/v3/index.js +19 -0
  25. package/package.json +1 -1
  26. package/src/components/index.ts +1 -0
  27. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +8 -8
  28. package/src/components/or-rich-text-editor-v3/index.ts +1 -1
@@ -1,493 +1,37 @@
1
- import { defineComponent, ref, onMounted, onBeforeUnmount, computed, watch } from 'vue-demi';
2
- import { u as useClassAttribute } from '../../useClassAttribute-47fdb016.js';
1
+ export { s as OrRichTextEditorV3 } from '../../OrRichTextEditor-a5d38e89.js';
2
+ import 'vue-demi';
3
+ import '../../useClassAttribute-47fdb016.js';
3
4
  import '@vueuse/core';
4
- import { defaultMarkdownSerializer, MarkdownSerializer } from 'prosemirror-markdown';
5
- import { DOMParser as DOMParser$1 } from 'prosemirror-model';
6
- import { marked } from 'marked';
7
- import { s as script$1 } from '../../OrIconButton-85abafab.js';
8
- import { s as script$2 } from '../../OrLabel-7d4fe80b.js';
9
- import { s as script$4 } from '../../OrMenu-d9e12030.js';
10
- import '../../OrPopover-94a8f21d.js';
11
- import { s as script$3 } from '../../OrMenuItem-d001f0f6.js';
12
- import { Editor, mergeAttributes } from '@tiptap/core';
13
- import StarterKit from '@tiptap/starter-kit';
14
- import Underline from '@tiptap/extension-underline';
15
- import Link from '@tiptap/extension-link';
16
- import Highlight from '@tiptap/extension-highlight';
17
- import Heading from '@tiptap/extension-heading';
18
- import Placeholder from '@tiptap/extension-placeholder';
19
- import Paragraph from '@tiptap/extension-paragraph';
20
- import BulletList from '@tiptap/extension-bullet-list';
21
- import ListItem from '@tiptap/extension-list-item';
22
- import OrderedList from '@tiptap/extension-ordered-list';
23
- import Strike from '@tiptap/extension-strike';
24
- import Italic from '@tiptap/extension-italic';
25
- import Bold from '@tiptap/extension-bold';
26
- import { resolveComponent, openBlock, createElementBlock, mergeProps, createVNode, withCtx, createTextVNode, toDisplayString, createElementVNode, normalizeClass, Fragment, renderList, createBlock, createCommentVNode } from 'vue';
27
- import { s as styleInject } from '../../style-inject.es-4c6f2515.js';
5
+ import 'prosemirror-markdown';
6
+ import 'prosemirror-model';
7
+ import 'marked';
8
+ import '../../OrIconButton-85abafab.js';
28
9
  import '../../OrIcon-e2fa4cf8.js';
10
+ import 'vue';
29
11
  import '../../OrTooltip-1500a1cd.js';
12
+ import '../../OrPopover-94a8f21d.js';
30
13
  import '@floating-ui/dom';
31
14
  import '../../useElevation-31bfe1f6.js';
32
15
  import '../../useResponsive-a02e95b7.js';
33
16
  import '../../OrBottomSheet-0eb33b18.js';
34
17
  import '../../OrOverlay-738a44d5.js';
35
18
  import '../../OrTeleport.vue3-8099178c.js';
36
-
37
- const EditorContainer = [
38
- // Colors
39
- 'border-outline', 'dark:border-outline-dark', 'focus-within:theme-border-1-primary', 'dark:focus-within:theme-border-1-primary-dark', 'focus-within:bg-primary-opacity-0-08', 'dark:focus-within:bg-primary-opacity-0-08-dark', 'focus-within:theme-outline-primary', 'dark:focus-within:theme-outline-primary-dark',
40
- // Sizing
41
- 'border-1', 'rounded-md'];
42
- const ToolbarContainer = [
43
- // Layout
44
- 'flex',
45
- //Spacing
46
- 'py-sm',
47
- //Sizing
48
- 'border-b-1',
49
- //Colors
50
- 'border-b-outline', 'dark:border-b-outline-dark'];
51
- const Toolbar = [
52
- // Layout
53
- 'flex',
54
- // Spacing
55
- 'px-sm', 'gap-md',
56
- // Sizing
57
- 'border-r-1',
58
- //Colors
59
- 'border-r-disabled', 'dark:border-r-outline-dark',
60
- // Last child
61
- 'last-of-type:border-none'];
62
- const ToolbarButton = [
63
- // Typography
64
- 'text-on-disabled', 'dark:text-outline-dark'];
65
- const ToolbarButtonActive = [
66
- // Typography
67
- 'text-on-background', 'dark:text-on-background-dark'];
68
- const EditorInput = [
69
- // Spacing
70
- 'p-sm',
71
- // Typography
72
- 'typography-body-2-regular', 'text-on-background', 'dark:text-on-background-dark',
73
- // Sizing
74
- 'min-h-[88px]'];
75
-
76
- var script = defineComponent({
77
- name: 'OrRichTextEditor',
78
- components: {
79
- OrIconButton: script$1,
80
- OrLabel: script$2,
81
- OrMenuItem: script$3,
82
- OrMenu: script$4
83
- },
84
- inheritAttrs: false,
85
- props: {
86
- modelValue: {
87
- type: String,
88
- default: '',
89
- required: false
90
- },
91
- toolbar: {
92
- type: Array,
93
- default: () => [['heading'], ['bold', 'italic', 'strike'], ['underline', 'highlight'], ['link'], ['bulletList', 'orderedList'], ['undo', 'redo']]
94
- },
95
- description: {
96
- type: String,
97
- default: 'Description'
98
- },
99
- placeholder: {
100
- type: String,
101
- default: 'Write something...'
102
- },
103
- autofocus: {
104
- type: Boolean,
105
- default: false
106
- },
107
- markdown: {
108
- type: Boolean,
109
- default: true
110
- }
111
- },
112
- emits: ['update:modelValue'],
113
- setup(props, {
114
- emit
115
- }) {
116
- // Refs
117
- let editor = null;
118
- const editorRef = ref();
119
- const containerRef = ref();
120
- const toolbarButtonRef = ref();
121
- const menuRef = ref();
122
- const isActive = ref({});
123
- const headingLevels = [1, 2, 3, 4];
124
- const previousHeadingLevel = ref();
125
- const activeHeadingLevel = ref(0);
126
- const markdownOutput = ref('');
127
- const iconsEnum = ref({
128
- bold: 'format_bold',
129
- italic: 'format_italic',
130
- underline: 'format_underlined',
131
- strike: 'format_strikethrough',
132
- bulletList: 'format_list_bulleted',
133
- orderedList: 'format_list_numbered',
134
- link: 'link',
135
- highlight: 'highlight',
136
- redo: 'redo',
137
- undo: 'undo'
138
- });
139
- const iconTooltipsEnum = ref({
140
- bold: 'Bold',
141
- italic: 'Italic',
142
- underline: 'Underline',
143
- strike: 'Strike',
144
- bulletList: 'Bulleted List',
145
- orderedList: 'Numbered List',
146
- link: 'Link',
147
- highlight: 'Highlight',
148
- redo: 'Redo',
149
- undo: 'Undo'
150
- });
151
- const serializerMarks = {
152
- ...defaultMarkdownSerializer.marks,
153
- [Bold.name]: defaultMarkdownSerializer.marks.strong,
154
- [Strike.name]: {
155
- open: '~~',
156
- close: '~~',
157
- mixable: true,
158
- expelEnclosingWhitespace: true
159
- },
160
- [Italic.name]: {
161
- open: '_',
162
- close: '_',
163
- mixable: true,
164
- expelEnclosingWhitespace: true
165
- },
166
- [Highlight.name]: {
167
- open: '==',
168
- close: '==',
169
- mixable: true,
170
- expelEnclosingWhitespace: true
171
- },
172
- [Link.name]: {
173
- open(state, mark, parent, index) {
174
- return isPlainURL(mark, parent, index, 1) ? '<' : '[';
175
- },
176
- close(state, mark, parent, index) {
177
- const href = mark.attrs.canonicalSrc || mark.attrs.href;
178
- return isPlainURL(mark, parent, index, -1) ? '>' : `](${state.esc(href)}${mark.attrs.title ? ` ${state.quote(mark.attrs.title)}` : ''})`;
179
- }
180
- }
181
- };
182
- const serializerNodes = {
183
- ...defaultMarkdownSerializer.nodes,
184
- [Paragraph.name]: defaultMarkdownSerializer.nodes.paragraph,
185
- [BulletList.name]: defaultMarkdownSerializer.nodes.bullet_list,
186
- [ListItem.name]: defaultMarkdownSerializer.nodes.list_item,
187
- [OrderedList.name]: defaultMarkdownSerializer.nodes.ordered_list
188
- // [HardBreak.name]: //TODO: add hard break
189
- };
190
-
191
- onMounted(() => {
192
- editor = new Editor({
193
- onUpdate: ({
194
- editor
195
- }) => {
196
- setActiveFormats();
197
- const html = editor.getHTML();
198
- const text = editor.getText();
199
- if (props.markdown) {
200
- const markdown = markdownOutput.value = serialize(editor.schema, editor.getJSON());
201
- emit('update:modelValue', markdown);
202
- } else {
203
- emit('update:modelValue', text === '' ? text : html);
204
- }
205
- },
206
- onCreate: ({
207
- editor
208
- }) => {
209
- if (props.markdown) {
210
- const deserialized = deserialize(editor.schema, props.modelValue);
211
- editor.commands.setContent(deserialized);
212
- } else {
213
- editor.commands.setContent(props.modelValue);
214
- }
215
- },
216
- element: editorRef.value,
217
- autofocus: props.autofocus,
218
- extensions: [StarterKit.configure({
219
- heading: false
220
- }), Heading.configure({
221
- levels: headingLevels
222
- }).extend({
223
- levels: headingLevels,
224
- renderHTML({
225
- node,
226
- HTMLAttributes
227
- }) {
228
- return ['h' + node.attrs.level, mergeAttributes(HTMLAttributes, {
229
- class: `typography-headline-${node.attrs.level}`
230
- }), 0];
231
- }
232
- }), Underline, Link.configure({
233
- openOnClick: true,
234
- linkOnPaste: true,
235
- autolink: false,
236
- protocols: ['ftp', 'mailto', 'http', 'https'],
237
- validate: href => /^https?:\/\//.test(href),
238
- HTMLAttributes: {
239
- class: 'text-primary cursor-pointer'
240
- }
241
- }), Highlight, Placeholder.configure({
242
- placeholder: props.placeholder,
243
- emptyEditorClass: 'is-editor-empty text-outline'
244
- })],
245
- editorProps: {
246
- attributes: {
247
- class: 'focus:outline-none'
248
- }
249
- }
250
- });
251
- setActiveFormats();
252
- });
253
- onBeforeUnmount(() => {
254
- editor === null || editor === void 0 ? void 0 : editor.destroy();
255
- });
256
- // Computed
257
- const getIndexOfHeading = computed(() => {
258
- return props.toolbar.flat().indexOf('heading');
259
- });
260
- const headingIcon = computed(() => {
261
- if (activeHeadingLevel.value && isActive.value.heading) {
262
- return `format_h${activeHeadingLevel.value}`;
263
- }
264
- return 'format_paragraph';
265
- });
266
- // Methods
267
- const handleEditorClick = () => {
268
- setActiveFormats();
269
- editor === null || editor === void 0 ? void 0 : editor.commands.focus();
270
- };
271
- const handleToolbarClick = (item, level) => {
272
- if (item === 'bulletList' || item === 'orderedList') {
273
- item === 'bulletList' ? editor === null || editor === void 0 ? void 0 : editor.commands.toggleBulletList() : editor === null || editor === void 0 ? void 0 : editor.commands.toggleOrderedList();
274
- } else if (item === 'link') {
275
- setLink();
276
- } else if (item === 'heading') {
277
- if (!level) {
278
- editor === null || editor === void 0 ? void 0 : editor.commands.toggleHeading({
279
- level: previousHeadingLevel.value
280
- });
281
- activeHeadingLevel.value = 0;
282
- } else {
283
- activeHeadingLevel.value = level;
284
- previousHeadingLevel.value = level;
285
- editor === null || editor === void 0 ? void 0 : editor.commands.toggleHeading({
286
- level: level
287
- });
288
- }
289
- editor === null || editor === void 0 ? void 0 : editor.commands.focus();
290
- } else if (item === 'undo' || item === 'redo') {
291
- item === 'undo' ? editor === null || editor === void 0 ? void 0 : editor.commands.undo() : editor === null || editor === void 0 ? void 0 : editor.commands.redo();
292
- } else {
293
- editor === null || editor === void 0 ? void 0 : editor.chain().focus().toggleMark(item).run();
294
- }
295
- };
296
- const setLink = () => {
297
- const previousUrl = editor === null || editor === void 0 ? void 0 : editor.getAttributes('link').href;
298
- const url = window.prompt('URL', previousUrl);
299
- // cancelled
300
- if (url === null) {
301
- return;
302
- }
303
- // empty
304
- if (url === '') {
305
- editor === null || editor === void 0 ? void 0 : editor.chain().focus().extendMarkRange('link').unsetLink().run();
306
- return;
307
- }
308
- // update link
309
- editor === null || editor === void 0 ? void 0 : editor.chain().focus().extendMarkRange('link').setLink({
310
- href: url
311
- }).run();
312
- };
313
- const setActiveFormats = () => {
314
- const toolbarList = props.toolbar.flat();
315
- toolbarList.forEach(item => {
316
- isActive.value[item] = (editor === null || editor === void 0 ? void 0 : editor.isActive(item)) || false;
317
- });
318
- };
319
- // Styles
320
- const classAttribute = useClassAttribute();
321
- const rootStyles = computed(() => {
322
- return ['or-rich-text-editor', classAttribute.value];
323
- });
324
- const containerStyles = computed(() => {
325
- return [...EditorContainer];
326
- });
327
- const toolbarContainerStyles = computed(() => {
328
- return [...ToolbarContainer];
329
- });
330
- const toolbarStyles = computed(() => {
331
- return [...Toolbar];
332
- });
333
- const editorInputStyles = computed(() => {
334
- return ['tiptap-editor', ...EditorInput];
335
- });
336
- const toolbarButtonStyles = item => {
337
- return [
338
- // Layout
339
- 'flex',
340
- // Spacing
341
- 'gap-md', ...(isActive.value[item] ? ToolbarButtonActive : ToolbarButton)];
342
- };
343
- const isPlainURL = (link, parent, index, side) => {
344
- if (link.attrs.title || !/^\w+:/.test(link.attrs.href)) return false;
345
- const content = parent.child(index + (side < 0 ? -1 : 0));
346
- if (!content.isText || content.text !== link.attrs.href || content.marks[content.marks.length - 1] !== link) return false;
347
- if (index === (side < 0 ? 1 : parent.childCount - 1)) return true;
348
- const next = parent.child(index + (side < 0 ? -2 : 1));
349
- return !link.isInSet(next.marks);
350
- };
351
- const serialize = (schema, content) => {
352
- const proseMirrorDocument = schema.nodeFromJSON(content);
353
- const serializer = new MarkdownSerializer(serializerNodes, serializerMarks);
354
- return serializer.serialize(proseMirrorDocument, {
355
- tightLists: true
356
- });
357
- };
358
- const deserialize = (schema, content) => {
359
- const html = marked.parse(content);
360
- if (!html) return null;
361
- const parser = new DOMParser();
362
- const {
363
- body
364
- } = parser.parseFromString(html, 'text/html');
365
- // append original source as a comment that nodes can access
366
- body.append(document.createComment(content));
367
- const state = DOMParser$1.fromSchema(schema).parse(body);
368
- return state.toJSON();
369
- };
370
- //Effects
371
- watch(() => props.modelValue, value => {
372
- if (value !== (editor === null || editor === void 0 ? void 0 : editor.getHTML()) && !props.markdown) {
373
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
374
- }
375
- if (props.markdown && value !== markdownOutput.value) {
376
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(markdownOutput.value);
377
- }
378
- });
379
- return {
380
- editor,
381
- editorRef,
382
- containerRef,
383
- toolbarButtonRef,
384
- menuRef,
385
- iconsEnum,
386
- handleToolbarClick,
387
- handleEditorClick,
388
- isActive,
389
- iconTooltipsEnum,
390
- containerStyles,
391
- toolbarContainerStyles,
392
- toolbarStyles,
393
- rootStyles,
394
- toolbarButtonStyles,
395
- editorInputStyles,
396
- getIndexOfHeading,
397
- headingLevels,
398
- headingIcon
399
- };
400
- }
401
- });
402
-
403
- function render(_ctx, _cache, $props, $setup, $data, $options) {
404
- const _component_or_label = resolveComponent("or-label");
405
- const _component_or_icon_button = resolveComponent("or-icon-button");
406
- const _component_or_menu_item = resolveComponent("or-menu-item");
407
- const _component_or_menu = resolveComponent("or-menu");
408
- return openBlock(), createElementBlock("div", mergeProps({
409
- ref: "root"
410
- }, _ctx.$attrs, {
411
- class: _ctx.rootStyles
412
- }), [createVNode(_component_or_label, null, {
413
- default: withCtx(() => [createTextVNode(toDisplayString(_ctx.description), 1 /* TEXT */)]),
414
-
415
- _: 1 /* STABLE */
416
- }), createElementVNode("div", {
417
- ref: "containerRef",
418
- class: normalizeClass(_ctx.containerStyles),
419
- onClick: _cache[1] || (_cache[1] = $event => _ctx.handleEditorClick())
420
- }, [createElementVNode("div", {
421
- class: normalizeClass(_ctx.toolbarContainerStyles)
422
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.toolbar, tool => {
423
- return openBlock(), createElementBlock("div", {
424
- key: tool,
425
- class: normalizeClass(_ctx.toolbarStyles)
426
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(tool, item => {
427
- return openBlock(), createElementBlock("div", {
428
- key: item,
429
- class: normalizeClass([_ctx.toolbarButtonStyles(item), "-my-xs"])
430
- }, [item === 'heading' ? (openBlock(), createBlock(_component_or_icon_button, {
431
- key: 0,
432
- ref_for: true,
433
- ref: "toolbarButtonRef",
434
- tooltip: {
435
- text: item,
436
- placement: 'top'
437
- },
438
- icon: {
439
- icon: _ctx.headingIcon,
440
- variant: 'inherit',
441
- size: 'm'
442
- },
443
- onClick: _cache[0] || (_cache[0] = $event => _ctx.menuRef.open())
444
- }, null, 8 /* PROPS */, ["tooltip", "icon"])) : (openBlock(), createBlock(_component_or_icon_button, {
445
- key: 1,
446
- tooltip: {
447
- text: _ctx.iconTooltipsEnum[item],
448
- placement: 'top'
449
- },
450
- icon: {
451
- icon: _ctx.iconsEnum[item],
452
- variant: 'inherit',
453
- size: 'm'
454
- },
455
- onClick: $event => _ctx.handleToolbarClick(item)
456
- }, null, 8 /* PROPS */, ["tooltip", "icon", "onClick"]))], 2 /* CLASS */);
457
- }), 128 /* KEYED_FRAGMENT */))], 2 /* CLASS */);
458
- }), 128 /* KEYED_FRAGMENT */))], 2 /* CLASS */), createElementVNode("div", {
459
- ref: "editorRef",
460
- class: normalizeClass(_ctx.editorInputStyles)
461
- }, null, 2 /* CLASS */)], 2 /* CLASS */), _ctx.toolbarButtonRef ? (openBlock(), createBlock(_component_or_menu, {
462
- key: 0,
463
- ref: "menuRef",
464
- trigger: _ctx.toolbarButtonRef[_ctx.getIndexOfHeading].root,
465
- placement: "bottom-start"
466
- }, {
467
- default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.headingLevels, heading => {
468
- return openBlock(), createBlock(_component_or_menu_item, {
469
- key: heading,
470
- onClick: $event => _ctx.handleToolbarClick('heading', heading)
471
- }, {
472
- default: withCtx(() => [createTextVNode(" Heading " + toDisplayString(heading), 1 /* TEXT */)]),
473
-
474
- _: 2 /* DYNAMIC */
475
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onClick"]);
476
- }), 128 /* KEYED_FRAGMENT */)), createVNode(_component_or_menu_item, {
477
- onClick: _cache[2] || (_cache[2] = $event => _ctx.handleToolbarClick('heading'))
478
- }, {
479
- default: withCtx(() => [createTextVNode(" None ")]),
480
- _: 1 /* STABLE */
481
- })]),
482
-
483
- _: 1 /* STABLE */
484
- }, 8 /* PROPS */, ["trigger"])) : createCommentVNode("v-if", true)], 16 /* FULL_PROPS */);
485
- }
486
-
487
- var css_248z = ".tiptap-editor ol {\n margin: 0 24px;\n list-style: decimal;\n}\n.tiptap-editor ul {\n margin: 0 24px;\n list-style: initial;\n}\n.tiptap-editor .is-editor-empty::before {\n content: attr(data-placeholder);\n height: 0;\n pointer-events: none;\n float: left;\n}";
488
- styleInject(css_248z);
489
-
490
- script.render = render;
491
- script.__file = "src/components/or-rich-text-editor-v3/OrRichTextEditor.vue";
492
-
493
- export { script as OrRichTextEditor };
19
+ import '../../OrLabel-7d4fe80b.js';
20
+ import '../../OrMenu-d9e12030.js';
21
+ import '../../OrMenuItem-d001f0f6.js';
22
+ import '@tiptap/core';
23
+ import '@tiptap/starter-kit';
24
+ import '@tiptap/extension-underline';
25
+ import '@tiptap/extension-link';
26
+ import '@tiptap/extension-highlight';
27
+ import '@tiptap/extension-heading';
28
+ import '@tiptap/extension-placeholder';
29
+ import '@tiptap/extension-paragraph';
30
+ import '@tiptap/extension-bullet-list';
31
+ import '@tiptap/extension-list-item';
32
+ import '@tiptap/extension-ordered-list';
33
+ import '@tiptap/extension-strike';
34
+ import '@tiptap/extension-italic';
35
+ import '@tiptap/extension-hard-break';
36
+ import '@tiptap/extension-bold';
37
+ import '../../style-inject.es-4c6f2515.js';
@@ -89,6 +89,7 @@ export { a as OrToastContainerV3, s as OrToastV3, t as TypesV3 } from './types-9
89
89
  export { p as PropsV3, a as useQueueV3, u as useToastV3 } from './useToast-0665462d.js';
90
90
  export { s as OrTooltip, a as OrTooltipContent } from './OrTooltip-78cd7f6b.js';
91
91
  export { s as OrTooltipV3 } from './OrTooltip-1500a1cd.js';
92
+ export { s as OrRichTextEditorV3 } from './OrRichTextEditor-a5d38e89.js';
92
93
  export { D as DropdownClose, a as DropdownOpen } from './dropdown-open-0d314aa4.js';
93
94
  export { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
94
95
  export { u as useElevation } from './useElevation-31bfe1f6.js';
@@ -116,6 +117,24 @@ import '@floating-ui/dom';
116
117
  import 'uuid';
117
118
  import 'sortablejs';
118
119
  import '@vueuse/integrations/useFocusTrap';
120
+ import 'prosemirror-markdown';
121
+ import 'prosemirror-model';
122
+ import 'marked';
123
+ import '@tiptap/core';
124
+ import '@tiptap/starter-kit';
125
+ import '@tiptap/extension-underline';
126
+ import '@tiptap/extension-link';
127
+ import '@tiptap/extension-highlight';
128
+ import '@tiptap/extension-heading';
129
+ import '@tiptap/extension-placeholder';
130
+ import '@tiptap/extension-paragraph';
131
+ import '@tiptap/extension-bullet-list';
132
+ import '@tiptap/extension-list-item';
133
+ import '@tiptap/extension-ordered-list';
134
+ import '@tiptap/extension-strike';
135
+ import '@tiptap/extension-italic';
136
+ import '@tiptap/extension-hard-break';
137
+ import '@tiptap/extension-bold';
119
138
 
120
139
  function getAbbreviation(text, limit) {
121
140
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/ui-components",
3
- "version": "2.68.0-beta.2001.0",
3
+ "version": "2.68.0-beta.2002.0",
4
4
  "description": "Vue components library for v2/3",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/auto/index.js",
@@ -87,3 +87,4 @@ export * from './or-toast';
87
87
  export * from './or-toast-v3';
88
88
  export * from './or-tooltip';
89
89
  export * from './or-tooltip-v3';
90
+ export * from './or-rich-text-editor-v3';
@@ -102,7 +102,7 @@ import ListItem from '@tiptap/extension-list-item';
102
102
  import OrderedList from '@tiptap/extension-ordered-list';
103
103
  import Strike from '@tiptap/extension-strike';
104
104
  import Italic from '@tiptap/extension-italic';
105
- // import HardBreak from '@tiptap/extension-hard-break';
105
+ import HardBreak from '@tiptap/extension-hard-break';
106
106
  import Bold from '@tiptap/extension-bold';
107
107
 
108
108
  export default defineComponent({
@@ -229,7 +229,7 @@ export default defineComponent({
229
229
  [BulletList.name]: defaultMarkdownSerializer.nodes.bullet_list,
230
230
  [ListItem.name]: defaultMarkdownSerializer.nodes.list_item,
231
231
  [OrderedList.name]: defaultMarkdownSerializer.nodes.ordered_list,
232
- // [HardBreak.name]: //TODO: add hard break
232
+ [HardBreak.name]: defaultMarkdownSerializer.nodes.hard_break,
233
233
  };
234
234
 
235
235
  onMounted(() => {
@@ -239,8 +239,8 @@ export default defineComponent({
239
239
  const html = editor.getHTML();
240
240
  const text = editor.getText();
241
241
  if (props.markdown) {
242
- const markdown = markdownOutput.value = serialize(editor.schema, editor.getJSON());
243
- emit('update:modelValue', markdown);
242
+ markdownOutput.value = serialize(editor.schema, editor.getJSON());
243
+ emit('update:modelValue', markdownOutput.value);
244
244
  } else {
245
245
  emit('update:modelValue', text === '' ? text : html);
246
246
  }
@@ -248,6 +248,8 @@ export default defineComponent({
248
248
  onCreate: ({ editor }) => {
249
249
  if (props.markdown) {
250
250
  const deserialized = deserialize(editor.schema, props.modelValue);
251
+ // const deserialized = defaultMarkdownParser.parse(props.modelValue);
252
+ // editor.view.state.doc = deserialized as Node;
251
253
  editor.commands.setContent(deserialized);
252
254
  } else {
253
255
  editor.commands.setContent(props.modelValue);
@@ -442,12 +444,11 @@ export default defineComponent({
442
444
  serializerMarks,
443
445
  );
444
446
 
445
- return serializer.serialize(proseMirrorDocument, {
446
- tightLists: true,
447
- });
447
+ return serializer.serialize(proseMirrorDocument);
448
448
  };
449
449
 
450
450
  const deserialize = (schema: any, content: any) => {
451
+ // const html = defaultMarkdownParser.parse(content);
451
452
  const html = marked.parse(content);
452
453
 
453
454
  if (!html) return null;
@@ -459,7 +460,6 @@ export default defineComponent({
459
460
  body.append(document.createComment(content));
460
461
 
461
462
  const state = ProseMirrorDOMParser.fromSchema(schema).parse(body);
462
-
463
463
  return state.toJSON();
464
464
  };
465
465
 
@@ -1 +1 @@
1
- export { default as OrRichTextEditor } from './OrRichTextEditor.vue';
1
+ export { default as OrRichTextEditorV3 } from './OrRichTextEditor.vue';