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