@dialpad/dialtone 9.131.0 → 9.132.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/css/dialtone-default-theme.css +1783 -5185
- package/dist/css/dialtone-default-theme.min.css +1 -1
- package/dist/css/dialtone-docs.json +1 -1
- package/dist/css/dialtone.css +622 -1999
- package/dist/css/dialtone.min.css +1 -1
- package/dist/css/tokens-docs.json +1 -1
- package/dist/tokens/css/tokens-dp-dark.css +104 -265
- package/dist/tokens/css/tokens-expressive-dark.css +104 -265
- package/dist/tokens/css/tokens-expressive-sm-dark.css +104 -265
- package/dist/tokens/css/tokens-tmo-dark.css +104 -265
- package/dist/tokens/doc.json +27983 -30007
- package/dist/tokens/themes/dp-dark.cjs +1 -1
- package/dist/tokens/themes/dp-dark.js +1 -1
- package/dist/tokens/themes/expressive-dark.cjs +1 -1
- package/dist/tokens/themes/expressive-dark.js +1 -1
- package/dist/tokens/themes/expressive-sm-dark.cjs +1 -1
- package/dist/tokens/themes/expressive-sm-dark.js +1 -1
- package/dist/tokens/themes/tmo-dark.cjs +1 -1
- package/dist/tokens/themes/tmo-dark.js +1 -1
- package/dist/tokens/tokens-dp-dark.json +11 -34
- package/dist/tokens/tokens-expressive-dark.json +11 -34
- package/dist/tokens/tokens-expressive-sm-dark.json +11 -34
- package/dist/tokens/tokens-tmo-dark.json +11 -34
- package/dist/vue2/common/emoji/index.cjs +1 -1
- package/dist/vue2/common/emoji/index.cjs.map +1 -1
- package/dist/vue2/common/emoji/index.js +25 -17
- package/dist/vue2/common/emoji/index.js.map +1 -1
- package/dist/vue2/component-documentation.json +1 -1
- package/dist/vue2/lib/emoji/emoji.cjs +1 -1
- package/dist/vue2/lib/emoji/emoji.cjs.map +1 -1
- package/dist/vue2/lib/emoji/emoji.js +16 -16
- package/dist/vue2/lib/emoji/emoji.js.map +1 -1
- package/dist/vue2/lib/message-input/message-input.cjs +1 -1
- package/dist/vue2/lib/message-input/message-input.cjs.map +1 -1
- package/dist/vue2/lib/message-input/message-input.js +15 -7
- package/dist/vue2/lib/message-input/message-input.js.map +1 -1
- package/dist/vue2/lib/rich-text-editor/rich-text-editor.cjs +7 -7
- package/dist/vue2/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
- package/dist/vue2/lib/rich-text-editor/rich-text-editor.js +393 -401
- package/dist/vue2/lib/rich-text-editor/rich-text-editor.js.map +1 -1
- package/dist/vue2/types/common/emoji/index.d.ts.map +1 -1
- package/dist/vue2/types/components/rich_text_editor/extensions/emoji/emoji.d.ts.map +1 -1
- package/dist/vue2/types/components/rich_text_editor/extensions/emoji/suggestion.d.ts +1 -1
- package/dist/vue2/types/components/rich_text_editor/extensions/emoji/suggestion.d.ts.map +1 -1
- package/dist/vue2/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts +1 -1
- package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
- package/dist/vue3/common/emoji/index.cjs +1 -1
- package/dist/vue3/common/emoji/index.cjs.map +1 -1
- package/dist/vue3/common/emoji/index.js +39 -33
- package/dist/vue3/common/emoji/index.js.map +1 -1
- package/dist/vue3/component-documentation.json +1 -1
- package/dist/vue3/lib/emoji/emoji.cjs +1 -1
- package/dist/vue3/lib/emoji/emoji.cjs.map +1 -1
- package/dist/vue3/lib/emoji/emoji.js +17 -17
- package/dist/vue3/lib/emoji/emoji.js.map +1 -1
- package/dist/vue3/lib/message-input/message-input.cjs +1 -1
- package/dist/vue3/lib/message-input/message-input.cjs.map +1 -1
- package/dist/vue3/lib/message-input/message-input.js +60 -52
- package/dist/vue3/lib/message-input/message-input.js.map +1 -1
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs +3 -3
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.js +133 -120
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.js.map +1 -1
- package/dist/vue3/types/common/emoji/index.d.ts.map +1 -1
- package/dist/vue3/types/components/rich_text_editor/extensions/emoji/suggestion.d.ts +1 -1
- package/dist/vue3/types/components/rich_text_editor/extensions/emoji/suggestion.d.ts.map +1 -1
- package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts +2 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { nodeViewProps as _, NodeViewWrapper as y, VueRenderer as w, VueNodeViewRenderer as v, BubbleMenu as H, EditorContent as j, Editor as
|
|
2
|
-
import { Node as
|
|
1
|
+
import { nodeViewProps as _, NodeViewWrapper as y, VueRenderer as w, VueNodeViewRenderer as v, BubbleMenu as H, EditorContent as j, Editor as F } from "../../node_modules/@tiptap/vue-2.js";
|
|
2
|
+
import { Node as N, nodePasteRule as E, InputRule as K, mergeAttributes as m, getMarksBetween as U, combineTransactionSteps as W, getChangedRanges as q, findChildrenInRange as V, Mark as z, nodeInputRule as X, Extension as J } from "@tiptap/core";
|
|
3
3
|
import Y from "@tiptap/extension-blockquote";
|
|
4
4
|
import G from "@tiptap/extension-code-block";
|
|
5
5
|
import Q from "@tiptap/extension-code";
|
|
@@ -14,8 +14,8 @@ import ie from "@tiptap/extension-link";
|
|
|
14
14
|
import oe from "@tiptap/extension-list-item";
|
|
15
15
|
import ae from "@tiptap/extension-ordered-list";
|
|
16
16
|
import le from "@tiptap/extension-strike";
|
|
17
|
-
import
|
|
18
|
-
import
|
|
17
|
+
import ce from "@tiptap/extension-underline";
|
|
18
|
+
import de from "@tiptap/extension-text";
|
|
19
19
|
import ue from "@tiptap/extension-text-align";
|
|
20
20
|
import me from "@tiptap/extension-history";
|
|
21
21
|
import he from "@tiptap/extension-text-style";
|
|
@@ -24,56 +24,40 @@ import pe from "@tiptap/extension-font-family";
|
|
|
24
24
|
import { PluginKey as f, Plugin as ge } from "@tiptap/pm/state";
|
|
25
25
|
import _e from "@tiptap/suggestion";
|
|
26
26
|
import { emojiPattern as O } from "regex-combined-emojis";
|
|
27
|
-
import { n as
|
|
28
|
-
import ye from "../skeleton/skeleton.js";
|
|
27
|
+
import { n as c } from "../../_plugin-vue2_normalizer-DSLOjnn3.js";
|
|
29
28
|
import P from "../emoji/emoji.js";
|
|
30
|
-
import {
|
|
31
|
-
import { emojisIndexed as ke } from "@dialpad/dialtone-emojis";
|
|
29
|
+
import { getEmojiData as ye, emojiRegex as we, stringToUnicode as ve, codeToEmojiData as L, emojiShortCodeRegex as xe } from "../../common/emoji/index.js";
|
|
32
30
|
import be from "../list-item/list-item.js";
|
|
33
31
|
import x from "../stack/stack.js";
|
|
34
|
-
import
|
|
35
|
-
import { getPhoneNumberRegex as
|
|
36
|
-
import
|
|
32
|
+
import b from "tippy.js";
|
|
33
|
+
import { getPhoneNumberRegex as ke, linkRegex as Ce, warnIfUnmounted as Te } from "../../common/utils/index.js";
|
|
34
|
+
import Ee from "@tiptap/extension-image";
|
|
37
35
|
import R from "@tiptap/extension-mention";
|
|
38
36
|
import D from "../link/link.js";
|
|
39
|
-
import { RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS as $, RICH_TEXT_EDITOR_OUTPUT_FORMATS as
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import { DialtoneLocalization as
|
|
45
|
-
import
|
|
46
|
-
const
|
|
37
|
+
import { RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS as $, RICH_TEXT_EDITOR_OUTPUT_FORMATS as Se, RICH_TEXT_EDITOR_AUTOFOCUS_TYPES as Le } from "./rich-text-editor-constants.js";
|
|
38
|
+
import Re from "../avatar/avatar.js";
|
|
39
|
+
import $e from "@dialpad/dialtone-icons/vue2/hash";
|
|
40
|
+
import Ie from "@dialpad/dialtone-icons/vue2/lock";
|
|
41
|
+
import Ae from "deep-equal";
|
|
42
|
+
import { DialtoneLocalization as Be } from "../../localization/index.js";
|
|
43
|
+
import Oe from "../button/button.js";
|
|
44
|
+
const Pe = {
|
|
47
45
|
name: "EmojiComponent",
|
|
48
46
|
components: {
|
|
49
47
|
NodeViewWrapper: y,
|
|
50
|
-
DtEmoji: P
|
|
51
|
-
DtSkeleton: ye
|
|
48
|
+
DtEmoji: P
|
|
52
49
|
},
|
|
53
|
-
props: _
|
|
54
|
-
data() {
|
|
55
|
-
return {
|
|
56
|
-
showSkeleton: !0
|
|
57
|
-
};
|
|
58
|
-
},
|
|
59
|
-
methods: {
|
|
60
|
-
handleImageLoad() {
|
|
61
|
-
this.showSkeleton = !1;
|
|
62
|
-
},
|
|
63
|
-
handleImageError: function(t) {
|
|
64
|
-
this.showSkeleton = !1, t.target.parentNode.remove();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
50
|
+
props: _
|
|
67
51
|
};
|
|
68
|
-
var
|
|
69
|
-
var
|
|
70
|
-
return n("node-view-wrapper", { staticClass: "d-d-inline-block d-va-bottom d-lh0" }, [
|
|
71
|
-
},
|
|
52
|
+
var De = function() {
|
|
53
|
+
var t = this, n = t._self._c;
|
|
54
|
+
return n("node-view-wrapper", { staticClass: "d-d-inline-block d-va-bottom d-lh0" }, [n("dt-emoji", { attrs: { size: "500", code: t.node.attrs.code } })], 1);
|
|
55
|
+
}, Me = [], He = /* @__PURE__ */ c(
|
|
56
|
+
Pe,
|
|
72
57
|
De,
|
|
73
|
-
Me
|
|
74
|
-
He
|
|
58
|
+
Me
|
|
75
59
|
);
|
|
76
|
-
const
|
|
60
|
+
const je = He.exports, Fe = {
|
|
77
61
|
name: "SuggestionList",
|
|
78
62
|
components: {
|
|
79
63
|
DtListItem: be
|
|
@@ -107,8 +91,8 @@ const Ne = je.exports, Fe = {
|
|
|
107
91
|
}
|
|
108
92
|
},
|
|
109
93
|
methods: {
|
|
110
|
-
onKeyDown({ event:
|
|
111
|
-
return
|
|
94
|
+
onKeyDown({ event: e }) {
|
|
95
|
+
return e.key === "ArrowUp" ? (this.upHandler(), !0) : e.key === "ArrowDown" ? (this.downHandler(), !0) : e.key === "Enter" || e.key === "Tab" ? (this.selectHandler(), !0) : !1;
|
|
112
96
|
},
|
|
113
97
|
upHandler() {
|
|
114
98
|
this.selectedIndex = (this.selectedIndex + this.items.length - 1) % this.items.length, this.scrollActiveElementIntoView();
|
|
@@ -118,8 +102,8 @@ const Ne = je.exports, Fe = {
|
|
|
118
102
|
},
|
|
119
103
|
async scrollActiveElementIntoView() {
|
|
120
104
|
await this.$nextTick();
|
|
121
|
-
const
|
|
122
|
-
|
|
105
|
+
const e = this.$refs.suggestionList.querySelector(".d-list-item--highlighted");
|
|
106
|
+
e && e.scrollIntoView({
|
|
123
107
|
behaviour: "smooth",
|
|
124
108
|
block: "center"
|
|
125
109
|
});
|
|
@@ -127,43 +111,43 @@ const Ne = je.exports, Fe = {
|
|
|
127
111
|
selectHandler() {
|
|
128
112
|
this.selectItem(this.selectedIndex);
|
|
129
113
|
},
|
|
130
|
-
selectItem(
|
|
131
|
-
const
|
|
114
|
+
selectItem(e) {
|
|
115
|
+
const t = this.items[e];
|
|
132
116
|
switch (this.itemType) {
|
|
133
117
|
case "emoji":
|
|
134
|
-
this.command(
|
|
118
|
+
this.command(t);
|
|
135
119
|
return;
|
|
136
120
|
case "mention":
|
|
137
|
-
this.command({ name:
|
|
121
|
+
this.command({ name: t.name, id: t.id, avatarSrc: t.avatarSrc });
|
|
138
122
|
break;
|
|
139
123
|
case "channel":
|
|
140
|
-
this.command({ name:
|
|
124
|
+
this.command({ name: t.name, id: t.id });
|
|
141
125
|
break;
|
|
142
126
|
case "slash-command":
|
|
143
|
-
this.command({ command:
|
|
127
|
+
this.command({ command: t.command });
|
|
144
128
|
break;
|
|
145
129
|
}
|
|
146
130
|
}
|
|
147
131
|
}
|
|
148
132
|
};
|
|
149
|
-
var
|
|
150
|
-
var
|
|
151
|
-
return n("div", { staticClass: "d-popover__dialog d-suggestion-list__container" }, [n("ul", { directives: [{ name: "show", rawName: "v-show", value:
|
|
133
|
+
var Ne = function() {
|
|
134
|
+
var t = this, n = t._self._c;
|
|
135
|
+
return n("div", { staticClass: "d-popover__dialog d-suggestion-list__container" }, [n("ul", { directives: [{ name: "show", rawName: "v-show", value: t.items.length, expression: "items.length" }], ref: "suggestionList", staticClass: "d-suggestion-list" }, t._l(t.items, function(r, s) {
|
|
152
136
|
return n("dt-list-item", { key: r.id, class: [
|
|
153
137
|
"d-suggestion-list__item",
|
|
154
|
-
{ "d-list-item--highlighted": s ===
|
|
155
|
-
], attrs: { "navigation-type": "arrow-keys" }, on: { click: function(
|
|
156
|
-
return
|
|
157
|
-
}, keydown: function(
|
|
158
|
-
return
|
|
159
|
-
} } }, [n(
|
|
138
|
+
{ "d-list-item--highlighted": s === t.selectedIndex }
|
|
139
|
+
], attrs: { "navigation-type": "arrow-keys" }, on: { click: function(i) {
|
|
140
|
+
return t.selectItem(s);
|
|
141
|
+
}, keydown: function(i) {
|
|
142
|
+
return i.preventDefault(), t.onKeyDown.apply(null, arguments);
|
|
143
|
+
} } }, [n(t.itemComponent, { tag: "component", attrs: { item: r } })], 1);
|
|
160
144
|
}), 1)]);
|
|
161
|
-
},
|
|
145
|
+
}, Ke = [], Ue = /* @__PURE__ */ c(
|
|
162
146
|
Fe,
|
|
163
|
-
|
|
164
|
-
|
|
147
|
+
Ne,
|
|
148
|
+
Ke
|
|
165
149
|
);
|
|
166
|
-
const
|
|
150
|
+
const k = Ue.exports, We = {
|
|
167
151
|
name: "EmojiSuggestion",
|
|
168
152
|
components: {
|
|
169
153
|
DtEmoji: P,
|
|
@@ -176,69 +160,76 @@ const b = Ue.exports, ze = {
|
|
|
176
160
|
}
|
|
177
161
|
}
|
|
178
162
|
};
|
|
179
|
-
var
|
|
180
|
-
var
|
|
181
|
-
return n("dt-stack", { attrs: { direction: "row", gap: "400" } }, [n("dt-emoji", { attrs: { size: "200", code:
|
|
182
|
-
}, Ve = [],
|
|
183
|
-
ze,
|
|
163
|
+
var qe = function() {
|
|
164
|
+
var t = this, n = t._self._c;
|
|
165
|
+
return n("dt-stack", { attrs: { direction: "row", gap: "400" } }, [n("dt-emoji", { attrs: { size: "200", code: t.item.code } }), t._v(" " + t._s(t.item.code) + " ")], 1);
|
|
166
|
+
}, Ve = [], ze = /* @__PURE__ */ c(
|
|
184
167
|
We,
|
|
168
|
+
qe,
|
|
185
169
|
Ve
|
|
186
170
|
);
|
|
187
|
-
const
|
|
171
|
+
const Xe = ze.exports, C = {
|
|
188
172
|
name: "hideOnEsc",
|
|
189
173
|
defaultValue: !0,
|
|
190
|
-
fn({ hide:
|
|
191
|
-
function
|
|
192
|
-
n.keyCode === 27 &&
|
|
174
|
+
fn({ hide: e }) {
|
|
175
|
+
function t(n) {
|
|
176
|
+
n.keyCode === 27 && e();
|
|
193
177
|
}
|
|
194
178
|
return {
|
|
195
179
|
onShow() {
|
|
196
|
-
document.addEventListener("keydown",
|
|
180
|
+
document.addEventListener("keydown", t);
|
|
197
181
|
},
|
|
198
182
|
onHide() {
|
|
199
|
-
document.removeEventListener("keydown",
|
|
183
|
+
document.removeEventListener("keydown", t);
|
|
200
184
|
}
|
|
201
185
|
};
|
|
202
186
|
}
|
|
203
|
-
},
|
|
204
|
-
|
|
205
|
-
|
|
187
|
+
}, Je = 20, Ye = (e, t, n) => {
|
|
188
|
+
var a, l;
|
|
189
|
+
const r = (a = e.shortname) == null ? void 0 : a.replaceAll(":", ""), s = (l = t.shortname) == null ? void 0 : l.replaceAll(":", ""), i = r.startsWith(n), o = s.startsWith(n);
|
|
190
|
+
return i && !o ? -1 : !i && o ? 1 : r.localeCompare(s);
|
|
191
|
+
}, Ge = {
|
|
192
|
+
items: ({ query: e }) => {
|
|
193
|
+
if (e.length < 2)
|
|
206
194
|
return [];
|
|
207
|
-
const
|
|
208
|
-
return
|
|
209
|
-
(r) =>
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
195
|
+
const t = Object.values(ye());
|
|
196
|
+
return e = e.toLowerCase(), t.filter(
|
|
197
|
+
(r) => {
|
|
198
|
+
var s;
|
|
199
|
+
return [
|
|
200
|
+
r.name,
|
|
201
|
+
(s = r.shortname) == null ? void 0 : s.replaceAll(":", ""),
|
|
202
|
+
...r.keywords || []
|
|
203
|
+
].some((i) => i && i.startsWith(e));
|
|
204
|
+
}
|
|
205
|
+
).splice(0, Je).sort((r, s) => Ye(r, s, e)).map((r) => ({ code: r.shortname }));
|
|
215
206
|
},
|
|
216
|
-
command: ({ editor:
|
|
217
|
-
var
|
|
218
|
-
const r =
|
|
219
|
-
((
|
|
207
|
+
command: ({ editor: e, range: t, props: n }) => {
|
|
208
|
+
var i, o;
|
|
209
|
+
const r = e.view.state.selection.$to.nodeAfter;
|
|
210
|
+
((i = r == null ? void 0 : r.text) == null ? void 0 : i.startsWith(" ")) && (t.to += 1), e.chain().focus().insertContentAt(t, [
|
|
220
211
|
{
|
|
221
212
|
type: "emoji",
|
|
222
213
|
attrs: n
|
|
223
214
|
}
|
|
224
|
-
]).run(), (
|
|
215
|
+
]).run(), (o = window.getSelection()) == null || o.collapseToEnd();
|
|
225
216
|
},
|
|
226
217
|
render: () => {
|
|
227
|
-
let
|
|
218
|
+
let e, t, n = !1;
|
|
228
219
|
return {
|
|
229
220
|
onStart: (r) => {
|
|
230
|
-
|
|
221
|
+
e = new w(k, {
|
|
231
222
|
parent: void 0,
|
|
232
223
|
propsData: {
|
|
233
|
-
itemComponent:
|
|
224
|
+
itemComponent: Xe,
|
|
234
225
|
itemType: "emoji",
|
|
235
226
|
...r
|
|
236
227
|
},
|
|
237
228
|
editor: r.editor
|
|
238
|
-
}), r.clientRect && (
|
|
229
|
+
}), r.clientRect && (t = b("body", {
|
|
239
230
|
getReferenceClientRect: r.clientRect,
|
|
240
231
|
appendTo: () => document.body,
|
|
241
|
-
content:
|
|
232
|
+
content: e.element,
|
|
242
233
|
showOnCreate: !1,
|
|
243
234
|
onShow: () => {
|
|
244
235
|
n = !0;
|
|
@@ -251,31 +242,31 @@ const Je = Xe.exports, C = {
|
|
|
251
242
|
placement: "top-start",
|
|
252
243
|
zIndex: 650,
|
|
253
244
|
plugins: [C]
|
|
254
|
-
}), r.items.length > 0 && (
|
|
245
|
+
}), r.items.length > 0 && (t == null || t[0].show()));
|
|
255
246
|
},
|
|
256
247
|
onUpdate(r) {
|
|
257
|
-
|
|
248
|
+
e == null || e.updateProps(r), r.items.length > 0 ? t == null || t[0].show() : t == null || t[0].hide(), t == null || t[0].setProps({
|
|
258
249
|
getReferenceClientRect: r.clientRect
|
|
259
250
|
});
|
|
260
251
|
},
|
|
261
252
|
onKeyDown(r) {
|
|
262
253
|
var s;
|
|
263
254
|
if (n)
|
|
264
|
-
return (s =
|
|
255
|
+
return (s = e == null ? void 0 : e.ref) == null ? void 0 : s.onKeyDown(r);
|
|
265
256
|
},
|
|
266
257
|
onExit() {
|
|
267
|
-
|
|
258
|
+
t == null || t[0].destroy(), t = null, e == null || e.destroy(), e = null;
|
|
268
259
|
}
|
|
269
260
|
};
|
|
270
261
|
}
|
|
271
|
-
}, Qe = /(:\w+:)$/, Ze = new RegExp(O + "$"), et = (
|
|
272
|
-
if (
|
|
273
|
-
return { text:
|
|
274
|
-
}, tt = (
|
|
262
|
+
}, Qe = /(:\w+:)$/, Ze = new RegExp(O + "$"), et = (e) => {
|
|
263
|
+
if (e && L(e[0]))
|
|
264
|
+
return { text: e[2] || e[0] };
|
|
265
|
+
}, tt = (e) => [...e.matchAll(xe)].filter((n) => L(n[0])).map((n) => ({
|
|
275
266
|
index: n.index,
|
|
276
267
|
text: n[0],
|
|
277
268
|
match: n
|
|
278
|
-
})), nt =
|
|
269
|
+
})), nt = N.create({
|
|
279
270
|
name: "emoji",
|
|
280
271
|
addOptions() {
|
|
281
272
|
return {
|
|
@@ -287,7 +278,7 @@ const Je = Xe.exports, C = {
|
|
|
287
278
|
selectable: !1,
|
|
288
279
|
atom: !0,
|
|
289
280
|
addNodeView() {
|
|
290
|
-
return v(
|
|
281
|
+
return v(je);
|
|
291
282
|
},
|
|
292
283
|
addAttributes() {
|
|
293
284
|
return {
|
|
@@ -309,29 +300,23 @@ const Je = Xe.exports, C = {
|
|
|
309
300
|
}
|
|
310
301
|
];
|
|
311
302
|
},
|
|
312
|
-
renderText({ node:
|
|
313
|
-
|
|
314
|
-
if (e !== null)
|
|
315
|
-
return e;
|
|
316
|
-
{
|
|
317
|
-
const r = L(n);
|
|
318
|
-
return ve(r.unicode_output);
|
|
319
|
-
}
|
|
303
|
+
renderText({ node: e }) {
|
|
304
|
+
return ve(L(e.attrs.code).unicode_output);
|
|
320
305
|
},
|
|
321
|
-
renderHTML({ HTMLAttributes:
|
|
322
|
-
return ["emoji-component", m(this.options.HTMLAttributes,
|
|
306
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
307
|
+
return ["emoji-component", m(this.options.HTMLAttributes, e)];
|
|
323
308
|
},
|
|
324
309
|
addInputRules() {
|
|
325
310
|
return [
|
|
326
311
|
new K({
|
|
327
|
-
find: (
|
|
328
|
-
const
|
|
329
|
-
if (
|
|
330
|
-
return et(
|
|
312
|
+
find: (e) => {
|
|
313
|
+
const t = e.match(Qe) || e.match(Ze);
|
|
314
|
+
if (t)
|
|
315
|
+
return et(t);
|
|
331
316
|
},
|
|
332
|
-
handler: ({ state:
|
|
333
|
-
const { tr: r } =
|
|
334
|
-
r.replaceWith(s,
|
|
317
|
+
handler: ({ state: e, range: t, match: n }) => {
|
|
318
|
+
const { tr: r } = e, s = t.from, i = t.to;
|
|
319
|
+
r.replaceWith(s, i, this.type.create({ code: n[0] }));
|
|
335
320
|
}
|
|
336
321
|
})
|
|
337
322
|
];
|
|
@@ -341,22 +326,22 @@ const Je = Xe.exports, C = {
|
|
|
341
326
|
E({
|
|
342
327
|
find: tt,
|
|
343
328
|
type: this.type,
|
|
344
|
-
getAttributes(
|
|
329
|
+
getAttributes(e) {
|
|
345
330
|
return {
|
|
346
|
-
code:
|
|
347
|
-
image:
|
|
348
|
-
name:
|
|
331
|
+
code: e[0],
|
|
332
|
+
image: e[1],
|
|
333
|
+
name: e[2]
|
|
349
334
|
};
|
|
350
335
|
}
|
|
351
336
|
}),
|
|
352
337
|
E({
|
|
353
338
|
find: we,
|
|
354
339
|
type: this.type,
|
|
355
|
-
getAttributes(
|
|
340
|
+
getAttributes(e) {
|
|
356
341
|
return {
|
|
357
|
-
code:
|
|
358
|
-
image:
|
|
359
|
-
name:
|
|
342
|
+
code: e[0],
|
|
343
|
+
image: e[1],
|
|
344
|
+
name: e[2]
|
|
360
345
|
};
|
|
361
346
|
}
|
|
362
347
|
})
|
|
@@ -375,42 +360,42 @@ const Je = Xe.exports, C = {
|
|
|
375
360
|
},
|
|
376
361
|
addKeyboardShortcuts() {
|
|
377
362
|
return {
|
|
378
|
-
Backspace: () => this.editor.commands.command(({ tr:
|
|
363
|
+
Backspace: () => this.editor.commands.command(({ tr: e, state: t }) => {
|
|
379
364
|
let n = !1;
|
|
380
|
-
const { selection: r } =
|
|
381
|
-
return s ? (
|
|
382
|
-
if (
|
|
383
|
-
return n = !0,
|
|
365
|
+
const { selection: r } = t, { empty: s, anchor: i } = r;
|
|
366
|
+
return s ? (t.doc.nodesBetween(i - 1, i, (o, a) => {
|
|
367
|
+
if (o.type.name === this.name)
|
|
368
|
+
return n = !0, e.insertText("", a, a + o.nodeSize), !1;
|
|
384
369
|
}), n) : !1;
|
|
385
370
|
})
|
|
386
371
|
};
|
|
387
372
|
}
|
|
388
373
|
});
|
|
389
|
-
function rt(
|
|
374
|
+
function rt(e, t, n = () => !0) {
|
|
390
375
|
const r = [];
|
|
391
|
-
|
|
376
|
+
t.lastIndex = 0;
|
|
392
377
|
let s;
|
|
393
|
-
for (; s =
|
|
394
|
-
n(
|
|
378
|
+
for (; s = t.exec(e); )
|
|
379
|
+
n(e, s) && r.push(s);
|
|
395
380
|
return r;
|
|
396
381
|
}
|
|
397
|
-
function st(
|
|
398
|
-
return !["#", "@"].includes(
|
|
382
|
+
function st(e, t) {
|
|
383
|
+
return !["#", "@"].includes(e.charAt(t.index)) && !["#", "@"].includes(e.charAt(t.index - 1));
|
|
399
384
|
}
|
|
400
|
-
function it(
|
|
401
|
-
const
|
|
385
|
+
function it(e) {
|
|
386
|
+
const t = new RegExp(
|
|
402
387
|
"(?:" + [
|
|
403
388
|
`[!?.,:;'"]`,
|
|
404
389
|
"(?:&|&)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"
|
|
405
390
|
].join("|"),
|
|
406
391
|
"g"
|
|
407
392
|
);
|
|
408
|
-
return
|
|
393
|
+
return e.replace(t, "");
|
|
409
394
|
}
|
|
410
|
-
function ot(
|
|
411
|
-
const n =
|
|
395
|
+
function ot(e, t) {
|
|
396
|
+
const n = e.slice(0, t + 1).search(/\S+\s*$/), r = e.slice(t).search(/\s/);
|
|
412
397
|
if (r < 0) {
|
|
413
|
-
const s =
|
|
398
|
+
const s = e.slice(n);
|
|
414
399
|
return {
|
|
415
400
|
text: s,
|
|
416
401
|
from: n,
|
|
@@ -418,61 +403,61 @@ function ot(t, e) {
|
|
|
418
403
|
};
|
|
419
404
|
}
|
|
420
405
|
return {
|
|
421
|
-
text:
|
|
406
|
+
text: e.slice(n, r + t),
|
|
422
407
|
from: n,
|
|
423
|
-
to: r +
|
|
408
|
+
to: r + t
|
|
424
409
|
};
|
|
425
410
|
}
|
|
426
|
-
function S(
|
|
427
|
-
const s = ot(
|
|
411
|
+
function S(e, t, n, r) {
|
|
412
|
+
const s = ot(e, t);
|
|
428
413
|
if (r.lastIndex = 0, !r.test(s.text))
|
|
429
414
|
return s;
|
|
430
|
-
const
|
|
431
|
-
return
|
|
415
|
+
const i = n === "left" ? s.from - 1 : s.to + 1;
|
|
416
|
+
return i <= 0 || i >= e.length || i === t ? s : S(e, i, n, r);
|
|
432
417
|
}
|
|
433
|
-
function at(
|
|
434
|
-
const s = Math.max(
|
|
435
|
-
for (const a of
|
|
418
|
+
function at(e, t, n, r) {
|
|
419
|
+
const s = Math.max(e.from - 1, 0), i = Math.min(e.to + 1, t.content.size), o = U(s, i, t);
|
|
420
|
+
for (const a of o)
|
|
436
421
|
a.mark.type === r && n.removeMark(a.from, a.to, r);
|
|
437
422
|
}
|
|
438
|
-
const I =
|
|
439
|
-
function A(
|
|
440
|
-
if (!
|
|
423
|
+
const I = ke(1, 15);
|
|
424
|
+
function A(e, t, n, r, s, i) {
|
|
425
|
+
if (!e)
|
|
441
426
|
return;
|
|
442
|
-
let
|
|
443
|
-
|
|
444
|
-
const a = r -
|
|
445
|
-
|
|
446
|
-
|
|
427
|
+
let o = n - t - 1;
|
|
428
|
+
o = o < 0 ? 0 : o;
|
|
429
|
+
const a = r - t, l = S(
|
|
430
|
+
e,
|
|
431
|
+
o,
|
|
447
432
|
"left",
|
|
448
433
|
I
|
|
449
|
-
),
|
|
450
|
-
|
|
434
|
+
), d = S(
|
|
435
|
+
e,
|
|
451
436
|
a,
|
|
452
437
|
"right",
|
|
453
438
|
I
|
|
454
|
-
), u =
|
|
455
|
-
rt(u,
|
|
456
|
-
const h = it(T[0]), g =
|
|
457
|
-
s.addMark(g, M,
|
|
439
|
+
), u = e.slice(l.from, d.to);
|
|
440
|
+
rt(u, Ce, st).forEach((T) => {
|
|
441
|
+
const h = it(T[0]), g = t + l.from + T.index + 1, M = g + h.length;
|
|
442
|
+
s.addMark(g, M, i.create());
|
|
458
443
|
});
|
|
459
444
|
}
|
|
460
|
-
function lt(
|
|
461
|
-
let
|
|
445
|
+
function lt(e) {
|
|
446
|
+
let t = !1;
|
|
462
447
|
return new ge({
|
|
463
448
|
key: new f("autolink"),
|
|
464
449
|
appendTransaction: (n, r, s) => {
|
|
465
|
-
const
|
|
466
|
-
if (
|
|
450
|
+
const i = n.some((u) => u.docChanged) && !r.doc.eq(s.doc);
|
|
451
|
+
if (t && !i)
|
|
467
452
|
return;
|
|
468
|
-
const { tr:
|
|
469
|
-
|
|
470
|
-
const l =
|
|
453
|
+
const { tr: o } = s, { textContent: a } = s.doc;
|
|
454
|
+
t || A(a, 0, 0, a.length, o, e.type), t = !0;
|
|
455
|
+
const l = W(
|
|
471
456
|
r.doc,
|
|
472
457
|
[...n]
|
|
473
458
|
);
|
|
474
|
-
return
|
|
475
|
-
at(p, s.doc,
|
|
459
|
+
return q(l).forEach(({ oldRange: u, newRange: p }) => {
|
|
460
|
+
at(p, s.doc, o, e.type), V(
|
|
476
461
|
s.doc,
|
|
477
462
|
p,
|
|
478
463
|
(h) => h.isTextblock
|
|
@@ -482,38 +467,38 @@ function lt(t) {
|
|
|
482
467
|
g,
|
|
483
468
|
u.from,
|
|
484
469
|
p.to,
|
|
485
|
-
|
|
486
|
-
|
|
470
|
+
o,
|
|
471
|
+
e.type
|
|
487
472
|
);
|
|
488
473
|
});
|
|
489
|
-
}),
|
|
474
|
+
}), o;
|
|
490
475
|
}
|
|
491
476
|
});
|
|
492
477
|
}
|
|
493
|
-
const
|
|
478
|
+
const ct = {
|
|
494
479
|
class: "d-link d-c-text d-d-inline-block d-wb-break-all",
|
|
495
480
|
rel: "noopener noreferrer nofollow"
|
|
496
|
-
},
|
|
481
|
+
}, dt = z.create({
|
|
497
482
|
name: "CustomLink",
|
|
498
|
-
renderHTML({ HTMLAttributes:
|
|
483
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
499
484
|
return [
|
|
500
485
|
"a",
|
|
501
486
|
m(
|
|
502
487
|
this.options.HTMLAttributes,
|
|
503
|
-
|
|
504
|
-
|
|
488
|
+
e,
|
|
489
|
+
ct
|
|
505
490
|
)
|
|
506
491
|
];
|
|
507
492
|
},
|
|
508
|
-
renderText({ node:
|
|
509
|
-
return
|
|
493
|
+
renderText({ node: e }) {
|
|
494
|
+
return e.attrs.text;
|
|
510
495
|
},
|
|
511
496
|
addProseMirrorPlugins() {
|
|
512
497
|
return [
|
|
513
498
|
lt({ type: this.type })
|
|
514
499
|
];
|
|
515
500
|
}
|
|
516
|
-
}), ut =
|
|
501
|
+
}), ut = Ee.extend({
|
|
517
502
|
name: "ConfigurableImage",
|
|
518
503
|
addAttributes() {
|
|
519
504
|
return {
|
|
@@ -541,8 +526,8 @@ const dt = {
|
|
|
541
526
|
parseHTML() {
|
|
542
527
|
return [{ tag: "div" }];
|
|
543
528
|
},
|
|
544
|
-
renderHTML({ HTMLAttributes:
|
|
545
|
-
return ["div", m(this.options.HTMLAttributes,
|
|
529
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
530
|
+
return ["div", m(this.options.HTMLAttributes, e), 0];
|
|
546
531
|
}
|
|
547
532
|
}), ht = {
|
|
548
533
|
name: "MentionComponent",
|
|
@@ -558,9 +543,9 @@ const dt = {
|
|
|
558
543
|
}
|
|
559
544
|
};
|
|
560
545
|
var ft = function() {
|
|
561
|
-
var
|
|
562
|
-
return n("node-view-wrapper", { staticClass: "d-d-inline-block" }, [n("dt-link", { attrs: { kind: "mention" } }, [
|
|
563
|
-
}, pt = [], gt = /* @__PURE__ */
|
|
546
|
+
var t = this, n = t._self._c;
|
|
547
|
+
return n("node-view-wrapper", { staticClass: "d-d-inline-block" }, [n("dt-link", { attrs: { kind: "mention" } }, [t._v(" " + t._s(t.text) + " ")])], 1);
|
|
548
|
+
}, pt = [], gt = /* @__PURE__ */ c(
|
|
564
549
|
ht,
|
|
565
550
|
ft,
|
|
566
551
|
pt
|
|
@@ -589,11 +574,11 @@ const _t = gt.exports, yt = R.extend({
|
|
|
589
574
|
}
|
|
590
575
|
};
|
|
591
576
|
},
|
|
592
|
-
renderText({ node:
|
|
593
|
-
return `@${
|
|
577
|
+
renderText({ node: e }) {
|
|
578
|
+
return `@${e.attrs.id}`;
|
|
594
579
|
},
|
|
595
|
-
renderHTML({ HTMLAttributes:
|
|
596
|
-
return ["mention-component", m(this.options.HTMLAttributes,
|
|
580
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
581
|
+
return ["mention-component", m(this.options.HTMLAttributes, e)];
|
|
597
582
|
}
|
|
598
583
|
}).configure({
|
|
599
584
|
suggestion: {
|
|
@@ -614,17 +599,17 @@ const _t = gt.exports, yt = R.extend({
|
|
|
614
599
|
}
|
|
615
600
|
};
|
|
616
601
|
var vt = function() {
|
|
617
|
-
var
|
|
618
|
-
return n("node-view-wrapper", { staticClass: "d-d-inline-block" }, [n("dt-link", { attrs: { kind: "mention" } }, [
|
|
619
|
-
}, xt = [],
|
|
602
|
+
var t = this, n = t._self._c;
|
|
603
|
+
return n("node-view-wrapper", { staticClass: "d-d-inline-block" }, [n("dt-link", { attrs: { kind: "mention" } }, [t._v(" " + t._s(t.text) + " ")])], 1);
|
|
604
|
+
}, xt = [], bt = /* @__PURE__ */ c(
|
|
620
605
|
wt,
|
|
621
606
|
vt,
|
|
622
607
|
xt
|
|
623
608
|
);
|
|
624
|
-
const
|
|
609
|
+
const kt = bt.exports, Ct = R.extend({
|
|
625
610
|
name: "channel",
|
|
626
611
|
addNodeView() {
|
|
627
|
-
return v(
|
|
612
|
+
return v(kt);
|
|
628
613
|
},
|
|
629
614
|
parseHTML() {
|
|
630
615
|
return [
|
|
@@ -646,11 +631,11 @@ const bt = kt.exports, Ct = R.extend({
|
|
|
646
631
|
}
|
|
647
632
|
};
|
|
648
633
|
},
|
|
649
|
-
renderText({ node:
|
|
650
|
-
return `#${
|
|
634
|
+
renderText({ node: e }) {
|
|
635
|
+
return `#${e.attrs.id}`;
|
|
651
636
|
},
|
|
652
|
-
renderHTML({ HTMLAttributes:
|
|
653
|
-
return ["channel-component", m(this.options.HTMLAttributes,
|
|
637
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
638
|
+
return ["channel-component", m(this.options.HTMLAttributes, e)];
|
|
654
639
|
}
|
|
655
640
|
}).configure({
|
|
656
641
|
suggestion: {
|
|
@@ -673,21 +658,21 @@ const bt = kt.exports, Ct = R.extend({
|
|
|
673
658
|
},
|
|
674
659
|
created() {
|
|
675
660
|
var n, r, s;
|
|
676
|
-
const
|
|
677
|
-
this.$emit("selected-command",
|
|
678
|
-
const
|
|
679
|
-
|
|
661
|
+
const e = this.$props.node.attrs.command;
|
|
662
|
+
this.$emit("selected-command", e);
|
|
663
|
+
const t = (s = (r = (n = this.editor) == null ? void 0 : n.storage) == null ? void 0 : r["slash-commands"]) == null ? void 0 : s.onSelectedCommand;
|
|
664
|
+
t && typeof t == "function" && t(e);
|
|
680
665
|
}
|
|
681
666
|
};
|
|
682
667
|
var Et = function() {
|
|
683
|
-
var
|
|
684
|
-
return n("node-view-wrapper", { staticClass: "d-d-inline-block" }, [
|
|
685
|
-
}, St = [], Lt = /* @__PURE__ */
|
|
668
|
+
var t = this, n = t._self._c;
|
|
669
|
+
return n("node-view-wrapper", { staticClass: "d-d-inline-block" }, [t._v(" " + t._s(t.text) + " ")]);
|
|
670
|
+
}, St = [], Lt = /* @__PURE__ */ c(
|
|
686
671
|
Tt,
|
|
687
672
|
Et,
|
|
688
673
|
St
|
|
689
674
|
);
|
|
690
|
-
const Rt = Lt.exports, $t = (
|
|
675
|
+
const Rt = Lt.exports, $t = (e, t) => [...e.matchAll(t)].map((r) => {
|
|
691
676
|
let s = r[2];
|
|
692
677
|
return s.endsWith(" ") || (s += " "), {
|
|
693
678
|
index: r.index,
|
|
@@ -699,9 +684,9 @@ const Rt = Lt.exports, $t = (t, e) => [...t.matchAll(e)].map((r) => {
|
|
|
699
684
|
group: "inline",
|
|
700
685
|
inline: !0,
|
|
701
686
|
addOptions() {
|
|
702
|
-
var
|
|
687
|
+
var e;
|
|
703
688
|
return {
|
|
704
|
-
...(
|
|
689
|
+
...(e = this.parent) == null ? void 0 : e.call(this),
|
|
705
690
|
onSelectedCommand: null
|
|
706
691
|
};
|
|
707
692
|
},
|
|
@@ -733,18 +718,18 @@ const Rt = Lt.exports, $t = (t, e) => [...t.matchAll(e)].map((r) => {
|
|
|
733
718
|
}
|
|
734
719
|
};
|
|
735
720
|
},
|
|
736
|
-
renderText({ node:
|
|
737
|
-
return `/${
|
|
721
|
+
renderText({ node: e }) {
|
|
722
|
+
return `/${e.attrs.command}`;
|
|
738
723
|
},
|
|
739
|
-
renderHTML({ HTMLAttributes:
|
|
740
|
-
return ["command-component", m(this.options.HTMLAttributes,
|
|
724
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
725
|
+
return ["command-component", m(this.options.HTMLAttributes, e)];
|
|
741
726
|
},
|
|
742
727
|
addInputRules() {
|
|
743
728
|
var n;
|
|
744
|
-
const
|
|
729
|
+
const e = (n = this.options.suggestion) == null ? void 0 : n.items({ query: "" }).map((r) => r.command), t = new RegExp(`^((?:\\/)(${e.join("|")})) $`);
|
|
745
730
|
return [
|
|
746
731
|
X({
|
|
747
|
-
find:
|
|
732
|
+
find: t,
|
|
748
733
|
type: this.type,
|
|
749
734
|
getAttributes(r) {
|
|
750
735
|
return { command: r[2] };
|
|
@@ -754,10 +739,10 @@ const Rt = Lt.exports, $t = (t, e) => [...t.matchAll(e)].map((r) => {
|
|
|
754
739
|
},
|
|
755
740
|
addPasteRules() {
|
|
756
741
|
var n;
|
|
757
|
-
const
|
|
742
|
+
const e = (n = this.options.suggestion) == null ? void 0 : n.items({ query: "" }).map((r) => r.command), t = new RegExp(`^((?:\\/)(${e.join("|")})) ?$`, "g");
|
|
758
743
|
return [
|
|
759
744
|
E({
|
|
760
|
-
find: (r) => $t(r,
|
|
745
|
+
find: (r) => $t(r, t),
|
|
761
746
|
type: this.type,
|
|
762
747
|
getAttributes(r) {
|
|
763
748
|
return { command: r[0].trim() };
|
|
@@ -773,7 +758,7 @@ const Rt = Lt.exports, $t = (t, e) => [...t.matchAll(e)].map((r) => {
|
|
|
773
758
|
}), At = {
|
|
774
759
|
name: "MentionSuggestion",
|
|
775
760
|
components: {
|
|
776
|
-
DtAvatar:
|
|
761
|
+
DtAvatar: Re,
|
|
777
762
|
DtStack: x
|
|
778
763
|
},
|
|
779
764
|
props: {
|
|
@@ -812,9 +797,9 @@ const Rt = Lt.exports, $t = (t, e) => [...t.matchAll(e)].map((r) => {
|
|
|
812
797
|
}
|
|
813
798
|
};
|
|
814
799
|
var Bt = function() {
|
|
815
|
-
var
|
|
816
|
-
return n("dt-stack", { staticClass: "d-mention-suggestion__container", attrs: { direction: "row", gap: "400" } }, [n("dt-avatar", { attrs: { "full-name":
|
|
817
|
-
}, Ot = [], Pt = /* @__PURE__ */
|
|
800
|
+
var t = this, n = t._self._c;
|
|
801
|
+
return n("dt-stack", { staticClass: "d-mention-suggestion__container", attrs: { direction: "row", gap: "400" } }, [n("dt-avatar", { attrs: { "full-name": t.name, "image-src": t.avatarSrc, "image-alt": t.name, "show-presence": t.showDetails, presence: t.presence, size: "sm" } }), n("dt-stack", { staticClass: "d-mention-suggestion__details-container", attrs: { gap: "100" } }, [n("span", { staticClass: "d-mention-suggestion__name" }, [t._v(" " + t._s(t.name) + " ")]), t.showDetails ? n("dt-stack", { staticClass: "d-label--sm-plain", attrs: { direction: "row", gap: "300" } }, [t.presenceText ? n("span", { staticClass: "d-mention-suggestion__presence", class: [t.presenceFontColorClass] }, [t._v(" " + t._s(t.presenceText) + " ")]) : t._e(), t.status && t.presenceText ? n("div", { staticClass: "d-mention-suggestion__divider" }, [t._v(" • ")]) : t._e(), t.status ? n("div", { staticClass: "d-mention-suggestion__status" }, [t._v(" " + t._s(t.status) + " ")]) : t._e()]) : t._e()], 1)], 1);
|
|
802
|
+
}, Ot = [], Pt = /* @__PURE__ */ c(
|
|
818
803
|
At,
|
|
819
804
|
Bt,
|
|
820
805
|
Ot
|
|
@@ -825,10 +810,10 @@ const Dt = Pt.exports, Mt = {
|
|
|
825
810
|
// items: ({ query }) => { return [] },
|
|
826
811
|
allowSpaces: !0,
|
|
827
812
|
render: () => {
|
|
828
|
-
let
|
|
813
|
+
let e, t, n = !1;
|
|
829
814
|
return {
|
|
830
815
|
onStart: (r) => {
|
|
831
|
-
|
|
816
|
+
e = new w(k, {
|
|
832
817
|
parent: void 0,
|
|
833
818
|
propsData: {
|
|
834
819
|
itemComponent: Dt,
|
|
@@ -836,10 +821,10 @@ const Dt = Pt.exports, Mt = {
|
|
|
836
821
|
...r
|
|
837
822
|
},
|
|
838
823
|
editor: r.editor
|
|
839
|
-
}), r.clientRect && (
|
|
824
|
+
}), r.clientRect && (t = b("body", {
|
|
840
825
|
getReferenceClientRect: r.clientRect,
|
|
841
826
|
appendTo: () => document.body,
|
|
842
|
-
content:
|
|
827
|
+
content: e.element,
|
|
843
828
|
showOnCreate: !1,
|
|
844
829
|
onShow: () => {
|
|
845
830
|
n = !0;
|
|
@@ -852,20 +837,20 @@ const Dt = Pt.exports, Mt = {
|
|
|
852
837
|
placement: "top-start",
|
|
853
838
|
zIndex: 650,
|
|
854
839
|
plugins: [C]
|
|
855
|
-
}), r.items.length > 0 && (
|
|
840
|
+
}), r.items.length > 0 && (t == null || t[0].show()));
|
|
856
841
|
},
|
|
857
842
|
onUpdate(r) {
|
|
858
|
-
|
|
843
|
+
e == null || e.updateProps(r), r.items.length > 0 ? t == null || t[0].show() : t == null || t[0].hide(), r.clientRect && (t == null || t[0].setProps({
|
|
859
844
|
getReferenceClientRect: r.clientRect
|
|
860
845
|
}));
|
|
861
846
|
},
|
|
862
847
|
onKeyDown(r) {
|
|
863
848
|
var s;
|
|
864
849
|
if (n)
|
|
865
|
-
return (s =
|
|
850
|
+
return (s = e == null ? void 0 : e.ref) == null ? void 0 : s.onKeyDown(r);
|
|
866
851
|
},
|
|
867
852
|
onExit() {
|
|
868
|
-
|
|
853
|
+
t == null || t[0].destroy(), t = null, e == null || e.destroy(), e = null;
|
|
869
854
|
}
|
|
870
855
|
};
|
|
871
856
|
}
|
|
@@ -873,8 +858,8 @@ const Dt = Pt.exports, Mt = {
|
|
|
873
858
|
name: "ChannelSuggestion",
|
|
874
859
|
components: {
|
|
875
860
|
DtStack: x,
|
|
876
|
-
DtIconHash:
|
|
877
|
-
DtIconLock:
|
|
861
|
+
DtIconHash: $e,
|
|
862
|
+
DtIconLock: Ie
|
|
878
863
|
},
|
|
879
864
|
props: {
|
|
880
865
|
item: {
|
|
@@ -889,23 +874,23 @@ const Dt = Pt.exports, Mt = {
|
|
|
889
874
|
}
|
|
890
875
|
};
|
|
891
876
|
var jt = function() {
|
|
892
|
-
var
|
|
893
|
-
return n("dt-stack", { attrs: { direction: "row", gap: "400" } }, [
|
|
894
|
-
},
|
|
877
|
+
var t = this, n = t._self._c;
|
|
878
|
+
return n("dt-stack", { attrs: { direction: "row", gap: "400" } }, [t.item.locked ? n("dt-icon-lock", { attrs: { size: "300" } }) : n("dt-icon-hash", { attrs: { size: "300" } }), n("span", [t._v(t._s(t.name))])], 1);
|
|
879
|
+
}, Ft = [], Nt = /* @__PURE__ */ c(
|
|
895
880
|
Ht,
|
|
896
881
|
jt,
|
|
897
|
-
|
|
882
|
+
Ft
|
|
898
883
|
);
|
|
899
|
-
const Kt =
|
|
884
|
+
const Kt = Nt.exports, Ut = {
|
|
900
885
|
// This function comes from the user and passed to the editor directly.
|
|
901
886
|
// This will also activate the mention plugin on the editor
|
|
902
887
|
// items: ({ query }) => { return [] },
|
|
903
888
|
allowSpaces: !0,
|
|
904
889
|
render: () => {
|
|
905
|
-
let
|
|
890
|
+
let e, t, n = !1;
|
|
906
891
|
return {
|
|
907
892
|
onStart: (r) => {
|
|
908
|
-
|
|
893
|
+
e = new w(k, {
|
|
909
894
|
parent: void 0,
|
|
910
895
|
propsData: {
|
|
911
896
|
itemComponent: Kt,
|
|
@@ -913,10 +898,10 @@ const Kt = Ft.exports, qt = {
|
|
|
913
898
|
...r
|
|
914
899
|
},
|
|
915
900
|
editor: r.editor
|
|
916
|
-
}), r.clientRect && (
|
|
901
|
+
}), r.clientRect && (t = b("body", {
|
|
917
902
|
getReferenceClientRect: r.clientRect,
|
|
918
903
|
appendTo: () => document.body,
|
|
919
|
-
content:
|
|
904
|
+
content: e.element,
|
|
920
905
|
showOnCreate: !1,
|
|
921
906
|
onShow: () => {
|
|
922
907
|
n = !0;
|
|
@@ -929,24 +914,24 @@ const Kt = Ft.exports, qt = {
|
|
|
929
914
|
placement: "top-start",
|
|
930
915
|
zIndex: 650,
|
|
931
916
|
plugins: [C]
|
|
932
|
-
}), r.items.length > 0 && (
|
|
917
|
+
}), r.items.length > 0 && (t == null || t[0].show()));
|
|
933
918
|
},
|
|
934
919
|
onUpdate(r) {
|
|
935
|
-
|
|
920
|
+
e == null || e.updateProps(r), r.items.length > 0 ? t == null || t[0].show() : t == null || t[0].hide(), r.clientRect && (t == null || t[0].setProps({
|
|
936
921
|
getReferenceClientRect: r.clientRect
|
|
937
922
|
}));
|
|
938
923
|
},
|
|
939
924
|
onKeyDown(r) {
|
|
940
925
|
var s;
|
|
941
926
|
if (n)
|
|
942
|
-
return (s =
|
|
927
|
+
return (s = e == null ? void 0 : e.ref) == null ? void 0 : s.onKeyDown(r);
|
|
943
928
|
},
|
|
944
929
|
onExit() {
|
|
945
|
-
|
|
930
|
+
t == null || t[0].destroy(), t = null, e == null || e.destroy(), e = null;
|
|
946
931
|
}
|
|
947
932
|
};
|
|
948
933
|
}
|
|
949
|
-
},
|
|
934
|
+
}, Wt = {
|
|
950
935
|
name: "SlashCommandSuggestion",
|
|
951
936
|
props: {
|
|
952
937
|
item: {
|
|
@@ -966,25 +951,25 @@ const Kt = Ft.exports, qt = {
|
|
|
966
951
|
}
|
|
967
952
|
}
|
|
968
953
|
};
|
|
969
|
-
var
|
|
970
|
-
var
|
|
971
|
-
return n("div", [n("div", { staticClass: "d-body--md-compact" }, [n("span", [
|
|
972
|
-
},
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
954
|
+
var qt = function() {
|
|
955
|
+
var t = this, n = t._self._c;
|
|
956
|
+
return n("div", [n("div", { staticClass: "d-body--md-compact" }, [n("span", [t._v("/" + t._s(t.command))]), t.parametersExample ? n("span", [t._v(" " + t._s(t.parametersExample))]) : t._e()]), n("div", { staticClass: "d-body--sm d-fc-tertiary" }, [t._v(" " + t._s(t.description) + " ")])]);
|
|
957
|
+
}, Vt = [], zt = /* @__PURE__ */ c(
|
|
958
|
+
Wt,
|
|
959
|
+
qt,
|
|
960
|
+
Vt
|
|
976
961
|
);
|
|
977
|
-
const Xt =
|
|
962
|
+
const Xt = zt.exports, Jt = {
|
|
978
963
|
// This function comes from the user and passed to the editor directly.
|
|
979
964
|
// This will also activate the mention plugin on the editor
|
|
980
965
|
// items: ({ query }) => { return [] },
|
|
981
966
|
allowSpaces: !0,
|
|
982
967
|
startOfLine: !0,
|
|
983
968
|
render: () => {
|
|
984
|
-
let
|
|
969
|
+
let e, t, n = !1;
|
|
985
970
|
return {
|
|
986
971
|
onStart: (r) => {
|
|
987
|
-
|
|
972
|
+
e = new w(k, {
|
|
988
973
|
parent: void 0,
|
|
989
974
|
propsData: {
|
|
990
975
|
itemComponent: Xt,
|
|
@@ -992,10 +977,10 @@ const Xt = Vt.exports, Jt = {
|
|
|
992
977
|
...r
|
|
993
978
|
},
|
|
994
979
|
editor: r.editor
|
|
995
|
-
}), r.clientRect && (
|
|
980
|
+
}), r.clientRect && (t = b("body", {
|
|
996
981
|
getReferenceClientRect: r.clientRect,
|
|
997
982
|
appendTo: () => document.body,
|
|
998
|
-
content:
|
|
983
|
+
content: e.element,
|
|
999
984
|
showOnCreate: !1,
|
|
1000
985
|
onShow: () => {
|
|
1001
986
|
n = !0;
|
|
@@ -1008,20 +993,20 @@ const Xt = Vt.exports, Jt = {
|
|
|
1008
993
|
placement: "top-start",
|
|
1009
994
|
zIndex: 650,
|
|
1010
995
|
plugins: [C]
|
|
1011
|
-
}), r.items.length > 0 && (
|
|
996
|
+
}), r.items.length > 0 && (t == null || t[0].show()));
|
|
1012
997
|
},
|
|
1013
998
|
onUpdate(r) {
|
|
1014
|
-
|
|
999
|
+
e == null || e.updateProps(r), r.items.length > 0 ? t == null || t[0].show() : t == null || t[0].hide(), r.clientRect && (t == null || t[0].setProps({
|
|
1015
1000
|
getReferenceClientRect: r.clientRect
|
|
1016
1001
|
}));
|
|
1017
1002
|
},
|
|
1018
1003
|
onKeyDown(r) {
|
|
1019
1004
|
var s;
|
|
1020
1005
|
if (n)
|
|
1021
|
-
return (s =
|
|
1006
|
+
return (s = e == null ? void 0 : e.ref) == null ? void 0 : s.onKeyDown(r);
|
|
1022
1007
|
},
|
|
1023
1008
|
onExit() {
|
|
1024
|
-
|
|
1009
|
+
t == null || t[0].destroy(), t = null, e == null || e.destroy(), e = null;
|
|
1025
1010
|
}
|
|
1026
1011
|
};
|
|
1027
1012
|
}
|
|
@@ -1030,7 +1015,7 @@ const Xt = Vt.exports, Jt = {
|
|
|
1030
1015
|
components: {
|
|
1031
1016
|
EditorContent: j,
|
|
1032
1017
|
BubbleMenu: H,
|
|
1033
|
-
DtButton:
|
|
1018
|
+
DtButton: Oe,
|
|
1034
1019
|
DtStack: x
|
|
1035
1020
|
},
|
|
1036
1021
|
props: {
|
|
@@ -1102,8 +1087,8 @@ const Xt = Vt.exports, Jt = {
|
|
|
1102
1087
|
autoFocus: {
|
|
1103
1088
|
type: [Boolean, String, Number],
|
|
1104
1089
|
default: !1,
|
|
1105
|
-
validator(
|
|
1106
|
-
return typeof
|
|
1090
|
+
validator(e) {
|
|
1091
|
+
return typeof e == "string" ? Le.includes(e) : !0;
|
|
1107
1092
|
}
|
|
1108
1093
|
},
|
|
1109
1094
|
/**
|
|
@@ -1115,8 +1100,8 @@ const Xt = Vt.exports, Jt = {
|
|
|
1115
1100
|
outputFormat: {
|
|
1116
1101
|
type: String,
|
|
1117
1102
|
default: "html",
|
|
1118
|
-
validator(
|
|
1119
|
-
return
|
|
1103
|
+
validator(e) {
|
|
1104
|
+
return Se.includes(e);
|
|
1120
1105
|
}
|
|
1121
1106
|
},
|
|
1122
1107
|
/**
|
|
@@ -1374,12 +1359,12 @@ const Xt = Vt.exports, Jt = {
|
|
|
1374
1359
|
editor: null,
|
|
1375
1360
|
tippyOptions: {
|
|
1376
1361
|
appendTo: () => {
|
|
1377
|
-
var
|
|
1378
|
-
return (
|
|
1362
|
+
var e;
|
|
1363
|
+
return (e = this.$refs.editor.$el.getRootNode()) == null ? void 0 : e.querySelector("body");
|
|
1379
1364
|
},
|
|
1380
1365
|
placement: "top-start"
|
|
1381
1366
|
},
|
|
1382
|
-
i18n: new
|
|
1367
|
+
i18n: new Be()
|
|
1383
1368
|
};
|
|
1384
1369
|
},
|
|
1385
1370
|
computed: {
|
|
@@ -1396,55 +1381,62 @@ const Xt = Vt.exports, Jt = {
|
|
|
1396
1381
|
},
|
|
1397
1382
|
// eslint-disable-next-line complexity
|
|
1398
1383
|
extensions() {
|
|
1399
|
-
const
|
|
1400
|
-
|
|
1384
|
+
const e = [Z, de, me, te];
|
|
1385
|
+
e.push(this.useDivTags ? mt : B), this.allowBold && e.push(ne), this.allowBlockquote && e.push(Y), this.allowBulletList && (e.push(re), e.push(oe.extend({
|
|
1401
1386
|
renderText({ node: r }) {
|
|
1402
1387
|
return r.textContent;
|
|
1403
1388
|
}
|
|
1404
|
-
})),
|
|
1389
|
+
})), e.push(ae)), this.allowItalic && e.push(se), this.allowStrike && e.push(le), this.allowUnderline && e.push(ce), this.placeholder && e.push(
|
|
1405
1390
|
ee.configure({ placeholder: this.placeholder })
|
|
1406
1391
|
);
|
|
1407
|
-
const
|
|
1392
|
+
const t = this, n = J.create({
|
|
1408
1393
|
addKeyboardShortcuts() {
|
|
1409
1394
|
return {
|
|
1410
|
-
"Shift-Enter": ({ editor: r }) =>
|
|
1395
|
+
"Shift-Enter": ({ editor: r }) => t.allowLineBreaks ? !1 : (r.commands.first(({ commands: s }) => [
|
|
1411
1396
|
() => s.newlineInCode(),
|
|
1412
|
-
() =>
|
|
1397
|
+
() => t.allowBulletList && s.splitListItem("listItem"),
|
|
1413
1398
|
() => s.createParagraphNear(),
|
|
1414
1399
|
() => s.liftEmptyBlock(),
|
|
1415
1400
|
() => s.splitBlock()
|
|
1416
1401
|
]), !0),
|
|
1417
|
-
Enter: () =>
|
|
1402
|
+
Enter: () => t.allowLineBreaks ? !1 : (t.$emit("enter"), !0)
|
|
1418
1403
|
};
|
|
1419
1404
|
}
|
|
1420
1405
|
});
|
|
1421
|
-
if (
|
|
1406
|
+
if (e.push(n), this.link && e.push(ie.extend({
|
|
1407
|
+
inclusive: !1,
|
|
1408
|
+
addKeyboardShortcuts() {
|
|
1409
|
+
return {
|
|
1410
|
+
"Mod-k": () => (t.$emit("edit-link"), !0)
|
|
1411
|
+
};
|
|
1412
|
+
}
|
|
1413
|
+
}).configure({
|
|
1422
1414
|
HTMLAttributes: {
|
|
1423
1415
|
class: "d-link d-wb-break-all"
|
|
1424
1416
|
},
|
|
1425
1417
|
openOnClick: !1,
|
|
1426
1418
|
autolink: !0,
|
|
1427
1419
|
protocols: $
|
|
1428
|
-
})), this.customLink &&
|
|
1420
|
+
})), this.customLink && e.push(this.getExtension(dt, this.customLink)), this.mentionSuggestion) {
|
|
1429
1421
|
const r = { ...this.mentionSuggestion, ...Mt };
|
|
1430
|
-
|
|
1422
|
+
e.push(yt.configure({ suggestion: r }));
|
|
1431
1423
|
}
|
|
1432
1424
|
if (this.channelSuggestion) {
|
|
1433
|
-
const r = { ...this.channelSuggestion, ...
|
|
1434
|
-
|
|
1425
|
+
const r = { ...this.channelSuggestion, ...Ut };
|
|
1426
|
+
e.push(Ct.configure({ suggestion: r }));
|
|
1435
1427
|
}
|
|
1436
1428
|
if (this.slashCommandSuggestion) {
|
|
1437
1429
|
const r = { ...this.slashCommandSuggestion, ...Jt };
|
|
1438
|
-
|
|
1430
|
+
e.push(It.configure({
|
|
1439
1431
|
suggestion: r,
|
|
1440
1432
|
onSelectedCommand: (s) => {
|
|
1441
1433
|
this.$emit("selected-command", s);
|
|
1442
1434
|
}
|
|
1443
1435
|
}));
|
|
1444
1436
|
}
|
|
1445
|
-
return
|
|
1437
|
+
return e.push(nt), e.push(ue.configure({
|
|
1446
1438
|
types: ["paragraph"]
|
|
1447
|
-
})), this.allowCode &&
|
|
1439
|
+
})), this.allowCode && e.push(Q), this.allowCodeblock && e.push(G.extend({
|
|
1448
1440
|
renderText({ node: r }) {
|
|
1449
1441
|
return `\`\`\`
|
|
1450
1442
|
${r.textContent}
|
|
@@ -1454,15 +1446,15 @@ ${r.textContent}
|
|
|
1454
1446
|
HTMLAttributes: {
|
|
1455
1447
|
class: "d-rich-text-editor__code-block"
|
|
1456
1448
|
}
|
|
1457
|
-
})), this.allowInlineImages &&
|
|
1449
|
+
})), this.allowInlineImages && e.push(ut), (this.allowFontFamily || this.allowFontColor) && (e.push(he), this.allowFontColor && e.push(fe), this.allowFontFamily && e.push(pe)), this.additionalExtensions.length && e.push(...this.additionalExtensions), e;
|
|
1458
1450
|
},
|
|
1459
1451
|
inputAttrs() {
|
|
1460
|
-
const
|
|
1452
|
+
const e = {
|
|
1461
1453
|
"aria-label": this.inputAriaLabel,
|
|
1462
1454
|
"aria-multiline": !0,
|
|
1463
1455
|
role: "textbox"
|
|
1464
1456
|
};
|
|
1465
|
-
return this.editable || (
|
|
1457
|
+
return this.editable || (e["aria-readonly"] = !0), e;
|
|
1466
1458
|
}
|
|
1467
1459
|
},
|
|
1468
1460
|
/**
|
|
@@ -1471,20 +1463,20 @@ ${r.textContent}
|
|
|
1471
1463
|
* to be hooked up to the Editor's own API.
|
|
1472
1464
|
*/
|
|
1473
1465
|
watch: {
|
|
1474
|
-
editable(
|
|
1475
|
-
this.editor.setEditable(
|
|
1466
|
+
editable(e) {
|
|
1467
|
+
this.editor.setEditable(e), this.updateEditorAttributes({ "aria-readonly": !e });
|
|
1476
1468
|
},
|
|
1477
|
-
inputClass(
|
|
1478
|
-
this.updateEditorAttributes({ class:
|
|
1469
|
+
inputClass(e) {
|
|
1470
|
+
this.updateEditorAttributes({ class: e });
|
|
1479
1471
|
},
|
|
1480
|
-
inputAriaLabel(
|
|
1481
|
-
this.updateEditorAttributes({ "aria-label":
|
|
1472
|
+
inputAriaLabel(e) {
|
|
1473
|
+
this.updateEditorAttributes({ "aria-label": e });
|
|
1482
1474
|
},
|
|
1483
1475
|
extensions() {
|
|
1484
1476
|
this.destroyEditor(), this.createEditor();
|
|
1485
1477
|
},
|
|
1486
|
-
value(
|
|
1487
|
-
this.processValue(
|
|
1478
|
+
value(e) {
|
|
1479
|
+
this.processValue(e);
|
|
1488
1480
|
}
|
|
1489
1481
|
},
|
|
1490
1482
|
created() {
|
|
@@ -1494,11 +1486,11 @@ ${r.textContent}
|
|
|
1494
1486
|
this.destroyEditor();
|
|
1495
1487
|
},
|
|
1496
1488
|
mounted() {
|
|
1497
|
-
|
|
1489
|
+
Te(this.$el, this.$options.name), this.processValue(this.value, !1);
|
|
1498
1490
|
},
|
|
1499
1491
|
methods: {
|
|
1500
1492
|
createEditor() {
|
|
1501
|
-
this.editor = new
|
|
1493
|
+
this.editor = new F({
|
|
1502
1494
|
autofocus: this.autoFocus,
|
|
1503
1495
|
content: this.value,
|
|
1504
1496
|
editable: this.editable,
|
|
@@ -1511,147 +1503,147 @@ ${r.textContent}
|
|
|
1511
1503
|
...this.inputAttrs,
|
|
1512
1504
|
class: this.inputClass
|
|
1513
1505
|
},
|
|
1514
|
-
handleKeyDown: (
|
|
1506
|
+
handleKeyDown: (e, t) => {
|
|
1515
1507
|
if (!this.preventTyping) return !1;
|
|
1516
1508
|
const n = ["Backspace"];
|
|
1517
|
-
return !this.allowLineBreaks && !
|
|
1509
|
+
return !this.allowLineBreaks && !t.shiftKey && n.push("Enter"), !n.includes(t.key);
|
|
1518
1510
|
},
|
|
1519
|
-
handlePaste: (
|
|
1520
|
-
const n =
|
|
1521
|
-
return this.processPasteData(
|
|
1511
|
+
handlePaste: (e, t) => {
|
|
1512
|
+
const n = t.clipboardData || window.clipboardData, r = n.getData("text/plain"), s = n.getData("text/html");
|
|
1513
|
+
return this.processPasteData(e, r, s);
|
|
1522
1514
|
},
|
|
1523
1515
|
// Moves the <br /> tags inside the previous closing tag to avoid
|
|
1524
1516
|
// Prosemirror wrapping them within another </p> tag.
|
|
1525
|
-
transformPastedHTML(
|
|
1526
|
-
return
|
|
1517
|
+
transformPastedHTML(e) {
|
|
1518
|
+
return e.replace(/(<\/\w+>)((<br \/>)+)/g, "$2$3$1");
|
|
1527
1519
|
}
|
|
1528
1520
|
}
|
|
1529
1521
|
}), this.addEditorListeners();
|
|
1530
1522
|
},
|
|
1531
|
-
bubbleMenuShouldShow({ editor:
|
|
1532
|
-
return
|
|
1523
|
+
bubbleMenuShouldShow({ editor: e }) {
|
|
1524
|
+
return e.isActive("link");
|
|
1533
1525
|
},
|
|
1534
1526
|
/**
|
|
1535
1527
|
* If the selection contains a link, return the existing link text.
|
|
1536
1528
|
* Otherwise, use just the selected text.
|
|
1537
1529
|
* @param editor the editor instance.
|
|
1538
1530
|
*/
|
|
1539
|
-
getSelectedLinkText(
|
|
1540
|
-
var a, l,
|
|
1541
|
-
const { view:
|
|
1542
|
-
return
|
|
1531
|
+
getSelectedLinkText(e) {
|
|
1532
|
+
var a, l, d;
|
|
1533
|
+
const { view: t, state: n } = e, { from: r, to: s } = t.state.selection, i = n.doc.textBetween(r, s, ""), o = this.editor.state.doc.nodeAt(r);
|
|
1534
|
+
return o && ((d = (l = (a = o.marks) == null ? void 0 : a.at(0)) == null ? void 0 : l.type) == null ? void 0 : d.name) === "link" ? o.textContent : i;
|
|
1543
1535
|
},
|
|
1544
1536
|
editLink() {
|
|
1545
|
-
const
|
|
1537
|
+
const e = this.getSelectedLinkText(this.editor), t = {
|
|
1546
1538
|
href: this.editor.getAttributes("link").href,
|
|
1547
|
-
text:
|
|
1539
|
+
text: e
|
|
1548
1540
|
};
|
|
1549
|
-
this.$emit("edit-link",
|
|
1541
|
+
this.$emit("edit-link", t);
|
|
1550
1542
|
},
|
|
1551
1543
|
removeLink() {
|
|
1552
|
-
var
|
|
1553
|
-
(r = (n = (
|
|
1544
|
+
var e, t, n, r;
|
|
1545
|
+
(r = (n = (t = (e = this.editor) == null ? void 0 : e.chain()) == null ? void 0 : t.focus()) == null ? void 0 : n.unsetLink()) == null || r.run();
|
|
1554
1546
|
},
|
|
1555
1547
|
openLink() {
|
|
1556
|
-
var
|
|
1557
|
-
(n = (
|
|
1558
|
-
const
|
|
1559
|
-
window.open(
|
|
1548
|
+
var t, n;
|
|
1549
|
+
(n = (t = this.editor) == null ? void 0 : t.chain()) == null || n.focus();
|
|
1550
|
+
const e = this.editor.getAttributes("link").href;
|
|
1551
|
+
window.open(e, "_blank");
|
|
1560
1552
|
},
|
|
1561
1553
|
// eslint-disable-next-line complexity
|
|
1562
|
-
setLink(
|
|
1563
|
-
var a, l,
|
|
1564
|
-
if (!
|
|
1554
|
+
setLink(e, t, n, r = $, s) {
|
|
1555
|
+
var a, l, d;
|
|
1556
|
+
if (!e) {
|
|
1565
1557
|
this.removeLink();
|
|
1566
1558
|
return;
|
|
1567
1559
|
}
|
|
1568
|
-
r.find((u) => u.test(
|
|
1569
|
-
const
|
|
1570
|
-
this.editor.chain().focus().insertContent(
|
|
1560
|
+
r.find((u) => u.test(e)) || (e = `${s}${e}`), this.editor.chain().focus().extendMarkRange("link").run();
|
|
1561
|
+
const o = (d = (l = (a = this.editor) == null ? void 0 : a.view) == null ? void 0 : l.state) == null ? void 0 : d.selection;
|
|
1562
|
+
this.editor.chain().focus().insertContent(t).setTextSelection({ from: o.from, to: o.from + t.length }).setLink({ href: e, class: n.class }).run();
|
|
1571
1563
|
},
|
|
1572
1564
|
// eslint-disable-next-line complexity
|
|
1573
|
-
processValue(
|
|
1565
|
+
processValue(e, t = !0) {
|
|
1574
1566
|
const n = this.getOutput();
|
|
1575
|
-
if (!(
|
|
1576
|
-
if (typeof
|
|
1567
|
+
if (!(t && Ae(e, n))) {
|
|
1568
|
+
if (typeof e == "string" && this.outputFormat === "text") {
|
|
1577
1569
|
const r = new RegExp(`(${O})`, "g");
|
|
1578
|
-
|
|
1570
|
+
e = e == null ? void 0 : e.replace(r, '<emoji-component code="$1"></emoji-component>');
|
|
1579
1571
|
}
|
|
1580
|
-
this.editor.commands.setContent(
|
|
1572
|
+
this.editor.commands.setContent(e, !1, { preserveWhitespace: "full" });
|
|
1581
1573
|
}
|
|
1582
1574
|
},
|
|
1583
1575
|
destroyEditor() {
|
|
1584
1576
|
this.editor.destroy();
|
|
1585
1577
|
},
|
|
1586
|
-
insertPlainTextWithHardBreaks(
|
|
1587
|
-
const { tr: n } =
|
|
1578
|
+
insertPlainTextWithHardBreaks(e, t) {
|
|
1579
|
+
const { tr: n } = e.state, { from: r, to: s } = e.state.selection;
|
|
1588
1580
|
n.deleteRange(r, s);
|
|
1589
|
-
const
|
|
1590
|
-
let
|
|
1591
|
-
for (let a = 0; a <
|
|
1592
|
-
a > 0 && (n.insert(
|
|
1593
|
-
|
|
1594
|
-
},
|
|
1595
|
-
shouldPreserveLineBreaks(
|
|
1596
|
-
return this.pasteRichText ? !
|
|
1597
|
-
},
|
|
1598
|
-
processPasteData(
|
|
1599
|
-
if (this.shouldPreserveLineBreaks(
|
|
1600
|
-
return this.insertPlainTextWithHardBreaks(
|
|
1581
|
+
const i = t.split(/\r?\n/);
|
|
1582
|
+
let o = r;
|
|
1583
|
+
for (let a = 0; a < i.length; a++)
|
|
1584
|
+
a > 0 && (n.insert(o, e.state.schema.nodes.hardBreak.create()), o++), n.insertText(i[a], o), o += i[a].length;
|
|
1585
|
+
e.dispatch(n);
|
|
1586
|
+
},
|
|
1587
|
+
shouldPreserveLineBreaks(e, t) {
|
|
1588
|
+
return this.pasteRichText ? !t && e && this.hasBlankLines(e) : !!e;
|
|
1589
|
+
},
|
|
1590
|
+
processPasteData(e, t, n) {
|
|
1591
|
+
if (this.shouldPreserveLineBreaks(t, n))
|
|
1592
|
+
return this.insertPlainTextWithHardBreaks(e, t), !0;
|
|
1601
1593
|
if (this.shouldHandlePreformattedHTML(n)) {
|
|
1602
1594
|
const r = this.extractPreformattedText(n);
|
|
1603
1595
|
if (r && r.includes(`
|
|
1604
1596
|
`))
|
|
1605
|
-
return this.insertPlainTextWithHardBreaks(
|
|
1597
|
+
return this.insertPlainTextWithHardBreaks(e, r), !0;
|
|
1606
1598
|
}
|
|
1607
1599
|
return !1;
|
|
1608
1600
|
},
|
|
1609
|
-
shouldHandlePreformattedHTML(
|
|
1610
|
-
return this.pasteRichText &&
|
|
1601
|
+
shouldHandlePreformattedHTML(e) {
|
|
1602
|
+
return this.pasteRichText && e && this.containsPreformattedContent(e);
|
|
1611
1603
|
},
|
|
1612
|
-
containsPreformattedContent(
|
|
1613
|
-
const
|
|
1614
|
-
|
|
1615
|
-
const n =
|
|
1604
|
+
containsPreformattedContent(e) {
|
|
1605
|
+
const t = document.createElement("div");
|
|
1606
|
+
t.innerHTML = e;
|
|
1607
|
+
const n = t.querySelectorAll("*");
|
|
1616
1608
|
for (const r of n)
|
|
1617
1609
|
if (this.hasPreWhitespace(r) && this.hasLineBreaks(r))
|
|
1618
1610
|
return !0;
|
|
1619
1611
|
return !1;
|
|
1620
1612
|
},
|
|
1621
|
-
hasPreWhitespace(
|
|
1622
|
-
const
|
|
1613
|
+
hasPreWhitespace(e) {
|
|
1614
|
+
const t = e.getAttribute("style") || "", n = e.style.whiteSpace || "", r = n === "pre" || n === "pre-wrap", s = t.includes("white-space: pre");
|
|
1623
1615
|
return r || s;
|
|
1624
1616
|
},
|
|
1625
|
-
hasLineBreaks(
|
|
1626
|
-
return
|
|
1617
|
+
hasLineBreaks(e) {
|
|
1618
|
+
return e.textContent && e.textContent.includes(`
|
|
1627
1619
|
`);
|
|
1628
1620
|
},
|
|
1629
|
-
hasBlankLines(
|
|
1630
|
-
return
|
|
1621
|
+
hasBlankLines(e) {
|
|
1622
|
+
return e.includes(`
|
|
1631
1623
|
|
|
1632
|
-
`) || /\n\s*\n/.test(
|
|
1633
|
-
},
|
|
1634
|
-
extractPreformattedText(
|
|
1635
|
-
const
|
|
1636
|
-
return
|
|
1637
|
-
},
|
|
1638
|
-
walkAndExtractText(
|
|
1639
|
-
let
|
|
1640
|
-
if (
|
|
1641
|
-
|
|
1642
|
-
else if (
|
|
1643
|
-
if (this.hasPreWhitespace(
|
|
1644
|
-
|
|
1624
|
+
`) || /\n\s*\n/.test(e);
|
|
1625
|
+
},
|
|
1626
|
+
extractPreformattedText(e) {
|
|
1627
|
+
const t = document.createElement("div");
|
|
1628
|
+
return t.innerHTML = e, this.walkAndExtractText(t);
|
|
1629
|
+
},
|
|
1630
|
+
walkAndExtractText(e) {
|
|
1631
|
+
let t = "";
|
|
1632
|
+
if (e.nodeType === Node.TEXT_NODE)
|
|
1633
|
+
t += e.textContent;
|
|
1634
|
+
else if (e.nodeType === Node.ELEMENT_NODE)
|
|
1635
|
+
if (this.hasPreWhitespace(e))
|
|
1636
|
+
t += e.textContent;
|
|
1645
1637
|
else
|
|
1646
|
-
for (const n of
|
|
1647
|
-
|
|
1648
|
-
return
|
|
1638
|
+
for (const n of e.childNodes)
|
|
1639
|
+
t += this.walkAndExtractText(n);
|
|
1640
|
+
return t;
|
|
1649
1641
|
},
|
|
1650
1642
|
triggerInputChangeEvents() {
|
|
1651
|
-
const
|
|
1652
|
-
this.$emit("input",
|
|
1653
|
-
const
|
|
1654
|
-
this.$emit("json-input",
|
|
1643
|
+
const e = this.getOutput();
|
|
1644
|
+
this.$emit("input", e), this.$emit("update:value", e);
|
|
1645
|
+
const t = this.editor.getJSON();
|
|
1646
|
+
this.$emit("json-input", t);
|
|
1655
1647
|
const n = this.editor.getHTML();
|
|
1656
1648
|
this.$emit("html-input", n);
|
|
1657
1649
|
const r = this.editor.getText({ blockSeparator: `
|
|
@@ -1667,12 +1659,12 @@ ${r.textContent}
|
|
|
1667
1659
|
this.triggerInputChangeEvents();
|
|
1668
1660
|
}), this.editor.on("update", () => {
|
|
1669
1661
|
this.triggerInputChangeEvents();
|
|
1670
|
-
}), this.editor.on("selectionUpdate", ({ editor:
|
|
1671
|
-
this.$emit("selected", this.getSelectedLinkText(
|
|
1672
|
-
}), this.editor.on("focus", ({ event:
|
|
1673
|
-
this.$emit("focus",
|
|
1674
|
-
}), this.editor.on("blur", ({ event:
|
|
1675
|
-
this.$emit("blur",
|
|
1662
|
+
}), this.editor.on("selectionUpdate", ({ editor: e }) => {
|
|
1663
|
+
this.$emit("selected", this.getSelectedLinkText(e));
|
|
1664
|
+
}), this.editor.on("focus", ({ event: e }) => {
|
|
1665
|
+
this.$emit("focus", e);
|
|
1666
|
+
}), this.editor.on("blur", ({ event: e }) => {
|
|
1667
|
+
this.$emit("blur", e);
|
|
1676
1668
|
});
|
|
1677
1669
|
},
|
|
1678
1670
|
getOutput() {
|
|
@@ -1687,17 +1679,17 @@ ${r.textContent}
|
|
|
1687
1679
|
` });
|
|
1688
1680
|
}
|
|
1689
1681
|
},
|
|
1690
|
-
getExtension(
|
|
1682
|
+
getExtension(e, t) {
|
|
1691
1683
|
var n;
|
|
1692
|
-
return typeof
|
|
1684
|
+
return typeof t == "boolean" ? e : (n = e.configure) == null ? void 0 : n.call(e, t);
|
|
1693
1685
|
},
|
|
1694
|
-
updateEditorAttributes(
|
|
1686
|
+
updateEditorAttributes(e) {
|
|
1695
1687
|
this.editor.setOptions({
|
|
1696
1688
|
editorProps: {
|
|
1697
1689
|
attributes: {
|
|
1698
1690
|
...this.inputAttrs,
|
|
1699
1691
|
class: this.inputClass,
|
|
1700
|
-
...
|
|
1692
|
+
...e
|
|
1701
1693
|
}
|
|
1702
1694
|
}
|
|
1703
1695
|
});
|
|
@@ -1708,9 +1700,9 @@ ${r.textContent}
|
|
|
1708
1700
|
}
|
|
1709
1701
|
};
|
|
1710
1702
|
var Gt = function() {
|
|
1711
|
-
var
|
|
1712
|
-
return n("div", [
|
|
1713
|
-
}, Qt = [], Zt = /* @__PURE__ */
|
|
1703
|
+
var t = this, n = t._self._c;
|
|
1704
|
+
return n("div", [t.editor && t.link && !t.hideLinkBubbleMenu ? n("bubble-menu", { staticStyle: { visibility: "visible" }, attrs: { editor: t.editor, "should-show": t.bubbleMenuShouldShow, "tippy-options": t.tippyOptions } }, [n("div", { staticClass: "d-popover__dialog" }, [n("dt-stack", { staticClass: "d-rich-text-editor-bubble-menu__button-stack", attrs: { direction: "row", gap: "0" } }, [n("dt-button", { attrs: { kind: "muted", importance: "clear" }, on: { click: t.editLink } }, [t._v(" " + t._s(t.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_EDIT_BUTTON_LABEL")) + " ")]), n("dt-button", { attrs: { kind: "muted", importance: "clear" }, on: { click: t.openLink } }, [t._v(" " + t._s(t.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_OPEN_LINK_BUTTON_LABEL")) + " ")]), n("dt-button", { attrs: { kind: "danger", importance: "clear" }, on: { click: t.removeLink } }, [t._v(" " + t._s(t.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_REMOVE_BUTTON_LABEL")) + " ")])], 1)], 1)]) : t._e(), n("editor-content", t._g({ ref: "editor", staticClass: "d-rich-text-editor", attrs: { editor: t.editor, "data-qa": "dt-rich-text-editor" } }, t.editorListeners))], 1);
|
|
1705
|
+
}, Qt = [], Zt = /* @__PURE__ */ c(
|
|
1714
1706
|
Yt,
|
|
1715
1707
|
Gt,
|
|
1716
1708
|
Qt
|