@parallelworks/tandem-web 0.163.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 +2 -1
- package/_virtual/_virtual_i18n/es/common.js +2 -1
- package/_virtual/_virtual_i18n/ja/common.js +2 -1
- package/_virtual/_virtual_i18n/ko/common.js +2 -1
- package/_virtual/_virtual_i18n/zh/common.js +2 -1
- package/components/Editor.js +81 -77
- 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
|
@@ -3906,6 +3906,7 @@ var e = {
|
|
|
3906
3906
|
save: "Save",
|
|
3907
3907
|
use: "Run agents here",
|
|
3908
3908
|
useHelp: "Agents in this workspace run in pods on this cluster."
|
|
3909
|
-
}
|
|
3909
|
+
},
|
|
3910
|
+
video: { linkHint: "Link your GitHub account to play this video" }
|
|
3910
3911
|
};
|
|
3911
3912
|
export { e as default };
|
|
@@ -3906,6 +3906,7 @@ var e = {
|
|
|
3906
3906
|
save: "Guardar",
|
|
3907
3907
|
use: "Ejecutar agentes aquí",
|
|
3908
3908
|
useHelp: "Los agentes de este espacio de trabajo se ejecutan en pods de este clúster."
|
|
3909
|
-
}
|
|
3909
|
+
},
|
|
3910
|
+
video: { linkHint: "Vincula tu cuenta de GitHub para reproducir este video" }
|
|
3910
3911
|
};
|
|
3911
3912
|
export { e as default };
|
package/components/Editor.js
CHANGED
|
@@ -3,90 +3,92 @@ import { DetailsContent as t, DetailsSummary as n, Toggle as r } from "./toggle.
|
|
|
3
3
|
import { Columns as i } from "./columns.js";
|
|
4
4
|
import { DateChip as a } from "./DateChip.js";
|
|
5
5
|
import { DocButton as o } from "./DocButton.js";
|
|
6
|
-
import { AttachmentFiles as s, AttachmentImage as c, DocLinkIcons as l, DocLinks as u, IssueMentions as d, KnowledgeTerms as f, LinkedIssues as p, PeopleMentions as m, TeamNames as h } from "./editorPlugins.js";
|
|
7
|
-
import { DocLinkPicker as
|
|
8
|
-
import { DocViewBlock as
|
|
6
|
+
import { AttachmentFiles as s, AttachmentImage as c, DocLinkIcons as l, DocLinks as u, IssueMentions as d, KnowledgeTerms as f, LinkedIssues as p, PeopleMentions as m, TeamNames as h, recordingText as g } from "./editorPlugins.js";
|
|
7
|
+
import { DocLinkPicker as _ } from "./DocLinkPicker.js";
|
|
8
|
+
import { DocViewBlock as ee } from "./DocViewBlock.js";
|
|
9
9
|
import { FigmaEmbedBlock as v } from "./Figma.js";
|
|
10
10
|
import { IssueListBlock as y } from "./IssueListBlock.js";
|
|
11
11
|
import { LinkCard as b } from "./LinkCard.js";
|
|
12
12
|
import { MentionPicker as x } from "./MentionPicker.js";
|
|
13
|
-
import { Diagrams as
|
|
14
|
-
import { SlashMenu as
|
|
15
|
-
import { SubPages as
|
|
16
|
-
import { MarkdownTable as
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
13
|
+
import { Diagrams as te, MathBlock as ne, MathInline as S } from "./mathDiagrams.js";
|
|
14
|
+
import { SlashMenu as C } from "./SlashMenu.js";
|
|
15
|
+
import { SubPages as w } from "./SubPages.js";
|
|
16
|
+
import { MarkdownTable as T } from "./table.js";
|
|
17
|
+
import { VideoBlock as E } from "./video.js";
|
|
18
|
+
import { useEffect as D, useRef as O } from "react";
|
|
19
|
+
import { useTranslations as k } from "use-intl";
|
|
20
|
+
import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
|
|
21
|
+
import { CodeBlockLowlight as N } from "@tiptap/extension-code-block-lowlight";
|
|
22
|
+
import { TaskItem as P, TaskList as F } from "@tiptap/extension-list";
|
|
23
|
+
import { TableKit as I } from "@tiptap/extension-table";
|
|
24
|
+
import { Placeholder as L } from "@tiptap/extensions";
|
|
25
|
+
import { Markdown as R } from "@tiptap/markdown";
|
|
26
|
+
import { EditorContent as z, useEditor as B } from "@tiptap/react";
|
|
27
|
+
import V from "@tiptap/starter-kit";
|
|
28
|
+
import re from "highlight.js/lib/languages/bash";
|
|
29
|
+
import H from "highlight.js/lib/languages/css";
|
|
30
|
+
import U from "highlight.js/lib/languages/diff";
|
|
31
|
+
import W from "highlight.js/lib/languages/dockerfile";
|
|
32
|
+
import G from "highlight.js/lib/languages/go";
|
|
33
|
+
import K from "highlight.js/lib/languages/ini";
|
|
34
|
+
import q from "highlight.js/lib/languages/javascript";
|
|
35
|
+
import J from "highlight.js/lib/languages/json";
|
|
36
|
+
import Y from "highlight.js/lib/languages/markdown";
|
|
37
|
+
import X from "highlight.js/lib/languages/python";
|
|
38
|
+
import ie from "highlight.js/lib/languages/rust";
|
|
39
|
+
import ae from "highlight.js/lib/languages/shell";
|
|
40
|
+
import oe from "highlight.js/lib/languages/sql";
|
|
41
|
+
import se from "highlight.js/lib/languages/typescript";
|
|
42
|
+
import ce from "highlight.js/lib/languages/xml";
|
|
43
|
+
import Z from "highlight.js/lib/languages/yaml";
|
|
44
|
+
import { createLowlight as le } from "lowlight";
|
|
43
45
|
// src/components/Editor.tsx
|
|
44
|
-
var
|
|
45
|
-
bash:
|
|
46
|
-
css:
|
|
47
|
-
diff:
|
|
48
|
-
dockerfile:
|
|
49
|
-
go:
|
|
50
|
-
ini:
|
|
51
|
-
javascript:
|
|
52
|
-
json:
|
|
53
|
-
markdown:
|
|
54
|
-
python:
|
|
55
|
-
rust:
|
|
56
|
-
shell:
|
|
57
|
-
sql:
|
|
58
|
-
typescript:
|
|
59
|
-
xml:
|
|
60
|
-
yaml:
|
|
46
|
+
var ue = le({
|
|
47
|
+
bash: re,
|
|
48
|
+
css: H,
|
|
49
|
+
diff: U,
|
|
50
|
+
dockerfile: W,
|
|
51
|
+
go: G,
|
|
52
|
+
ini: K,
|
|
53
|
+
javascript: q,
|
|
54
|
+
json: J,
|
|
55
|
+
markdown: Y,
|
|
56
|
+
python: X,
|
|
57
|
+
rust: ie,
|
|
58
|
+
shell: ae,
|
|
59
|
+
sql: oe,
|
|
60
|
+
typescript: se,
|
|
61
|
+
xml: ce,
|
|
62
|
+
yaml: Z
|
|
61
63
|
});
|
|
62
|
-
function Q({ editable: g = !0, placeholder:
|
|
64
|
+
function Q({ editable: g = !0, placeholder: _ = "", collaborative: x = !1 } = {}) {
|
|
63
65
|
return [
|
|
64
|
-
|
|
66
|
+
V.configure({
|
|
65
67
|
link: {
|
|
66
68
|
openOnClick: !g,
|
|
67
69
|
autolink: !0
|
|
68
70
|
},
|
|
69
71
|
codeBlock: !1,
|
|
70
72
|
blockquote: !1,
|
|
71
|
-
...g && !
|
|
72
|
-
...
|
|
73
|
+
...g && !x ? {} : { trailingNode: !1 },
|
|
74
|
+
...x ? { undoRedo: !1 } : {}
|
|
73
75
|
}),
|
|
74
|
-
|
|
76
|
+
N.configure({ lowlight: ue }),
|
|
75
77
|
e,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
F,
|
|
79
|
+
P.configure({ nested: !0 }),
|
|
78
80
|
r,
|
|
79
|
-
|
|
81
|
+
w,
|
|
80
82
|
n,
|
|
81
83
|
t,
|
|
82
84
|
i,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
I.configure({ table: !1 }),
|
|
86
|
+
T.configure({
|
|
85
87
|
resizable: !1,
|
|
86
88
|
allowTableNodeSelection: !1
|
|
87
89
|
}),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
L.configure({ placeholder: _ }),
|
|
91
|
+
R,
|
|
90
92
|
f,
|
|
91
93
|
u,
|
|
92
94
|
l,
|
|
@@ -96,13 +98,14 @@ function Q({ editable: g = !0, placeholder: x = "", collaborative: S = !1 } = {}
|
|
|
96
98
|
m,
|
|
97
99
|
h,
|
|
98
100
|
d,
|
|
99
|
-
|
|
101
|
+
ee,
|
|
100
102
|
o,
|
|
101
103
|
b,
|
|
102
104
|
v,
|
|
105
|
+
E,
|
|
106
|
+
S,
|
|
103
107
|
ne,
|
|
104
108
|
te,
|
|
105
|
-
ee,
|
|
106
109
|
y,
|
|
107
110
|
a
|
|
108
111
|
];
|
|
@@ -122,8 +125,9 @@ function $(e) {
|
|
|
122
125
|
}
|
|
123
126
|
};
|
|
124
127
|
}
|
|
125
|
-
function
|
|
126
|
-
|
|
128
|
+
function de({ value: e, onChange: t, onSubmit: n, onBlur: r, onFocus: i, placeholder: a, editable: o = !0, autofocus: s = !1, className: c = "", label: l, onFiles: u, onEditor: d }) {
|
|
129
|
+
g.linkHint = k("video")("linkHint");
|
|
130
|
+
let f = O({
|
|
127
131
|
onChange: t,
|
|
128
132
|
onSubmit: n,
|
|
129
133
|
onBlur: r,
|
|
@@ -135,9 +139,9 @@ function ce({ value: e, onChange: t, onSubmit: n, onBlur: r, onFocus: i, placeho
|
|
|
135
139
|
onBlur: r,
|
|
136
140
|
onFocus: i
|
|
137
141
|
};
|
|
138
|
-
let p =
|
|
142
|
+
let p = O(u);
|
|
139
143
|
p.current = u;
|
|
140
|
-
let m =
|
|
144
|
+
let m = B({
|
|
141
145
|
extensions: Q({
|
|
142
146
|
editable: o,
|
|
143
147
|
placeholder: a ?? ""
|
|
@@ -164,23 +168,23 @@ function ce({ value: e, onChange: t, onSubmit: n, onBlur: r, onFocus: i, placeho
|
|
|
164
168
|
onBlur: ({ editor: e }) => f.current.onBlur?.(e.getMarkdown()),
|
|
165
169
|
onFocus: () => f.current.onFocus?.()
|
|
166
170
|
});
|
|
167
|
-
|
|
171
|
+
D(() => {
|
|
168
172
|
m && !m.isFocused && m.getMarkdown() !== e && m.commands.setContent(e, {
|
|
169
173
|
contentType: "markdown",
|
|
170
174
|
emitUpdate: !1
|
|
171
175
|
});
|
|
172
|
-
}, [m, e]),
|
|
176
|
+
}, [m, e]), D(() => {
|
|
173
177
|
m?.setEditable(o);
|
|
174
178
|
}, [m, o]);
|
|
175
|
-
let h =
|
|
176
|
-
return h.current = d,
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
o && /* @__PURE__ */
|
|
179
|
-
o && /* @__PURE__ */
|
|
179
|
+
let h = O(d);
|
|
180
|
+
return h.current = d, D(() => (h.current?.(m), () => h.current?.(null)), [m]), /* @__PURE__ */ M(A, { children: [
|
|
181
|
+
/* @__PURE__ */ j(z, { editor: m }),
|
|
182
|
+
o && /* @__PURE__ */ j(_, { editor: m }),
|
|
183
|
+
o && /* @__PURE__ */ j(C, {
|
|
180
184
|
editor: m,
|
|
181
185
|
onFiles: p
|
|
182
186
|
}),
|
|
183
|
-
o && /* @__PURE__ */
|
|
187
|
+
o && /* @__PURE__ */ j(x, { editor: m })
|
|
184
188
|
] });
|
|
185
189
|
}
|
|
186
|
-
export {
|
|
190
|
+
export { de as Editor, Q as contentExtensions, $ as fileHandlers };
|
|
@@ -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 };
|
package/lib/attachments.js
CHANGED
|
@@ -19,7 +19,30 @@ function o(e) {
|
|
|
19
19
|
function s(t) {
|
|
20
20
|
return t.startsWith("/api/v1/attachments/") ? e + t : t;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
var c = /\.(mp4|m4v|mov|webm)$/i;
|
|
23
|
+
function l(e) {
|
|
24
|
+
if (!e) return !1;
|
|
25
|
+
try {
|
|
26
|
+
let t = new URL(e);
|
|
27
|
+
return t.protocol === "https:" && t.hostname.toLowerCase() === "github.com" && /^\/user-attachments\/assets\/[0-9a-f-]{36}$/.test(t.pathname) && !t.search && !t.hash;
|
|
28
|
+
} catch {
|
|
29
|
+
return !1;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function u(t) {
|
|
33
|
+
return l(t) ? `${e}/api/v1/github/media?url=${encodeURIComponent(t)}` : s(t);
|
|
34
|
+
}
|
|
35
|
+
function d(e) {
|
|
36
|
+
if (!e) return !1;
|
|
37
|
+
if (o(e)) return !0;
|
|
38
|
+
try {
|
|
39
|
+
let t = new URL(e, window.location.origin);
|
|
40
|
+
return t.origin === window.location.origin && c.test(t.pathname);
|
|
41
|
+
} catch {
|
|
42
|
+
return !1;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async function f(e, r, i) {
|
|
23
46
|
return n(await t.POST("/api/v1/workspaces/{workspace}/issues/{identifier}/attachments", {
|
|
24
47
|
params: {
|
|
25
48
|
path: {
|
|
@@ -33,7 +56,7 @@ async function c(e, r, i) {
|
|
|
33
56
|
headers: { "Content-Type": "application/octet-stream" }
|
|
34
57
|
}));
|
|
35
58
|
}
|
|
36
|
-
async function
|
|
59
|
+
async function p(e, r, i) {
|
|
37
60
|
return n(await t.POST("/api/v1/workspaces/{workspace}/knowledge/{entry}/attachments", {
|
|
38
61
|
params: {
|
|
39
62
|
path: {
|
|
@@ -47,7 +70,7 @@ async function l(e, r, i) {
|
|
|
47
70
|
headers: { "Content-Type": "application/octet-stream" }
|
|
48
71
|
}));
|
|
49
72
|
}
|
|
50
|
-
function
|
|
73
|
+
function m(e, t, n) {
|
|
51
74
|
let i = t.flatMap((e) => {
|
|
52
75
|
let t = r + e.id;
|
|
53
76
|
return e.inline ? [{
|
|
@@ -70,7 +93,7 @@ function u(e, t, n) {
|
|
|
70
93
|
}), a = e.chain().focus();
|
|
71
94
|
(n === void 0 ? a : a.setTextSelection(n)).insertContent(i).run();
|
|
72
95
|
}
|
|
73
|
-
var
|
|
96
|
+
var h = (() => {
|
|
74
97
|
let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
75
98
|
return {
|
|
76
99
|
get: (t) => e.get(t),
|
|
@@ -86,13 +109,13 @@ var d = (() => {
|
|
|
86
109
|
}
|
|
87
110
|
};
|
|
88
111
|
})();
|
|
89
|
-
function
|
|
112
|
+
function g(e) {
|
|
90
113
|
return new Promise((t, n) => {
|
|
91
114
|
let r = new FileReader();
|
|
92
115
|
r.onload = () => t(String(r.result)), r.onerror = () => n(r.error), r.readAsDataURL(e);
|
|
93
116
|
});
|
|
94
117
|
}
|
|
95
|
-
function
|
|
118
|
+
function _(e, t, n) {
|
|
96
119
|
let r = t.flatMap(({ file: e, src: t }) => e.type.startsWith("image/") ? [{
|
|
97
120
|
type: "image",
|
|
98
121
|
attrs: {
|
|
@@ -112,4 +135,4 @@ function p(e, t, n) {
|
|
|
112
135
|
}]);
|
|
113
136
|
n === void 0 ? e.chain().focus().insertContent(r).run() : e.chain().focus().insertContentAt(n, r).run();
|
|
114
137
|
}
|
|
115
|
-
export { a as attachmentIdOf, r as attachmentPrefix,
|
|
138
|
+
export { a as attachmentIdOf, r as attachmentPrefix, h as attachmentSizes, s as attachmentURL, o as githubMedia, l as githubUpload, m as insertAttachments, _ as insertPreviews, u as mediaURL, d as playableLink, g as readDataURL, f as uploadAttachment, p as uploadKnowledgeAttachment, c as videoName };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { basePath as e } from "./base.js";
|
|
2
|
+
import { api as t } from "../api/client.js";
|
|
3
|
+
// src/lib/githubLink.ts
|
|
4
|
+
var n;
|
|
5
|
+
function r() {
|
|
6
|
+
return n ??= t.GET("/api/v1/me/github").then(({ data: t }) => {
|
|
7
|
+
if (!t?.enabled || !t.keepsTokens || t.actsAsYou) return null;
|
|
8
|
+
if (t.linkedByHost) return t.linkURL ?? null;
|
|
9
|
+
let n = window.location.pathname.slice(e.length).split("/")[1];
|
|
10
|
+
return n ? `${e}/${n}/settings/connections` : null;
|
|
11
|
+
}).catch(() => null), n;
|
|
12
|
+
}
|
|
13
|
+
export { r as githubLinkPage };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/lib/videoMarkdown.ts
|
|
2
|
+
var e = /^<video\b([^>]*)>(?:([\s\S]*?)<\/video>)?[ \t]*(?:\n|$)/i, t = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i, n = (e) => e.replace(/"/g, "\"").replace(/'/g, "'").replace(/&/g, "&");
|
|
3
|
+
function r(r) {
|
|
4
|
+
let i = e.exec(r);
|
|
5
|
+
if (!i) return;
|
|
6
|
+
let a = t.exec(i[1] ?? ""), o = /<source\b[^>]*>/i.exec(i[2] ?? ""), s = a ?? (o ? t.exec(o[0]) : null), c = s ? s[1] ?? s[2] ?? "" : "";
|
|
7
|
+
return c ? {
|
|
8
|
+
raw: i[0],
|
|
9
|
+
url: n(c)
|
|
10
|
+
} : void 0;
|
|
11
|
+
}
|
|
12
|
+
function i(e) {
|
|
13
|
+
return `<video src="${e.replace(/&/g, "&").replace(/"/g, """)}"></video>`;
|
|
14
|
+
}
|
|
15
|
+
export { i as videoMarkdown, r as videoTag };
|
package/package.json
CHANGED
package/styles.css
CHANGED
|
@@ -653,6 +653,18 @@ body[data-tandem] > :not(:has(.tandem)) {
|
|
|
653
653
|
border-radius: 0.375rem;
|
|
654
654
|
background: var(--color-muted);
|
|
655
655
|
}
|
|
656
|
+
/* Where a recording that won't play was: its link, and where to link
|
|
657
|
+
GitHub when that would let it play (unplayable). */
|
|
658
|
+
.prose-issue .recording-box,
|
|
659
|
+
.prose-issue .recording-unplayable {
|
|
660
|
+
display: block;
|
|
661
|
+
}
|
|
662
|
+
.prose-issue .recording-unplayable a.recording-hint {
|
|
663
|
+
display: block;
|
|
664
|
+
margin: 0.2em 0 0.4em;
|
|
665
|
+
font-size: 0.8125rem;
|
|
666
|
+
color: var(--color-muted-foreground);
|
|
667
|
+
}
|
|
656
668
|
/* An attached file reads as a chip with its size, and downloads. */
|
|
657
669
|
.prose-issue a[href*="/api/v1/attachments/"] {
|
|
658
670
|
display: inline-flex;
|