@dialpad/dialtone 9.131.1 → 9.132.1
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/tokens/doc.json +38398 -38398
- 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/chip/chip.cjs +1 -1
- package/dist/vue2/lib/chip/chip.cjs.map +1 -1
- package/dist/vue2/lib/chip/chip.js +17 -7
- package/dist/vue2/lib/chip/chip.js.map +1 -1
- package/dist/vue2/lib/combobox-multi-select/combobox-multi-select.cjs +1 -1
- package/dist/vue2/lib/combobox-multi-select/combobox-multi-select.cjs.map +1 -1
- package/dist/vue2/lib/combobox-multi-select/combobox-multi-select.js +43 -27
- package/dist/vue2/lib/combobox-multi-select/combobox-multi-select.js.map +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 +14 -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 +387 -402
- 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/chip/chip.vue.d.ts +2 -1
- package/dist/vue2/types/components/chip/chip.vue.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/recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue.d.ts +1 -1
- package/dist/vue2/types/recipes/comboboxes/combobox_multi_select/combobox_multi_select.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/chip/chip.cjs +1 -1
- package/dist/vue3/lib/chip/chip.cjs.map +1 -1
- package/dist/vue3/lib/chip/chip.js +40 -30
- package/dist/vue3/lib/chip/chip.js.map +1 -1
- package/dist/vue3/lib/combobox-multi-select/combobox-multi-select.cjs +1 -1
- package/dist/vue3/lib/combobox-multi-select/combobox-multi-select.cjs.map +1 -1
- package/dist/vue3/lib/combobox-multi-select/combobox-multi-select.js +25 -11
- package/dist/vue3/lib/combobox-multi-select/combobox-multi-select.js.map +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 +59 -51
- 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 +125 -119
- 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/chip/chip.vue.d.ts +3 -1
- package/dist/vue3/types/components/chip/chip.vue.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/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 +2 -2
|
@@ -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,33 +1381,33 @@ 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({
|
|
1422
1407
|
inclusive: !1,
|
|
1423
1408
|
addKeyboardShortcuts() {
|
|
1424
1409
|
return {
|
|
1425
|
-
"Mod-k": () => (
|
|
1410
|
+
"Mod-k": () => (t.$emit("edit-link"), !0)
|
|
1426
1411
|
};
|
|
1427
1412
|
}
|
|
1428
1413
|
}).configure({
|
|
@@ -1432,26 +1417,26 @@ const Xt = Vt.exports, Jt = {
|
|
|
1432
1417
|
openOnClick: !1,
|
|
1433
1418
|
autolink: !0,
|
|
1434
1419
|
protocols: $
|
|
1435
|
-
})), this.customLink &&
|
|
1420
|
+
})), this.customLink && e.push(this.getExtension(dt, this.customLink)), this.mentionSuggestion) {
|
|
1436
1421
|
const r = { ...this.mentionSuggestion, ...Mt };
|
|
1437
|
-
|
|
1422
|
+
e.push(yt.configure({ suggestion: r }));
|
|
1438
1423
|
}
|
|
1439
1424
|
if (this.channelSuggestion) {
|
|
1440
|
-
const r = { ...this.channelSuggestion, ...
|
|
1441
|
-
|
|
1425
|
+
const r = { ...this.channelSuggestion, ...Ut };
|
|
1426
|
+
e.push(Ct.configure({ suggestion: r }));
|
|
1442
1427
|
}
|
|
1443
1428
|
if (this.slashCommandSuggestion) {
|
|
1444
1429
|
const r = { ...this.slashCommandSuggestion, ...Jt };
|
|
1445
|
-
|
|
1430
|
+
e.push(It.configure({
|
|
1446
1431
|
suggestion: r,
|
|
1447
1432
|
onSelectedCommand: (s) => {
|
|
1448
1433
|
this.$emit("selected-command", s);
|
|
1449
1434
|
}
|
|
1450
1435
|
}));
|
|
1451
1436
|
}
|
|
1452
|
-
return
|
|
1437
|
+
return e.push(nt), e.push(ue.configure({
|
|
1453
1438
|
types: ["paragraph"]
|
|
1454
|
-
})), this.allowCode &&
|
|
1439
|
+
})), this.allowCode && e.push(Q), this.allowCodeblock && e.push(G.extend({
|
|
1455
1440
|
renderText({ node: r }) {
|
|
1456
1441
|
return `\`\`\`
|
|
1457
1442
|
${r.textContent}
|
|
@@ -1461,15 +1446,15 @@ ${r.textContent}
|
|
|
1461
1446
|
HTMLAttributes: {
|
|
1462
1447
|
class: "d-rich-text-editor__code-block"
|
|
1463
1448
|
}
|
|
1464
|
-
})), 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;
|
|
1465
1450
|
},
|
|
1466
1451
|
inputAttrs() {
|
|
1467
|
-
const
|
|
1452
|
+
const e = {
|
|
1468
1453
|
"aria-label": this.inputAriaLabel,
|
|
1469
1454
|
"aria-multiline": !0,
|
|
1470
1455
|
role: "textbox"
|
|
1471
1456
|
};
|
|
1472
|
-
return this.editable || (
|
|
1457
|
+
return this.editable || (e["aria-readonly"] = !0), e;
|
|
1473
1458
|
}
|
|
1474
1459
|
},
|
|
1475
1460
|
/**
|
|
@@ -1478,20 +1463,20 @@ ${r.textContent}
|
|
|
1478
1463
|
* to be hooked up to the Editor's own API.
|
|
1479
1464
|
*/
|
|
1480
1465
|
watch: {
|
|
1481
|
-
editable(
|
|
1482
|
-
this.editor.setEditable(
|
|
1466
|
+
editable(e) {
|
|
1467
|
+
this.editor.setEditable(e), this.updateEditorAttributes({ "aria-readonly": !e });
|
|
1483
1468
|
},
|
|
1484
|
-
inputClass(
|
|
1485
|
-
this.updateEditorAttributes({ class:
|
|
1469
|
+
inputClass(e) {
|
|
1470
|
+
this.updateEditorAttributes({ class: e });
|
|
1486
1471
|
},
|
|
1487
|
-
inputAriaLabel(
|
|
1488
|
-
this.updateEditorAttributes({ "aria-label":
|
|
1472
|
+
inputAriaLabel(e) {
|
|
1473
|
+
this.updateEditorAttributes({ "aria-label": e });
|
|
1489
1474
|
},
|
|
1490
1475
|
extensions() {
|
|
1491
1476
|
this.destroyEditor(), this.createEditor();
|
|
1492
1477
|
},
|
|
1493
|
-
value(
|
|
1494
|
-
this.processValue(
|
|
1478
|
+
value(e) {
|
|
1479
|
+
this.processValue(e);
|
|
1495
1480
|
}
|
|
1496
1481
|
},
|
|
1497
1482
|
created() {
|
|
@@ -1501,11 +1486,11 @@ ${r.textContent}
|
|
|
1501
1486
|
this.destroyEditor();
|
|
1502
1487
|
},
|
|
1503
1488
|
mounted() {
|
|
1504
|
-
|
|
1489
|
+
Te(this.$el, this.$options.name), this.processValue(this.value, !1);
|
|
1505
1490
|
},
|
|
1506
1491
|
methods: {
|
|
1507
1492
|
createEditor() {
|
|
1508
|
-
this.editor = new
|
|
1493
|
+
this.editor = new F({
|
|
1509
1494
|
autofocus: this.autoFocus,
|
|
1510
1495
|
content: this.value,
|
|
1511
1496
|
editable: this.editable,
|
|
@@ -1518,147 +1503,147 @@ ${r.textContent}
|
|
|
1518
1503
|
...this.inputAttrs,
|
|
1519
1504
|
class: this.inputClass
|
|
1520
1505
|
},
|
|
1521
|
-
handleKeyDown: (
|
|
1506
|
+
handleKeyDown: (e, t) => {
|
|
1522
1507
|
if (!this.preventTyping) return !1;
|
|
1523
1508
|
const n = ["Backspace"];
|
|
1524
|
-
return !this.allowLineBreaks && !
|
|
1509
|
+
return !this.allowLineBreaks && !t.shiftKey && n.push("Enter"), !n.includes(t.key);
|
|
1525
1510
|
},
|
|
1526
|
-
handlePaste: (
|
|
1527
|
-
const n =
|
|
1528
|
-
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);
|
|
1529
1514
|
},
|
|
1530
1515
|
// Moves the <br /> tags inside the previous closing tag to avoid
|
|
1531
1516
|
// Prosemirror wrapping them within another </p> tag.
|
|
1532
|
-
transformPastedHTML(
|
|
1533
|
-
return
|
|
1517
|
+
transformPastedHTML(e) {
|
|
1518
|
+
return e.replace(/(<\/\w+>)((<br \/>)+)/g, "$2$3$1");
|
|
1534
1519
|
}
|
|
1535
1520
|
}
|
|
1536
1521
|
}), this.addEditorListeners();
|
|
1537
1522
|
},
|
|
1538
|
-
bubbleMenuShouldShow({ editor:
|
|
1539
|
-
return
|
|
1523
|
+
bubbleMenuShouldShow({ editor: e }) {
|
|
1524
|
+
return e.isActive("link");
|
|
1540
1525
|
},
|
|
1541
1526
|
/**
|
|
1542
1527
|
* If the selection contains a link, return the existing link text.
|
|
1543
1528
|
* Otherwise, use just the selected text.
|
|
1544
1529
|
* @param editor the editor instance.
|
|
1545
1530
|
*/
|
|
1546
|
-
getSelectedLinkText(
|
|
1547
|
-
var a, l,
|
|
1548
|
-
const { view:
|
|
1549
|
-
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;
|
|
1550
1535
|
},
|
|
1551
1536
|
editLink() {
|
|
1552
|
-
const
|
|
1537
|
+
const e = this.getSelectedLinkText(this.editor), t = {
|
|
1553
1538
|
href: this.editor.getAttributes("link").href,
|
|
1554
|
-
text:
|
|
1539
|
+
text: e
|
|
1555
1540
|
};
|
|
1556
|
-
this.$emit("edit-link",
|
|
1541
|
+
this.$emit("edit-link", t);
|
|
1557
1542
|
},
|
|
1558
1543
|
removeLink() {
|
|
1559
|
-
var
|
|
1560
|
-
(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();
|
|
1561
1546
|
},
|
|
1562
1547
|
openLink() {
|
|
1563
|
-
var
|
|
1564
|
-
(n = (
|
|
1565
|
-
const
|
|
1566
|
-
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");
|
|
1567
1552
|
},
|
|
1568
1553
|
// eslint-disable-next-line complexity
|
|
1569
|
-
setLink(
|
|
1570
|
-
var a, l,
|
|
1571
|
-
if (!
|
|
1554
|
+
setLink(e, t, n, r = $, s) {
|
|
1555
|
+
var a, l, d;
|
|
1556
|
+
if (!e) {
|
|
1572
1557
|
this.removeLink();
|
|
1573
1558
|
return;
|
|
1574
1559
|
}
|
|
1575
|
-
r.find((u) => u.test(
|
|
1576
|
-
const
|
|
1577
|
-
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();
|
|
1578
1563
|
},
|
|
1579
1564
|
// eslint-disable-next-line complexity
|
|
1580
|
-
processValue(
|
|
1565
|
+
processValue(e, t = !0) {
|
|
1581
1566
|
const n = this.getOutput();
|
|
1582
|
-
if (!(
|
|
1583
|
-
if (typeof
|
|
1567
|
+
if (!(t && Ae(e, n))) {
|
|
1568
|
+
if (typeof e == "string" && this.outputFormat === "text") {
|
|
1584
1569
|
const r = new RegExp(`(${O})`, "g");
|
|
1585
|
-
|
|
1570
|
+
e = e == null ? void 0 : e.replace(r, '<emoji-component code="$1"></emoji-component>');
|
|
1586
1571
|
}
|
|
1587
|
-
this.editor.commands.setContent(
|
|
1572
|
+
this.editor.commands.setContent(e, !1, { preserveWhitespace: "full" });
|
|
1588
1573
|
}
|
|
1589
1574
|
},
|
|
1590
1575
|
destroyEditor() {
|
|
1591
1576
|
this.editor.destroy();
|
|
1592
1577
|
},
|
|
1593
|
-
insertPlainTextWithHardBreaks(
|
|
1594
|
-
const { tr: n } =
|
|
1578
|
+
insertPlainTextWithHardBreaks(e, t) {
|
|
1579
|
+
const { tr: n } = e.state, { from: r, to: s } = e.state.selection;
|
|
1595
1580
|
n.deleteRange(r, s);
|
|
1596
|
-
const
|
|
1597
|
-
let
|
|
1598
|
-
for (let a = 0; a <
|
|
1599
|
-
a > 0 && (n.insert(
|
|
1600
|
-
|
|
1601
|
-
},
|
|
1602
|
-
shouldPreserveLineBreaks(
|
|
1603
|
-
return this.pasteRichText ? !
|
|
1604
|
-
},
|
|
1605
|
-
processPasteData(
|
|
1606
|
-
if (this.shouldPreserveLineBreaks(
|
|
1607
|
-
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;
|
|
1608
1593
|
if (this.shouldHandlePreformattedHTML(n)) {
|
|
1609
1594
|
const r = this.extractPreformattedText(n);
|
|
1610
1595
|
if (r && r.includes(`
|
|
1611
1596
|
`))
|
|
1612
|
-
return this.insertPlainTextWithHardBreaks(
|
|
1597
|
+
return this.insertPlainTextWithHardBreaks(e, r), !0;
|
|
1613
1598
|
}
|
|
1614
1599
|
return !1;
|
|
1615
1600
|
},
|
|
1616
|
-
shouldHandlePreformattedHTML(
|
|
1617
|
-
return this.pasteRichText &&
|
|
1601
|
+
shouldHandlePreformattedHTML(e) {
|
|
1602
|
+
return this.pasteRichText && e && this.containsPreformattedContent(e);
|
|
1618
1603
|
},
|
|
1619
|
-
containsPreformattedContent(
|
|
1620
|
-
const
|
|
1621
|
-
|
|
1622
|
-
const n =
|
|
1604
|
+
containsPreformattedContent(e) {
|
|
1605
|
+
const t = document.createElement("div");
|
|
1606
|
+
t.innerHTML = e;
|
|
1607
|
+
const n = t.querySelectorAll("*");
|
|
1623
1608
|
for (const r of n)
|
|
1624
1609
|
if (this.hasPreWhitespace(r) && this.hasLineBreaks(r))
|
|
1625
1610
|
return !0;
|
|
1626
1611
|
return !1;
|
|
1627
1612
|
},
|
|
1628
|
-
hasPreWhitespace(
|
|
1629
|
-
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");
|
|
1630
1615
|
return r || s;
|
|
1631
1616
|
},
|
|
1632
|
-
hasLineBreaks(
|
|
1633
|
-
return
|
|
1617
|
+
hasLineBreaks(e) {
|
|
1618
|
+
return e.textContent && e.textContent.includes(`
|
|
1634
1619
|
`);
|
|
1635
1620
|
},
|
|
1636
|
-
hasBlankLines(
|
|
1637
|
-
return
|
|
1621
|
+
hasBlankLines(e) {
|
|
1622
|
+
return e.includes(`
|
|
1638
1623
|
|
|
1639
|
-
`) || /\n\s*\n/.test(
|
|
1640
|
-
},
|
|
1641
|
-
extractPreformattedText(
|
|
1642
|
-
const
|
|
1643
|
-
return
|
|
1644
|
-
},
|
|
1645
|
-
walkAndExtractText(
|
|
1646
|
-
let
|
|
1647
|
-
if (
|
|
1648
|
-
|
|
1649
|
-
else if (
|
|
1650
|
-
if (this.hasPreWhitespace(
|
|
1651
|
-
|
|
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;
|
|
1652
1637
|
else
|
|
1653
|
-
for (const n of
|
|
1654
|
-
|
|
1655
|
-
return
|
|
1638
|
+
for (const n of e.childNodes)
|
|
1639
|
+
t += this.walkAndExtractText(n);
|
|
1640
|
+
return t;
|
|
1656
1641
|
},
|
|
1657
1642
|
triggerInputChangeEvents() {
|
|
1658
|
-
const
|
|
1659
|
-
this.$emit("input",
|
|
1660
|
-
const
|
|
1661
|
-
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);
|
|
1662
1647
|
const n = this.editor.getHTML();
|
|
1663
1648
|
this.$emit("html-input", n);
|
|
1664
1649
|
const r = this.editor.getText({ blockSeparator: `
|
|
@@ -1674,12 +1659,12 @@ ${r.textContent}
|
|
|
1674
1659
|
this.triggerInputChangeEvents();
|
|
1675
1660
|
}), this.editor.on("update", () => {
|
|
1676
1661
|
this.triggerInputChangeEvents();
|
|
1677
|
-
}), this.editor.on("selectionUpdate", ({ editor:
|
|
1678
|
-
this.$emit("selected", this.getSelectedLinkText(
|
|
1679
|
-
}), this.editor.on("focus", ({ event:
|
|
1680
|
-
this.$emit("focus",
|
|
1681
|
-
}), this.editor.on("blur", ({ event:
|
|
1682
|
-
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);
|
|
1683
1668
|
});
|
|
1684
1669
|
},
|
|
1685
1670
|
getOutput() {
|
|
@@ -1694,17 +1679,17 @@ ${r.textContent}
|
|
|
1694
1679
|
` });
|
|
1695
1680
|
}
|
|
1696
1681
|
},
|
|
1697
|
-
getExtension(
|
|
1682
|
+
getExtension(e, t) {
|
|
1698
1683
|
var n;
|
|
1699
|
-
return typeof
|
|
1684
|
+
return typeof t == "boolean" ? e : (n = e.configure) == null ? void 0 : n.call(e, t);
|
|
1700
1685
|
},
|
|
1701
|
-
updateEditorAttributes(
|
|
1686
|
+
updateEditorAttributes(e) {
|
|
1702
1687
|
this.editor.setOptions({
|
|
1703
1688
|
editorProps: {
|
|
1704
1689
|
attributes: {
|
|
1705
1690
|
...this.inputAttrs,
|
|
1706
1691
|
class: this.inputClass,
|
|
1707
|
-
...
|
|
1692
|
+
...e
|
|
1708
1693
|
}
|
|
1709
1694
|
}
|
|
1710
1695
|
});
|
|
@@ -1715,9 +1700,9 @@ ${r.textContent}
|
|
|
1715
1700
|
}
|
|
1716
1701
|
};
|
|
1717
1702
|
var Gt = function() {
|
|
1718
|
-
var
|
|
1719
|
-
return n("div", [
|
|
1720
|
-
}, 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(
|
|
1721
1706
|
Yt,
|
|
1722
1707
|
Gt,
|
|
1723
1708
|
Qt
|