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