@parallelworks/tandem-web 0.162.0 → 0.164.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/_virtual/_virtual_i18n/en/common.js +3 -1
- package/_virtual/_virtual_i18n/es/common.js +3 -1
- package/_virtual/_virtual_i18n/ja/common.js +3 -1
- package/_virtual/_virtual_i18n/ko/common.js +3 -1
- package/_virtual/_virtual_i18n/zh/common.js +3 -1
- package/components/Editor.js +81 -77
- package/components/TeamRepositories.js +134 -115
- package/components/editorPlugins.js +162 -126
- package/components/video.js +51 -0
- package/lib/attachments.js +30 -7
- package/lib/githubLink.js +13 -0
- package/lib/videoMarkdown.js +15 -0
- package/package.json +1 -1
- package/styles.css +12 -0
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import { glossary as e, mentions as t } from "../lib/glossary.js";
|
|
2
2
|
import { iconImageURL as n } from "./EntityIcon.js";
|
|
3
3
|
import { docIcons as r } from "./DocIcon.js";
|
|
4
|
-
import { attachmentIdOf as i, attachmentPrefix as a, attachmentSizes as o, attachmentURL as s, githubMedia as c } from "../lib/attachments.js";
|
|
5
|
-
import { docLooks as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import C from "@tiptap/
|
|
15
|
-
import
|
|
4
|
+
import { attachmentIdOf as i, attachmentPrefix as a, attachmentSizes as o, attachmentURL as s, githubMedia as c, githubUpload as l, mediaURL as u, playableLink as d, videoName as f } from "../lib/attachments.js";
|
|
5
|
+
import { docLooks as p } from "../lib/docLooks.js";
|
|
6
|
+
import { githubLinkPage as m } from "../lib/githubLink.js";
|
|
7
|
+
import { issueKeyOfHref as ee, issueKeyPattern as te, issueRefs as h } from "../lib/issueRefs.js";
|
|
8
|
+
import { linkedIssues as g } from "../lib/linkedIssues.js";
|
|
9
|
+
import { mentionable as _, mentionsIn as ne } from "../lib/mentions.js";
|
|
10
|
+
import { teamNames as v } from "../lib/teamNames.js";
|
|
11
|
+
import { createElement as y } from "react";
|
|
12
|
+
import { Extension as b } from "@tiptap/react";
|
|
13
|
+
import { Plugin as x, PluginKey as S, TextSelection as re } from "@tiptap/pm/state";
|
|
14
|
+
import { Decoration as C, DecorationSet as w } from "@tiptap/pm/view";
|
|
15
|
+
import T from "@tiptap/extension-image";
|
|
16
|
+
import { createRoot as E } from "react-dom/client";
|
|
16
17
|
// src/components/editorPlugins.ts
|
|
17
|
-
var
|
|
18
|
+
var D = new S("knowledgeTerms"), O = /* @__PURE__ */ new Set([
|
|
18
19
|
"ArrowLeft",
|
|
19
20
|
"ArrowRight",
|
|
20
21
|
"ArrowUp",
|
|
21
22
|
"ArrowDown",
|
|
22
23
|
"Home",
|
|
23
24
|
"End"
|
|
24
|
-
]),
|
|
25
|
-
function
|
|
25
|
+
]), k = "tandem:term-caret";
|
|
26
|
+
function A(e, t) {
|
|
26
27
|
e.descendants((e, n) => {
|
|
27
28
|
if (!e.isTextblock) return !0;
|
|
28
29
|
if (e.type.spec.code) return !1;
|
|
@@ -35,12 +36,12 @@ function D(e, t) {
|
|
|
35
36
|
}), t(r, n + 1), !1;
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function j(n, r) {
|
|
39
40
|
let i = e.forms();
|
|
40
|
-
if (i.length === 0) return
|
|
41
|
+
if (i.length === 0) return w.empty;
|
|
41
42
|
let a = [];
|
|
42
|
-
return
|
|
43
|
-
for (let o of t(e, i)) a.push(
|
|
43
|
+
return A(n, (e, n) => {
|
|
44
|
+
for (let o of t(e, i)) a.push(C.inline(n + o.from, n + o.to, {
|
|
44
45
|
class: "kb-term",
|
|
45
46
|
"data-term": o.id,
|
|
46
47
|
...r && {
|
|
@@ -48,18 +49,18 @@ function O(n, r) {
|
|
|
48
49
|
role: "button"
|
|
49
50
|
}
|
|
50
51
|
}));
|
|
51
|
-
}),
|
|
52
|
+
}), w.create(n, a);
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
+
function ie(e) {
|
|
54
55
|
let t = /* @__PURE__ */ new Set();
|
|
55
56
|
return e.descendants((e) => {
|
|
56
57
|
for (let n of e.marks) n.type.name === "link" && t.add(String(n.attrs.href ?? ""));
|
|
57
58
|
return !0;
|
|
58
59
|
}), t;
|
|
59
60
|
}
|
|
60
|
-
function
|
|
61
|
+
function ae(e, n, r) {
|
|
61
62
|
let i = [], a = /* @__PURE__ */ new Set();
|
|
62
|
-
return
|
|
63
|
+
return A(e, (e, o) => {
|
|
63
64
|
for (let s of t(e, n)) a.has(s.id) || (a.add(s.id), !r(s.id) && i.push({
|
|
64
65
|
from: o + s.from,
|
|
65
66
|
to: o + s.to,
|
|
@@ -68,49 +69,49 @@ function A(e, n, r) {
|
|
|
68
69
|
}));
|
|
69
70
|
}), i;
|
|
70
71
|
}
|
|
71
|
-
var
|
|
72
|
+
var oe = b.create({
|
|
72
73
|
name: "knowledgeTerms",
|
|
73
74
|
addProseMirrorPlugins() {
|
|
74
75
|
let t = this.editor, n = "";
|
|
75
|
-
return [new
|
|
76
|
-
key:
|
|
76
|
+
return [new x({
|
|
77
|
+
key: D,
|
|
77
78
|
state: {
|
|
78
|
-
init: (e, n) =>
|
|
79
|
-
apply: (e, n) => e.docChanged || e.getMeta(
|
|
79
|
+
init: (e, n) => j(n.doc, !t.isEditable),
|
|
80
|
+
apply: (e, n) => e.docChanged || e.getMeta(D) ? j(e.doc, !t.isEditable) : n.map(e.mapping, e.doc)
|
|
80
81
|
},
|
|
81
82
|
props: {
|
|
82
|
-
decorations: (e) =>
|
|
83
|
+
decorations: (e) => D.getState(e),
|
|
83
84
|
handleKeyDown: (e, t) => (n = t.key, !1)
|
|
84
85
|
},
|
|
85
86
|
view: (t) => ({
|
|
86
87
|
update: (e, t) => {
|
|
87
88
|
let { selection: r } = e.state;
|
|
88
|
-
if (!
|
|
89
|
+
if (!O.has(n) || !r.empty || t.selection.eq(r)) return;
|
|
89
90
|
n = "";
|
|
90
91
|
let i = e.domAtPos(r.from);
|
|
91
|
-
(i.node.nodeType === 1 ? i.node : i.node.parentElement)?.closest(".kb-term")?.dispatchEvent(new CustomEvent(
|
|
92
|
+
(i.node.nodeType === 1 ? i.node : i.node.parentElement)?.closest(".kb-term")?.dispatchEvent(new CustomEvent(k, { bubbles: !0 }));
|
|
92
93
|
},
|
|
93
94
|
destroy: e.subscribe(() => {
|
|
94
|
-
t.isDestroyed || t.dispatch(t.state.tr.setMeta(
|
|
95
|
+
t.isDestroyed || t.dispatch(t.state.tr.setMeta(D, !0));
|
|
95
96
|
})
|
|
96
97
|
})
|
|
97
98
|
})];
|
|
98
99
|
}
|
|
99
100
|
});
|
|
100
|
-
function
|
|
101
|
+
function se(e) {
|
|
101
102
|
return e.docLinks;
|
|
102
103
|
}
|
|
103
|
-
var
|
|
104
|
+
var ce = b.create({
|
|
104
105
|
name: "docLinks",
|
|
105
106
|
addStorage: () => ({ handlers: /* @__PURE__ */ new Set() }),
|
|
106
107
|
addProseMirrorPlugins() {
|
|
107
108
|
let e = this.storage;
|
|
108
|
-
return [new
|
|
109
|
+
return [new x({ props: { handleKeyDown: (t, n) => {
|
|
109
110
|
for (let t of e.handlers) if (t(n)) return !0;
|
|
110
111
|
return !1;
|
|
111
112
|
} } })];
|
|
112
113
|
}
|
|
113
|
-
}),
|
|
114
|
+
}), M = "tandem:open-image", le = T.extend({
|
|
114
115
|
parseHTML() {
|
|
115
116
|
return [{
|
|
116
117
|
tag: "img[src]",
|
|
@@ -129,19 +130,52 @@ var N = _.create({
|
|
|
129
130
|
renderHTML({ HTMLAttributes: e }) {
|
|
130
131
|
return ["img", {
|
|
131
132
|
...e,
|
|
132
|
-
src:
|
|
133
|
+
src: u(String(e.src ?? "")),
|
|
133
134
|
class: "attachment-image",
|
|
134
135
|
loading: "lazy"
|
|
135
136
|
}];
|
|
137
|
+
},
|
|
138
|
+
addNodeView() {
|
|
139
|
+
return ({ node: e }) => {
|
|
140
|
+
let t = String(e.attrs.src ?? ""), n = document.createElement("img");
|
|
141
|
+
if (n.src = u(t), n.className = "attachment-image", n.loading = "lazy", e.attrs.alt && (n.alt = String(e.attrs.alt)), e.attrs.title && (n.title = String(e.attrs.title)), !l(t)) return { dom: n };
|
|
142
|
+
let r = document.createElement("span");
|
|
143
|
+
return r.append(n), n.addEventListener("error", () => {
|
|
144
|
+
n.replaceWith(N(t, (e) => F(e, t, !0)));
|
|
145
|
+
}, { once: !0 }), {
|
|
146
|
+
dom: r,
|
|
147
|
+
ignoreMutation: () => !0
|
|
148
|
+
};
|
|
149
|
+
};
|
|
136
150
|
}
|
|
137
|
-
}).configure({ inline: !0 })
|
|
138
|
-
function
|
|
151
|
+
}).configure({ inline: !0 });
|
|
152
|
+
function N(e, t) {
|
|
153
|
+
let n = document.createElement("video");
|
|
154
|
+
return n.className = "github-recording", n.src = u(e), n.controls = !0, n.preload = "metadata", n.contentEditable = "false", n.addEventListener("error", function r() {
|
|
155
|
+
n.src !== e && l(e) ? n.src = e : (n.removeEventListener("error", r), t(n));
|
|
156
|
+
}), n;
|
|
157
|
+
}
|
|
158
|
+
var P = { linkHint: "" };
|
|
159
|
+
function F(e, t, n) {
|
|
160
|
+
let r = document.createElement("span");
|
|
161
|
+
r.className = "recording-unplayable", r.contentEditable = "false", n && r.append(I(t)), e.replaceWith(r), l(t) && m().then((e) => {
|
|
162
|
+
if (!e || !P.linkHint) return;
|
|
163
|
+
let t = document.createElement("a");
|
|
164
|
+
t.className = "recording-hint", t.href = e, t.textContent = P.linkHint, r.append(t);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function I(e) {
|
|
168
|
+
let t = document.createElement("a");
|
|
169
|
+
return t.href = s(e), t.textContent = e, t.rel = "noopener noreferrer", t.target = "_blank", t;
|
|
170
|
+
}
|
|
171
|
+
var L = new S("attachmentFiles");
|
|
172
|
+
function R(e, t) {
|
|
139
173
|
e.descendants((e, n) => {
|
|
140
174
|
if (e.type.name !== "paragraph") return !0;
|
|
141
175
|
let r = e.childCount === 1 ? e.firstChild : null, i = r?.marks.find((e) => e.type.name === "link")?.attrs.href;
|
|
142
|
-
return r?.isText && i &&
|
|
143
|
-
let e = document.createElement("
|
|
144
|
-
return e.className = "
|
|
176
|
+
return r?.isText && i && d(i) && r.text?.trim() === i && t.push(C.widget(n + e.nodeSize - 1, () => {
|
|
177
|
+
let e = document.createElement("span");
|
|
178
|
+
return e.className = "recording-box", e.contentEditable = "false", e.append(N(i, (e) => F(e, i, !1))), e;
|
|
145
179
|
}, {
|
|
146
180
|
side: 1,
|
|
147
181
|
key: `recording-${i}`,
|
|
@@ -150,16 +184,18 @@ function ne(e, t) {
|
|
|
150
184
|
})), !1;
|
|
151
185
|
});
|
|
152
186
|
}
|
|
153
|
-
function
|
|
187
|
+
function z(e) {
|
|
154
188
|
let t = [];
|
|
155
|
-
return
|
|
189
|
+
return R(e, t), e.descendants((e, n) => {
|
|
156
190
|
if (!e.isText) return !0;
|
|
157
191
|
let r = e.marks.find((e) => e.type.name === "link"), a = i(r?.attrs.href), c = a && o.get(a);
|
|
158
|
-
|
|
192
|
+
c && t.push(C.inline(n, n + e.nodeSize, { "data-size": c }));
|
|
193
|
+
let l = !o.get(a ?? "") && f.test(e.text ?? "");
|
|
194
|
+
if (a && (o.isVideo(a) || l) && r) {
|
|
159
195
|
let i = s(String(r.attrs.href));
|
|
160
|
-
t.push(
|
|
196
|
+
t.push(C.widget(n + e.nodeSize, () => {
|
|
161
197
|
let e = document.createElement("video");
|
|
162
|
-
return e.className = "attachment-video", e.src = i, e.controls = !0, e.preload = "metadata", e.contentEditable = "false", e;
|
|
198
|
+
return e.className = "attachment-video", e.src = i, e.controls = !0, e.preload = "metadata", e.contentEditable = "false", l && e.addEventListener("error", () => e.remove(), { once: !0 }), e;
|
|
163
199
|
}, {
|
|
164
200
|
side: 1,
|
|
165
201
|
key: `video-${a}`,
|
|
@@ -168,21 +204,21 @@ function L(e) {
|
|
|
168
204
|
}));
|
|
169
205
|
}
|
|
170
206
|
return !1;
|
|
171
|
-
}),
|
|
207
|
+
}), w.create(e, t);
|
|
172
208
|
}
|
|
173
|
-
var
|
|
209
|
+
var B = b.create({
|
|
174
210
|
name: "attachmentFiles",
|
|
175
211
|
priority: 1e3,
|
|
176
212
|
addProseMirrorPlugins() {
|
|
177
|
-
return [new
|
|
178
|
-
key:
|
|
213
|
+
return [new x({
|
|
214
|
+
key: L,
|
|
179
215
|
state: {
|
|
180
|
-
init: (e, t) =>
|
|
181
|
-
apply: (e, t) => e.docChanged || e.getMeta(
|
|
216
|
+
init: (e, t) => z(t.doc),
|
|
217
|
+
apply: (e, t) => e.docChanged || e.getMeta(L) ? z(e.doc) : t
|
|
182
218
|
},
|
|
183
219
|
props: {
|
|
184
|
-
decorations: (e) =>
|
|
185
|
-
handleClickOn: (e, t, n, r, a) => n.type.name !== "image" || !i(n.attrs.src) ? !1 : (a.preventDefault(), e.dom.dispatchEvent(new CustomEvent(
|
|
220
|
+
decorations: (e) => L.getState(e),
|
|
221
|
+
handleClickOn: (e, t, n, r, a) => n.type.name !== "image" || !i(n.attrs.src) ? !1 : (a.preventDefault(), e.dom.dispatchEvent(new CustomEvent(M, {
|
|
186
222
|
bubbles: !0,
|
|
187
223
|
detail: {
|
|
188
224
|
src: n.attrs.src,
|
|
@@ -198,17 +234,17 @@ var R = _.create({
|
|
|
198
234
|
}
|
|
199
235
|
},
|
|
200
236
|
view: (e) => ({ destroy: o.subscribe(() => {
|
|
201
|
-
e.isDestroyed || e.dispatch(e.state.tr.setMeta(
|
|
237
|
+
e.isDestroyed || e.dispatch(e.state.tr.setMeta(L, !0));
|
|
202
238
|
}) })
|
|
203
239
|
})];
|
|
204
240
|
}
|
|
205
|
-
}),
|
|
206
|
-
function
|
|
241
|
+
}), V = new S("linkedIssues");
|
|
242
|
+
function H(e) {
|
|
207
243
|
let t = [], n, r = () => {
|
|
208
|
-
let e = n &&
|
|
244
|
+
let e = n && g.get(n.href);
|
|
209
245
|
if (n && e) {
|
|
210
246
|
let { identifier: r, title: i, status: a } = e;
|
|
211
|
-
t.push(
|
|
247
|
+
t.push(C.widget(n.end, () => {
|
|
212
248
|
let e = document.createElement("button");
|
|
213
249
|
return e.type = "button", e.className = "linked-issue", e.dataset.linkedIssue = r, e.dataset.category = a.category, e.contentEditable = "false", e.title = `${r} ${i}`, e.textContent = `${r} · ${a.name}`, e;
|
|
214
250
|
}, {
|
|
@@ -225,52 +261,52 @@ function B(e) {
|
|
|
225
261
|
href: i,
|
|
226
262
|
end: t + e.nodeSize
|
|
227
263
|
}), !1;
|
|
228
|
-
}), r(),
|
|
264
|
+
}), r(), w.create(e, t);
|
|
229
265
|
}
|
|
230
|
-
var
|
|
266
|
+
var U = b.create({
|
|
231
267
|
name: "linkedIssues",
|
|
232
268
|
addProseMirrorPlugins() {
|
|
233
|
-
return [new
|
|
234
|
-
key:
|
|
269
|
+
return [new x({
|
|
270
|
+
key: V,
|
|
235
271
|
state: {
|
|
236
|
-
init: (e, t) =>
|
|
237
|
-
apply: (e, t) => e.docChanged || e.getMeta(
|
|
272
|
+
init: (e, t) => H(t.doc),
|
|
273
|
+
apply: (e, t) => e.docChanged || e.getMeta(V) ? H(e.doc) : t
|
|
238
274
|
},
|
|
239
275
|
props: {
|
|
240
|
-
decorations: (e) =>
|
|
276
|
+
decorations: (e) => V.getState(e),
|
|
241
277
|
handleDOMEvents: { click: (e, t) => {
|
|
242
278
|
let n = t.target?.closest("[data-linked-issue]");
|
|
243
|
-
return n ? (t.preventDefault(),
|
|
279
|
+
return n ? (t.preventDefault(), g.open(n.dataset.linkedIssue ?? ""), !0) : !1;
|
|
244
280
|
} }
|
|
245
281
|
},
|
|
246
|
-
view: (e) => ({ destroy:
|
|
247
|
-
e.isDestroyed || e.dispatch(e.state.tr.setMeta(
|
|
282
|
+
view: (e) => ({ destroy: g.subscribe(() => {
|
|
283
|
+
e.isDestroyed || e.dispatch(e.state.tr.setMeta(V, !0));
|
|
248
284
|
}) })
|
|
249
285
|
})];
|
|
250
286
|
}
|
|
251
|
-
}),
|
|
252
|
-
function
|
|
287
|
+
}), W = new S("issueMentions");
|
|
288
|
+
function ue(e) {
|
|
253
289
|
let t = document.createElement("span");
|
|
254
290
|
return t.className = "issue-mention-status", t.dataset.category = e, t.contentEditable = "false", t;
|
|
255
291
|
}
|
|
256
|
-
function
|
|
257
|
-
let t =
|
|
258
|
-
if (!t) return
|
|
292
|
+
function G(e) {
|
|
293
|
+
let t = h.workspace();
|
|
294
|
+
if (!t) return w.empty;
|
|
259
295
|
let n = [], r = [], i = (e, t, i, a) => {
|
|
260
|
-
let o =
|
|
296
|
+
let o = h.get(i);
|
|
261
297
|
if (!o) {
|
|
262
298
|
r.push(i);
|
|
263
299
|
return;
|
|
264
300
|
}
|
|
265
301
|
let s = o.status.category;
|
|
266
|
-
n.push(
|
|
302
|
+
n.push(C.widget(e, () => ue(s), {
|
|
267
303
|
side: -1,
|
|
268
304
|
key: `dot-${i}-${s}`
|
|
269
|
-
}),
|
|
305
|
+
}), C.inline(e, t, {
|
|
270
306
|
class: a ? "issue-mention issue-mention-key" : "issue-mention",
|
|
271
307
|
"data-issue": o.identifier,
|
|
272
308
|
title: `${o.identifier} ${o.title} · ${o.status.name}`
|
|
273
|
-
})), a && n.push(
|
|
309
|
+
})), a && n.push(C.widget(t, () => {
|
|
274
310
|
let e = document.createElement("span");
|
|
275
311
|
return e.className = "issue-mention-title", e.contentEditable = "false", e.textContent = o.title, e;
|
|
276
312
|
}, {
|
|
@@ -278,14 +314,14 @@ function W(e) {
|
|
|
278
314
|
key: `title-${i}-${o.title}`
|
|
279
315
|
}));
|
|
280
316
|
};
|
|
281
|
-
|
|
282
|
-
for (let n of e.matchAll(
|
|
317
|
+
A(e, (e, t) => {
|
|
318
|
+
for (let n of e.matchAll(te)) {
|
|
283
319
|
let e = n[1] ?? "";
|
|
284
320
|
i(t + (n.index ?? 0), t + (n.index ?? 0) + e.length, e, !0);
|
|
285
321
|
}
|
|
286
322
|
});
|
|
287
323
|
let a, o = () => {
|
|
288
|
-
let e = a &&
|
|
324
|
+
let e = a && ee(a.href, t);
|
|
289
325
|
a && e && i(a.from, a.to, e, !1), a = void 0;
|
|
290
326
|
};
|
|
291
327
|
return e.descendants((e, t) => {
|
|
@@ -299,77 +335,77 @@ function W(e) {
|
|
|
299
335
|
from: t,
|
|
300
336
|
to: t + e.nodeSize
|
|
301
337
|
}), !1;
|
|
302
|
-
}), o(), r.length > 0 &&
|
|
338
|
+
}), o(), r.length > 0 && h.want(r), w.create(e, n);
|
|
303
339
|
}
|
|
304
|
-
var
|
|
340
|
+
var de = b.create({
|
|
305
341
|
name: "issueMentions",
|
|
306
342
|
addProseMirrorPlugins() {
|
|
307
|
-
return [new
|
|
308
|
-
key:
|
|
343
|
+
return [new x({
|
|
344
|
+
key: W,
|
|
309
345
|
state: {
|
|
310
|
-
init: (e, t) =>
|
|
311
|
-
apply: (e, t) => e.docChanged || e.getMeta(
|
|
346
|
+
init: (e, t) => G(t.doc),
|
|
347
|
+
apply: (e, t) => e.docChanged || e.getMeta(W) ? G(e.doc) : t.map(e.mapping, e.doc)
|
|
312
348
|
},
|
|
313
|
-
props: { decorations: (e) =>
|
|
314
|
-
view: (e) => ({ destroy:
|
|
315
|
-
e.isDestroyed || e.dispatch(e.state.tr.setMeta(
|
|
349
|
+
props: { decorations: (e) => W.getState(e) },
|
|
350
|
+
view: (e) => ({ destroy: h.subscribe(() => {
|
|
351
|
+
e.isDestroyed || e.dispatch(e.state.tr.setMeta(W, !0));
|
|
316
352
|
}) })
|
|
317
353
|
})];
|
|
318
354
|
}
|
|
319
|
-
}), K = new
|
|
355
|
+
}), K = new S("teamNames");
|
|
320
356
|
function q(e) {
|
|
321
|
-
let n =
|
|
322
|
-
if (n.length === 0) return
|
|
357
|
+
let n = v.forms();
|
|
358
|
+
if (n.length === 0) return w.empty;
|
|
323
359
|
let r = [];
|
|
324
|
-
return
|
|
325
|
-
for (let a of t(e, n, !0)) r.push(
|
|
360
|
+
return A(e, (e, i) => {
|
|
361
|
+
for (let a of t(e, n, !0)) r.push(C.inline(i + a.from, i + a.to, {
|
|
326
362
|
class: "team-mention",
|
|
327
363
|
"data-team": a.id
|
|
328
364
|
}));
|
|
329
|
-
}),
|
|
365
|
+
}), w.create(e, r);
|
|
330
366
|
}
|
|
331
|
-
var
|
|
367
|
+
var fe = b.create({
|
|
332
368
|
name: "teamNames",
|
|
333
369
|
addProseMirrorPlugins() {
|
|
334
|
-
return [new
|
|
370
|
+
return [new x({
|
|
335
371
|
key: K,
|
|
336
372
|
state: {
|
|
337
373
|
init: (e, t) => q(t.doc),
|
|
338
374
|
apply: (e, t) => e.docChanged || e.getMeta(K) ? q(e.doc) : t.map(e.mapping, e.doc)
|
|
339
375
|
},
|
|
340
376
|
props: { decorations: (e) => K.getState(e) },
|
|
341
|
-
view: (e) => ({ destroy:
|
|
377
|
+
view: (e) => ({ destroy: v.subscribe(() => {
|
|
342
378
|
e.isDestroyed || e.dispatch(e.state.tr.setMeta(K, !0));
|
|
343
379
|
}) })
|
|
344
380
|
})];
|
|
345
381
|
}
|
|
346
|
-
}),
|
|
347
|
-
function
|
|
382
|
+
}), J = new S("peopleMentions");
|
|
383
|
+
function Y(e) {
|
|
348
384
|
let t = [];
|
|
349
|
-
return
|
|
350
|
-
for (let r of
|
|
385
|
+
return A(e, (e, n) => {
|
|
386
|
+
for (let r of ne(e)) _.has(r.username) && t.push(C.inline(n + r.from, n + r.to, {
|
|
351
387
|
class: "person-mention",
|
|
352
388
|
"data-username": r.username
|
|
353
389
|
}));
|
|
354
|
-
}),
|
|
390
|
+
}), w.create(e, t);
|
|
355
391
|
}
|
|
356
|
-
var
|
|
392
|
+
var X = b.create({
|
|
357
393
|
name: "peopleMentions",
|
|
358
394
|
addProseMirrorPlugins() {
|
|
359
|
-
return [new
|
|
360
|
-
key:
|
|
395
|
+
return [new x({
|
|
396
|
+
key: J,
|
|
361
397
|
state: {
|
|
362
|
-
init: (e, t) =>
|
|
363
|
-
apply: (e, t) => e.docChanged || e.getMeta(
|
|
398
|
+
init: (e, t) => Y(t.doc),
|
|
399
|
+
apply: (e, t) => e.docChanged || e.getMeta(J) ? Y(e.doc) : t.map(e.mapping, e.doc)
|
|
364
400
|
},
|
|
365
|
-
props: { decorations: (e) =>
|
|
366
|
-
view: (e) => ({ destroy:
|
|
367
|
-
e.isDestroyed || e.dispatch(e.state.tr.setMeta(
|
|
401
|
+
props: { decorations: (e) => J.getState(e) },
|
|
402
|
+
view: (e) => ({ destroy: _.subscribe(() => {
|
|
403
|
+
e.isDestroyed || e.dispatch(e.state.tr.setMeta(J, !0));
|
|
368
404
|
}) })
|
|
369
405
|
})];
|
|
370
406
|
}
|
|
371
|
-
}), Z = new
|
|
372
|
-
function
|
|
407
|
+
}), Z = new S("docLinkIcons"), Q = /* @__PURE__ */ new WeakMap();
|
|
408
|
+
function pe(e) {
|
|
373
409
|
let t = document.createElement("span");
|
|
374
410
|
t.className = "doc-link-icon", t.contentEditable = "false";
|
|
375
411
|
let i = n(e), a = e.startsWith("icon:") ? r[e.slice(5)] : void 0;
|
|
@@ -377,8 +413,8 @@ function ie(e) {
|
|
|
377
413
|
let e = document.createElement("img");
|
|
378
414
|
e.src = i, e.alt = "", t.appendChild(e);
|
|
379
415
|
} else if (a) {
|
|
380
|
-
let e =
|
|
381
|
-
queueMicrotask(() => e.render(
|
|
416
|
+
let e = E(t);
|
|
417
|
+
queueMicrotask(() => e.render(y(a, { className: "size-[0.95em]" }))), Q.set(t, e);
|
|
382
418
|
} else t.textContent = e;
|
|
383
419
|
return t;
|
|
384
420
|
}
|
|
@@ -388,8 +424,8 @@ function $(e) {
|
|
|
388
424
|
if (!e.isText) return !0;
|
|
389
425
|
let a = e.marks.find((e) => e.type.name === "link"), o = String(a?.attrs.href ?? ""), s = !!a && o === r && i === n;
|
|
390
426
|
if (r = a ? o : "", n = i + e.nodeSize, !a || s || !o.includes("/docs/")) return !1;
|
|
391
|
-
let c =
|
|
392
|
-
return c && t.push(
|
|
427
|
+
let c = p.iconAt(o);
|
|
428
|
+
return c && t.push(C.widget(i, () => pe(c), {
|
|
393
429
|
side: 1,
|
|
394
430
|
marks: [a],
|
|
395
431
|
key: `doc-icon:${c}`,
|
|
@@ -399,24 +435,24 @@ function $(e) {
|
|
|
399
435
|
t && queueMicrotask(() => t.unmount());
|
|
400
436
|
}
|
|
401
437
|
})), !1;
|
|
402
|
-
}),
|
|
438
|
+
}), w.create(e, t);
|
|
403
439
|
}
|
|
404
|
-
var
|
|
440
|
+
var me = b.create({
|
|
405
441
|
name: "docLinkIcons",
|
|
406
442
|
addProseMirrorPlugins() {
|
|
407
|
-
return [new
|
|
443
|
+
return [new x({
|
|
408
444
|
key: Z,
|
|
409
445
|
state: {
|
|
410
446
|
init: (e, t) => $(t.doc),
|
|
411
447
|
apply: (e, t) => e.docChanged || e.getMeta(Z) ? $(e.doc) : t
|
|
412
448
|
},
|
|
413
449
|
props: { decorations: (e) => Z.getState(e) },
|
|
414
|
-
view: (e) => ({ destroy:
|
|
450
|
+
view: (e) => ({ destroy: p.subscribe(() => {
|
|
415
451
|
e.isDestroyed || e.dispatch(e.state.tr.setMeta(Z, !0));
|
|
416
452
|
}) })
|
|
417
453
|
})];
|
|
418
454
|
}
|
|
419
|
-
}),
|
|
455
|
+
}), he = b.create({
|
|
420
456
|
name: "moveBlock",
|
|
421
457
|
addKeyboardShortcuts() {
|
|
422
458
|
let e = (e) => () => {
|
|
@@ -425,7 +461,7 @@ var ae = _.create({
|
|
|
425
461
|
let i = r.index(0), a = t.doc.child(i), o = i + e;
|
|
426
462
|
if (o < 0 || o >= t.doc.childCount) return !0;
|
|
427
463
|
let s = t.doc.child(o), c = r.before(1), l = r.pos - c, u = t.tr.delete(c, c + a.nodeSize), d = e < 0 ? c - s.nodeSize : c + s.nodeSize;
|
|
428
|
-
return u.insert(d, a), u.setSelection(
|
|
464
|
+
return u.insert(d, a), u.setSelection(re.near(u.doc.resolve(d + l))), n.dispatch(u.scrollIntoView()), !0;
|
|
429
465
|
};
|
|
430
466
|
return {
|
|
431
467
|
"Mod-Shift-ArrowUp": e(-1),
|
|
@@ -433,4 +469,4 @@ var ae = _.create({
|
|
|
433
469
|
};
|
|
434
470
|
}
|
|
435
471
|
});
|
|
436
|
-
export {
|
|
472
|
+
export { B as AttachmentFiles, le as AttachmentImage, me as DocLinkIcons, ce as DocLinks, de as IssueMentions, oe as KnowledgeTerms, U as LinkedIssues, he as MoveBlock, X as PeopleMentions, fe as TeamNames, ie as linksIn, M as openImageEvent, se as pickerKeys, I as plainLink, N as recordingPlayer, P as recordingText, k as termCaretEvent, ae as unlinkedMentions, F as unplayable };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { attachmentIdOf as e, githubMedia as t, githubUpload as n } from "../lib/attachments.js";
|
|
2
|
+
import { plainLink as r, recordingPlayer as i, unplayable as a } from "./editorPlugins.js";
|
|
3
|
+
import { videoMarkdown as o, videoTag as s } from "../lib/videoMarkdown.js";
|
|
4
|
+
import { Node as c, mergeAttributes as l } from "@tiptap/react";
|
|
5
|
+
// src/components/video.ts
|
|
6
|
+
function u(e) {
|
|
7
|
+
return e.getAttribute("src") ?? e.querySelector("source[src]")?.getAttribute("src") ?? null;
|
|
8
|
+
}
|
|
9
|
+
var d = c.create({
|
|
10
|
+
name: "video",
|
|
11
|
+
group: "block",
|
|
12
|
+
atom: !0,
|
|
13
|
+
draggable: !0,
|
|
14
|
+
addAttributes: () => ({ src: { default: "" } }),
|
|
15
|
+
parseHTML: () => [{
|
|
16
|
+
tag: "video",
|
|
17
|
+
getAttrs: (e) => {
|
|
18
|
+
let t = u(e);
|
|
19
|
+
return t ? { src: t } : !1;
|
|
20
|
+
}
|
|
21
|
+
}],
|
|
22
|
+
renderHTML: ({ node: e, HTMLAttributes: t }) => ["video", l(t, {
|
|
23
|
+
src: e.attrs.src,
|
|
24
|
+
controls: "",
|
|
25
|
+
preload: "metadata"
|
|
26
|
+
})],
|
|
27
|
+
addNodeView: () => ({ node: o }) => {
|
|
28
|
+
let s = String(o.attrs.src ?? ""), c = document.createElement("div");
|
|
29
|
+
return c.className = "video-block", n(s) || t(s) || e(s) ? c.append(i(s, (e) => a(e, s, !0))) : c.append(r(s)), {
|
|
30
|
+
dom: c,
|
|
31
|
+
ignoreMutation: () => !0
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
markdownTokenName: "video",
|
|
35
|
+
markdownTokenizer: {
|
|
36
|
+
name: "video",
|
|
37
|
+
level: "block",
|
|
38
|
+
start: (e) => e.search(/^<video\b/im),
|
|
39
|
+
tokenize: (e) => {
|
|
40
|
+
let t = s(e);
|
|
41
|
+
return t ? {
|
|
42
|
+
type: "video",
|
|
43
|
+
raw: t.raw,
|
|
44
|
+
text: t.url
|
|
45
|
+
} : void 0;
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
parseMarkdown: (e, t) => t.createNode("video", { src: e.text ?? "" }),
|
|
49
|
+
renderMarkdown: (e) => o(String(e.attrs?.src ?? ""))
|
|
50
|
+
});
|
|
51
|
+
export { d as VideoBlock };
|