@onereach/ui-components 25.1.0 → 25.1.1-beta.5755.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/esm/{OrRichTextEditor-B_uVsae1.mjs → OrRichTextEditor-DKhL46g9.mjs} +309 -300
- package/dist/esm/OrRichTextEditor-DKhL46g9.mjs.map +1 -0
- package/dist/esm/components/index.mjs +1 -1
- package/dist/esm/components/or-rich-text-editor-v3/index.mjs +1 -1
- package/dist/esm/index.mjs +1 -1
- package/package.json +4 -5
- package/dist/esm/OrRichTextEditor-B_uVsae1.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("[data-v-
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("[data-v-1222a307] .or-cm-paragraph{@apply my-xs;}[data-v-1222a307] .or-cm-bulletList{@apply mx-lg my-xs list-disc;}[data-v-1222a307] .or-cm-orderedList{@apply mx-lg my-xs list-decimal;}[data-v-1222a307] .or-cm-blockquote{@apply my-sm mx-lg px-lg border-l-2 border-outline;}[data-v-1222a307] .or-cm-link{@apply text-primary cursor-pointer;}[data-v-1222a307] .or-cm-placeholder{@apply text-outline;}[data-v-1222a307] .or-cm-editorProps{@apply flex flex-col focus:outline-none gap-xs h-full;}.tiptap-editor-v3 .is-editor-empty:before{float:left;height:0;pointer-events:none;content:attr(data-placeholder)}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
2
|
import { useTheme as ft, useResponsive as pt } from "@onereach/ui-components-common/hooks";
|
|
3
3
|
import { isArray as gt } from "@onereach/ui-components-common/utils";
|
|
4
4
|
import { O as ht } from "./OrButton-C_hXddAf.mjs";
|
|
@@ -13,39 +13,39 @@ import { O as St } from "./OrMenu-CJT4Snay.mjs";
|
|
|
13
13
|
import { O as Lt } from "./OrModal-CQhwUYFk.mjs";
|
|
14
14
|
import { O as Bt } from "./OrPopover-DbygLPtT.mjs";
|
|
15
15
|
import { Node as Mt, Editor as At, mergeAttributes as Pt } from "@tiptap/core";
|
|
16
|
-
import
|
|
17
|
-
import
|
|
16
|
+
import qe from "@tiptap/extension-blockquote";
|
|
17
|
+
import ze from "@tiptap/extension-bullet-list";
|
|
18
18
|
import Ht from "@tiptap/extension-heading";
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
19
|
+
import Te from "@tiptap/extension-highlight";
|
|
20
|
+
import De from "@tiptap/extension-link";
|
|
21
|
+
import Ue from "@tiptap/extension-ordered-list";
|
|
22
|
+
import We from "@tiptap/extension-paragraph";
|
|
23
23
|
import Rt from "@tiptap/extension-placeholder";
|
|
24
|
-
import
|
|
24
|
+
import Ge from "@tiptap/extension-underline";
|
|
25
25
|
import Nt from "@tiptap/starter-kit";
|
|
26
26
|
import { useResizeObserver as Vt, useDebounceFn as $t, onClickOutside as It } from "@vueuse/core";
|
|
27
27
|
import { useFocusTrap as Et } from "@vueuse/integrations/useFocusTrap";
|
|
28
|
-
import { defineComponent as Ft, shallowRef as qt, ref as m, onMounted as zt, onBeforeUnmount as Tt, computed as w, watch as Dt, nextTick as Ut, resolveComponent as O, openBlock as f, createElementBlock as
|
|
28
|
+
import { defineComponent as Ft, shallowRef as qt, ref as m, onMounted as zt, onBeforeUnmount as Tt, computed as w, watch as Dt, nextTick as Ut, resolveComponent as O, openBlock as f, createElementBlock as q, normalizeClass as V, createBlock as N, withCtx as b, renderSlot as re, createTextVNode as $, toDisplayString as ae, createCommentVNode as T, createVNode as I, createElementVNode as z, Fragment as ne, renderList as le, withDirectives as se, vShow as ie, vModelText as Wt } from "vue";
|
|
29
29
|
import { TextSelection as Gt, Selection as Jt } from "prosemirror-state";
|
|
30
30
|
import { exitCode as jt } from "prosemirror-commands";
|
|
31
|
-
import { EditorState as
|
|
32
|
-
import { EditorView as
|
|
31
|
+
import { EditorState as we } from "@codemirror/state";
|
|
32
|
+
import { EditorView as Je, highlightActiveLine as Kt, highlightActiveLineGutter as Qt, lineNumbers as Xt, keymap as Yt } from "@codemirror/view";
|
|
33
33
|
import { HighlightStyle as Zt, syntaxHighlighting as xt } from "@codemirror/language";
|
|
34
|
-
import { tags as
|
|
34
|
+
import { tags as n } from "@lezer/highlight";
|
|
35
35
|
import { minimalSetup as _t } from "codemirror";
|
|
36
36
|
import { javascript as eo } from "@codemirror/lang-javascript";
|
|
37
37
|
import to from "@tiptap/extension-bold";
|
|
38
38
|
import oo from "@tiptap/extension-code-block";
|
|
39
39
|
import ro from "@tiptap/extension-hard-break";
|
|
40
|
-
import
|
|
41
|
-
import
|
|
40
|
+
import ao from "@tiptap/extension-italic";
|
|
41
|
+
import no from "@tiptap/extension-list-item";
|
|
42
42
|
import lo from "@tiptap/extension-strike";
|
|
43
43
|
import so from "@tiptap/extension-horizontal-rule";
|
|
44
44
|
import { marked as io } from "marked";
|
|
45
|
-
import { defaultMarkdownSerializer as S, MarkdownSerializer as
|
|
46
|
-
import { DOMParser as
|
|
45
|
+
import { defaultMarkdownSerializer as S, MarkdownSerializer as uo } from "prosemirror-markdown";
|
|
46
|
+
import { DOMParser as co } from "prosemirror-model";
|
|
47
47
|
import { _ as mo } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
48
|
-
var
|
|
48
|
+
var je = /* @__PURE__ */ ((e) => (e.Markdown = "markdown", e.Markup = "markup", e))(je || {}), Ke = /* @__PURE__ */ ((e) => (e.bold = "format_bold", e.italic = "format_italic", e.underline = "format_underlined", e.strike = "format_strikethrough", e.bulletList = "format_list_bulleted", e.orderedList = "format_list_numbered", e.link = "link", e.highlight = "highlight", e.redo = "redo", e.undo = "undo", e.codeBlock = "code_blocks", e.blockquote = "format_quote", e.file = "attach_file", e.source = "source_notes", e))(Ke || {}), Qe = /* @__PURE__ */ ((e) => (e.bold = "Bold", e.italic = "Italic", e.underline = "Underline", e.strike = "Strike", e.bulletList = "Bulleted List", e.orderedList = "Numbered List", e.link = "Link", e.highlight = "Highlight", e.redo = "Redo", e.undo = "Undo", e.codeBlock = "Code Block", e.blockquote = "Quote", e.file = "File", e.source = "Source", e))(Qe || {});
|
|
49
49
|
const fo = [
|
|
50
50
|
// Layout
|
|
51
51
|
"layout-column",
|
|
@@ -84,24 +84,24 @@ const fo = [
|
|
|
84
84
|
"typography-body-2-regular",
|
|
85
85
|
// Size
|
|
86
86
|
"h-full"
|
|
87
|
-
],
|
|
88
|
-
var
|
|
89
|
-
const ko = (
|
|
90
|
-
var
|
|
91
|
-
const Oo =
|
|
87
|
+
], a = ft(), vo = a == null ? void 0 : a.backgroundColor["custom-colors-custom-6"], Oe = a == null ? void 0 : a.backgroundColor["custom-colors-custom-1"], bo = a == null ? void 0 : a.backgroundColor["custom-colors-custom-3"];
|
|
88
|
+
var Me;
|
|
89
|
+
const ko = (Me = a == null ? void 0 : a.backgroundColor) == null ? void 0 : Me.white, ue = a == null ? void 0 : a.backgroundColor["custom-colors-custom-6"], ve = a == null ? void 0 : a.backgroundColor["custom-colors-custom-5"], yo = a == null ? void 0 : a.backgroundColor["custom-colors-custom-3"], Co = a == null ? void 0 : a.backgroundColor.success, Se = a == null ? void 0 : a.backgroundColor.warning, wo = a == null ? void 0 : a.backgroundColor["custom-colors-custom-1"];
|
|
90
|
+
var Ae, Pe, He, Re, Ne, Ve, $e, Ie, Ee, Fe;
|
|
91
|
+
const Oo = Je.theme({
|
|
92
92
|
"&": {
|
|
93
|
-
color:
|
|
94
|
-
backgroundColor: (
|
|
93
|
+
color: ue,
|
|
94
|
+
backgroundColor: (Ae = a == null ? void 0 : a.backgroundColor) == null ? void 0 : Ae["bg-primary-container"]
|
|
95
95
|
},
|
|
96
96
|
".cm-editor": {
|
|
97
97
|
border: "none",
|
|
98
|
-
borderRadius: (
|
|
98
|
+
borderRadius: (Pe = a == null ? void 0 : a.spacing) == null ? void 0 : Pe.xs
|
|
99
99
|
},
|
|
100
100
|
"&.cm-focused": {
|
|
101
101
|
outline: "none"
|
|
102
102
|
},
|
|
103
103
|
".cm-scroller": {
|
|
104
|
-
borderRadius: (
|
|
104
|
+
borderRadius: (He = a == null ? void 0 : a.spacing) == null ? void 0 : He.xs
|
|
105
105
|
},
|
|
106
106
|
".cm-content": {
|
|
107
107
|
// caretColor: cursor,
|
|
@@ -110,7 +110,7 @@ const Oo = Ge.theme({
|
|
|
110
110
|
// background: highlightBackground,
|
|
111
111
|
// color: themes?.colors?.neutral?.[600],
|
|
112
112
|
border: 0,
|
|
113
|
-
borderRadius: (
|
|
113
|
+
borderRadius: (Re = a == null ? void 0 : a.spacing) == null ? void 0 : Re.xs
|
|
114
114
|
},
|
|
115
115
|
".cm-panel.cm-search input[type=checkbox]": {
|
|
116
116
|
display: "inline-block",
|
|
@@ -122,7 +122,7 @@ const Oo = Ge.theme({
|
|
|
122
122
|
},
|
|
123
123
|
".cm-panels": {
|
|
124
124
|
// backgroundColor: darkBackground,
|
|
125
|
-
color:
|
|
125
|
+
color: ue
|
|
126
126
|
},
|
|
127
127
|
// '.cm-panels.cm-panels-top': { borderBottom: `2px solid ${themes?.colors?.neutral?.[200]}` },
|
|
128
128
|
// '.cm-panels.cm-panels-bottom': { borderTop: `2px solid ${themes?.colors?.neutral?.[200]}` },
|
|
@@ -134,23 +134,23 @@ const Oo = Ge.theme({
|
|
|
134
134
|
// backgroundColor: themes?.colors?.sky?.[100],
|
|
135
135
|
},
|
|
136
136
|
".cm-activeLine": {
|
|
137
|
-
backgroundColor: (
|
|
137
|
+
backgroundColor: (Ne = a == null ? void 0 : a.backgroundColor) == null ? void 0 : Ne["bg-secondary-container"]
|
|
138
138
|
},
|
|
139
139
|
// '.cm-selectionMatch': { backgroundColor: themes?.colors?.lime?.[500] },
|
|
140
140
|
"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket": {
|
|
141
141
|
// backgroundColor: themes?.colors?.lime?.[600],
|
|
142
142
|
},
|
|
143
143
|
".cm-gutters": {
|
|
144
|
-
backgroundColor: (
|
|
145
|
-
color:
|
|
144
|
+
backgroundColor: (Ve = a == null ? void 0 : a.backgroundColor) == null ? void 0 : Ve["primary-opacity-0-12"],
|
|
145
|
+
color: ve,
|
|
146
146
|
border: "none"
|
|
147
147
|
},
|
|
148
148
|
".cm-lineNumbers .cm-gutterElement": {
|
|
149
|
-
paddingLeft: (
|
|
150
|
-
paddingRight: (
|
|
149
|
+
paddingLeft: ($e = a == null ? void 0 : a.spacing) == null ? void 0 : $e["sm+*"],
|
|
150
|
+
paddingRight: (Ie = a == null ? void 0 : a.spacing) == null ? void 0 : Ie["sm+*"]
|
|
151
151
|
},
|
|
152
152
|
".cm-activeLineGutter": {
|
|
153
|
-
backgroundColor: (
|
|
153
|
+
backgroundColor: (Ee = a == null ? void 0 : a.backgroundColor) == null ? void 0 : Ee["primary-opacity-0-16"]
|
|
154
154
|
},
|
|
155
155
|
".cm-foldPlaceholder": {
|
|
156
156
|
backgroundColor: "transparent",
|
|
@@ -172,7 +172,7 @@ const Oo = Ge.theme({
|
|
|
172
172
|
".cm-tooltip-autocomplete": {
|
|
173
173
|
"& > ul > li[aria-selected]": {
|
|
174
174
|
// backgroundColor: highlightBackground,
|
|
175
|
-
color:
|
|
175
|
+
color: ue
|
|
176
176
|
}
|
|
177
177
|
},
|
|
178
178
|
".cm-textfield": {
|
|
@@ -181,104 +181,104 @@ const Oo = Ge.theme({
|
|
|
181
181
|
// color: themes?.colors?.neutral?.[600],
|
|
182
182
|
// backgroundColor: themes?.colors?.neutral?.[100],
|
|
183
183
|
// border: `1px solid ${themes?.colors?.neutral?.[200]}`,
|
|
184
|
-
borderRadius: (
|
|
184
|
+
borderRadius: (Fe = a == null ? void 0 : a.spacing) == null ? void 0 : Fe.xs
|
|
185
185
|
}
|
|
186
186
|
}, { dark: !0 }), So = Zt.define([
|
|
187
187
|
{
|
|
188
|
-
tag:
|
|
188
|
+
tag: n.keyword,
|
|
189
189
|
color: wo
|
|
190
190
|
},
|
|
191
191
|
{
|
|
192
|
-
tag: [
|
|
193
|
-
color:
|
|
192
|
+
tag: [n.name, n.deleted, n.character, n.propertyName, n.macroName],
|
|
193
|
+
color: Oe
|
|
194
194
|
},
|
|
195
195
|
{
|
|
196
|
-
tag: [
|
|
196
|
+
tag: [n.function(n.variableName), n.labelName],
|
|
197
197
|
color: yo
|
|
198
198
|
},
|
|
199
199
|
{
|
|
200
|
-
tag: [
|
|
201
|
-
color:
|
|
200
|
+
tag: [n.color, n.constant(n.name), n.standard(n.name)],
|
|
201
|
+
color: Se
|
|
202
202
|
},
|
|
203
203
|
{
|
|
204
|
-
tag: [
|
|
205
|
-
color:
|
|
204
|
+
tag: [n.definition(n.name), n.separator],
|
|
205
|
+
color: ue
|
|
206
206
|
},
|
|
207
207
|
{
|
|
208
|
-
tag: [
|
|
208
|
+
tag: [n.typeName, n.className, n.number, n.changed, n.annotation, n.modifier, n.self, n.namespace],
|
|
209
209
|
color: vo
|
|
210
210
|
},
|
|
211
211
|
{
|
|
212
|
-
tag: [
|
|
212
|
+
tag: [n.operator, n.operatorKeyword, n.url, n.escape, n.regexp, n.link, n.special(n.string)],
|
|
213
213
|
color: bo
|
|
214
214
|
},
|
|
215
215
|
{
|
|
216
|
-
tag: [
|
|
217
|
-
color:
|
|
216
|
+
tag: [n.meta, n.comment],
|
|
217
|
+
color: ve
|
|
218
218
|
},
|
|
219
219
|
{
|
|
220
|
-
tag:
|
|
220
|
+
tag: n.strong,
|
|
221
221
|
fontWeight: "bold"
|
|
222
222
|
},
|
|
223
223
|
{
|
|
224
|
-
tag:
|
|
224
|
+
tag: n.emphasis,
|
|
225
225
|
fontStyle: "italic"
|
|
226
226
|
},
|
|
227
227
|
{
|
|
228
|
-
tag:
|
|
228
|
+
tag: n.strikethrough,
|
|
229
229
|
textDecoration: "line-through"
|
|
230
230
|
},
|
|
231
231
|
{
|
|
232
|
-
tag:
|
|
233
|
-
color:
|
|
232
|
+
tag: n.link,
|
|
233
|
+
color: ve,
|
|
234
234
|
textDecoration: "underline"
|
|
235
235
|
},
|
|
236
236
|
{
|
|
237
|
-
tag:
|
|
237
|
+
tag: n.heading,
|
|
238
238
|
fontWeight: "bold",
|
|
239
|
-
color:
|
|
239
|
+
color: Oe
|
|
240
240
|
},
|
|
241
241
|
{
|
|
242
|
-
tag: [
|
|
243
|
-
color:
|
|
242
|
+
tag: [n.atom, n.bool, n.special(n.variableName)],
|
|
243
|
+
color: Se
|
|
244
244
|
},
|
|
245
245
|
{
|
|
246
|
-
tag: [
|
|
246
|
+
tag: [n.processingInstruction, n.string, n.inserted],
|
|
247
247
|
color: Co
|
|
248
248
|
},
|
|
249
249
|
{
|
|
250
|
-
tag:
|
|
250
|
+
tag: n.invalid,
|
|
251
251
|
color: ko
|
|
252
252
|
}
|
|
253
|
-
]), Lo = [Oo, xt(So)],
|
|
253
|
+
]), Lo = [Oo, xt(So)], Le = (e, o) => {
|
|
254
254
|
if (e === o)
|
|
255
255
|
return null;
|
|
256
|
-
let t = 0,
|
|
257
|
-
for (; t <
|
|
256
|
+
let t = 0, s = e.length, l = o.length;
|
|
257
|
+
for (; t < s && e.charCodeAt(t) === o.charCodeAt(t); )
|
|
258
258
|
t += 1;
|
|
259
|
-
for (;
|
|
260
|
-
|
|
259
|
+
for (; s > t && l > t && e.charCodeAt(s - 1) === o.charCodeAt(l - 1); )
|
|
260
|
+
s -= 1, l -= 1;
|
|
261
261
|
return {
|
|
262
262
|
from: t,
|
|
263
|
-
to:
|
|
263
|
+
to: s,
|
|
264
264
|
text: o.slice(t, l)
|
|
265
265
|
};
|
|
266
266
|
};
|
|
267
267
|
class Bo {
|
|
268
268
|
constructor(o) {
|
|
269
|
-
var
|
|
269
|
+
var h;
|
|
270
270
|
this.updating = !1, this.node = o.node, this.view = o.view;
|
|
271
|
-
const t = ((
|
|
271
|
+
const t = ((h = o.cmOptions) == null ? void 0 : h.extensions) || [];
|
|
272
272
|
this.name = "codeBlock", this.getPos = o.getPos;
|
|
273
|
-
const
|
|
274
|
-
this.cm = new
|
|
273
|
+
const s = we.changeFilter.of((L) => (!L.docChanged && !this.updating && this.forwardSelection(), !0));
|
|
274
|
+
this.cm = new Je({
|
|
275
275
|
dispatch: this.dispatch.bind(this)
|
|
276
276
|
}), this.dom = this.cm.dom;
|
|
277
|
-
const l =
|
|
277
|
+
const l = we.create({
|
|
278
278
|
doc: this.node.textContent,
|
|
279
279
|
extensions: [
|
|
280
280
|
Lo,
|
|
281
|
-
|
|
281
|
+
s,
|
|
282
282
|
Kt(),
|
|
283
283
|
Qt(),
|
|
284
284
|
Xt(),
|
|
@@ -316,22 +316,22 @@ class Bo {
|
|
|
316
316
|
t.eq(o.selection) || this.view.dispatch(o.tr.setSelection(t));
|
|
317
317
|
}
|
|
318
318
|
asProseMirrorSelection(o) {
|
|
319
|
-
const t = this.getPos() + 1, { anchor:
|
|
320
|
-
return Gt.create(o,
|
|
319
|
+
const t = this.getPos() + 1, { anchor: s, head: l } = this.cm.state.selection.main;
|
|
320
|
+
return Gt.create(o, s + t, l + t);
|
|
321
321
|
}
|
|
322
322
|
dispatch(o) {
|
|
323
323
|
if (this.cm.setState(o.state), o.docChanged && !this.updating) {
|
|
324
|
-
const t = this.getPos() + 1,
|
|
324
|
+
const t = this.getPos() + 1, s = o.state.doc.toString(), l = Le(this.node.textContent, s);
|
|
325
325
|
if (!l)
|
|
326
326
|
return;
|
|
327
|
-
const
|
|
327
|
+
const h = l.text ? this.view.state.schema.text(l.text) : null, L = this.view.state.tr.replaceWith(l.from + t, l.to + t, h);
|
|
328
328
|
this.view.dispatch(L), this.forwardSelection();
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
mayBeEscape(o, t) {
|
|
332
|
-
return (
|
|
333
|
-
const { state: l } =
|
|
334
|
-
const y =
|
|
332
|
+
return (s) => {
|
|
333
|
+
const { state: l } = s, { selection: h } = l, k = (() => {
|
|
334
|
+
const y = h.main.from, A = l.doc.lineAt(y);
|
|
335
335
|
return {
|
|
336
336
|
line: A.number,
|
|
337
337
|
ch: y - A.from
|
|
@@ -347,7 +347,7 @@ class Bo {
|
|
|
347
347
|
if (o.type !== this.node.type)
|
|
348
348
|
return !1;
|
|
349
349
|
this.node = o;
|
|
350
|
-
const t =
|
|
350
|
+
const t = Le(this.cm.state.doc.toString(), o.textContent);
|
|
351
351
|
return t && (this.updating = !0, this.cm.dispatch({
|
|
352
352
|
changes: {
|
|
353
353
|
from: t.from,
|
|
@@ -408,13 +408,13 @@ const Mo = Mt.create({
|
|
|
408
408
|
}
|
|
409
409
|
}), Ao = {
|
|
410
410
|
...S.nodes,
|
|
411
|
-
[
|
|
412
|
-
[
|
|
413
|
-
[
|
|
414
|
-
[
|
|
411
|
+
[We.name]: S.nodes.paragraph,
|
|
412
|
+
[ze.name]: S.nodes.bullet_list,
|
|
413
|
+
[no.name]: S.nodes.list_item,
|
|
414
|
+
[Ue.name]: S.nodes.ordered_list,
|
|
415
415
|
[ro.name]: S.nodes.hard_break,
|
|
416
416
|
[oo.name]: S.nodes.code_block,
|
|
417
|
-
[
|
|
417
|
+
[qe.name]: S.nodes.blockquote,
|
|
418
418
|
[so.name]: S.nodes.horizontal_rule
|
|
419
419
|
}, Po = {
|
|
420
420
|
...S.marks,
|
|
@@ -425,56 +425,56 @@ const Mo = Mt.create({
|
|
|
425
425
|
mixable: !0,
|
|
426
426
|
expelEnclosingWhitespace: !0
|
|
427
427
|
},
|
|
428
|
-
[
|
|
428
|
+
[ao.name]: {
|
|
429
429
|
open: " _",
|
|
430
430
|
close: "_ ",
|
|
431
431
|
mixable: !0,
|
|
432
432
|
expelEnclosingWhitespace: !0
|
|
433
433
|
},
|
|
434
|
-
[
|
|
434
|
+
[Te.name]: {
|
|
435
435
|
open: "==",
|
|
436
436
|
close: "==",
|
|
437
437
|
mixable: !0,
|
|
438
438
|
expelEnclosingWhitespace: !0
|
|
439
439
|
},
|
|
440
|
-
[
|
|
440
|
+
[Ge.name]: {
|
|
441
441
|
open: "<u>",
|
|
442
442
|
close: "</u>",
|
|
443
443
|
mixable: !0,
|
|
444
444
|
expelEnclosingWhitespace: !0
|
|
445
445
|
},
|
|
446
|
-
[
|
|
447
|
-
open(e, o, t,
|
|
448
|
-
return
|
|
446
|
+
[De.name]: {
|
|
447
|
+
open(e, o, t, s) {
|
|
448
|
+
return Be(o, t, s, 1) ? "<" : "[";
|
|
449
449
|
},
|
|
450
|
-
close(e, o, t,
|
|
450
|
+
close(e, o, t, s) {
|
|
451
451
|
const l = o.attrs.canonicalSrc || o.attrs.href;
|
|
452
|
-
return
|
|
452
|
+
return Be(o, t, s, -1) ? ">" : `](${e.esc(l)}${o.attrs.title ? ` ${e.quote(o.attrs.title)}` : ""})`;
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
455
|
};
|
|
456
|
-
function
|
|
456
|
+
function Be(e, o, t, s) {
|
|
457
457
|
if (e.attrs.title || !/^\w+:/.test(e.attrs.href)) return !1;
|
|
458
|
-
const l = o.child(t + (
|
|
458
|
+
const l = o.child(t + (s < 0 ? -1 : 0));
|
|
459
459
|
if (!l.isText || l.text !== e.attrs.href || l.marks[l.marks.length - 1] !== e)
|
|
460
460
|
return !1;
|
|
461
|
-
if (t === (
|
|
462
|
-
const
|
|
463
|
-
return !e.isInSet(
|
|
461
|
+
if (t === (s < 0 ? 1 : o.childCount - 1)) return !0;
|
|
462
|
+
const h = o.child(t + (s < 0 ? -2 : 1));
|
|
463
|
+
return !e.isInSet(h.marks);
|
|
464
464
|
}
|
|
465
|
-
function
|
|
466
|
-
const t = new
|
|
465
|
+
function ge(e, o) {
|
|
466
|
+
const t = new uo(
|
|
467
467
|
Ao,
|
|
468
468
|
Po
|
|
469
|
-
),
|
|
470
|
-
return t.serialize(
|
|
469
|
+
), s = e.nodeFromJSON(o);
|
|
470
|
+
return t.serialize(s, { tightLists: !0 });
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function he(e, o) {
|
|
473
473
|
if (!o) return null;
|
|
474
474
|
const t = io.parse(o);
|
|
475
475
|
if (!t) return null;
|
|
476
|
-
const
|
|
477
|
-
return l.append(document.createComment(o)),
|
|
476
|
+
const s = new DOMParser(), { body: l } = s.parseFromString(t, "text/html");
|
|
477
|
+
return l.append(document.createComment(o)), co.fromSchema(e).parse(l).toJSON();
|
|
478
478
|
}
|
|
479
479
|
const Ho = Ft({
|
|
480
480
|
name: "OrRichTextEditor",
|
|
@@ -510,7 +510,7 @@ const Ho = Ft({
|
|
|
510
510
|
},
|
|
511
511
|
format: {
|
|
512
512
|
type: String,
|
|
513
|
-
default: () =>
|
|
513
|
+
default: () => je.Markup
|
|
514
514
|
},
|
|
515
515
|
label: {
|
|
516
516
|
type: String,
|
|
@@ -550,7 +550,7 @@ const Ho = Ft({
|
|
|
550
550
|
],
|
|
551
551
|
setup(e, o) {
|
|
552
552
|
let t = qt();
|
|
553
|
-
const
|
|
553
|
+
const s = m(), l = m(), h = m(), L = m(), k = m(), D = m(), U = m(), W = m(), G = m(), B = m({
|
|
554
554
|
bold: !1,
|
|
555
555
|
italic: !1,
|
|
556
556
|
underline: !1,
|
|
@@ -565,29 +565,29 @@ const Ho = Ft({
|
|
|
565
565
|
blockquote: !1,
|
|
566
566
|
file: !1,
|
|
567
567
|
source: !1
|
|
568
|
-
}), y = m(e.autofocus), A = [1, 2, 3, 4], P = m(0),
|
|
569
|
-
let
|
|
568
|
+
}), y = m(e.autofocus), A = [1, 2, 3, 4], P = m(0), E = m(""), i = m(!1), H = m(!1), d = m(""), v = m(""), ce = m(0), be = m(""), { isMobile: ke } = pt();
|
|
569
|
+
let ye = Et(s, {
|
|
570
570
|
fallbackFocus: ".container",
|
|
571
571
|
allowOutsideClick: !0
|
|
572
572
|
});
|
|
573
|
-
Vt(
|
|
574
|
-
var
|
|
575
|
-
const
|
|
576
|
-
if (k.value && l.value &&
|
|
573
|
+
Vt(h, $t((r) => {
|
|
574
|
+
var p, g;
|
|
575
|
+
const u = r[0], { width: c } = u.contentRect;
|
|
576
|
+
if (k.value && l.value && Ce.value) {
|
|
577
577
|
let C = 0;
|
|
578
|
-
C = ((
|
|
579
|
-
const M =
|
|
580
|
-
|
|
578
|
+
C = ((g = (p = l.value.firstElementChild) == null ? void 0 : p.firstElementChild) == null ? void 0 : g.offsetWidth) + 16;
|
|
579
|
+
const M = c / C - 2;
|
|
580
|
+
ce.value = Math.round(Ce.value - M);
|
|
581
581
|
}
|
|
582
582
|
}, 10)), zt(() => {
|
|
583
583
|
t.value = new At({
|
|
584
584
|
onUpdate: ({ editor: r }) => {
|
|
585
|
-
y.value = !0,
|
|
586
|
-
const
|
|
587
|
-
e.format === "markdown" ? (
|
|
585
|
+
y.value = !0, me();
|
|
586
|
+
const u = r.getHTML(), c = r.getText();
|
|
587
|
+
e.format === "markdown" ? (E.value = ge(r.schema, r.getJSON()), F.value = E.value) : F.value = c === "" ? c : u;
|
|
588
588
|
},
|
|
589
589
|
onCreate: ({ editor: r }) => {
|
|
590
|
-
e.format === "markdown" ? r.commands.setContent(
|
|
590
|
+
e.format === "markdown" ? r.commands.setContent(he(r.schema, F.value)) : r.commands.setContent(F.value);
|
|
591
591
|
},
|
|
592
592
|
onFocus(r) {
|
|
593
593
|
o.emit("focus", r);
|
|
@@ -595,7 +595,7 @@ const Ho = Ft({
|
|
|
595
595
|
onBlur(r) {
|
|
596
596
|
o.emit("blur", r);
|
|
597
597
|
},
|
|
598
|
-
element:
|
|
598
|
+
element: s.value,
|
|
599
599
|
autofocus: e.autofocus,
|
|
600
600
|
enableInputRules: !0,
|
|
601
601
|
enablePasteRules: !0,
|
|
@@ -609,40 +609,40 @@ const Ho = Ft({
|
|
|
609
609
|
orderedList: !1,
|
|
610
610
|
blockquote: !1
|
|
611
611
|
}),
|
|
612
|
-
|
|
612
|
+
We.configure({
|
|
613
613
|
HTMLAttributes: {
|
|
614
614
|
class: "or-cm-paragraph my-xs"
|
|
615
615
|
}
|
|
616
616
|
}),
|
|
617
|
-
|
|
617
|
+
ze.configure({
|
|
618
618
|
HTMLAttributes: {
|
|
619
619
|
class: "or-cm-bulletList mx-lg my-xs list-disc"
|
|
620
620
|
}
|
|
621
621
|
}),
|
|
622
|
-
|
|
622
|
+
Ue.configure({
|
|
623
623
|
HTMLAttributes: {
|
|
624
624
|
class: "or-cm-orderedList mx-lg my-xs list-decimal"
|
|
625
625
|
}
|
|
626
626
|
}),
|
|
627
|
-
|
|
627
|
+
qe.configure({
|
|
628
628
|
HTMLAttributes: {
|
|
629
629
|
class: "or-cm-blockquote my-sm mx-lg px-lg border-l-2 border-outline"
|
|
630
630
|
}
|
|
631
631
|
}),
|
|
632
632
|
Ht.configure({ levels: A }).extend({
|
|
633
633
|
levels: A,
|
|
634
|
-
renderHTML({ node: r, HTMLAttributes:
|
|
634
|
+
renderHTML({ node: r, HTMLAttributes: u }) {
|
|
635
635
|
return [
|
|
636
636
|
"h" + r.attrs.level,
|
|
637
|
-
Pt(
|
|
637
|
+
Pt(u, {
|
|
638
638
|
class: `typography-headline-${r.attrs.level} my-xs`
|
|
639
639
|
}),
|
|
640
640
|
0
|
|
641
641
|
];
|
|
642
642
|
}
|
|
643
643
|
}),
|
|
644
|
-
|
|
645
|
-
|
|
644
|
+
Ge,
|
|
645
|
+
De.configure({
|
|
646
646
|
openOnClick: !0,
|
|
647
647
|
linkOnPaste: !0,
|
|
648
648
|
autolink: !1,
|
|
@@ -652,7 +652,7 @@ const Ho = Ft({
|
|
|
652
652
|
class: "or-cm-link text-primary cursor-pointer"
|
|
653
653
|
}
|
|
654
654
|
}),
|
|
655
|
-
|
|
655
|
+
Te,
|
|
656
656
|
Rt.configure({
|
|
657
657
|
placeholder: e.placeholder,
|
|
658
658
|
emptyEditorClass: "or-cm-placeholder text-outline is-editor-empty"
|
|
@@ -666,38 +666,38 @@ const Ho = Ft({
|
|
|
666
666
|
parseOptions: {
|
|
667
667
|
preserveWhitespace: !0
|
|
668
668
|
}
|
|
669
|
-
}),
|
|
669
|
+
}), me(), ye.activate();
|
|
670
670
|
}), Tt(() => {
|
|
671
671
|
var r;
|
|
672
672
|
(r = t.value) == null || r.destroy();
|
|
673
|
-
}), It(
|
|
674
|
-
y.value = !1,
|
|
673
|
+
}), It(h, () => {
|
|
674
|
+
y.value = !1, ye.deactivate();
|
|
675
675
|
});
|
|
676
|
-
const
|
|
676
|
+
const F = w({
|
|
677
677
|
get: () => e.modelValue,
|
|
678
678
|
set: (r) => {
|
|
679
679
|
o.emit("input", r), o.emit("update:modelValue", r);
|
|
680
680
|
}
|
|
681
|
-
}),
|
|
682
|
-
const r =
|
|
683
|
-
let
|
|
684
|
-
return e.toolbar.forEach((
|
|
685
|
-
|
|
686
|
-
}),
|
|
687
|
-
}),
|
|
688
|
-
var r,
|
|
689
|
-
|
|
690
|
-
},
|
|
691
|
-
var
|
|
692
|
-
const
|
|
693
|
-
(
|
|
694
|
-
},
|
|
695
|
-
var
|
|
681
|
+
}), Xe = w(() => e.toolbar.flat().indexOf("heading")), Ye = w(() => (r) => Ke[r]), Ze = w(() => (r) => Qe[r]), xe = w(() => P.value && B.value.heading ? `format_h${P.value}` : "format_paragraph"), Ce = w(() => e.toolbar.flat().length), de = w(() => {
|
|
682
|
+
const r = ce.value, u = e.toolbar.flat();
|
|
683
|
+
let c = new Set(u.slice(u.length - r, u.length));
|
|
684
|
+
return e.toolbar.forEach((p) => {
|
|
685
|
+
p.some((g) => c.has(g)) && p.forEach((g) => c.add(g));
|
|
686
|
+
}), c;
|
|
687
|
+
}), _e = () => {
|
|
688
|
+
var r, u, c;
|
|
689
|
+
me(), y.value = !0, (r = t.value) == null || r.commands.focus(), P.value = ((c = (u = t.value) == null ? void 0 : u.getAttributes("heading")) == null ? void 0 : c.level) || 0;
|
|
690
|
+
}, et = (r) => ke.value ? !0 : gt(r) ? !r.some((c) => de.value.has(c)) : !de.value.has(r), tt = (r) => {
|
|
691
|
+
var p, g, C, M;
|
|
692
|
+
const c = r.target.value;
|
|
693
|
+
(g = t.value) == null || g.commands.setContent(he((p = t.value) == null ? void 0 : p.schema, c)), E.value = ge((C = t.value) == null ? void 0 : C.schema, (M = t.value) == null ? void 0 : M.getJSON()), F.value = E.value;
|
|
694
|
+
}, ot = (r, u) => {
|
|
695
|
+
var c, p, g, C, M, J, j, K, Q, X, Y, Z, x, _, ee, te, oe;
|
|
696
696
|
switch (r) {
|
|
697
697
|
case "source":
|
|
698
|
-
|
|
699
|
-
var
|
|
700
|
-
return (
|
|
698
|
+
i.value = !i.value, be.value = ge((c = t.value) == null ? void 0 : c.schema, (p = t.value) == null ? void 0 : p.getJSON()), (C = L.value) == null || C.style.setProperty("height", `${((g = s.value) == null ? void 0 : g.offsetHeight) || 88}px`), Ut(() => {
|
|
699
|
+
var R;
|
|
700
|
+
return (R = L.value) == null ? void 0 : R.focus();
|
|
701
701
|
});
|
|
702
702
|
break;
|
|
703
703
|
case "bulletList":
|
|
@@ -706,10 +706,10 @@ const Ho = Ft({
|
|
|
706
706
|
break;
|
|
707
707
|
case "link":
|
|
708
708
|
if (t.value) {
|
|
709
|
-
const
|
|
710
|
-
d.value =
|
|
709
|
+
const R = ((j = t.value) == null ? void 0 : j.state.selection.$anchor.pos) || 0, { from: fe, to: ut, empty: ct } = t.value.state.selection, pe = (K = t.value.view.state.doc.nodeAt(R)) == null ? void 0 : K.marks.filter((mt) => mt.type.name === "link"), dt = pe != null && pe.length && ((Q = t.value.view.state.doc.nodeAt(R)) == null ? void 0 : Q.text) || "";
|
|
710
|
+
d.value = ct ? dt : t.value.state.doc.textBetween(fe, ut, " "), v.value = t.value.getAttributes("link").href || "";
|
|
711
711
|
}
|
|
712
|
-
|
|
712
|
+
H.value = !H.value;
|
|
713
713
|
break;
|
|
714
714
|
case "blockquote":
|
|
715
715
|
(X = t.value) == null || X.chain().toggleBlockquote().run();
|
|
@@ -718,73 +718,82 @@ const Ho = Ft({
|
|
|
718
718
|
B.value.codeBlock ? (Z = t.value) == null || Z.commands.setNode("paragraph") : (Y = t.value) == null || Y.commands.setNode(r, { language: "javascript" });
|
|
719
719
|
break;
|
|
720
720
|
case "heading":
|
|
721
|
-
|
|
721
|
+
u ? (P.value = u, (_ = t.value) == null || _.commands.toggleHeading({ level: u })) : ((x = t.value) == null || x.commands.setParagraph(), P.value = 0);
|
|
722
722
|
break;
|
|
723
723
|
case "undo":
|
|
724
724
|
case "redo":
|
|
725
|
-
r === "undo" ? (
|
|
725
|
+
r === "undo" ? (ee = t.value) == null || ee.commands.undo() : (te = t.value) == null || te.commands.redo();
|
|
726
726
|
break;
|
|
727
727
|
case "file":
|
|
728
728
|
o.emit("file-upload");
|
|
729
729
|
break;
|
|
730
730
|
default:
|
|
731
|
-
(
|
|
731
|
+
(oe = t.value) == null || oe.chain().toggleMark(r).run();
|
|
732
732
|
break;
|
|
733
733
|
}
|
|
734
|
-
},
|
|
735
|
-
var
|
|
736
|
-
|
|
737
|
-
const r = (C = t.value) == null ? void 0 : C.state.selection.empty,
|
|
738
|
-
|
|
739
|
-
href:
|
|
734
|
+
}, rt = async () => {
|
|
735
|
+
var g, C, M, J, j, K, Q, X, Y, Z, x, _, ee, te, oe;
|
|
736
|
+
v.value === "" && ((g = t.value) == null || g.chain().focus().extendMarkRange("link").unsetLink().run());
|
|
737
|
+
const r = (C = t.value) == null ? void 0 : C.state.selection.empty, u = ((M = t.value) == null ? void 0 : M.state.selection.$anchor.pos) || 0, c = (j = (J = t.value) == null ? void 0 : J.view.state.doc.nodeAt(u)) == null ? void 0 : j.marks.filter((R) => R.type.name === "link"), p = c != null && c.length ? (Q = (K = t.value) == null ? void 0 : K.view.state.doc.nodeAt(u)) == null ? void 0 : Q.text : "";
|
|
738
|
+
v.value && r && !p && ((X = t.value) == null || X.chain().focus().setMark("link", {
|
|
739
|
+
href: v.value,
|
|
740
|
+
target: "__blank"
|
|
741
|
+
}).command(({ tr: R }) => {
|
|
742
|
+
const fe = d.value[d.value.length - 1] === " " ? d.value : `${d.value} `;
|
|
743
|
+
return R.insertText(fe), !0;
|
|
744
|
+
}).run()), v.value && p === d.value && r && ((Y = t.value) == null || Y.chain().extendMarkRange("link").updateAttributes("link", {
|
|
745
|
+
href: v.value
|
|
746
|
+
}).run()), v.value && d.value !== p && !r && ((te = t.value) == null || te.chain().focus().insertContentAt({
|
|
747
|
+
from: (Z = t.value) == null ? void 0 : Z.state.selection.from,
|
|
748
|
+
to: (x = t.value) == null ? void 0 : x.state.selection.to
|
|
749
|
+
}, d.value).setTextSelection({
|
|
750
|
+
from: (_ = t.value) == null ? void 0 : _.state.selection.from,
|
|
751
|
+
to: ((ee = t.value) == null ? void 0 : ee.state.selection.from) + d.value.length
|
|
752
|
+
}).setMark("link", {
|
|
753
|
+
href: v.value,
|
|
740
754
|
target: "__blank"
|
|
741
|
-
}).
|
|
742
|
-
|
|
743
|
-
return z.insertText(_), !0;
|
|
744
|
-
}).run()), b.value && h === d.value && r && ((Y = t.value) == null || Y.chain().extendMarkRange("link").updateAttributes("link", {
|
|
745
|
-
href: b.value
|
|
746
|
-
}).run()), b.value && !r && ((Z = t.value) == null || Z.chain().focus().setMark("link", {
|
|
747
|
-
href: b.value,
|
|
755
|
+
}).run()), v.value && !r && ((oe = t.value) == null || oe.chain().focus().setMark("link", {
|
|
756
|
+
href: v.value,
|
|
748
757
|
target: "__blank"
|
|
749
|
-
}).run()), d.value = "",
|
|
750
|
-
},
|
|
751
|
-
|
|
752
|
-
},
|
|
753
|
-
e.toolbar.flat().forEach((
|
|
754
|
-
var
|
|
755
|
-
|
|
758
|
+
}).run()), d.value = "", v.value = "", H.value = !1;
|
|
759
|
+
}, at = () => {
|
|
760
|
+
H.value = !1;
|
|
761
|
+
}, me = () => {
|
|
762
|
+
e.toolbar.flat().forEach((u) => {
|
|
763
|
+
var c;
|
|
764
|
+
u === "source" ? B.value[u] = i.value : B.value[u] = ((c = t.value) == null ? void 0 : c.isActive(u)) || !1;
|
|
756
765
|
});
|
|
757
766
|
};
|
|
758
767
|
Dt([
|
|
759
768
|
t,
|
|
760
|
-
|
|
769
|
+
F,
|
|
761
770
|
() => e.disabled
|
|
762
771
|
], ([
|
|
763
772
|
r,
|
|
764
|
-
|
|
765
|
-
|
|
773
|
+
u,
|
|
774
|
+
c
|
|
766
775
|
]) => {
|
|
767
|
-
|
|
776
|
+
u !== (r == null ? void 0 : r.getHTML()) && e.format !== "markdown" && (r == null || r.commands.setContent(u)), u !== E.value && e.format === "markdown" && (r == null || r.commands.setContent(he(r == null ? void 0 : r.schema, u))), r == null || r.setEditable(!c);
|
|
768
777
|
});
|
|
769
778
|
const nt = w(() => [
|
|
770
779
|
"or-rich-text-editor-v3",
|
|
771
780
|
...fo
|
|
772
|
-
]), at = w(() => [
|
|
773
|
-
...po
|
|
774
781
|
]), lt = w(() => [
|
|
775
|
-
...
|
|
782
|
+
...po
|
|
776
783
|
]), st = w(() => [
|
|
784
|
+
...go
|
|
785
|
+
]), it = w(() => [
|
|
777
786
|
"tiptap-editor-v3",
|
|
778
787
|
...ho
|
|
779
788
|
]);
|
|
780
789
|
return {
|
|
781
|
-
root:
|
|
790
|
+
root: h,
|
|
782
791
|
rootStyles: nt,
|
|
783
792
|
toolbarRef: l,
|
|
784
|
-
toolbarStyles:
|
|
785
|
-
toolbarGroupStyles:
|
|
786
|
-
controlRef:
|
|
787
|
-
controlStyles:
|
|
793
|
+
toolbarStyles: lt,
|
|
794
|
+
toolbarGroupStyles: st,
|
|
795
|
+
controlRef: s,
|
|
796
|
+
controlStyles: it,
|
|
788
797
|
editor: t,
|
|
789
798
|
containerRef: k,
|
|
790
799
|
toolbarButtonRef: W,
|
|
@@ -792,84 +801,84 @@ const Ho = Ft({
|
|
|
792
801
|
textareaRef: L,
|
|
793
802
|
morePopoverRef: U,
|
|
794
803
|
menuRef: G,
|
|
795
|
-
handleToolbarClick:
|
|
796
|
-
handleEditorClick:
|
|
804
|
+
handleToolbarClick: ot,
|
|
805
|
+
handleEditorClick: _e,
|
|
797
806
|
isActive: B,
|
|
798
|
-
getRichTextEditorIcon:
|
|
799
|
-
getRichTextEditorTooltipIcon:
|
|
800
|
-
getIndexOfHeading:
|
|
807
|
+
getRichTextEditorIcon: Ye,
|
|
808
|
+
getRichTextEditorTooltipIcon: Ze,
|
|
809
|
+
getIndexOfHeading: Xe,
|
|
801
810
|
headingLevels: A,
|
|
802
|
-
headingIcon:
|
|
803
|
-
attachLink:
|
|
804
|
-
discardLink:
|
|
805
|
-
isOpenLinkModal:
|
|
811
|
+
headingIcon: xe,
|
|
812
|
+
attachLink: rt,
|
|
813
|
+
discardLink: at,
|
|
814
|
+
isOpenLinkModal: H,
|
|
806
815
|
text: d,
|
|
807
|
-
link:
|
|
816
|
+
link: v,
|
|
808
817
|
isFocused: y,
|
|
809
|
-
isVisible:
|
|
810
|
-
isMobile:
|
|
811
|
-
countOfNotVisibleTools:
|
|
812
|
-
notVisibleTools:
|
|
813
|
-
handleInput:
|
|
814
|
-
model:
|
|
815
|
-
disableMarkdown:
|
|
816
|
-
sourceValue:
|
|
818
|
+
isVisible: et,
|
|
819
|
+
isMobile: ke,
|
|
820
|
+
countOfNotVisibleTools: ce,
|
|
821
|
+
notVisibleTools: de,
|
|
822
|
+
handleInput: tt,
|
|
823
|
+
model: F,
|
|
824
|
+
disableMarkdown: i,
|
|
825
|
+
sourceValue: be,
|
|
817
826
|
activeHeadingLevel: P
|
|
818
827
|
};
|
|
819
828
|
}
|
|
820
829
|
}), Ro = ["disabled"], No = ["disabled"], Vo = {
|
|
821
|
-
class: /* @__PURE__ */
|
|
830
|
+
class: /* @__PURE__ */ V(["p-sm", "overflow-auto", "min-h-[88px]", "h-full"])
|
|
822
831
|
}, $o = ["activated"], Io = { class: "flex p-sm gap-md" }, Eo = {
|
|
823
|
-
class: /* @__PURE__ */
|
|
832
|
+
class: /* @__PURE__ */ V(["layout-column", "gap-md"])
|
|
824
833
|
}, Fo = {
|
|
825
|
-
class: /* @__PURE__ */
|
|
834
|
+
class: /* @__PURE__ */ V(["layout-row-reverse", "gap-md"])
|
|
826
835
|
};
|
|
827
|
-
function qo(e, o, t,
|
|
828
|
-
const L = O("OrLabel"), k = O("OrIconButton"), D = O("OrInputBox"), U = O("OrHint"), W = O("OrError"), G = O("OrPopover"), B = O("OrMenuItem"), y = O("OrMenu"), A = O("OrInput"), P = O("OrButton"),
|
|
829
|
-
return f(),
|
|
836
|
+
function qo(e, o, t, s, l, h) {
|
|
837
|
+
const L = O("OrLabel"), k = O("OrIconButton"), D = O("OrInputBox"), U = O("OrHint"), W = O("OrError"), G = O("OrPopover"), B = O("OrMenuItem"), y = O("OrMenu"), A = O("OrInput"), P = O("OrButton"), E = O("OrModal");
|
|
838
|
+
return f(), q("div", {
|
|
830
839
|
ref: "root",
|
|
831
|
-
class:
|
|
840
|
+
class: V(e.rootStyles)
|
|
832
841
|
}, [
|
|
833
|
-
e.$slots.label || e.$slots.addon || e.label ? (f(),
|
|
842
|
+
e.$slots.label || e.$slots.addon || e.label ? (f(), N(L, {
|
|
834
843
|
key: 0,
|
|
835
844
|
variant: "input",
|
|
836
845
|
required: e.required,
|
|
837
846
|
disabled: e.disabled
|
|
838
847
|
}, {
|
|
839
|
-
addon:
|
|
840
|
-
|
|
848
|
+
addon: b(() => [
|
|
849
|
+
re(e.$slots, "addon", {}, void 0, !0)
|
|
841
850
|
]),
|
|
842
|
-
default:
|
|
843
|
-
|
|
844
|
-
|
|
851
|
+
default: b(() => [
|
|
852
|
+
re(e.$slots, "label", {}, () => [
|
|
853
|
+
$(ae(e.label), 1)
|
|
845
854
|
], !0)
|
|
846
855
|
]),
|
|
847
856
|
_: 3
|
|
848
857
|
}, 8, ["required", "disabled"])) : T("", !0),
|
|
849
|
-
|
|
858
|
+
I(D, {
|
|
850
859
|
ref: "containerRef",
|
|
851
860
|
class: "grow",
|
|
852
861
|
direction: "column",
|
|
853
862
|
invalid: !!e.error,
|
|
854
863
|
disabled: e.disabled,
|
|
855
|
-
onClick: o[4] || (o[4] = (
|
|
864
|
+
onClick: o[4] || (o[4] = (i) => e.handleEditorClick())
|
|
856
865
|
}, {
|
|
857
|
-
default:
|
|
858
|
-
|
|
866
|
+
default: b(() => [
|
|
867
|
+
z("div", {
|
|
859
868
|
ref: "toolbarRef",
|
|
860
|
-
class:
|
|
869
|
+
class: V(e.toolbarStyles),
|
|
861
870
|
disabled: e.disabled || !e.isFocused
|
|
862
871
|
}, [
|
|
863
|
-
(f(!0),
|
|
864
|
-
key:
|
|
865
|
-
class:
|
|
872
|
+
(f(!0), q(ne, null, le(e.toolbar, (i, H) => (f(), q("div", {
|
|
873
|
+
key: H,
|
|
874
|
+
class: V([...e.toolbarGroupStyles, { hidden: !e.isVisible(i) }]),
|
|
866
875
|
disabled: e.disabled || !e.isFocused
|
|
867
876
|
}, [
|
|
868
|
-
(f(!0),
|
|
877
|
+
(f(!0), q(ne, null, le(i, (d) => (f(), q("div", {
|
|
869
878
|
key: d,
|
|
870
|
-
class:
|
|
879
|
+
class: V(["flex gap-md", { hidden: !e.isVisible(d) }])
|
|
871
880
|
}, [
|
|
872
|
-
d === "heading" ? (f(),
|
|
881
|
+
d === "heading" ? (f(), N(k, {
|
|
873
882
|
key: 0,
|
|
874
883
|
ref_for: !0,
|
|
875
884
|
ref: "toolbarButtonRef",
|
|
@@ -877,158 +886,158 @@ function qo(e, o, t, i, l, g) {
|
|
|
877
886
|
tooltip: { content: d, placement: "top" },
|
|
878
887
|
selected: e.isActive[d],
|
|
879
888
|
disabled: e.disabled || !e.isFocused,
|
|
880
|
-
onClick: o[0] || (o[0] = (
|
|
881
|
-
}, null, 8, ["icon", "tooltip", "selected", "disabled"])) : e.isVisible(d) ? (f(),
|
|
889
|
+
onClick: o[0] || (o[0] = (v) => e.menuRef && e.menuRef.toggle())
|
|
890
|
+
}, null, 8, ["icon", "tooltip", "selected", "disabled"])) : e.isVisible(d) ? (f(), N(k, {
|
|
882
891
|
key: 1,
|
|
883
892
|
icon: { icon: e.getRichTextEditorIcon(d), variant: "inherit" },
|
|
884
893
|
tooltip: { content: e.getRichTextEditorTooltipIcon(d), placement: "top" },
|
|
885
894
|
selected: e.isActive[d],
|
|
886
895
|
disabled: e.disabled || !e.isFocused,
|
|
887
|
-
onClick: (
|
|
896
|
+
onClick: (v) => e.handleToolbarClick(d)
|
|
888
897
|
}, null, 8, ["icon", "tooltip", "selected", "disabled", "onClick"])) : T("", !0)
|
|
889
898
|
], 2))), 128))
|
|
890
899
|
], 10, No))), 128)),
|
|
891
|
-
e.countOfNotVisibleTools > 0 && !e.isMobile ? (f(),
|
|
900
|
+
e.countOfNotVisibleTools > 0 && !e.isMobile ? (f(), N(k, {
|
|
892
901
|
key: 0,
|
|
893
902
|
ref: "moreButtonRef",
|
|
894
|
-
class:
|
|
903
|
+
class: V(["mx-sm"]),
|
|
895
904
|
icon: { icon: "more_horiz", variant: "inherit" },
|
|
896
905
|
disabled: e.disabled || !e.isFocused,
|
|
897
906
|
"force-state": e.morePopoverRef && e.morePopoverRef.state === "open" ? "hover" : void 0,
|
|
898
|
-
onClick: o[1] || (o[1] = (
|
|
907
|
+
onClick: o[1] || (o[1] = (i) => e.morePopoverRef && e.morePopoverRef.open())
|
|
899
908
|
}, null, 8, ["disabled", "force-state"])) : T("", !0)
|
|
900
909
|
], 10, Ro),
|
|
901
|
-
|
|
902
|
-
|
|
910
|
+
z("div", Vo, [
|
|
911
|
+
se(z("textarea", {
|
|
903
912
|
ref: "textareaRef",
|
|
904
|
-
"onUpdate:modelValue": o[2] || (o[2] = (
|
|
913
|
+
"onUpdate:modelValue": o[2] || (o[2] = (i) => e.sourceValue = i),
|
|
905
914
|
activated: e.disableMarkdown,
|
|
906
915
|
class: "block w-full h-full resize-none border-none outline-none bg-transparent typography-body-2-regular",
|
|
907
|
-
onInput: o[3] || (o[3] = (...
|
|
916
|
+
onInput: o[3] || (o[3] = (...i) => e.handleInput && e.handleInput(...i))
|
|
908
917
|
}, null, 40, $o), [
|
|
909
|
-
[
|
|
918
|
+
[ie, e.disableMarkdown],
|
|
910
919
|
[Wt, e.sourceValue]
|
|
911
920
|
]),
|
|
912
|
-
|
|
921
|
+
se(z("div", {
|
|
913
922
|
ref: "controlRef",
|
|
914
|
-
class:
|
|
923
|
+
class: V(e.controlStyles)
|
|
915
924
|
}, null, 2), [
|
|
916
|
-
[
|
|
925
|
+
[ie, !e.disableMarkdown]
|
|
917
926
|
]),
|
|
918
|
-
|
|
927
|
+
re(e.$slots, "files", {}, void 0, !0)
|
|
919
928
|
])
|
|
920
929
|
]),
|
|
921
930
|
_: 3
|
|
922
931
|
}, 8, ["invalid", "disabled"]),
|
|
923
|
-
e.$slots.hint || e.hint ?
|
|
932
|
+
e.$slots.hint || e.hint ? se((f(), N(U, {
|
|
924
933
|
key: 1,
|
|
925
934
|
disabled: e.disabled
|
|
926
935
|
}, {
|
|
927
|
-
default:
|
|
928
|
-
|
|
929
|
-
|
|
936
|
+
default: b(() => [
|
|
937
|
+
re(e.$slots, "hint", {}, () => [
|
|
938
|
+
$(ae(e.hint), 1)
|
|
930
939
|
], !0)
|
|
931
940
|
]),
|
|
932
941
|
_: 3
|
|
933
942
|
}, 8, ["disabled"])), [
|
|
934
|
-
[
|
|
943
|
+
[ie, !e.error]
|
|
935
944
|
]) : T("", !0),
|
|
936
|
-
|
|
937
|
-
default:
|
|
938
|
-
|
|
945
|
+
se(I(W, { disabled: e.disabled }, {
|
|
946
|
+
default: b(() => [
|
|
947
|
+
$(ae(e.error), 1)
|
|
939
948
|
]),
|
|
940
949
|
_: 1
|
|
941
950
|
}, 8, ["disabled"]), [
|
|
942
|
-
[
|
|
951
|
+
[ie, typeof e.error == "string" && e.error.length > 0]
|
|
943
952
|
]),
|
|
944
|
-
e.moreButtonRef ? (f(),
|
|
953
|
+
e.moreButtonRef ? (f(), N(G, {
|
|
945
954
|
key: 2,
|
|
946
955
|
ref: "morePopoverRef",
|
|
947
956
|
trigger: e.moreButtonRef && e.moreButtonRef.root,
|
|
948
957
|
placement: "top-end"
|
|
949
958
|
}, {
|
|
950
|
-
default:
|
|
951
|
-
|
|
952
|
-
(f(!0),
|
|
953
|
-
key:
|
|
954
|
-
icon: { icon: e.getRichTextEditorIcon(
|
|
955
|
-
tooltip: { content: e.getRichTextEditorTooltipIcon(
|
|
956
|
-
selected: e.isActive[
|
|
957
|
-
onClick: (
|
|
959
|
+
default: b(() => [
|
|
960
|
+
z("div", Io, [
|
|
961
|
+
(f(!0), q(ne, null, le(e.notVisibleTools, (i) => (f(), N(k, {
|
|
962
|
+
key: i,
|
|
963
|
+
icon: { icon: e.getRichTextEditorIcon(i), variant: "inherit" },
|
|
964
|
+
tooltip: { content: e.getRichTextEditorTooltipIcon(i), placement: "top" },
|
|
965
|
+
selected: e.isActive[i],
|
|
966
|
+
onClick: (H) => e.handleToolbarClick(i)
|
|
958
967
|
}, null, 8, ["icon", "tooltip", "selected", "onClick"]))), 128))
|
|
959
968
|
])
|
|
960
969
|
]),
|
|
961
970
|
_: 1
|
|
962
971
|
}, 8, ["trigger"])) : T("", !0),
|
|
963
|
-
e.toolbarButtonRef ? (f(),
|
|
972
|
+
e.toolbarButtonRef ? (f(), N(y, {
|
|
964
973
|
key: 3,
|
|
965
974
|
ref: "menuRef",
|
|
966
975
|
trigger: e.toolbarButtonRef[e.getIndexOfHeading] && e.toolbarButtonRef[e.getIndexOfHeading].root,
|
|
967
976
|
placement: "bottom-start"
|
|
968
977
|
}, {
|
|
969
|
-
default:
|
|
970
|
-
(f(!0),
|
|
971
|
-
key:
|
|
972
|
-
selected: e.activeHeadingLevel ===
|
|
973
|
-
onClick: (
|
|
978
|
+
default: b(() => [
|
|
979
|
+
(f(!0), q(ne, null, le(e.headingLevels, (i) => (f(), N(B, {
|
|
980
|
+
key: i,
|
|
981
|
+
selected: e.activeHeadingLevel === i,
|
|
982
|
+
onClick: (H) => e.handleToolbarClick("heading", i)
|
|
974
983
|
}, {
|
|
975
|
-
default:
|
|
976
|
-
|
|
984
|
+
default: b(() => [
|
|
985
|
+
$(" Heading " + ae(i), 1)
|
|
977
986
|
]),
|
|
978
987
|
_: 2
|
|
979
988
|
}, 1032, ["selected", "onClick"]))), 128)),
|
|
980
|
-
|
|
989
|
+
I(B, {
|
|
981
990
|
selected: !e.activeHeadingLevel,
|
|
982
|
-
onClick: o[5] || (o[5] = (
|
|
991
|
+
onClick: o[5] || (o[5] = (i) => e.handleToolbarClick("heading"))
|
|
983
992
|
}, {
|
|
984
|
-
default:
|
|
985
|
-
|
|
993
|
+
default: b(() => [
|
|
994
|
+
$(" None ")
|
|
986
995
|
]),
|
|
987
996
|
_: 1
|
|
988
997
|
}, 8, ["selected"])
|
|
989
998
|
]),
|
|
990
999
|
_: 1
|
|
991
1000
|
}, 8, ["trigger"])) : T("", !0),
|
|
992
|
-
|
|
1001
|
+
I(E, {
|
|
993
1002
|
"is-open": e.isOpenLinkModal,
|
|
994
1003
|
size: "s"
|
|
995
1004
|
}, {
|
|
996
|
-
header:
|
|
997
|
-
|
|
1005
|
+
header: b(() => [
|
|
1006
|
+
$(" Add Link ")
|
|
998
1007
|
]),
|
|
999
|
-
footer:
|
|
1000
|
-
|
|
1001
|
-
|
|
1008
|
+
footer: b(() => [
|
|
1009
|
+
z("div", Fo, [
|
|
1010
|
+
I(P, {
|
|
1002
1011
|
variant: "contained",
|
|
1003
|
-
onClick: o[8] || (o[8] = (
|
|
1012
|
+
onClick: o[8] || (o[8] = (i) => e.attachLink())
|
|
1004
1013
|
}, {
|
|
1005
|
-
default:
|
|
1006
|
-
|
|
1014
|
+
default: b(() => [
|
|
1015
|
+
$(" Save ")
|
|
1007
1016
|
]),
|
|
1008
1017
|
_: 1
|
|
1009
1018
|
}),
|
|
1010
|
-
|
|
1019
|
+
I(P, {
|
|
1011
1020
|
variant: "outlined",
|
|
1012
|
-
onClick: o[9] || (o[9] = (
|
|
1021
|
+
onClick: o[9] || (o[9] = (i) => e.discardLink())
|
|
1013
1022
|
}, {
|
|
1014
|
-
default:
|
|
1015
|
-
|
|
1023
|
+
default: b(() => [
|
|
1024
|
+
$(" Cancel ")
|
|
1016
1025
|
]),
|
|
1017
1026
|
_: 1
|
|
1018
1027
|
})
|
|
1019
1028
|
])
|
|
1020
1029
|
]),
|
|
1021
|
-
default:
|
|
1022
|
-
|
|
1023
|
-
|
|
1030
|
+
default: b(() => [
|
|
1031
|
+
z("div", Eo, [
|
|
1032
|
+
I(A, {
|
|
1024
1033
|
modelValue: e.text,
|
|
1025
|
-
"onUpdate:modelValue": o[6] || (o[6] = (
|
|
1034
|
+
"onUpdate:modelValue": o[6] || (o[6] = (i) => e.text = i),
|
|
1026
1035
|
label: "Text",
|
|
1027
1036
|
placeholder: "Enter text"
|
|
1028
1037
|
}, null, 8, ["modelValue"]),
|
|
1029
|
-
|
|
1038
|
+
I(A, {
|
|
1030
1039
|
modelValue: e.link,
|
|
1031
|
-
"onUpdate:modelValue": o[7] || (o[7] = (
|
|
1040
|
+
"onUpdate:modelValue": o[7] || (o[7] = (i) => e.link = i),
|
|
1032
1041
|
label: "Link",
|
|
1033
1042
|
placeholder: "Enter link"
|
|
1034
1043
|
}, null, 8, ["modelValue"])
|
|
@@ -1038,11 +1047,11 @@ function qo(e, o, t, i, l, g) {
|
|
|
1038
1047
|
}, 8, ["is-open"])
|
|
1039
1048
|
], 2);
|
|
1040
1049
|
}
|
|
1041
|
-
const Rr = /* @__PURE__ */ mo(Ho, [["render", qo], ["__scopeId", "data-v-
|
|
1050
|
+
const Rr = /* @__PURE__ */ mo(Ho, [["render", qo], ["__scopeId", "data-v-1222a307"]]);
|
|
1042
1051
|
export {
|
|
1043
|
-
|
|
1052
|
+
je as F,
|
|
1044
1053
|
Rr as O,
|
|
1045
|
-
|
|
1046
|
-
|
|
1054
|
+
Ke as R,
|
|
1055
|
+
Qe as a
|
|
1047
1056
|
};
|
|
1048
|
-
//# sourceMappingURL=OrRichTextEditor-
|
|
1057
|
+
//# sourceMappingURL=OrRichTextEditor-DKhL46g9.mjs.map
|