@onereach/ui-components 4.0.2 → 4.1.0-beta.2508.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/components/OrCode/OrCode.js +6 -3727
- package/dist/bundled/v2/components/OrCode/index.js +6 -2
- package/dist/bundled/v2/components/OrCode/lang.js +3898 -3
- package/dist/bundled/v2/components/OrCode/theme.js +3 -1
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +2033 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +181 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/index.d.ts +1 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/index.js +67 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.d.ts +7 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.js +43 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +45 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +183 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +1 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.js +4 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +19 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.js +1 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.d.ts +3 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.js +5 -0
- package/dist/bundled/v2/components/index.d.ts +1 -0
- package/dist/bundled/v2/components/index.js +14 -2
- package/dist/bundled/v2/index-62c3221b.js +6956 -0
- package/dist/bundled/v2/index-62e39ec2.js +4534 -0
- package/dist/bundled/{v3/OrCode.vue_vue_type_script_lang-c5a9adb7.js → v2/index-92e69736.js} +15 -234
- package/dist/bundled/v2/{index-6976c52a.js → index-c76372bb.js} +16 -4659
- package/dist/bundled/{v3/lang-02d2bb2d.js → v2/index-db5e8c99.js} +74 -3965
- package/dist/bundled/v2/index.es-3f39f316.js +115 -0
- package/dist/bundled/v2/index.js +17 -5
- package/dist/bundled/v2/markdown-00716a39.js +18683 -0
- package/dist/bundled/v2/tiptap-core.esm-f85402b1.js +9360 -0
- package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-0c5e41b0.js +236 -0
- package/dist/bundled/v3/OrRichTextEditor.vue_vue_type_script_lang-33b56bd6.js +1815 -0
- package/dist/bundled/v3/components/OrCode/OrCode.js +9 -5
- package/dist/bundled/v3/components/OrCode/index.js +7 -3
- package/dist/bundled/v3/components/OrCode/lang.js +3898 -3
- package/dist/bundled/v3/components/OrCode/theme.js +3 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +219 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +181 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.d.ts +1 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +83 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.d.ts +7 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +43 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +45 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +183 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +1 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +4 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +19 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.js +1 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.d.ts +3 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +5 -0
- package/dist/bundled/v3/components/index.d.ts +1 -0
- package/dist/bundled/v3/components/index.js +16 -3
- package/dist/bundled/v3/index-62c3221b.js +6956 -0
- package/dist/bundled/v3/index-62e39ec2.js +4534 -0
- package/dist/bundled/v3/index-92e69736.js +3741 -0
- package/dist/bundled/v3/{index-6976c52a.js → index-c76372bb.js} +16 -4659
- package/dist/bundled/{v2/lang-02d2bb2d.js → v3/index-db5e8c99.js} +74 -3965
- package/dist/bundled/v3/index.es-3f39f316.js +115 -0
- package/dist/bundled/v3/index.js +20 -7
- package/dist/bundled/v3/markdown-00716a39.js +18683 -0
- package/dist/bundled/v3/tiptap-core.esm-f85402b1.js +9360 -0
- package/dist/esm/v2/OrRichTextEditor-45fb1867.js +718 -0
- package/dist/esm/v2/codemirrorView-2e87c938.js +184 -0
- package/dist/esm/v2/components/index.d.ts +1 -0
- package/dist/esm/v2/components/index.js +24 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +181 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.d.ts +1 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +56 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/styles.d.ts +7 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.js +5 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/markdown.d.ts +3 -0
- package/dist/esm/v2/index.js +24 -0
- package/dist/esm/v3/OrRichTextEditor-4c0b6030.js +680 -0
- package/dist/esm/v3/codemirrorView-2e87c938.js +184 -0
- package/dist/esm/v3/components/index.d.ts +1 -0
- package/dist/esm/v3/components/index.js +24 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +181 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.d.ts +1 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +54 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/styles.d.ts +7 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.js +5 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/markdown.d.ts +3 -0
- package/dist/esm/v3/index.js +24 -0
- package/package.json +25 -5
- package/src/components/index.ts +1 -0
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.docs.mdx +7 -0
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +79 -0
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +622 -0
- package/src/components/or-rich-text-editor-v3/index.ts +1 -0
- package/src/components/or-rich-text-editor-v3/styles.ts +72 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.ts +40 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.ts +252 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/index.ts +1 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/types.ts +22 -0
- package/src/components/or-rich-text-editor-v3/utils/markdown.ts +110 -0
|
@@ -0,0 +1,680 @@
|
|
|
1
|
+
import { defineComponent, ref, onMounted, onBeforeUnmount, computed, watch } from 'vue-demi';
|
|
2
|
+
import { onClickOutside } from '@vueuse/core';
|
|
3
|
+
import { defaultMarkdownSerializer, MarkdownSerializer } from 'prosemirror-markdown';
|
|
4
|
+
import { DOMParser as DOMParser$1 } from 'prosemirror-model';
|
|
5
|
+
import { marked } from 'marked';
|
|
6
|
+
import Paragraph from '@tiptap/extension-paragraph';
|
|
7
|
+
import BulletList from '@tiptap/extension-bullet-list';
|
|
8
|
+
import ListItem from '@tiptap/extension-list-item';
|
|
9
|
+
import OrderedList from '@tiptap/extension-ordered-list';
|
|
10
|
+
import Strike from '@tiptap/extension-strike';
|
|
11
|
+
import Italic from '@tiptap/extension-italic';
|
|
12
|
+
import HardBreak from '@tiptap/extension-hard-break';
|
|
13
|
+
import Bold from '@tiptap/extension-bold';
|
|
14
|
+
import CodeBlock from '@tiptap/extension-code-block';
|
|
15
|
+
import Blockquote from '@tiptap/extension-blockquote';
|
|
16
|
+
import Link from '@tiptap/extension-link';
|
|
17
|
+
import Highlight from '@tiptap/extension-highlight';
|
|
18
|
+
import { s as script$1 } from './OrIconButton-65e83586.js';
|
|
19
|
+
import { s as script$2 } from './OrLabel-4da56db0.js';
|
|
20
|
+
import { s as script$4 } from './OrMenu-053a9ab7.js';
|
|
21
|
+
import './OrPopover-3ac8f589.js';
|
|
22
|
+
import { s as script$3 } from './OrMenuItem-dbee450f.js';
|
|
23
|
+
import { s as script$5 } from './OrModal-81dc4dcd.js';
|
|
24
|
+
import { s as script$6 } from './OrInput-a7cbc8b9.js';
|
|
25
|
+
import { s as script$7 } from './OrButton-b9bab32c.js';
|
|
26
|
+
import { Node, Editor, mergeAttributes } from '@tiptap/core';
|
|
27
|
+
import StarterKit from '@tiptap/starter-kit';
|
|
28
|
+
import Underline from '@tiptap/extension-underline';
|
|
29
|
+
import Heading from '@tiptap/extension-heading';
|
|
30
|
+
import Placeholder from '@tiptap/extension-placeholder';
|
|
31
|
+
import { C as CodeMirrorView } from './codemirrorView-2e87c938.js';
|
|
32
|
+
import { minimalSetup } from 'codemirror';
|
|
33
|
+
import { javascript } from '@codemirror/lang-javascript';
|
|
34
|
+
import { resolveComponent, openBlock, createElementBlock, normalizeClass, createVNode, withCtx, createTextVNode, toDisplayString, createElementVNode, Fragment, renderList, createBlock, createCommentVNode } from 'vue';
|
|
35
|
+
import { s as styleInject } from './style-inject.es-4c6f2515.js';
|
|
36
|
+
|
|
37
|
+
const serializerNodes = {
|
|
38
|
+
...defaultMarkdownSerializer.nodes,
|
|
39
|
+
[Paragraph.name]: defaultMarkdownSerializer.nodes.paragraph,
|
|
40
|
+
[BulletList.name]: defaultMarkdownSerializer.nodes.bullet_list,
|
|
41
|
+
[ListItem.name]: defaultMarkdownSerializer.nodes.list_item,
|
|
42
|
+
[OrderedList.name]: defaultMarkdownSerializer.nodes.ordered_list,
|
|
43
|
+
[HardBreak.name]: defaultMarkdownSerializer.nodes.hard_break,
|
|
44
|
+
[CodeBlock.name]: defaultMarkdownSerializer.nodes.code_block,
|
|
45
|
+
[Blockquote.name]: defaultMarkdownSerializer.nodes.blockquote
|
|
46
|
+
};
|
|
47
|
+
const serializerMarks = {
|
|
48
|
+
...defaultMarkdownSerializer.marks,
|
|
49
|
+
[Bold.name]: defaultMarkdownSerializer.marks.strong,
|
|
50
|
+
[Strike.name]: {
|
|
51
|
+
open: '~~',
|
|
52
|
+
close: '~~',
|
|
53
|
+
mixable: true,
|
|
54
|
+
expelEnclosingWhitespace: true
|
|
55
|
+
},
|
|
56
|
+
[Italic.name]: {
|
|
57
|
+
open: '_',
|
|
58
|
+
close: '_',
|
|
59
|
+
mixable: true,
|
|
60
|
+
expelEnclosingWhitespace: true
|
|
61
|
+
},
|
|
62
|
+
[Highlight.name]: {
|
|
63
|
+
open: '==',
|
|
64
|
+
close: '==',
|
|
65
|
+
mixable: true,
|
|
66
|
+
expelEnclosingWhitespace: true
|
|
67
|
+
},
|
|
68
|
+
[Link.name]: {
|
|
69
|
+
open(state, mark, parent, index) {
|
|
70
|
+
return isPlainURL(mark, parent, index, 1) ? '<' : '[';
|
|
71
|
+
},
|
|
72
|
+
close(state, mark, parent, index) {
|
|
73
|
+
const href = mark.attrs.canonicalSrc || mark.attrs.href;
|
|
74
|
+
return isPlainURL(mark, parent, index, -1) ? '>' : `](${state.esc(href)}${mark.attrs.title ? ` ${state.quote(mark.attrs.title)}` : ''})`;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const isPlainURL = (link, parent, index, side) => {
|
|
79
|
+
if (link.attrs.title || !/^\w+:/.test(link.attrs.href)) return false;
|
|
80
|
+
const content = parent.child(index + (side < 0 ? -1 : 0));
|
|
81
|
+
if (!content.isText || content.text !== link.attrs.href || content.marks[content.marks.length - 1] !== link) return false;
|
|
82
|
+
if (index === (side < 0 ? 1 : parent.childCount - 1)) return true;
|
|
83
|
+
const next = parent.child(index + (side < 0 ? -2 : 1));
|
|
84
|
+
return !link.isInSet(next.marks);
|
|
85
|
+
};
|
|
86
|
+
const serialize = (schema, content) => {
|
|
87
|
+
const proseMirrorDocument = schema.nodeFromJSON(content);
|
|
88
|
+
const serializer = new MarkdownSerializer(serializerNodes, serializerMarks);
|
|
89
|
+
return serializer.serialize(proseMirrorDocument);
|
|
90
|
+
};
|
|
91
|
+
const deserialize = (schema, content) => {
|
|
92
|
+
if (!content) return null;
|
|
93
|
+
const html = marked.parse(content);
|
|
94
|
+
if (!html) return null;
|
|
95
|
+
const parser = new DOMParser();
|
|
96
|
+
const {
|
|
97
|
+
body
|
|
98
|
+
} = parser.parseFromString(html, 'text/html');
|
|
99
|
+
// append original source as a comment that nodes can access
|
|
100
|
+
body.append(document.createComment(content));
|
|
101
|
+
const state = DOMParser$1.fromSchema(schema).parse(body);
|
|
102
|
+
return state.toJSON();
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const EditorContainer = [
|
|
106
|
+
// Colors
|
|
107
|
+
'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',
|
|
108
|
+
// Sizing
|
|
109
|
+
'border-1', 'rounded-md', 'w-full'];
|
|
110
|
+
const ToolbarContainer = [
|
|
111
|
+
// Layout
|
|
112
|
+
'flex',
|
|
113
|
+
//Spacing
|
|
114
|
+
'py-sm',
|
|
115
|
+
//Sizing
|
|
116
|
+
'border-b-1',
|
|
117
|
+
//Colors
|
|
118
|
+
'border-b-outline', 'dark:border-b-outline-dark'];
|
|
119
|
+
const Toolbar = [
|
|
120
|
+
// Layout
|
|
121
|
+
'flex',
|
|
122
|
+
// Spacing
|
|
123
|
+
'px-sm', 'gap-md',
|
|
124
|
+
// Sizing
|
|
125
|
+
'border-r-1',
|
|
126
|
+
//Colors
|
|
127
|
+
'border-r-disabled', 'dark:border-r-outline-dark',
|
|
128
|
+
// Last child
|
|
129
|
+
'last-of-type:border-none'];
|
|
130
|
+
const ToolbarButton = [
|
|
131
|
+
// Typography
|
|
132
|
+
'text-on-disabled', 'dark:text-on-disabled-dark'];
|
|
133
|
+
const ToolbarButtonFocused = [
|
|
134
|
+
// Typography
|
|
135
|
+
'text-outline', 'dark:text-outline-dark'];
|
|
136
|
+
const ToolbarButtonActive = [
|
|
137
|
+
// Typography
|
|
138
|
+
'text-on-background', 'dark:text-on-background-dark'];
|
|
139
|
+
const EditorInput = [
|
|
140
|
+
// Spacing
|
|
141
|
+
'p-sm',
|
|
142
|
+
// Typography
|
|
143
|
+
'typography-body-2-regular', 'text-on-background', 'dark:text-on-background-dark',
|
|
144
|
+
// Sizing
|
|
145
|
+
'min-h-[88px]'];
|
|
146
|
+
|
|
147
|
+
var codemirrorNode = Node.create({
|
|
148
|
+
name: 'codeBlock',
|
|
149
|
+
content: 'text*',
|
|
150
|
+
marks: '',
|
|
151
|
+
group: 'block',
|
|
152
|
+
code: true,
|
|
153
|
+
defining: true,
|
|
154
|
+
isolating: true,
|
|
155
|
+
parseHTML() {
|
|
156
|
+
return [{
|
|
157
|
+
tag: 'pre',
|
|
158
|
+
preserveWhitespace: 'full'
|
|
159
|
+
}];
|
|
160
|
+
},
|
|
161
|
+
renderHTML() {
|
|
162
|
+
return ['pre', ['code', 0]];
|
|
163
|
+
},
|
|
164
|
+
addNodeView() {
|
|
165
|
+
return ({
|
|
166
|
+
node,
|
|
167
|
+
editor,
|
|
168
|
+
getPos
|
|
169
|
+
}) => {
|
|
170
|
+
return new CodeMirrorView({
|
|
171
|
+
node,
|
|
172
|
+
view: editor.view,
|
|
173
|
+
getPos: getPos,
|
|
174
|
+
cmOptions: {
|
|
175
|
+
extensions: [minimalSetup, javascript()]
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
var script = defineComponent({
|
|
183
|
+
name: 'OrRichTextEditor',
|
|
184
|
+
components: {
|
|
185
|
+
OrIconButton: script$1,
|
|
186
|
+
OrLabel: script$2,
|
|
187
|
+
OrMenuItem: script$3,
|
|
188
|
+
OrMenu: script$4,
|
|
189
|
+
OrModal: script$5,
|
|
190
|
+
OrInput: script$6,
|
|
191
|
+
OrButton: script$7
|
|
192
|
+
},
|
|
193
|
+
inheritAttrs: false,
|
|
194
|
+
props: {
|
|
195
|
+
modelValue: {
|
|
196
|
+
type: String,
|
|
197
|
+
default: undefined
|
|
198
|
+
},
|
|
199
|
+
value: {
|
|
200
|
+
type: String,
|
|
201
|
+
default: undefined
|
|
202
|
+
},
|
|
203
|
+
toolbar: {
|
|
204
|
+
type: Array,
|
|
205
|
+
default: () => [['heading'], ['bold', 'italic', 'strike'], ['underline', 'highlight'], ['link'], ['blockquote', 'codeBlock'], ['bulletList', 'orderedList'], ['undo', 'redo']]
|
|
206
|
+
},
|
|
207
|
+
description: {
|
|
208
|
+
type: String,
|
|
209
|
+
default: ''
|
|
210
|
+
},
|
|
211
|
+
placeholder: {
|
|
212
|
+
type: String,
|
|
213
|
+
default: 'Write something...'
|
|
214
|
+
},
|
|
215
|
+
autofocus: {
|
|
216
|
+
type: Boolean,
|
|
217
|
+
default: false
|
|
218
|
+
},
|
|
219
|
+
markdownFormat: {
|
|
220
|
+
type: Boolean,
|
|
221
|
+
default: false
|
|
222
|
+
},
|
|
223
|
+
fullHeight: {
|
|
224
|
+
type: Boolean,
|
|
225
|
+
default: false
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
emits: ['update:modelValue', 'input'],
|
|
229
|
+
expose: ['root'],
|
|
230
|
+
setup(props, context) {
|
|
231
|
+
// Refs
|
|
232
|
+
const root = ref();
|
|
233
|
+
let editor = null;
|
|
234
|
+
const editorRef = ref();
|
|
235
|
+
const containerRef = ref();
|
|
236
|
+
const toolbarButtonRef = ref();
|
|
237
|
+
const menuRef = ref();
|
|
238
|
+
const isActive = ref({});
|
|
239
|
+
const isFocused = ref(props.autofocus);
|
|
240
|
+
const headingLevels = [1, 2, 3, 4];
|
|
241
|
+
const previousHeadingLevel = ref();
|
|
242
|
+
const activeHeadingLevel = ref(0);
|
|
243
|
+
const markdownOutput = ref('');
|
|
244
|
+
const isOpenLinkModal = ref(false);
|
|
245
|
+
const text = ref('');
|
|
246
|
+
const link = ref('');
|
|
247
|
+
// let trap: UseFocusTrapReturn = useFocusTrap(editorRef, {
|
|
248
|
+
// immediate: true,
|
|
249
|
+
// fallbackFocus: '.container',
|
|
250
|
+
// allowOutsideClick: true,
|
|
251
|
+
// });
|
|
252
|
+
const iconsEnum = ref({
|
|
253
|
+
bold: 'format_bold',
|
|
254
|
+
italic: 'format_italic',
|
|
255
|
+
underline: 'format_underlined',
|
|
256
|
+
strike: 'format_strikethrough',
|
|
257
|
+
bulletList: 'format_list_bulleted',
|
|
258
|
+
orderedList: 'format_list_numbered',
|
|
259
|
+
link: 'link',
|
|
260
|
+
highlight: 'highlight',
|
|
261
|
+
redo: 'redo',
|
|
262
|
+
undo: 'undo',
|
|
263
|
+
codeBlock: 'code_blocks',
|
|
264
|
+
blockquote: 'format_quote'
|
|
265
|
+
});
|
|
266
|
+
const iconTooltipsEnum = ref({
|
|
267
|
+
bold: 'Bold',
|
|
268
|
+
italic: 'Italic',
|
|
269
|
+
underline: 'Underline',
|
|
270
|
+
strike: 'Strike',
|
|
271
|
+
bulletList: 'Bulleted List',
|
|
272
|
+
orderedList: 'Numbered List',
|
|
273
|
+
link: 'Link',
|
|
274
|
+
highlight: 'Highlight',
|
|
275
|
+
redo: 'Redo',
|
|
276
|
+
undo: 'Undo',
|
|
277
|
+
codeBlock: 'Code Block',
|
|
278
|
+
blockquote: 'Quote'
|
|
279
|
+
});
|
|
280
|
+
onMounted(() => {
|
|
281
|
+
editor = new Editor({
|
|
282
|
+
onUpdate: ({
|
|
283
|
+
editor
|
|
284
|
+
}) => {
|
|
285
|
+
isFocused.value = true;
|
|
286
|
+
setActiveFormats();
|
|
287
|
+
const html = editor.getHTML();
|
|
288
|
+
const text = editor.getText();
|
|
289
|
+
if (props.markdownFormat) {
|
|
290
|
+
markdownOutput.value = serialize(editor.schema, editor.getJSON());
|
|
291
|
+
proxyModelValue.value = markdownOutput.value;
|
|
292
|
+
} else {
|
|
293
|
+
proxyModelValue.value = text === '' ? text : html;
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
onCreate: ({
|
|
297
|
+
editor
|
|
298
|
+
}) => {
|
|
299
|
+
if (props.markdownFormat) {
|
|
300
|
+
const deserialized = deserialize(editor.schema, proxyModelValue.value);
|
|
301
|
+
editor.commands.setContent(deserialized);
|
|
302
|
+
} else {
|
|
303
|
+
editor.commands.setContent(proxyModelValue.value);
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
element: editorRef.value,
|
|
307
|
+
autofocus: props.autofocus,
|
|
308
|
+
extensions: [codemirrorNode, StarterKit.configure({
|
|
309
|
+
heading: false,
|
|
310
|
+
codeBlock: false
|
|
311
|
+
}), Heading.configure({
|
|
312
|
+
levels: headingLevels
|
|
313
|
+
}).extend({
|
|
314
|
+
levels: headingLevels,
|
|
315
|
+
renderHTML({
|
|
316
|
+
node,
|
|
317
|
+
HTMLAttributes
|
|
318
|
+
}) {
|
|
319
|
+
return ['h' + node.attrs.level, mergeAttributes(HTMLAttributes, {
|
|
320
|
+
class: `typography-headline-${node.attrs.level}`
|
|
321
|
+
}), 0];
|
|
322
|
+
}
|
|
323
|
+
}), Underline, Link.configure({
|
|
324
|
+
openOnClick: true,
|
|
325
|
+
linkOnPaste: true,
|
|
326
|
+
autolink: false,
|
|
327
|
+
protocols: ['ftp', 'mailto', 'http', 'https'],
|
|
328
|
+
validate: href => /^https?:\/\//.test(href),
|
|
329
|
+
HTMLAttributes: {
|
|
330
|
+
class: 'text-primary cursor-pointer'
|
|
331
|
+
}
|
|
332
|
+
}), Highlight, Placeholder.configure({
|
|
333
|
+
placeholder: props.placeholder,
|
|
334
|
+
emptyEditorClass: 'is-editor-empty text-outline'
|
|
335
|
+
})],
|
|
336
|
+
editorProps: {
|
|
337
|
+
attributes: {
|
|
338
|
+
class: 'focus:outline-none'
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
setActiveFormats();
|
|
343
|
+
});
|
|
344
|
+
onBeforeUnmount(() => {
|
|
345
|
+
editor === null || editor === void 0 ? void 0 : editor.destroy();
|
|
346
|
+
});
|
|
347
|
+
onClickOutside(root, () => {
|
|
348
|
+
isFocused.value = false;
|
|
349
|
+
// trap.deactivate();
|
|
350
|
+
});
|
|
351
|
+
// Computed
|
|
352
|
+
const proxyModelValue = computed({
|
|
353
|
+
get: () => {
|
|
354
|
+
var _a;
|
|
355
|
+
return (_a = props.modelValue) !== null && _a !== void 0 ? _a : props.value; // TODO: Remove Vue 2 fallback
|
|
356
|
+
},
|
|
357
|
+
|
|
358
|
+
set: value => {
|
|
359
|
+
context.emit('input', value);
|
|
360
|
+
context.emit('update:modelValue', value);
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
const getIndexOfHeading = computed(() => {
|
|
364
|
+
return props.toolbar.flat().indexOf('heading');
|
|
365
|
+
});
|
|
366
|
+
const headingIcon = computed(() => {
|
|
367
|
+
if (activeHeadingLevel.value && isActive.value.heading) {
|
|
368
|
+
return `format_h${activeHeadingLevel.value}`;
|
|
369
|
+
}
|
|
370
|
+
return 'format_paragraph';
|
|
371
|
+
});
|
|
372
|
+
//Methods
|
|
373
|
+
const handleEditorClick = () => {
|
|
374
|
+
setActiveFormats();
|
|
375
|
+
isFocused.value = true;
|
|
376
|
+
editor === null || editor === void 0 ? void 0 : editor.commands.focus();
|
|
377
|
+
};
|
|
378
|
+
const handleToolbarClick = (item, level) => {
|
|
379
|
+
var _a, _b;
|
|
380
|
+
switch (item) {
|
|
381
|
+
case 'bulletList':
|
|
382
|
+
case 'orderedList':
|
|
383
|
+
item === 'bulletList' ? editor === null || editor === void 0 ? void 0 : editor.commands.toggleBulletList() : editor === null || editor === void 0 ? void 0 : editor.commands.toggleOrderedList();
|
|
384
|
+
break;
|
|
385
|
+
case 'link':
|
|
386
|
+
if (editor) {
|
|
387
|
+
const cursorPosition = (editor === null || editor === void 0 ? void 0 : editor.state.selection.$anchor.pos) || 0;
|
|
388
|
+
const {
|
|
389
|
+
from,
|
|
390
|
+
to,
|
|
391
|
+
empty
|
|
392
|
+
} = editor.state.selection;
|
|
393
|
+
const isLink = (_a = editor.view.state.doc.nodeAt(cursorPosition)) === null || _a === void 0 ? void 0 : _a.marks.filter(mark => mark.type.name === 'link');
|
|
394
|
+
const existedText = (isLink === null || isLink === void 0 ? void 0 : isLink.length) ? ((_b = editor.view.state.doc.nodeAt(cursorPosition)) === null || _b === void 0 ? void 0 : _b.text) || '' : '';
|
|
395
|
+
text.value = empty ? existedText : editor.state.doc.textBetween(from, to, ' ');
|
|
396
|
+
link.value = editor.getAttributes('link').href || '';
|
|
397
|
+
}
|
|
398
|
+
isOpenLinkModal.value = !isOpenLinkModal.value;
|
|
399
|
+
break;
|
|
400
|
+
case 'blockquote':
|
|
401
|
+
editor === null || editor === void 0 ? void 0 : editor.chain().focus().toggleBlockquote().run();
|
|
402
|
+
break;
|
|
403
|
+
case 'codeBlock':
|
|
404
|
+
if (!isActive.value['codeBlock']) {
|
|
405
|
+
editor === null || editor === void 0 ? void 0 : editor.commands.setNode(item, {
|
|
406
|
+
language: 'javascript'
|
|
407
|
+
});
|
|
408
|
+
} else {
|
|
409
|
+
editor === null || editor === void 0 ? void 0 : editor.commands.setNode('paragraph');
|
|
410
|
+
}
|
|
411
|
+
break;
|
|
412
|
+
case 'heading':
|
|
413
|
+
if (!level) {
|
|
414
|
+
editor === null || editor === void 0 ? void 0 : editor.commands.toggleHeading({
|
|
415
|
+
level: previousHeadingLevel.value
|
|
416
|
+
});
|
|
417
|
+
activeHeadingLevel.value = 0;
|
|
418
|
+
} else {
|
|
419
|
+
activeHeadingLevel.value = level;
|
|
420
|
+
previousHeadingLevel.value = level;
|
|
421
|
+
editor === null || editor === void 0 ? void 0 : editor.commands.toggleHeading({
|
|
422
|
+
level: level
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
editor === null || editor === void 0 ? void 0 : editor.commands.focus();
|
|
426
|
+
break;
|
|
427
|
+
case 'undo':
|
|
428
|
+
case 'redo':
|
|
429
|
+
item === 'undo' ? editor === null || editor === void 0 ? void 0 : editor.commands.undo() : editor === null || editor === void 0 ? void 0 : editor.commands.redo();
|
|
430
|
+
break;
|
|
431
|
+
default:
|
|
432
|
+
editor === null || editor === void 0 ? void 0 : editor.chain().focus().toggleMark(item).run();
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
const attachLink = async () => {
|
|
437
|
+
var _a, _b;
|
|
438
|
+
// empty
|
|
439
|
+
if (link.value === '') {
|
|
440
|
+
editor === null || editor === void 0 ? void 0 : editor.chain().focus().extendMarkRange('link').unsetLink().run();
|
|
441
|
+
}
|
|
442
|
+
const isEmptySelection = editor === null || editor === void 0 ? void 0 : editor.state.selection.empty;
|
|
443
|
+
const cursorPosition = (editor === null || editor === void 0 ? void 0 : editor.state.selection.$anchor.pos) || 0;
|
|
444
|
+
const isLink = (_a = editor === null || editor === void 0 ? void 0 : editor.view.state.doc.nodeAt(cursorPosition)) === null || _a === void 0 ? void 0 : _a.marks.filter(mark => mark.type.name === 'link');
|
|
445
|
+
const existedText = (isLink === null || isLink === void 0 ? void 0 : isLink.length) ? (_b = editor === null || editor === void 0 ? void 0 : editor.view.state.doc.nodeAt(cursorPosition)) === null || _b === void 0 ? void 0 : _b.text : '';
|
|
446
|
+
if (link.value && isEmptySelection && !existedText) {
|
|
447
|
+
editor === null || editor === void 0 ? void 0 : editor.chain().focus().setMark('link', {
|
|
448
|
+
href: link.value,
|
|
449
|
+
target: '__blank'
|
|
450
|
+
}).command(({
|
|
451
|
+
tr
|
|
452
|
+
}) => {
|
|
453
|
+
const preparedValue = text.value[text.value.length - 1] === ' ' ? text.value : `${text.value} `;
|
|
454
|
+
tr.insertText(preparedValue);
|
|
455
|
+
return true;
|
|
456
|
+
}).run();
|
|
457
|
+
}
|
|
458
|
+
if (link.value && existedText === text.value && isEmptySelection) {
|
|
459
|
+
editor === null || editor === void 0 ? void 0 : editor.chain().extendMarkRange('link').updateAttributes('link', {
|
|
460
|
+
href: link.value
|
|
461
|
+
}).run();
|
|
462
|
+
}
|
|
463
|
+
if (link.value && !isEmptySelection) {
|
|
464
|
+
editor === null || editor === void 0 ? void 0 : editor.chain().focus().setMark('link', {
|
|
465
|
+
href: link.value,
|
|
466
|
+
target: '__blank'
|
|
467
|
+
}).run();
|
|
468
|
+
}
|
|
469
|
+
text.value = '';
|
|
470
|
+
link.value = '';
|
|
471
|
+
isOpenLinkModal.value = false;
|
|
472
|
+
};
|
|
473
|
+
const discardLink = () => {
|
|
474
|
+
isOpenLinkModal.value = false;
|
|
475
|
+
};
|
|
476
|
+
const setActiveFormats = () => {
|
|
477
|
+
const toolbarList = props.toolbar.flat();
|
|
478
|
+
toolbarList.forEach(item => {
|
|
479
|
+
isActive.value[item] = (editor === null || editor === void 0 ? void 0 : editor.isActive(item)) || false;
|
|
480
|
+
});
|
|
481
|
+
};
|
|
482
|
+
// Styles
|
|
483
|
+
const rootStyles = computed(() => {
|
|
484
|
+
return ['or-rich-text-editor', ...(props.fullHeight ? ['h-full'] : [])];
|
|
485
|
+
});
|
|
486
|
+
const containerStyles = computed(() => {
|
|
487
|
+
return [...EditorContainer, ...(props.fullHeight ? ['h-full'] : [])];
|
|
488
|
+
});
|
|
489
|
+
const toolbarContainerStyles = computed(() => {
|
|
490
|
+
return [...ToolbarContainer];
|
|
491
|
+
});
|
|
492
|
+
const toolbarStyles = computed(() => {
|
|
493
|
+
return [...Toolbar, ...(isFocused.value ? ToolbarButtonFocused : ToolbarButton)];
|
|
494
|
+
});
|
|
495
|
+
const editorInputStyles = computed(() => {
|
|
496
|
+
return ['tiptap-editor', ...(props.fullHeight ? ['h-full'] : []), ...EditorInput];
|
|
497
|
+
});
|
|
498
|
+
const toolbarButtonStyles = item => {
|
|
499
|
+
return [
|
|
500
|
+
// Layout
|
|
501
|
+
'flex',
|
|
502
|
+
// Spacing
|
|
503
|
+
'gap-md', ...(isActive.value[item] ? ToolbarButtonActive : [])];
|
|
504
|
+
};
|
|
505
|
+
//Effects
|
|
506
|
+
watch(proxyModelValue, value => {
|
|
507
|
+
if (value !== (editor === null || editor === void 0 ? void 0 : editor.getHTML()) && !props.markdownFormat) {
|
|
508
|
+
editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
|
|
509
|
+
}
|
|
510
|
+
if (props.markdownFormat && value !== markdownOutput.value) {
|
|
511
|
+
const deserialized = deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value);
|
|
512
|
+
editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialized);
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
return {
|
|
516
|
+
editor,
|
|
517
|
+
editorRef,
|
|
518
|
+
containerRef,
|
|
519
|
+
toolbarButtonRef,
|
|
520
|
+
menuRef,
|
|
521
|
+
iconsEnum,
|
|
522
|
+
handleToolbarClick,
|
|
523
|
+
handleEditorClick,
|
|
524
|
+
isActive,
|
|
525
|
+
iconTooltipsEnum,
|
|
526
|
+
containerStyles,
|
|
527
|
+
toolbarContainerStyles,
|
|
528
|
+
toolbarStyles,
|
|
529
|
+
rootStyles,
|
|
530
|
+
root,
|
|
531
|
+
toolbarButtonStyles,
|
|
532
|
+
editorInputStyles,
|
|
533
|
+
getIndexOfHeading,
|
|
534
|
+
headingLevels,
|
|
535
|
+
headingIcon,
|
|
536
|
+
attachLink,
|
|
537
|
+
discardLink,
|
|
538
|
+
isOpenLinkModal,
|
|
539
|
+
text,
|
|
540
|
+
link
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
const _hoisted_1 = /*#__PURE__*/createElementVNode("p", {
|
|
546
|
+
class: "text-headline-2"
|
|
547
|
+
}, " Add Link ", -1 /* HOISTED */);
|
|
548
|
+
const _hoisted_2 = {
|
|
549
|
+
class: "flex ml-auto gap-md"
|
|
550
|
+
};
|
|
551
|
+
const _hoisted_3 = /*#__PURE__*/createElementVNode("p", null, "Cancel", -1 /* HOISTED */);
|
|
552
|
+
const _hoisted_4 = /*#__PURE__*/createElementVNode("p", null, "Save", -1 /* HOISTED */);
|
|
553
|
+
|
|
554
|
+
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
555
|
+
const _component_or_label = resolveComponent("or-label");
|
|
556
|
+
const _component_or_icon_button = resolveComponent("or-icon-button");
|
|
557
|
+
const _component_or_menu_item = resolveComponent("or-menu-item");
|
|
558
|
+
const _component_or_menu = resolveComponent("or-menu");
|
|
559
|
+
const _component_or_input = resolveComponent("or-input");
|
|
560
|
+
const _component_or_button = resolveComponent("or-button");
|
|
561
|
+
const _component_or_modal = resolveComponent("or-modal");
|
|
562
|
+
return openBlock(), createElementBlock("div", {
|
|
563
|
+
ref: "root",
|
|
564
|
+
class: normalizeClass(_ctx.rootStyles)
|
|
565
|
+
}, [createVNode(_component_or_label, null, {
|
|
566
|
+
default: withCtx(() => [createTextVNode(toDisplayString(_ctx.description), 1 /* TEXT */)]),
|
|
567
|
+
|
|
568
|
+
_: 1 /* STABLE */
|
|
569
|
+
}), createElementVNode("div", {
|
|
570
|
+
ref: "containerRef",
|
|
571
|
+
class: normalizeClass(_ctx.containerStyles),
|
|
572
|
+
onClick: _cache[1] || (_cache[1] = $event => _ctx.handleEditorClick())
|
|
573
|
+
}, [createElementVNode("div", {
|
|
574
|
+
class: normalizeClass(_ctx.toolbarContainerStyles)
|
|
575
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.toolbar, (tool, index) => {
|
|
576
|
+
return openBlock(), createElementBlock("div", {
|
|
577
|
+
key: index,
|
|
578
|
+
class: normalizeClass(_ctx.toolbarStyles)
|
|
579
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(tool, item => {
|
|
580
|
+
return openBlock(), createElementBlock("div", {
|
|
581
|
+
key: item,
|
|
582
|
+
class: normalizeClass([_ctx.toolbarButtonStyles(item), "-my-xs"])
|
|
583
|
+
}, [item === 'heading' ? (openBlock(), createBlock(_component_or_icon_button, {
|
|
584
|
+
key: 0,
|
|
585
|
+
ref_for: true,
|
|
586
|
+
ref: "toolbarButtonRef",
|
|
587
|
+
tooltip: {
|
|
588
|
+
text: item,
|
|
589
|
+
placement: 'top'
|
|
590
|
+
},
|
|
591
|
+
icon: {
|
|
592
|
+
icon: _ctx.headingIcon,
|
|
593
|
+
variant: 'inherit',
|
|
594
|
+
size: 'm'
|
|
595
|
+
},
|
|
596
|
+
onClick: _cache[0] || (_cache[0] = $event => _ctx.menuRef.open())
|
|
597
|
+
}, null, 8 /* PROPS */, ["tooltip", "icon"])) : (openBlock(), createBlock(_component_or_icon_button, {
|
|
598
|
+
key: 1,
|
|
599
|
+
tooltip: {
|
|
600
|
+
text: _ctx.iconTooltipsEnum[item],
|
|
601
|
+
placement: 'top'
|
|
602
|
+
},
|
|
603
|
+
icon: {
|
|
604
|
+
icon: _ctx.iconsEnum[item],
|
|
605
|
+
variant: 'inherit',
|
|
606
|
+
size: 'm'
|
|
607
|
+
},
|
|
608
|
+
onClick: $event => _ctx.handleToolbarClick(item)
|
|
609
|
+
}, null, 8 /* PROPS */, ["tooltip", "icon", "onClick"]))], 2 /* CLASS */);
|
|
610
|
+
}), 128 /* KEYED_FRAGMENT */))], 2 /* CLASS */);
|
|
611
|
+
}), 128 /* KEYED_FRAGMENT */))], 2 /* CLASS */), createElementVNode("div", {
|
|
612
|
+
ref: "editorRef",
|
|
613
|
+
class: normalizeClass(_ctx.editorInputStyles)
|
|
614
|
+
}, null, 2 /* CLASS */)], 2 /* CLASS */), _ctx.toolbarButtonRef ? (openBlock(), createBlock(_component_or_menu, {
|
|
615
|
+
key: 0,
|
|
616
|
+
ref: "menuRef",
|
|
617
|
+
trigger: _ctx.toolbarButtonRef[_ctx.getIndexOfHeading].root,
|
|
618
|
+
placement: "bottom-start"
|
|
619
|
+
}, {
|
|
620
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.headingLevels, heading => {
|
|
621
|
+
return openBlock(), createBlock(_component_or_menu_item, {
|
|
622
|
+
key: heading,
|
|
623
|
+
onClick: $event => _ctx.handleToolbarClick('heading', heading)
|
|
624
|
+
}, {
|
|
625
|
+
default: withCtx(() => [createTextVNode(" Heading " + toDisplayString(heading), 1 /* TEXT */)]),
|
|
626
|
+
|
|
627
|
+
_: 2 /* DYNAMIC */
|
|
628
|
+
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onClick"]);
|
|
629
|
+
}), 128 /* KEYED_FRAGMENT */)), createVNode(_component_or_menu_item, {
|
|
630
|
+
onClick: _cache[2] || (_cache[2] = $event => _ctx.handleToolbarClick('heading'))
|
|
631
|
+
}, {
|
|
632
|
+
default: withCtx(() => [createTextVNode(" None ")]),
|
|
633
|
+
_: 1 /* STABLE */
|
|
634
|
+
})]),
|
|
635
|
+
|
|
636
|
+
_: 1 /* STABLE */
|
|
637
|
+
}, 8 /* PROPS */, ["trigger"])) : createCommentVNode("v-if", true), createVNode(_component_or_modal, {
|
|
638
|
+
"is-open": _ctx.isOpenLinkModal,
|
|
639
|
+
size: "s"
|
|
640
|
+
}, {
|
|
641
|
+
header: withCtx(() => [_hoisted_1]),
|
|
642
|
+
footer: withCtx(() => [createElementVNode("div", _hoisted_2, [createVNode(_component_or_button, {
|
|
643
|
+
variant: "outlined",
|
|
644
|
+
onClick: _ctx.discardLink
|
|
645
|
+
}, {
|
|
646
|
+
default: withCtx(() => [_hoisted_3]),
|
|
647
|
+
_: 1 /* STABLE */
|
|
648
|
+
}, 8 /* PROPS */, ["onClick"]), createVNode(_component_or_button, {
|
|
649
|
+
onClick: _ctx.attachLink
|
|
650
|
+
}, {
|
|
651
|
+
default: withCtx(() => [_hoisted_4]),
|
|
652
|
+
_: 1 /* STABLE */
|
|
653
|
+
}, 8 /* PROPS */, ["onClick"])])]),
|
|
654
|
+
default: withCtx(() => [createElementVNode("div", null, [createVNode(_component_or_label, null, {
|
|
655
|
+
default: withCtx(() => [createTextVNode(" Text ")]),
|
|
656
|
+
_: 1 /* STABLE */
|
|
657
|
+
}), createVNode(_component_or_input, {
|
|
658
|
+
modelValue: _ctx.text,
|
|
659
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = $event => _ctx.text = $event),
|
|
660
|
+
placeholder: "Placeholder",
|
|
661
|
+
class: "pb-md"
|
|
662
|
+
}, null, 8 /* PROPS */, ["modelValue"]), createVNode(_component_or_label, null, {
|
|
663
|
+
default: withCtx(() => [createTextVNode(" Link ")]),
|
|
664
|
+
_: 1 /* STABLE */
|
|
665
|
+
}), createVNode(_component_or_input, {
|
|
666
|
+
modelValue: _ctx.link,
|
|
667
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = $event => _ctx.link = $event),
|
|
668
|
+
placeholder: "Placeholder"
|
|
669
|
+
}, null, 8 /* PROPS */, ["modelValue"])])]),
|
|
670
|
+
_: 1 /* STABLE */
|
|
671
|
+
}, 8 /* PROPS */, ["is-open"])], 2 /* CLASS */);
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
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}\n.tiptap-editor .cm-editor {\n border: none;\n border-radius: 4px;\n}\n.tiptap-editor .cm-editor .cm-scroller {\n border-radius: 4px;\n}\n.tiptap-editor .cm-editor.cm-focused {\n outline: none;\n}\n.tiptap-editor .cm-editor .cm-gutters {\n background-color: rgba(0, 95, 177, 0.08);\n border: none;\n}\n.tiptap-editor .cm-editor .cm-gutters .cm-gutterElement {\n padding: 0 10px;\n}\n.tiptap-editor .cm-editor .cm-gutters .cm-gutterElement.cm-activeLineGutter {\n background-color: rgba(0, 95, 177, 0.07);\n}";
|
|
675
|
+
styleInject(css_248z);
|
|
676
|
+
|
|
677
|
+
script.render = render;
|
|
678
|
+
script.__file = "src/components/or-rich-text-editor-v3/OrRichTextEditor.vue";
|
|
679
|
+
|
|
680
|
+
export { script as s };
|