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