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