@dialpad/dialtone 9.125.0 → 9.126.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 +4 -0
- package/dist/css/dialtone-default-theme.min.css +1 -1
- package/dist/css/dialtone.css +4 -0
- package/dist/css/dialtone.min.css +1 -1
- package/dist/tokens/doc.json +26387 -26387
- package/dist/vue2/component-documentation.json +1 -1
- package/dist/vue2/dialtone-vue.cjs +1 -1
- package/dist/vue2/dialtone-vue.js +227 -225
- package/dist/vue2/dialtone-vue.js.map +1 -1
- package/dist/vue2/lib/button/button.cjs +1 -1
- package/dist/vue2/lib/button/button.cjs.map +1 -1
- package/dist/vue2/lib/button/button.js +7 -7
- package/dist/vue2/lib/button/button.js.map +1 -1
- package/dist/vue2/lib/list-item/list-item.cjs +1 -1
- package/dist/vue2/lib/list-item/list-item.cjs.map +1 -1
- package/dist/vue2/lib/list-item/list-item.js +21 -11
- package/dist/vue2/lib/list-item/list-item.js.map +1 -1
- package/dist/vue2/lib/loader/index.cjs +2 -0
- package/dist/vue2/lib/loader/index.cjs.map +1 -0
- package/dist/vue2/lib/loader/index.js +5 -0
- package/dist/vue2/lib/loader/index.js.map +1 -0
- package/dist/vue2/lib/loader/loader.cjs +2 -0
- package/dist/vue2/lib/loader/loader.cjs.map +1 -0
- package/dist/vue2/lib/loader/loader.js +48 -0
- package/dist/vue2/lib/loader/loader.js.map +1 -0
- package/dist/vue2/lib/rich-text-editor/rich-text-editor.cjs +8 -4
- 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 +414 -356
- package/dist/vue2/lib/rich-text-editor/rich-text-editor.js.map +1 -1
- package/dist/vue2/localization/en-US.cjs +1 -1
- package/dist/vue2/localization/en-US.cjs.map +1 -1
- package/dist/vue2/localization/en-US.js +1 -1
- package/dist/vue2/localization/en-US.js.map +1 -1
- package/dist/vue2/localization/es-LA.cjs +1 -1
- package/dist/vue2/localization/es-LA.cjs.map +1 -1
- package/dist/vue2/localization/es-LA.js +1 -1
- package/dist/vue2/localization/es-LA.js.map +1 -1
- package/dist/vue2/localization/index.cjs +157 -11
- package/dist/vue2/localization/index.cjs.map +1 -1
- package/dist/vue2/localization/index.js +164 -18
- package/dist/vue2/localization/index.js.map +1 -1
- package/dist/vue2/types/components/list_item/list_item.vue.d.ts +9 -0
- package/dist/vue2/types/components/list_item/list_item.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/loader/index.d.ts +2 -0
- package/dist/vue2/types/components/loader/index.d.ts.map +1 -0
- package/dist/vue2/types/components/loader/loader.vue.d.ts +32 -0
- package/dist/vue2/types/components/loader/loader.vue.d.ts.map +1 -0
- package/dist/vue2/types/components/rich_text_editor/rich_text_editor.vue.d.ts +10 -0
- package/dist/vue2/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
- package/dist/vue2/types/index.d.ts +1 -0
- package/dist/vue2/types/recipes/conversation_view/feed_item_pill/feed_item_pill.vue.d.ts +1 -1
- package/dist/vue3/component-documentation.json +1 -1
- package/dist/vue3/dialtone-vue.cjs +1 -1
- package/dist/vue3/dialtone-vue.js +208 -206
- package/dist/vue3/dialtone-vue.js.map +1 -1
- package/dist/vue3/lib/list-item/list-item.cjs +1 -1
- package/dist/vue3/lib/list-item/list-item.cjs.map +1 -1
- package/dist/vue3/lib/list-item/list-item.js +35 -30
- package/dist/vue3/lib/list-item/list-item.js.map +1 -1
- package/dist/vue3/lib/loader/index.cjs +2 -0
- package/dist/vue3/lib/loader/index.cjs.map +1 -0
- package/dist/vue3/lib/loader/index.js +5 -0
- package/dist/vue3/lib/loader/index.js.map +1 -0
- package/dist/vue3/lib/loader/loader.cjs +2 -0
- package/dist/vue3/lib/loader/loader.cjs.map +1 -0
- package/dist/vue3/lib/loader/loader.js +48 -0
- package/dist/vue3/lib/loader/loader.js.map +1 -0
- 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 +2 -1
- package/dist/vue3/lib/message-input/message-input.js.map +1 -1
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs +8 -4
- 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 +301 -235
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.js.map +1 -1
- package/dist/vue3/types/components/list_item/list_item.vue.d.ts +10 -2
- package/dist/vue3/types/components/loader/index.d.ts +2 -0
- package/dist/vue3/types/components/loader/index.d.ts.map +1 -0
- package/dist/vue3/types/components/loader/loader.vue.d.ts +26 -0
- package/dist/vue3/types/components/loader/loader.vue.d.ts.map +1 -0
- package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts +19 -0
- package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/toggle/toggle.vue.d.ts +1 -1
- package/dist/vue3/types/index.d.ts +1 -0
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { NodeViewWrapper as _, nodeViewProps as y, VueRenderer as w, VueNodeViewRenderer as v, EditorContent as H, BubbleMenu as
|
|
2
|
-
import { Node as N, mergeAttributes as m, InputRule as
|
|
1
|
+
import { NodeViewWrapper as _, nodeViewProps as y, VueRenderer as w, VueNodeViewRenderer as v, EditorContent as H, BubbleMenu as j, Editor as F } from "../../node_modules/@tiptap/vue-2.js";
|
|
2
|
+
import { Node as N, mergeAttributes as m, InputRule as q, nodePasteRule as E, getMarksBetween as U, combineTransactionSteps as K, getChangedRanges as W, 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";
|
|
6
6
|
import Z from "@tiptap/extension-document";
|
|
7
|
-
import
|
|
7
|
+
import O from "@tiptap/extension-paragraph";
|
|
8
8
|
import ee from "@tiptap/extension-placeholder";
|
|
9
9
|
import te from "@tiptap/extension-hard-break";
|
|
10
10
|
import ne from "@tiptap/extension-bold";
|
|
11
11
|
import re from "@tiptap/extension-bullet-list";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
12
|
+
import se from "@tiptap/extension-italic";
|
|
13
|
+
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";
|
|
@@ -23,45 +23,45 @@ import fe from "@tiptap/extension-color";
|
|
|
23
23
|
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
|
-
import { emojiPattern as
|
|
26
|
+
import { emojiPattern as B } from "regex-combined-emojis";
|
|
27
27
|
import { n as c } from "../../_plugin-vue2_normalizer-DSLOjnn3.js";
|
|
28
|
-
import
|
|
29
|
-
import { stringToUnicode as ye, codeToEmojiData as
|
|
30
|
-
import { emojisIndexed as
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import { linkRegex as
|
|
28
|
+
import P from "../emoji/emoji.js";
|
|
29
|
+
import { stringToUnicode as ye, codeToEmojiData as R, emojiRegex as we, emojiShortCodeRegex as ve } from "../../common/emoji/index.js";
|
|
30
|
+
import { emojisIndexed as xe } from "@dialpad/dialtone-emojis";
|
|
31
|
+
import be from "../list-item/list-item.js";
|
|
32
|
+
import x from "../stack/stack.js";
|
|
33
|
+
import b from "tippy.js";
|
|
34
|
+
import { linkRegex as ke, getPhoneNumberRegex as Te, warnIfUnmounted as Ce } from "../../common/utils/index.js";
|
|
35
35
|
import Ee from "@tiptap/extension-image";
|
|
36
|
-
import
|
|
36
|
+
import S from "@tiptap/extension-mention";
|
|
37
37
|
import M from "../link/link.js";
|
|
38
|
-
import { RICH_TEXT_EDITOR_AUTOFOCUS_TYPES as
|
|
39
|
-
import
|
|
38
|
+
import { RICH_TEXT_EDITOR_AUTOFOCUS_TYPES as Le, RICH_TEXT_EDITOR_OUTPUT_FORMATS as Re, RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS as $ } from "./rich-text-editor-constants.js";
|
|
39
|
+
import Se from "../avatar/avatar.js";
|
|
40
40
|
import $e from "@dialpad/dialtone-icons/vue2/hash";
|
|
41
41
|
import Ie from "@dialpad/dialtone-icons/vue2/lock";
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
const
|
|
42
|
+
import Ae from "deep-equal";
|
|
43
|
+
import Oe from "../button/button.js";
|
|
44
|
+
import Be from "../../common/mixins/localization.js";
|
|
45
|
+
const Pe = {
|
|
46
46
|
name: "EmojiComponent",
|
|
47
47
|
components: {
|
|
48
48
|
NodeViewWrapper: _,
|
|
49
|
-
DtEmoji:
|
|
49
|
+
DtEmoji: P
|
|
50
50
|
},
|
|
51
51
|
props: y
|
|
52
52
|
};
|
|
53
53
|
var Me = function() {
|
|
54
|
-
var
|
|
55
|
-
return n("node-view-wrapper", { staticClass: "d-d-inline-block d-va-bottom d-lh0" }, [n("dt-emoji", { attrs: { size: "500", code:
|
|
56
|
-
},
|
|
57
|
-
|
|
54
|
+
var t = this, n = t._self._c;
|
|
55
|
+
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);
|
|
56
|
+
}, De = [], He = /* @__PURE__ */ c(
|
|
57
|
+
Pe,
|
|
58
58
|
Me,
|
|
59
|
-
|
|
59
|
+
De
|
|
60
60
|
);
|
|
61
|
-
const
|
|
61
|
+
const je = He.exports, Fe = {
|
|
62
62
|
name: "SuggestionList",
|
|
63
63
|
components: {
|
|
64
|
-
DtListItem:
|
|
64
|
+
DtListItem: be
|
|
65
65
|
},
|
|
66
66
|
props: {
|
|
67
67
|
items: {
|
|
@@ -92,8 +92,8 @@ const Pe = He.exports, Fe = {
|
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
94
|
methods: {
|
|
95
|
-
onKeyDown({ event:
|
|
96
|
-
return
|
|
95
|
+
onKeyDown({ event: e }) {
|
|
96
|
+
return e.key === "ArrowUp" ? (this.upHandler(), !0) : e.key === "ArrowDown" ? (this.downHandler(), !0) : e.key === "Enter" || e.key === "Tab" ? (this.selectHandler(), !0) : !1;
|
|
97
97
|
},
|
|
98
98
|
upHandler() {
|
|
99
99
|
this.selectedIndex = (this.selectedIndex + this.items.length - 1) % this.items.length, this.scrollActiveElementIntoView();
|
|
@@ -103,8 +103,8 @@ const Pe = He.exports, Fe = {
|
|
|
103
103
|
},
|
|
104
104
|
async scrollActiveElementIntoView() {
|
|
105
105
|
await this.$nextTick();
|
|
106
|
-
const
|
|
107
|
-
|
|
106
|
+
const e = this.$refs.suggestionList.querySelector(".d-list-item--highlighted");
|
|
107
|
+
e && e.scrollIntoView({
|
|
108
108
|
behaviour: "smooth",
|
|
109
109
|
block: "center"
|
|
110
110
|
});
|
|
@@ -112,47 +112,47 @@ const Pe = He.exports, Fe = {
|
|
|
112
112
|
selectHandler() {
|
|
113
113
|
this.selectItem(this.selectedIndex);
|
|
114
114
|
},
|
|
115
|
-
selectItem(
|
|
116
|
-
const
|
|
115
|
+
selectItem(e) {
|
|
116
|
+
const t = this.items[e];
|
|
117
117
|
switch (this.itemType) {
|
|
118
118
|
case "emoji":
|
|
119
|
-
this.command(
|
|
119
|
+
this.command(t);
|
|
120
120
|
return;
|
|
121
121
|
case "mention":
|
|
122
|
-
this.command({ name:
|
|
122
|
+
this.command({ name: t.name, id: t.id, avatarSrc: t.avatarSrc });
|
|
123
123
|
break;
|
|
124
124
|
case "channel":
|
|
125
|
-
this.command({ name:
|
|
125
|
+
this.command({ name: t.name, id: t.id });
|
|
126
126
|
break;
|
|
127
127
|
case "slash-command":
|
|
128
|
-
this.command({ command:
|
|
128
|
+
this.command({ command: t.command });
|
|
129
129
|
break;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
134
|
var Ne = function() {
|
|
135
|
-
var
|
|
136
|
-
return n("div", { staticClass: "d-popover__dialog d-suggestion-list__container" }, [n("ul", { directives: [{ name: "show", rawName: "v-show", value:
|
|
135
|
+
var t = this, n = t._self._c;
|
|
136
|
+
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) {
|
|
137
137
|
return n("dt-list-item", { key: r.id, class: [
|
|
138
138
|
"d-suggestion-list__item",
|
|
139
|
-
{ "d-list-item--highlighted":
|
|
139
|
+
{ "d-list-item--highlighted": s === t.selectedIndex }
|
|
140
140
|
], attrs: { "navigation-type": "arrow-keys" }, on: { click: function(o) {
|
|
141
|
-
return
|
|
141
|
+
return t.selectItem(s);
|
|
142
142
|
}, keydown: function(o) {
|
|
143
|
-
return o.preventDefault(),
|
|
144
|
-
} } }, [n(
|
|
143
|
+
return o.preventDefault(), t.onKeyDown.apply(null, arguments);
|
|
144
|
+
} } }, [n(t.itemComponent, { tag: "component", attrs: { item: r } })], 1);
|
|
145
145
|
}), 1)]);
|
|
146
|
-
},
|
|
146
|
+
}, qe = [], Ue = /* @__PURE__ */ c(
|
|
147
147
|
Fe,
|
|
148
148
|
Ne,
|
|
149
|
-
|
|
149
|
+
qe
|
|
150
150
|
);
|
|
151
|
-
const
|
|
151
|
+
const k = Ue.exports, Ke = {
|
|
152
152
|
name: "EmojiSuggestion",
|
|
153
153
|
components: {
|
|
154
|
-
DtEmoji:
|
|
155
|
-
DtStack:
|
|
154
|
+
DtEmoji: P,
|
|
155
|
+
DtStack: x
|
|
156
156
|
},
|
|
157
157
|
props: {
|
|
158
158
|
item: {
|
|
@@ -161,58 +161,58 @@ const C = qe.exports, Ke = {
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
|
-
var
|
|
165
|
-
var
|
|
166
|
-
return n("dt-stack", { attrs: { direction: "row", gap: "400" } }, [n("dt-emoji", { attrs: { size: "200", code:
|
|
167
|
-
},
|
|
164
|
+
var We = function() {
|
|
165
|
+
var t = this, n = t._self._c;
|
|
166
|
+
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);
|
|
167
|
+
}, Ve = [], ze = /* @__PURE__ */ c(
|
|
168
168
|
Ke,
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
We,
|
|
170
|
+
Ve
|
|
171
171
|
);
|
|
172
|
-
const Xe =
|
|
172
|
+
const Xe = ze.exports, T = {
|
|
173
173
|
name: "hideOnEsc",
|
|
174
174
|
defaultValue: !0,
|
|
175
|
-
fn({ hide:
|
|
176
|
-
function
|
|
177
|
-
n.keyCode === 27 &&
|
|
175
|
+
fn({ hide: e }) {
|
|
176
|
+
function t(n) {
|
|
177
|
+
n.keyCode === 27 && e();
|
|
178
178
|
}
|
|
179
179
|
return {
|
|
180
180
|
onShow() {
|
|
181
|
-
document.addEventListener("keydown",
|
|
181
|
+
document.addEventListener("keydown", t);
|
|
182
182
|
},
|
|
183
183
|
onHide() {
|
|
184
|
-
document.removeEventListener("keydown",
|
|
184
|
+
document.removeEventListener("keydown", t);
|
|
185
185
|
}
|
|
186
186
|
};
|
|
187
187
|
}
|
|
188
188
|
}, Je = 20, Ye = {
|
|
189
|
-
items: ({ query:
|
|
190
|
-
if (
|
|
189
|
+
items: ({ query: e }) => {
|
|
190
|
+
if (e.length < 2)
|
|
191
191
|
return [];
|
|
192
|
-
const
|
|
193
|
-
return
|
|
192
|
+
const t = Object.values(xe);
|
|
193
|
+
return e = e.toLowerCase(), t.filter(
|
|
194
194
|
(r) => [
|
|
195
195
|
r.name,
|
|
196
196
|
r.shortname.replaceAll(":", ""),
|
|
197
197
|
...r.keywords
|
|
198
|
-
].some((
|
|
198
|
+
].some((s) => s.startsWith(e))
|
|
199
199
|
).splice(0, Je).map((r) => ({ code: r.shortname }));
|
|
200
200
|
},
|
|
201
|
-
command: ({ editor:
|
|
202
|
-
var o,
|
|
203
|
-
const r =
|
|
204
|
-
((o = r == null ? void 0 : r.text) == null ? void 0 : o.startsWith(" ")) && (
|
|
201
|
+
command: ({ editor: e, range: t, props: n }) => {
|
|
202
|
+
var o, i;
|
|
203
|
+
const r = e.view.state.selection.$to.nodeAfter;
|
|
204
|
+
((o = r == null ? void 0 : r.text) == null ? void 0 : o.startsWith(" ")) && (t.to += 1), e.chain().focus().insertContentAt(t, [
|
|
205
205
|
{
|
|
206
206
|
type: "emoji",
|
|
207
207
|
attrs: n
|
|
208
208
|
}
|
|
209
|
-
]).run(), (
|
|
209
|
+
]).run(), (i = window.getSelection()) == null || i.collapseToEnd();
|
|
210
210
|
},
|
|
211
211
|
render: () => {
|
|
212
|
-
let
|
|
212
|
+
let e, t, n = !1;
|
|
213
213
|
return {
|
|
214
214
|
onStart: (r) => {
|
|
215
|
-
|
|
215
|
+
e = new w(k, {
|
|
216
216
|
parent: void 0,
|
|
217
217
|
propsData: {
|
|
218
218
|
itemComponent: Xe,
|
|
@@ -220,10 +220,10 @@ const Xe = We.exports, k = {
|
|
|
220
220
|
...r
|
|
221
221
|
},
|
|
222
222
|
editor: r.editor
|
|
223
|
-
}), r.clientRect && (
|
|
223
|
+
}), r.clientRect && (t = b("body", {
|
|
224
224
|
getReferenceClientRect: r.clientRect,
|
|
225
225
|
appendTo: () => document.body,
|
|
226
|
-
content:
|
|
226
|
+
content: e.element,
|
|
227
227
|
showOnCreate: !1,
|
|
228
228
|
onShow: () => {
|
|
229
229
|
n = !0;
|
|
@@ -235,28 +235,28 @@ const Xe = We.exports, k = {
|
|
|
235
235
|
trigger: "manual",
|
|
236
236
|
placement: "top-start",
|
|
237
237
|
zIndex: 650,
|
|
238
|
-
plugins: [
|
|
239
|
-
}), r.items.length > 0 && (
|
|
238
|
+
plugins: [T]
|
|
239
|
+
}), r.items.length > 0 && (t == null || t[0].show()));
|
|
240
240
|
},
|
|
241
241
|
onUpdate(r) {
|
|
242
|
-
|
|
242
|
+
e == null || e.updateProps(r), r.items.length > 0 ? t == null || t[0].show() : t == null || t[0].hide(), t == null || t[0].setProps({
|
|
243
243
|
getReferenceClientRect: r.clientRect
|
|
244
244
|
});
|
|
245
245
|
},
|
|
246
246
|
onKeyDown(r) {
|
|
247
|
-
var
|
|
247
|
+
var s;
|
|
248
248
|
if (n)
|
|
249
|
-
return (
|
|
249
|
+
return (s = e == null ? void 0 : e.ref) == null ? void 0 : s.onKeyDown(r);
|
|
250
250
|
},
|
|
251
251
|
onExit() {
|
|
252
|
-
|
|
252
|
+
t == null || t[0].destroy(), t = null, e == null || e.destroy(), e = null;
|
|
253
253
|
}
|
|
254
254
|
};
|
|
255
255
|
}
|
|
256
|
-
}, Ge = /(:\w+:)$/, Qe = new RegExp(
|
|
257
|
-
if (
|
|
258
|
-
return { text:
|
|
259
|
-
}, et = (
|
|
256
|
+
}, Ge = /(:\w+:)$/, Qe = new RegExp(B + "$"), Ze = (e) => {
|
|
257
|
+
if (e && R(e[0]))
|
|
258
|
+
return { text: e[2] || e[0] };
|
|
259
|
+
}, et = (e) => [...e.matchAll(ve)].filter((n) => R(n[0])).map((n) => ({
|
|
260
260
|
index: n.index,
|
|
261
261
|
text: n[0],
|
|
262
262
|
match: n
|
|
@@ -272,7 +272,7 @@ const Xe = We.exports, k = {
|
|
|
272
272
|
selectable: !1,
|
|
273
273
|
atom: !0,
|
|
274
274
|
addNodeView() {
|
|
275
|
-
return v(
|
|
275
|
+
return v(je);
|
|
276
276
|
},
|
|
277
277
|
addAttributes() {
|
|
278
278
|
return {
|
|
@@ -288,23 +288,23 @@ const Xe = We.exports, k = {
|
|
|
288
288
|
}
|
|
289
289
|
];
|
|
290
290
|
},
|
|
291
|
-
renderText({ node:
|
|
292
|
-
return ye(
|
|
291
|
+
renderText({ node: e }) {
|
|
292
|
+
return ye(R(e.attrs.code).unicode_output);
|
|
293
293
|
},
|
|
294
|
-
renderHTML({ HTMLAttributes:
|
|
295
|
-
return ["emoji-component", m(this.options.HTMLAttributes,
|
|
294
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
295
|
+
return ["emoji-component", m(this.options.HTMLAttributes, e)];
|
|
296
296
|
},
|
|
297
297
|
addInputRules() {
|
|
298
298
|
return [
|
|
299
|
-
new
|
|
300
|
-
find: (
|
|
301
|
-
const
|
|
302
|
-
if (
|
|
303
|
-
return Ze(
|
|
299
|
+
new q({
|
|
300
|
+
find: (e) => {
|
|
301
|
+
const t = e.match(Ge) || e.match(Qe);
|
|
302
|
+
if (t)
|
|
303
|
+
return Ze(t);
|
|
304
304
|
},
|
|
305
|
-
handler: ({ state:
|
|
306
|
-
const { tr:
|
|
307
|
-
|
|
305
|
+
handler: ({ state: e, range: t, match: n, commands: r, chain: s, can: o }) => {
|
|
306
|
+
const { tr: i } = e, a = t.from, l = t.to;
|
|
307
|
+
i.replaceWith(a, l, this.type.create({ code: n[0] }));
|
|
308
308
|
}
|
|
309
309
|
})
|
|
310
310
|
];
|
|
@@ -314,18 +314,18 @@ const Xe = We.exports, k = {
|
|
|
314
314
|
E({
|
|
315
315
|
find: et,
|
|
316
316
|
type: this.type,
|
|
317
|
-
getAttributes(
|
|
317
|
+
getAttributes(e) {
|
|
318
318
|
return {
|
|
319
|
-
code:
|
|
319
|
+
code: e[0]
|
|
320
320
|
};
|
|
321
321
|
}
|
|
322
322
|
}),
|
|
323
323
|
E({
|
|
324
324
|
find: we,
|
|
325
325
|
type: this.type,
|
|
326
|
-
getAttributes(
|
|
326
|
+
getAttributes(e) {
|
|
327
327
|
return {
|
|
328
|
-
code:
|
|
328
|
+
code: e[0]
|
|
329
329
|
};
|
|
330
330
|
}
|
|
331
331
|
})
|
|
@@ -344,138 +344,138 @@ const Xe = We.exports, k = {
|
|
|
344
344
|
},
|
|
345
345
|
addKeyboardShortcuts() {
|
|
346
346
|
return {
|
|
347
|
-
Backspace: () => this.editor.commands.command(({ tr:
|
|
347
|
+
Backspace: () => this.editor.commands.command(({ tr: e, state: t }) => {
|
|
348
348
|
let n = !1;
|
|
349
|
-
const { selection: r } =
|
|
350
|
-
return
|
|
351
|
-
if (
|
|
352
|
-
return n = !0,
|
|
349
|
+
const { selection: r } = t, { empty: s, anchor: o } = r;
|
|
350
|
+
return s ? (t.doc.nodesBetween(o - 1, o, (i, a) => {
|
|
351
|
+
if (i.type.name === this.name)
|
|
352
|
+
return n = !0, e.insertText("", a, a + i.nodeSize), !1;
|
|
353
353
|
}), n) : !1;
|
|
354
354
|
})
|
|
355
355
|
};
|
|
356
356
|
}
|
|
357
357
|
});
|
|
358
|
-
function nt(
|
|
358
|
+
function nt(e, t, n = () => !0) {
|
|
359
359
|
const r = [];
|
|
360
|
-
|
|
361
|
-
let
|
|
362
|
-
for (;
|
|
363
|
-
n(
|
|
360
|
+
t.lastIndex = 0;
|
|
361
|
+
let s;
|
|
362
|
+
for (; s = t.exec(e); )
|
|
363
|
+
n(e, s) && r.push(s);
|
|
364
364
|
return r;
|
|
365
365
|
}
|
|
366
|
-
function rt(
|
|
367
|
-
return !["#", "@"].includes(
|
|
366
|
+
function rt(e, t) {
|
|
367
|
+
return !["#", "@"].includes(e.charAt(t.index)) && !["#", "@"].includes(e.charAt(t.index - 1));
|
|
368
368
|
}
|
|
369
|
-
function
|
|
370
|
-
const
|
|
369
|
+
function st(e) {
|
|
370
|
+
const t = new RegExp(
|
|
371
371
|
"(?:" + [
|
|
372
372
|
`[!?.,:;'"]`,
|
|
373
373
|
"(?:&|&)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"
|
|
374
374
|
].join("|"),
|
|
375
375
|
"g"
|
|
376
376
|
);
|
|
377
|
-
return
|
|
377
|
+
return e.replace(t, "");
|
|
378
378
|
}
|
|
379
|
-
function
|
|
380
|
-
const n =
|
|
379
|
+
function it(e, t) {
|
|
380
|
+
const n = e.slice(0, t + 1).search(/\S+\s*$/), r = e.slice(t).search(/\s/);
|
|
381
381
|
if (r < 0) {
|
|
382
|
-
const
|
|
382
|
+
const s = e.slice(n);
|
|
383
383
|
return {
|
|
384
|
-
text:
|
|
384
|
+
text: s,
|
|
385
385
|
from: n,
|
|
386
|
-
to: n +
|
|
386
|
+
to: n + s.length
|
|
387
387
|
};
|
|
388
388
|
}
|
|
389
389
|
return {
|
|
390
|
-
text:
|
|
390
|
+
text: e.slice(n, r + t),
|
|
391
391
|
from: n,
|
|
392
|
-
to: r +
|
|
392
|
+
to: r + t
|
|
393
393
|
};
|
|
394
394
|
}
|
|
395
|
-
function
|
|
396
|
-
const
|
|
397
|
-
if (r.lastIndex = 0, !r.test(
|
|
398
|
-
return
|
|
399
|
-
const o = n === "left" ?
|
|
400
|
-
return o <= 0 || o >=
|
|
395
|
+
function L(e, t, n, r) {
|
|
396
|
+
const s = it(e, t);
|
|
397
|
+
if (r.lastIndex = 0, !r.test(s.text))
|
|
398
|
+
return s;
|
|
399
|
+
const o = n === "left" ? s.from - 1 : s.to + 1;
|
|
400
|
+
return o <= 0 || o >= e.length || o === t ? s : L(e, o, n, r);
|
|
401
401
|
}
|
|
402
|
-
function ot(
|
|
403
|
-
const
|
|
404
|
-
for (const a of
|
|
402
|
+
function ot(e, t, n, r) {
|
|
403
|
+
const s = Math.max(e.from - 1, 0), o = Math.min(e.to + 1, t.content.size), i = U(s, o, t);
|
|
404
|
+
for (const a of i)
|
|
405
405
|
a.mark.type === r && n.removeMark(a.from, a.to, r);
|
|
406
406
|
}
|
|
407
|
-
const I =
|
|
408
|
-
function
|
|
409
|
-
if (!
|
|
407
|
+
const I = Te(1, 15);
|
|
408
|
+
function A(e, t, n, r, s, o) {
|
|
409
|
+
if (!e)
|
|
410
410
|
return;
|
|
411
|
-
let
|
|
412
|
-
|
|
413
|
-
const a = r -
|
|
414
|
-
|
|
415
|
-
|
|
411
|
+
let i = n - t - 1;
|
|
412
|
+
i = i < 0 ? 0 : i;
|
|
413
|
+
const a = r - t, l = L(
|
|
414
|
+
e,
|
|
415
|
+
i,
|
|
416
416
|
"left",
|
|
417
417
|
I
|
|
418
|
-
), d =
|
|
419
|
-
|
|
418
|
+
), d = L(
|
|
419
|
+
e,
|
|
420
420
|
a,
|
|
421
421
|
"right",
|
|
422
422
|
I
|
|
423
|
-
), u =
|
|
424
|
-
nt(u,
|
|
425
|
-
const h =
|
|
426
|
-
|
|
423
|
+
), u = e.slice(l.from, d.to);
|
|
424
|
+
nt(u, ke, rt).forEach((C) => {
|
|
425
|
+
const h = st(C[0]), g = t + l.from + C.index + 1, D = g + h.length;
|
|
426
|
+
s.addMark(g, D, o.create());
|
|
427
427
|
});
|
|
428
428
|
}
|
|
429
|
-
function at(
|
|
430
|
-
let
|
|
429
|
+
function at(e) {
|
|
430
|
+
let t = !1;
|
|
431
431
|
return new ge({
|
|
432
432
|
key: new f("autolink"),
|
|
433
|
-
appendTransaction: (n, r,
|
|
434
|
-
const o = n.some((u) => u.docChanged) && !r.doc.eq(
|
|
435
|
-
if (
|
|
433
|
+
appendTransaction: (n, r, s) => {
|
|
434
|
+
const o = n.some((u) => u.docChanged) && !r.doc.eq(s.doc);
|
|
435
|
+
if (t && !o)
|
|
436
436
|
return;
|
|
437
|
-
const { tr:
|
|
438
|
-
|
|
437
|
+
const { tr: i } = s, { textContent: a } = s.doc;
|
|
438
|
+
t || A(a, 0, 0, a.length, i, e.type), t = !0;
|
|
439
439
|
const l = K(
|
|
440
440
|
r.doc,
|
|
441
441
|
[...n]
|
|
442
442
|
);
|
|
443
|
-
return
|
|
444
|
-
ot(p,
|
|
445
|
-
|
|
443
|
+
return W(l).forEach(({ oldRange: u, newRange: p }) => {
|
|
444
|
+
ot(p, s.doc, i, e.type), V(
|
|
445
|
+
s.doc,
|
|
446
446
|
p,
|
|
447
447
|
(h) => h.isTextblock
|
|
448
448
|
).forEach(({ node: h, pos: g }) => {
|
|
449
|
-
|
|
449
|
+
A(
|
|
450
450
|
h.textContent,
|
|
451
451
|
g,
|
|
452
452
|
u.from,
|
|
453
453
|
p.to,
|
|
454
|
-
|
|
455
|
-
|
|
454
|
+
i,
|
|
455
|
+
e.type
|
|
456
456
|
);
|
|
457
457
|
});
|
|
458
|
-
}),
|
|
458
|
+
}), i;
|
|
459
459
|
}
|
|
460
460
|
});
|
|
461
461
|
}
|
|
462
462
|
const lt = {
|
|
463
463
|
class: "d-link d-c-text d-d-inline-block d-wb-break-all",
|
|
464
464
|
rel: "noopener noreferrer nofollow"
|
|
465
|
-
}, ct =
|
|
465
|
+
}, ct = z.create({
|
|
466
466
|
name: "CustomLink",
|
|
467
|
-
renderHTML({ HTMLAttributes:
|
|
467
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
468
468
|
return [
|
|
469
469
|
"a",
|
|
470
470
|
m(
|
|
471
471
|
this.options.HTMLAttributes,
|
|
472
|
-
|
|
472
|
+
e,
|
|
473
473
|
lt
|
|
474
474
|
)
|
|
475
475
|
];
|
|
476
476
|
},
|
|
477
|
-
renderText({ node:
|
|
478
|
-
return
|
|
477
|
+
renderText({ node: e }) {
|
|
478
|
+
return e.attrs.text;
|
|
479
479
|
},
|
|
480
480
|
addProseMirrorPlugins() {
|
|
481
481
|
return [
|
|
@@ -506,12 +506,12 @@ const lt = {
|
|
|
506
506
|
}
|
|
507
507
|
};
|
|
508
508
|
}
|
|
509
|
-
}).configure({ inline: !0, allowBase64: !0 }), ut =
|
|
509
|
+
}).configure({ inline: !0, allowBase64: !0 }), ut = O.extend({
|
|
510
510
|
parseHTML() {
|
|
511
511
|
return [{ tag: "div" }];
|
|
512
512
|
},
|
|
513
|
-
renderHTML({ HTMLAttributes:
|
|
514
|
-
return ["div", m(this.options.HTMLAttributes,
|
|
513
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
514
|
+
return ["div", m(this.options.HTMLAttributes, e), 0];
|
|
515
515
|
}
|
|
516
516
|
}), mt = {
|
|
517
517
|
name: "MentionComponent",
|
|
@@ -527,14 +527,14 @@ const lt = {
|
|
|
527
527
|
}
|
|
528
528
|
};
|
|
529
529
|
var ht = function() {
|
|
530
|
-
var
|
|
531
|
-
return n("node-view-wrapper", { staticClass: "d-d-inline-block" }, [n("dt-link", { attrs: { kind: "mention" } }, [
|
|
530
|
+
var t = this, n = t._self._c;
|
|
531
|
+
return n("node-view-wrapper", { staticClass: "d-d-inline-block" }, [n("dt-link", { attrs: { kind: "mention" } }, [t._v(" " + t._s(t.text) + " ")])], 1);
|
|
532
532
|
}, ft = [], pt = /* @__PURE__ */ c(
|
|
533
533
|
mt,
|
|
534
534
|
ht,
|
|
535
535
|
ft
|
|
536
536
|
);
|
|
537
|
-
const gt = pt.exports, _t =
|
|
537
|
+
const gt = pt.exports, _t = S.extend({
|
|
538
538
|
addNodeView() {
|
|
539
539
|
return v(gt);
|
|
540
540
|
},
|
|
@@ -558,11 +558,11 @@ const gt = pt.exports, _t = L.extend({
|
|
|
558
558
|
}
|
|
559
559
|
};
|
|
560
560
|
},
|
|
561
|
-
renderText({ node:
|
|
562
|
-
return `@${
|
|
561
|
+
renderText({ node: e }) {
|
|
562
|
+
return `@${e.attrs.id}`;
|
|
563
563
|
},
|
|
564
|
-
renderHTML({ HTMLAttributes:
|
|
565
|
-
return ["mention-component", m(this.options.HTMLAttributes,
|
|
564
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
565
|
+
return ["mention-component", m(this.options.HTMLAttributes, e)];
|
|
566
566
|
}
|
|
567
567
|
}).configure({
|
|
568
568
|
suggestion: {
|
|
@@ -583,17 +583,17 @@ const gt = pt.exports, _t = L.extend({
|
|
|
583
583
|
}
|
|
584
584
|
};
|
|
585
585
|
var wt = function() {
|
|
586
|
-
var
|
|
587
|
-
return n("node-view-wrapper", { staticClass: "d-d-inline-block" }, [n("dt-link", { attrs: { kind: "mention" } }, [
|
|
588
|
-
}, vt = [],
|
|
586
|
+
var t = this, n = t._self._c;
|
|
587
|
+
return n("node-view-wrapper", { staticClass: "d-d-inline-block" }, [n("dt-link", { attrs: { kind: "mention" } }, [t._v(" " + t._s(t.text) + " ")])], 1);
|
|
588
|
+
}, vt = [], xt = /* @__PURE__ */ c(
|
|
589
589
|
yt,
|
|
590
590
|
wt,
|
|
591
591
|
vt
|
|
592
592
|
);
|
|
593
|
-
const
|
|
593
|
+
const bt = xt.exports, kt = S.extend({
|
|
594
594
|
name: "channel",
|
|
595
595
|
addNodeView() {
|
|
596
|
-
return v(
|
|
596
|
+
return v(bt);
|
|
597
597
|
},
|
|
598
598
|
parseHTML() {
|
|
599
599
|
return [
|
|
@@ -615,18 +615,18 @@ const xt = bt.exports, Ct = L.extend({
|
|
|
615
615
|
}
|
|
616
616
|
};
|
|
617
617
|
},
|
|
618
|
-
renderText({ node:
|
|
619
|
-
return `#${
|
|
618
|
+
renderText({ node: e }) {
|
|
619
|
+
return `#${e.attrs.id}`;
|
|
620
620
|
},
|
|
621
|
-
renderHTML({ HTMLAttributes:
|
|
622
|
-
return ["channel-component", m(this.options.HTMLAttributes,
|
|
621
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
622
|
+
return ["channel-component", m(this.options.HTMLAttributes, e)];
|
|
623
623
|
}
|
|
624
624
|
}).configure({
|
|
625
625
|
suggestion: {
|
|
626
626
|
char: "#",
|
|
627
627
|
pluginKey: new f("channelSuggestion")
|
|
628
628
|
}
|
|
629
|
-
}),
|
|
629
|
+
}), Tt = {
|
|
630
630
|
name: "SlashCommandsComponent",
|
|
631
631
|
components: {
|
|
632
632
|
NodeViewWrapper: _
|
|
@@ -642,27 +642,27 @@ const xt = bt.exports, Ct = L.extend({
|
|
|
642
642
|
this.$parent.$emit("selected-command", this.$props.node.attrs.command);
|
|
643
643
|
}
|
|
644
644
|
};
|
|
645
|
-
var
|
|
646
|
-
var
|
|
647
|
-
return n("node-view-wrapper", { staticClass: "d-d-inline-block" }, [
|
|
648
|
-
}, Et = [],
|
|
649
|
-
kt,
|
|
645
|
+
var Ct = function() {
|
|
646
|
+
var t = this, n = t._self._c;
|
|
647
|
+
return n("node-view-wrapper", { staticClass: "d-d-inline-block" }, [t._v(" " + t._s(t.text) + " ")]);
|
|
648
|
+
}, Et = [], Lt = /* @__PURE__ */ c(
|
|
650
649
|
Tt,
|
|
650
|
+
Ct,
|
|
651
651
|
Et
|
|
652
652
|
);
|
|
653
|
-
const
|
|
654
|
-
let
|
|
655
|
-
return
|
|
653
|
+
const Rt = Lt.exports, St = (e, t) => [...e.matchAll(t)].map((r) => {
|
|
654
|
+
let s = r[2];
|
|
655
|
+
return s.endsWith(" ") || (s += " "), {
|
|
656
656
|
index: r.index,
|
|
657
|
-
text:
|
|
657
|
+
text: s,
|
|
658
658
|
match: r
|
|
659
659
|
};
|
|
660
|
-
}), $t =
|
|
660
|
+
}), $t = S.extend({
|
|
661
661
|
name: "slash-commands",
|
|
662
662
|
group: "inline",
|
|
663
663
|
inline: !0,
|
|
664
664
|
addNodeView() {
|
|
665
|
-
return v(
|
|
665
|
+
return v(Rt);
|
|
666
666
|
},
|
|
667
667
|
parseHTML() {
|
|
668
668
|
return [
|
|
@@ -684,18 +684,18 @@ const St = Rt.exports, Lt = (t, e) => [...t.matchAll(e)].map((r) => {
|
|
|
684
684
|
}
|
|
685
685
|
};
|
|
686
686
|
},
|
|
687
|
-
renderText({ node:
|
|
688
|
-
return `/${
|
|
687
|
+
renderText({ node: e }) {
|
|
688
|
+
return `/${e.attrs.command}`;
|
|
689
689
|
},
|
|
690
|
-
renderHTML({ HTMLAttributes:
|
|
691
|
-
return ["command-component", m(this.options.HTMLAttributes,
|
|
690
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
691
|
+
return ["command-component", m(this.options.HTMLAttributes, e)];
|
|
692
692
|
},
|
|
693
693
|
addInputRules() {
|
|
694
694
|
var n;
|
|
695
|
-
const
|
|
695
|
+
const e = (n = this.options.suggestion) == null ? void 0 : n.items({ query: "" }).map((r) => r.command), t = new RegExp(`^((?:\\/)(${e.join("|")})) $`);
|
|
696
696
|
return [
|
|
697
697
|
X({
|
|
698
|
-
find:
|
|
698
|
+
find: t,
|
|
699
699
|
type: this.type,
|
|
700
700
|
getAttributes(r) {
|
|
701
701
|
return { command: r[2] };
|
|
@@ -705,10 +705,10 @@ const St = Rt.exports, Lt = (t, e) => [...t.matchAll(e)].map((r) => {
|
|
|
705
705
|
},
|
|
706
706
|
addPasteRules() {
|
|
707
707
|
var n;
|
|
708
|
-
const
|
|
708
|
+
const e = (n = this.options.suggestion) == null ? void 0 : n.items({ query: "" }).map((r) => r.command), t = new RegExp(`^((?:\\/)(${e.join("|")})) ?$`, "g");
|
|
709
709
|
return [
|
|
710
710
|
E({
|
|
711
|
-
find: (r) =>
|
|
711
|
+
find: (r) => St(r, t),
|
|
712
712
|
type: this.type,
|
|
713
713
|
getAttributes(r) {
|
|
714
714
|
return { command: r[0].trim() };
|
|
@@ -724,8 +724,8 @@ const St = Rt.exports, Lt = (t, e) => [...t.matchAll(e)].map((r) => {
|
|
|
724
724
|
}), It = {
|
|
725
725
|
name: "MentionSuggestion",
|
|
726
726
|
components: {
|
|
727
|
-
DtAvatar:
|
|
728
|
-
DtStack:
|
|
727
|
+
DtAvatar: Se,
|
|
728
|
+
DtStack: x
|
|
729
729
|
},
|
|
730
730
|
props: {
|
|
731
731
|
item: {
|
|
@@ -762,35 +762,35 @@ const St = Rt.exports, Lt = (t, e) => [...t.matchAll(e)].map((r) => {
|
|
|
762
762
|
}
|
|
763
763
|
}
|
|
764
764
|
};
|
|
765
|
-
var
|
|
766
|
-
var
|
|
767
|
-
return n("dt-stack", { staticClass: "d-mention-suggestion__container", attrs: { direction: "row", gap: "400" } }, [n("dt-avatar", { attrs: { "full-name":
|
|
768
|
-
},
|
|
765
|
+
var At = function() {
|
|
766
|
+
var t = this, n = t._self._c;
|
|
767
|
+
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);
|
|
768
|
+
}, Ot = [], Bt = /* @__PURE__ */ c(
|
|
769
769
|
It,
|
|
770
|
-
|
|
771
|
-
|
|
770
|
+
At,
|
|
771
|
+
Ot
|
|
772
772
|
);
|
|
773
|
-
const
|
|
773
|
+
const Pt = Bt.exports, Mt = {
|
|
774
774
|
// This function comes from the user and passed to the editor directly.
|
|
775
775
|
// This will also activate the mention plugin on the editor
|
|
776
776
|
// items: ({ query }) => { return [] },
|
|
777
777
|
allowSpaces: !0,
|
|
778
778
|
render: () => {
|
|
779
|
-
let
|
|
779
|
+
let e, t, n = !1;
|
|
780
780
|
return {
|
|
781
781
|
onStart: (r) => {
|
|
782
|
-
|
|
782
|
+
e = new w(k, {
|
|
783
783
|
parent: void 0,
|
|
784
784
|
propsData: {
|
|
785
|
-
itemComponent:
|
|
785
|
+
itemComponent: Pt,
|
|
786
786
|
itemType: "mention",
|
|
787
787
|
...r
|
|
788
788
|
},
|
|
789
789
|
editor: r.editor
|
|
790
|
-
}), r.clientRect && (
|
|
790
|
+
}), r.clientRect && (t = b("body", {
|
|
791
791
|
getReferenceClientRect: r.clientRect,
|
|
792
792
|
appendTo: () => document.body,
|
|
793
|
-
content:
|
|
793
|
+
content: e.element,
|
|
794
794
|
showOnCreate: !1,
|
|
795
795
|
onShow: () => {
|
|
796
796
|
n = !0;
|
|
@@ -802,28 +802,28 @@ const Bt = Dt.exports, Mt = {
|
|
|
802
802
|
trigger: "manual",
|
|
803
803
|
placement: "top-start",
|
|
804
804
|
zIndex: 650,
|
|
805
|
-
plugins: [
|
|
806
|
-
}), r.items.length > 0 && (
|
|
805
|
+
plugins: [T]
|
|
806
|
+
}), r.items.length > 0 && (t == null || t[0].show()));
|
|
807
807
|
},
|
|
808
808
|
onUpdate(r) {
|
|
809
|
-
|
|
809
|
+
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({
|
|
810
810
|
getReferenceClientRect: r.clientRect
|
|
811
811
|
}));
|
|
812
812
|
},
|
|
813
813
|
onKeyDown(r) {
|
|
814
|
-
var
|
|
814
|
+
var s;
|
|
815
815
|
if (n)
|
|
816
|
-
return (
|
|
816
|
+
return (s = e == null ? void 0 : e.ref) == null ? void 0 : s.onKeyDown(r);
|
|
817
817
|
},
|
|
818
818
|
onExit() {
|
|
819
|
-
|
|
819
|
+
t == null || t[0].destroy(), t = null, e == null || e.destroy(), e = null;
|
|
820
820
|
}
|
|
821
821
|
};
|
|
822
822
|
}
|
|
823
|
-
},
|
|
823
|
+
}, Dt = {
|
|
824
824
|
name: "ChannelSuggestion",
|
|
825
825
|
components: {
|
|
826
|
-
DtStack:
|
|
826
|
+
DtStack: x,
|
|
827
827
|
DtIconHash: $e,
|
|
828
828
|
DtIconLock: Ie
|
|
829
829
|
},
|
|
@@ -840,23 +840,23 @@ const Bt = Dt.exports, Mt = {
|
|
|
840
840
|
}
|
|
841
841
|
};
|
|
842
842
|
var Ht = function() {
|
|
843
|
-
var
|
|
844
|
-
return n("dt-stack", { attrs: { direction: "row", gap: "400" } }, [
|
|
845
|
-
},
|
|
846
|
-
|
|
843
|
+
var t = this, n = t._self._c;
|
|
844
|
+
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);
|
|
845
|
+
}, jt = [], Ft = /* @__PURE__ */ c(
|
|
846
|
+
Dt,
|
|
847
847
|
Ht,
|
|
848
|
-
|
|
848
|
+
jt
|
|
849
849
|
);
|
|
850
|
-
const Nt = Ft.exports,
|
|
850
|
+
const Nt = Ft.exports, qt = {
|
|
851
851
|
// This function comes from the user and passed to the editor directly.
|
|
852
852
|
// This will also activate the mention plugin on the editor
|
|
853
853
|
// items: ({ query }) => { return [] },
|
|
854
854
|
allowSpaces: !0,
|
|
855
855
|
render: () => {
|
|
856
|
-
let
|
|
856
|
+
let e, t, n = !1;
|
|
857
857
|
return {
|
|
858
858
|
onStart: (r) => {
|
|
859
|
-
|
|
859
|
+
e = new w(k, {
|
|
860
860
|
parent: void 0,
|
|
861
861
|
propsData: {
|
|
862
862
|
itemComponent: Nt,
|
|
@@ -864,10 +864,10 @@ const Nt = Ft.exports, Ut = {
|
|
|
864
864
|
...r
|
|
865
865
|
},
|
|
866
866
|
editor: r.editor
|
|
867
|
-
}), r.clientRect && (
|
|
867
|
+
}), r.clientRect && (t = b("body", {
|
|
868
868
|
getReferenceClientRect: r.clientRect,
|
|
869
869
|
appendTo: () => document.body,
|
|
870
|
-
content:
|
|
870
|
+
content: e.element,
|
|
871
871
|
showOnCreate: !1,
|
|
872
872
|
onShow: () => {
|
|
873
873
|
n = !0;
|
|
@@ -879,25 +879,25 @@ const Nt = Ft.exports, Ut = {
|
|
|
879
879
|
trigger: "manual",
|
|
880
880
|
placement: "top-start",
|
|
881
881
|
zIndex: 650,
|
|
882
|
-
plugins: [
|
|
883
|
-
}), r.items.length > 0 && (
|
|
882
|
+
plugins: [T]
|
|
883
|
+
}), r.items.length > 0 && (t == null || t[0].show()));
|
|
884
884
|
},
|
|
885
885
|
onUpdate(r) {
|
|
886
|
-
|
|
886
|
+
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({
|
|
887
887
|
getReferenceClientRect: r.clientRect
|
|
888
888
|
}));
|
|
889
889
|
},
|
|
890
890
|
onKeyDown(r) {
|
|
891
|
-
var
|
|
891
|
+
var s;
|
|
892
892
|
if (n)
|
|
893
|
-
return (
|
|
893
|
+
return (s = e == null ? void 0 : e.ref) == null ? void 0 : s.onKeyDown(r);
|
|
894
894
|
},
|
|
895
895
|
onExit() {
|
|
896
|
-
|
|
896
|
+
t == null || t[0].destroy(), t = null, e == null || e.destroy(), e = null;
|
|
897
897
|
}
|
|
898
898
|
};
|
|
899
899
|
}
|
|
900
|
-
},
|
|
900
|
+
}, Ut = {
|
|
901
901
|
name: "SlashCommandSuggestion",
|
|
902
902
|
props: {
|
|
903
903
|
item: {
|
|
@@ -918,35 +918,35 @@ const Nt = Ft.exports, Ut = {
|
|
|
918
918
|
}
|
|
919
919
|
};
|
|
920
920
|
var Kt = function() {
|
|
921
|
-
var
|
|
922
|
-
return n("div", [n("div", { staticClass: "d-body--md-compact" }, [n("span", [
|
|
923
|
-
},
|
|
924
|
-
|
|
921
|
+
var t = this, n = t._self._c;
|
|
922
|
+
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) + " ")])]);
|
|
923
|
+
}, Wt = [], Vt = /* @__PURE__ */ c(
|
|
924
|
+
Ut,
|
|
925
925
|
Kt,
|
|
926
|
-
|
|
926
|
+
Wt
|
|
927
927
|
);
|
|
928
|
-
const
|
|
928
|
+
const zt = Vt.exports, Xt = {
|
|
929
929
|
// This function comes from the user and passed to the editor directly.
|
|
930
930
|
// This will also activate the mention plugin on the editor
|
|
931
931
|
// items: ({ query }) => { return [] },
|
|
932
932
|
allowSpaces: !0,
|
|
933
933
|
startOfLine: !0,
|
|
934
934
|
render: () => {
|
|
935
|
-
let
|
|
935
|
+
let e, t, n = !1;
|
|
936
936
|
return {
|
|
937
937
|
onStart: (r) => {
|
|
938
|
-
|
|
938
|
+
e = new w(k, {
|
|
939
939
|
parent: void 0,
|
|
940
940
|
propsData: {
|
|
941
|
-
itemComponent:
|
|
941
|
+
itemComponent: zt,
|
|
942
942
|
itemType: "slash-command",
|
|
943
943
|
...r
|
|
944
944
|
},
|
|
945
945
|
editor: r.editor
|
|
946
|
-
}), r.clientRect && (
|
|
946
|
+
}), r.clientRect && (t = b("body", {
|
|
947
947
|
getReferenceClientRect: r.clientRect,
|
|
948
948
|
appendTo: () => document.body,
|
|
949
|
-
content:
|
|
949
|
+
content: e.element,
|
|
950
950
|
showOnCreate: !1,
|
|
951
951
|
onShow: () => {
|
|
952
952
|
n = !0;
|
|
@@ -958,21 +958,21 @@ const Wt = zt.exports, Xt = {
|
|
|
958
958
|
trigger: "manual",
|
|
959
959
|
placement: "top-start",
|
|
960
960
|
zIndex: 650,
|
|
961
|
-
plugins: [
|
|
962
|
-
}), r.items.length > 0 && (
|
|
961
|
+
plugins: [T]
|
|
962
|
+
}), r.items.length > 0 && (t == null || t[0].show()));
|
|
963
963
|
},
|
|
964
964
|
onUpdate(r) {
|
|
965
|
-
|
|
965
|
+
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({
|
|
966
966
|
getReferenceClientRect: r.clientRect
|
|
967
967
|
}));
|
|
968
968
|
},
|
|
969
969
|
onKeyDown(r) {
|
|
970
|
-
var
|
|
970
|
+
var s;
|
|
971
971
|
if (n)
|
|
972
|
-
return (
|
|
972
|
+
return (s = e == null ? void 0 : e.ref) == null ? void 0 : s.onKeyDown(r);
|
|
973
973
|
},
|
|
974
974
|
onExit() {
|
|
975
|
-
|
|
975
|
+
t == null || t[0].destroy(), t = null, e == null || e.destroy(), e = null;
|
|
976
976
|
}
|
|
977
977
|
};
|
|
978
978
|
}
|
|
@@ -980,11 +980,11 @@ const Wt = zt.exports, Xt = {
|
|
|
980
980
|
name: "DtRichTextEditor",
|
|
981
981
|
components: {
|
|
982
982
|
EditorContent: H,
|
|
983
|
-
BubbleMenu:
|
|
984
|
-
DtButton:
|
|
985
|
-
DtStack:
|
|
983
|
+
BubbleMenu: j,
|
|
984
|
+
DtButton: Oe,
|
|
985
|
+
DtStack: x
|
|
986
986
|
},
|
|
987
|
-
mixins: [
|
|
987
|
+
mixins: [Be],
|
|
988
988
|
props: {
|
|
989
989
|
/**
|
|
990
990
|
* Value of the input. The object format should match TipTap's JSON
|
|
@@ -1054,8 +1054,8 @@ const Wt = zt.exports, Xt = {
|
|
|
1054
1054
|
autoFocus: {
|
|
1055
1055
|
type: [Boolean, String, Number],
|
|
1056
1056
|
default: !1,
|
|
1057
|
-
validator(
|
|
1058
|
-
return typeof
|
|
1057
|
+
validator(e) {
|
|
1058
|
+
return typeof e == "string" ? Le.includes(e) : !0;
|
|
1059
1059
|
}
|
|
1060
1060
|
},
|
|
1061
1061
|
/**
|
|
@@ -1067,8 +1067,8 @@ const Wt = zt.exports, Xt = {
|
|
|
1067
1067
|
outputFormat: {
|
|
1068
1068
|
type: String,
|
|
1069
1069
|
default: "html",
|
|
1070
|
-
validator(
|
|
1071
|
-
return
|
|
1070
|
+
validator(e) {
|
|
1071
|
+
return Re.includes(e);
|
|
1072
1072
|
}
|
|
1073
1073
|
},
|
|
1074
1074
|
/**
|
|
@@ -1320,8 +1320,8 @@ const Wt = zt.exports, Xt = {
|
|
|
1320
1320
|
editor: null,
|
|
1321
1321
|
tippyOptions: {
|
|
1322
1322
|
appendTo: () => {
|
|
1323
|
-
var
|
|
1324
|
-
return (
|
|
1323
|
+
var e;
|
|
1324
|
+
return (e = this.$refs.editor.$el.getRootNode()) == null ? void 0 : e.querySelector("body");
|
|
1325
1325
|
},
|
|
1326
1326
|
placement: "top-start"
|
|
1327
1327
|
}
|
|
@@ -1341,50 +1341,50 @@ const Wt = zt.exports, Xt = {
|
|
|
1341
1341
|
},
|
|
1342
1342
|
// eslint-disable-next-line complexity
|
|
1343
1343
|
extensions() {
|
|
1344
|
-
const
|
|
1345
|
-
|
|
1344
|
+
const e = [Z, de, me, te];
|
|
1345
|
+
e.push(this.useDivTags ? ut : O), this.allowBlockquote && e.push(Y), this.allowBold && e.push(ne), this.allowBulletList && (e.push(re), e.push(oe.extend({
|
|
1346
1346
|
renderText({ node: r }) {
|
|
1347
1347
|
return r.textContent;
|
|
1348
1348
|
}
|
|
1349
|
-
})),
|
|
1349
|
+
})), e.push(ae)), this.allowItalic && e.push(se), this.allowStrike && e.push(le), this.allowUnderline && e.push(ce), this.placeholder && e.push(
|
|
1350
1350
|
ee.configure({ placeholder: this.placeholder })
|
|
1351
1351
|
);
|
|
1352
|
-
const
|
|
1352
|
+
const t = this, n = J.create({
|
|
1353
1353
|
addKeyboardShortcuts() {
|
|
1354
1354
|
return {
|
|
1355
|
-
"Shift-Enter": ({ editor: r }) =>
|
|
1356
|
-
() =>
|
|
1357
|
-
() =>
|
|
1358
|
-
() =>
|
|
1359
|
-
() =>
|
|
1360
|
-
() =>
|
|
1355
|
+
"Shift-Enter": ({ editor: r }) => t.allowLineBreaks ? !1 : (r.commands.first(({ commands: s }) => [
|
|
1356
|
+
() => s.newlineInCode(),
|
|
1357
|
+
() => t.allowBulletList && s.splitListItem("listItem"),
|
|
1358
|
+
() => s.createParagraphNear(),
|
|
1359
|
+
() => s.liftEmptyBlock(),
|
|
1360
|
+
() => s.splitBlock()
|
|
1361
1361
|
]), !0),
|
|
1362
|
-
Enter: () =>
|
|
1362
|
+
Enter: () => t.allowLineBreaks ? !1 : (t.$emit("enter"), !0)
|
|
1363
1363
|
};
|
|
1364
1364
|
}
|
|
1365
1365
|
});
|
|
1366
|
-
if (
|
|
1366
|
+
if (e.push(n), this.link && e.push(ie.extend({ inclusive: !1 }).configure({
|
|
1367
1367
|
HTMLAttributes: {
|
|
1368
1368
|
class: "d-link d-wb-break-all"
|
|
1369
1369
|
},
|
|
1370
1370
|
openOnClick: !1,
|
|
1371
1371
|
autolink: !0,
|
|
1372
1372
|
protocols: $
|
|
1373
|
-
})), this.customLink &&
|
|
1373
|
+
})), this.customLink && e.push(this.getExtension(ct, this.customLink)), this.mentionSuggestion) {
|
|
1374
1374
|
const r = { ...this.mentionSuggestion, ...Mt };
|
|
1375
|
-
|
|
1375
|
+
e.push(_t.configure({ suggestion: r }));
|
|
1376
1376
|
}
|
|
1377
1377
|
if (this.channelSuggestion) {
|
|
1378
|
-
const r = { ...this.channelSuggestion, ...
|
|
1379
|
-
|
|
1378
|
+
const r = { ...this.channelSuggestion, ...qt };
|
|
1379
|
+
e.push(kt.configure({ suggestion: r }));
|
|
1380
1380
|
}
|
|
1381
1381
|
if (this.slashCommandSuggestion) {
|
|
1382
1382
|
const r = { ...this.slashCommandSuggestion, ...Xt };
|
|
1383
|
-
|
|
1383
|
+
e.push($t.configure({ suggestion: r }));
|
|
1384
1384
|
}
|
|
1385
|
-
return
|
|
1385
|
+
return e.push(tt), e.push(ue.configure({
|
|
1386
1386
|
types: ["paragraph"]
|
|
1387
|
-
})), this.allowCode &&
|
|
1387
|
+
})), this.allowCode && e.push(Q), this.allowCodeblock && e.push(G.extend({
|
|
1388
1388
|
renderText({ node: r }) {
|
|
1389
1389
|
return `\`\`\`
|
|
1390
1390
|
${r.textContent}
|
|
@@ -1394,15 +1394,15 @@ ${r.textContent}
|
|
|
1394
1394
|
HTMLAttributes: {
|
|
1395
1395
|
class: "d-rich-text-editor__code-block"
|
|
1396
1396
|
}
|
|
1397
|
-
})), this.allowInlineImages &&
|
|
1397
|
+
})), this.allowInlineImages && e.push(dt), (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;
|
|
1398
1398
|
},
|
|
1399
1399
|
inputAttrs() {
|
|
1400
|
-
const
|
|
1400
|
+
const e = {
|
|
1401
1401
|
"aria-label": this.inputAriaLabel,
|
|
1402
1402
|
"aria-multiline": !0,
|
|
1403
1403
|
role: "textbox"
|
|
1404
1404
|
};
|
|
1405
|
-
return this.editable || (
|
|
1405
|
+
return this.editable || (e["aria-readonly"] = !0), e;
|
|
1406
1406
|
}
|
|
1407
1407
|
},
|
|
1408
1408
|
/**
|
|
@@ -1411,20 +1411,20 @@ ${r.textContent}
|
|
|
1411
1411
|
* to be hooked up to the Editor's own API.
|
|
1412
1412
|
*/
|
|
1413
1413
|
watch: {
|
|
1414
|
-
editable(
|
|
1415
|
-
this.editor.setEditable(
|
|
1414
|
+
editable(e) {
|
|
1415
|
+
this.editor.setEditable(e), this.updateEditorAttributes({ "aria-readonly": !e });
|
|
1416
1416
|
},
|
|
1417
|
-
inputClass(
|
|
1418
|
-
this.updateEditorAttributes({ class:
|
|
1417
|
+
inputClass(e) {
|
|
1418
|
+
this.updateEditorAttributes({ class: e });
|
|
1419
1419
|
},
|
|
1420
|
-
inputAriaLabel(
|
|
1421
|
-
this.updateEditorAttributes({ "aria-label":
|
|
1420
|
+
inputAriaLabel(e) {
|
|
1421
|
+
this.updateEditorAttributes({ "aria-label": e });
|
|
1422
1422
|
},
|
|
1423
1423
|
extensions() {
|
|
1424
1424
|
this.destroyEditor(), this.createEditor();
|
|
1425
1425
|
},
|
|
1426
|
-
value(
|
|
1427
|
-
this.processValue(
|
|
1426
|
+
value(e) {
|
|
1427
|
+
this.processValue(e);
|
|
1428
1428
|
}
|
|
1429
1429
|
},
|
|
1430
1430
|
created() {
|
|
@@ -1434,7 +1434,7 @@ ${r.textContent}
|
|
|
1434
1434
|
this.destroyEditor();
|
|
1435
1435
|
},
|
|
1436
1436
|
mounted() {
|
|
1437
|
-
|
|
1437
|
+
Ce(this.$el, this.$options.name), this.processValue(this.value, !1);
|
|
1438
1438
|
},
|
|
1439
1439
|
methods: {
|
|
1440
1440
|
createEditor() {
|
|
@@ -1451,84 +1451,142 @@ ${r.textContent}
|
|
|
1451
1451
|
...this.inputAttrs,
|
|
1452
1452
|
class: this.inputClass
|
|
1453
1453
|
},
|
|
1454
|
-
handlePaste: (
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
if (i) {
|
|
1458
|
-
const { tr: o } = t.state, { from: s, to: a } = t.state.selection;
|
|
1459
|
-
return o.insertText(i, s, a), t.dispatch(o), !0;
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
return !1;
|
|
1454
|
+
handlePaste: (e, t, n) => {
|
|
1455
|
+
const r = t.clipboardData || window.clipboardData, s = r.getData("text/plain"), o = r.getData("text/html");
|
|
1456
|
+
return this.processPasteData(e, s, o);
|
|
1463
1457
|
},
|
|
1464
1458
|
// Moves the <br /> tags inside the previous closing tag to avoid
|
|
1465
1459
|
// Prosemirror wrapping them within another </p> tag.
|
|
1466
|
-
transformPastedHTML(
|
|
1467
|
-
return
|
|
1460
|
+
transformPastedHTML(e) {
|
|
1461
|
+
return e.replace(/(<\/\w+>)((<br \/>)+)/g, "$2$3$1");
|
|
1468
1462
|
}
|
|
1469
1463
|
}
|
|
1470
1464
|
}), this.addEditorListeners();
|
|
1471
1465
|
},
|
|
1472
|
-
bubbleMenuShouldShow({ editor:
|
|
1473
|
-
return
|
|
1466
|
+
bubbleMenuShouldShow({ editor: e, view: t, state: n, oldState: r, from: s, to: o }) {
|
|
1467
|
+
return e.isActive("link");
|
|
1474
1468
|
},
|
|
1475
1469
|
/**
|
|
1476
1470
|
* If the selection contains a link, return the existing link text.
|
|
1477
1471
|
* Otherwise, use just the selected text.
|
|
1478
1472
|
* @param editor the editor instance.
|
|
1479
1473
|
*/
|
|
1480
|
-
getSelectedLinkText(
|
|
1474
|
+
getSelectedLinkText(e) {
|
|
1481
1475
|
var a, l, d;
|
|
1482
|
-
const { view:
|
|
1483
|
-
return
|
|
1476
|
+
const { view: t, state: n } = e, { from: r, to: s } = t.state.selection, o = n.doc.textBetween(r, s, ""), i = this.editor.state.doc.nodeAt(r);
|
|
1477
|
+
return i && ((d = (l = (a = i.marks) == null ? void 0 : a.at(0)) == null ? void 0 : l.type) == null ? void 0 : d.name) === "link" ? i.textContent : o;
|
|
1484
1478
|
},
|
|
1485
1479
|
editLink() {
|
|
1486
|
-
const
|
|
1480
|
+
const e = this.getSelectedLinkText(this.editor), t = {
|
|
1487
1481
|
href: this.editor.getAttributes("link").href,
|
|
1488
|
-
text:
|
|
1482
|
+
text: e
|
|
1489
1483
|
};
|
|
1490
|
-
this.$emit("edit-link",
|
|
1484
|
+
this.$emit("edit-link", t);
|
|
1491
1485
|
},
|
|
1492
1486
|
removeLink() {
|
|
1493
|
-
var
|
|
1494
|
-
(r = (n = (
|
|
1487
|
+
var e, t, n, r;
|
|
1488
|
+
(r = (n = (t = (e = this.editor) == null ? void 0 : e.chain()) == null ? void 0 : t.focus()) == null ? void 0 : n.unsetLink()) == null || r.run();
|
|
1495
1489
|
},
|
|
1496
1490
|
openLink() {
|
|
1497
|
-
var
|
|
1498
|
-
(n = (
|
|
1499
|
-
const
|
|
1500
|
-
window.open(
|
|
1491
|
+
var t, n;
|
|
1492
|
+
(n = (t = this.editor) == null ? void 0 : t.chain()) == null || n.focus();
|
|
1493
|
+
const e = this.editor.getAttributes("link").href;
|
|
1494
|
+
window.open(e, "_blank");
|
|
1501
1495
|
},
|
|
1502
1496
|
// eslint-disable-next-line complexity
|
|
1503
|
-
setLink(
|
|
1497
|
+
setLink(e, t, n, r = $, s) {
|
|
1504
1498
|
var a, l, d;
|
|
1505
|
-
if (!
|
|
1499
|
+
if (!e) {
|
|
1506
1500
|
this.removeLink();
|
|
1507
1501
|
return;
|
|
1508
1502
|
}
|
|
1509
|
-
r.find((u) => u.test(
|
|
1510
|
-
const
|
|
1511
|
-
this.editor.chain().focus().insertContent(
|
|
1503
|
+
r.find((u) => u.test(e)) || (e = `${s}${e}`), this.editor.chain().focus().extendMarkRange("link").run();
|
|
1504
|
+
const i = (d = (l = (a = this.editor) == null ? void 0 : a.view) == null ? void 0 : l.state) == null ? void 0 : d.selection;
|
|
1505
|
+
this.editor.chain().focus().insertContent(t).setTextSelection({ from: i.from, to: i.from + t.length }).setLink({ href: e, class: n.class }).run();
|
|
1512
1506
|
},
|
|
1513
1507
|
// eslint-disable-next-line complexity
|
|
1514
|
-
processValue(
|
|
1508
|
+
processValue(e, t = !0) {
|
|
1515
1509
|
const n = this.getOutput();
|
|
1516
|
-
if (!(
|
|
1517
|
-
if (typeof
|
|
1518
|
-
const r = new RegExp(`(${
|
|
1519
|
-
|
|
1510
|
+
if (!(t && Ae(e, n))) {
|
|
1511
|
+
if (typeof e == "string" && this.outputFormat === "text") {
|
|
1512
|
+
const r = new RegExp(`(${B})`, "g");
|
|
1513
|
+
e = e == null ? void 0 : e.replace(r, '<emoji-component code="$1"></emoji-component>');
|
|
1520
1514
|
}
|
|
1521
|
-
this.editor.commands.setContent(
|
|
1515
|
+
this.editor.commands.setContent(e, !1, { preserveWhitespace: "full" });
|
|
1522
1516
|
}
|
|
1523
1517
|
},
|
|
1524
1518
|
destroyEditor() {
|
|
1525
1519
|
this.editor.destroy();
|
|
1526
1520
|
},
|
|
1521
|
+
insertPlainTextWithHardBreaks(e, t) {
|
|
1522
|
+
const { tr: n } = e.state, { from: r, to: s } = e.state.selection;
|
|
1523
|
+
n.deleteRange(r, s);
|
|
1524
|
+
const o = t.split(/\r?\n/);
|
|
1525
|
+
let i = r;
|
|
1526
|
+
for (let a = 0; a < o.length; a++)
|
|
1527
|
+
a > 0 && (n.insert(i, e.state.schema.nodes.hardBreak.create()), i++), n.insertText(o[a], i), i += o[a].length;
|
|
1528
|
+
e.dispatch(n);
|
|
1529
|
+
},
|
|
1530
|
+
shouldPreserveLineBreaks(e, t) {
|
|
1531
|
+
return this.pasteRichText ? !t && e && this.hasBlankLines(e) : !!e;
|
|
1532
|
+
},
|
|
1533
|
+
processPasteData(e, t, n) {
|
|
1534
|
+
if (this.shouldPreserveLineBreaks(t, n))
|
|
1535
|
+
return this.insertPlainTextWithHardBreaks(e, t), !0;
|
|
1536
|
+
if (this.shouldHandlePreformattedHTML(n)) {
|
|
1537
|
+
const r = this.extractPreformattedText(n);
|
|
1538
|
+
if (r && r.includes(`
|
|
1539
|
+
`))
|
|
1540
|
+
return this.insertPlainTextWithHardBreaks(e, r), !0;
|
|
1541
|
+
}
|
|
1542
|
+
return !1;
|
|
1543
|
+
},
|
|
1544
|
+
shouldHandlePreformattedHTML(e) {
|
|
1545
|
+
return this.pasteRichText && e && this.containsPreformattedContent(e);
|
|
1546
|
+
},
|
|
1547
|
+
containsPreformattedContent(e) {
|
|
1548
|
+
const t = document.createElement("div");
|
|
1549
|
+
t.innerHTML = e;
|
|
1550
|
+
const n = t.querySelectorAll("*");
|
|
1551
|
+
for (const r of n)
|
|
1552
|
+
if (this.hasPreWhitespace(r) && this.hasLineBreaks(r))
|
|
1553
|
+
return !0;
|
|
1554
|
+
return !1;
|
|
1555
|
+
},
|
|
1556
|
+
hasPreWhitespace(e) {
|
|
1557
|
+
const t = e.getAttribute("style") || "", n = e.style.whiteSpace || "", r = n === "pre" || n === "pre-wrap", s = t.includes("white-space: pre");
|
|
1558
|
+
return r || s;
|
|
1559
|
+
},
|
|
1560
|
+
hasLineBreaks(e) {
|
|
1561
|
+
return e.textContent && e.textContent.includes(`
|
|
1562
|
+
`);
|
|
1563
|
+
},
|
|
1564
|
+
hasBlankLines(e) {
|
|
1565
|
+
return e.includes(`
|
|
1566
|
+
|
|
1567
|
+
`) || /\n\s*\n/.test(e);
|
|
1568
|
+
},
|
|
1569
|
+
extractPreformattedText(e) {
|
|
1570
|
+
const t = document.createElement("div");
|
|
1571
|
+
return t.innerHTML = e, this.walkAndExtractText(t);
|
|
1572
|
+
},
|
|
1573
|
+
walkAndExtractText(e) {
|
|
1574
|
+
let t = "";
|
|
1575
|
+
if (e.nodeType === Node.TEXT_NODE)
|
|
1576
|
+
t += e.textContent;
|
|
1577
|
+
else if (e.nodeType === Node.ELEMENT_NODE)
|
|
1578
|
+
if (this.hasPreWhitespace(e))
|
|
1579
|
+
t += e.textContent;
|
|
1580
|
+
else
|
|
1581
|
+
for (const n of e.childNodes)
|
|
1582
|
+
t += this.walkAndExtractText(n);
|
|
1583
|
+
return t;
|
|
1584
|
+
},
|
|
1527
1585
|
triggerInputChangeEvents() {
|
|
1528
|
-
const
|
|
1529
|
-
this.$emit("input",
|
|
1530
|
-
const
|
|
1531
|
-
this.$emit("json-input",
|
|
1586
|
+
const e = this.getOutput();
|
|
1587
|
+
this.$emit("input", e), this.$emit("update:value", e);
|
|
1588
|
+
const t = this.editor.getJSON();
|
|
1589
|
+
this.$emit("json-input", t);
|
|
1532
1590
|
const n = this.editor.getHTML();
|
|
1533
1591
|
this.$emit("html-input", n);
|
|
1534
1592
|
const r = this.editor.getText({ blockSeparator: `
|
|
@@ -1543,18 +1601,18 @@ ${r.textContent}
|
|
|
1543
1601
|
this.editor.on("create", () => {
|
|
1544
1602
|
this.triggerInputChangeEvents();
|
|
1545
1603
|
}), this.editor.on("update", () => {
|
|
1546
|
-
var
|
|
1547
|
-
if (this.preventTyping && ((
|
|
1604
|
+
var e, t;
|
|
1605
|
+
if (this.preventTyping && ((t = (e = this.editor.view) == null ? void 0 : e.input) == null ? void 0 : t.lastKeyCode) !== 8) {
|
|
1548
1606
|
this.editor.commands.setContent(this.value, !1);
|
|
1549
1607
|
return;
|
|
1550
1608
|
}
|
|
1551
1609
|
this.triggerInputChangeEvents();
|
|
1552
|
-
}), this.editor.on("selectionUpdate", ({ editor:
|
|
1553
|
-
this.$emit("selected", this.getSelectedLinkText(
|
|
1554
|
-
}), this.editor.on("focus", ({ event:
|
|
1555
|
-
this.$emit("focus",
|
|
1556
|
-
}), this.editor.on("blur", ({ event:
|
|
1557
|
-
this.$emit("blur",
|
|
1610
|
+
}), this.editor.on("selectionUpdate", ({ editor: e }) => {
|
|
1611
|
+
this.$emit("selected", this.getSelectedLinkText(e));
|
|
1612
|
+
}), this.editor.on("focus", ({ event: e }) => {
|
|
1613
|
+
this.$emit("focus", e);
|
|
1614
|
+
}), this.editor.on("blur", ({ event: e }) => {
|
|
1615
|
+
this.$emit("blur", e);
|
|
1558
1616
|
});
|
|
1559
1617
|
},
|
|
1560
1618
|
getOutput() {
|
|
@@ -1569,17 +1627,17 @@ ${r.textContent}
|
|
|
1569
1627
|
` });
|
|
1570
1628
|
}
|
|
1571
1629
|
},
|
|
1572
|
-
getExtension(
|
|
1630
|
+
getExtension(e, t) {
|
|
1573
1631
|
var n;
|
|
1574
|
-
return typeof
|
|
1632
|
+
return typeof t == "boolean" ? e : (n = e.configure) == null ? void 0 : n.call(e, t);
|
|
1575
1633
|
},
|
|
1576
|
-
updateEditorAttributes(
|
|
1634
|
+
updateEditorAttributes(e) {
|
|
1577
1635
|
this.editor.setOptions({
|
|
1578
1636
|
editorProps: {
|
|
1579
1637
|
attributes: {
|
|
1580
1638
|
...this.inputAttrs,
|
|
1581
1639
|
class: this.inputClass,
|
|
1582
|
-
...
|
|
1640
|
+
...e
|
|
1583
1641
|
}
|
|
1584
1642
|
}
|
|
1585
1643
|
});
|
|
@@ -1590,8 +1648,8 @@ ${r.textContent}
|
|
|
1590
1648
|
}
|
|
1591
1649
|
};
|
|
1592
1650
|
var Yt = function() {
|
|
1593
|
-
var
|
|
1594
|
-
return n("div", [
|
|
1651
|
+
var t = this, n = t._self._c;
|
|
1652
|
+
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);
|
|
1595
1653
|
}, Gt = [], Qt = /* @__PURE__ */ c(
|
|
1596
1654
|
Jt,
|
|
1597
1655
|
Yt,
|