@pretextbook/web-editor 0.14.0 → 0.15.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/components/AssetManagerModal.d.ts +10 -12
- package/dist/components/CodeEditor.d.ts +1 -0
- package/dist/components/CodeEditorMenu.d.ts +1 -0
- package/dist/components/Editors.d.ts +18 -21
- package/dist/components/TableOfContents.d.ts +3 -1
- package/dist/components/toc/ArticleToc.d.ts +2 -1
- package/dist/index.es.js +482 -593
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/sectionUtils.d.ts +8 -8
- package/dist/store/editorStore.d.ts +1 -15
- package/dist/types/editor.d.ts +10 -3
- package/dist/types/sections.d.ts +9 -2
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -13808,20 +13808,20 @@ var oc = 6, sc = ({ actions: e }) => {
|
|
|
13808
13808
|
})
|
|
13809
13809
|
]
|
|
13810
13810
|
});
|
|
13811
|
-
}, cc = ({ content: e, sourceFormat: r, onContentChange: i, onOpenLatexImport: a, onOpenDocinfoEditor: o, onConvertToPretext: s, canConvertToPretext: c, onOpenAssets: l,
|
|
13812
|
-
let
|
|
13811
|
+
}, cc = ({ content: e, sourceFormat: r, onContentChange: i, onOpenLatexImport: a, onOpenDocinfoEditor: o, onConvertToPretext: s, canConvertToPretext: c, onOpenAssets: l, hideAssets: u, onShowFullSource: d }) => {
|
|
13812
|
+
let f = () => {
|
|
13813
13813
|
try {
|
|
13814
13814
|
i(Fs(e));
|
|
13815
13815
|
} catch (e) {
|
|
13816
13816
|
console.error("Error formatting:", e), alert("Error formatting XML");
|
|
13817
13817
|
}
|
|
13818
|
-
},
|
|
13818
|
+
}, p = {
|
|
13819
13819
|
key: "full-source",
|
|
13820
13820
|
label: "Display Full Source",
|
|
13821
|
-
onClick:
|
|
13821
|
+
onClick: d,
|
|
13822
13822
|
title: "Show the full assembled PreTeXt source for the project"
|
|
13823
|
-
},
|
|
13824
|
-
return
|
|
13823
|
+
}, m;
|
|
13824
|
+
return m = r === "latex" ? [
|
|
13825
13825
|
...s ? [{
|
|
13826
13826
|
key: "convert",
|
|
13827
13827
|
label: "Convert to PreTeXt",
|
|
@@ -13836,7 +13836,7 @@ var oc = 6, sc = ({ actions: e }) => {
|
|
|
13836
13836
|
onClick: o,
|
|
13837
13837
|
title: "Edit Preamble"
|
|
13838
13838
|
},
|
|
13839
|
-
|
|
13839
|
+
p
|
|
13840
13840
|
] : r === "markdown" ? [
|
|
13841
13841
|
...s ? [{
|
|
13842
13842
|
key: "convert",
|
|
@@ -13852,12 +13852,12 @@ var oc = 6, sc = ({ actions: e }) => {
|
|
|
13852
13852
|
onClick: o,
|
|
13853
13853
|
title: "Edit Macros"
|
|
13854
13854
|
},
|
|
13855
|
-
|
|
13855
|
+
p
|
|
13856
13856
|
] : [
|
|
13857
13857
|
{
|
|
13858
13858
|
key: "format",
|
|
13859
13859
|
label: "Format PreTeXt",
|
|
13860
|
-
onClick:
|
|
13860
|
+
onClick: f,
|
|
13861
13861
|
title: "Format the PreTeXt source"
|
|
13862
13862
|
},
|
|
13863
13863
|
{
|
|
@@ -13872,16 +13872,16 @@ var oc = 6, sc = ({ actions: e }) => {
|
|
|
13872
13872
|
onClick: o,
|
|
13873
13873
|
title: "Edit Macros"
|
|
13874
13874
|
},
|
|
13875
|
-
...l ? [{
|
|
13875
|
+
...l && !u ? [{
|
|
13876
13876
|
key: "assets",
|
|
13877
13877
|
label: "Assets",
|
|
13878
13878
|
onClick: l,
|
|
13879
13879
|
title: "Manage assets"
|
|
13880
13880
|
}] : [],
|
|
13881
|
-
|
|
13881
|
+
p
|
|
13882
13882
|
], /* @__PURE__ */ n("div", {
|
|
13883
13883
|
className: "pretext-plus-editor__code-editor-menu",
|
|
13884
|
-
children: [/* @__PURE__ */ t(sc, { actions:
|
|
13884
|
+
children: [/* @__PURE__ */ t(sc, { actions: m }), /* @__PURE__ */ t("span", {
|
|
13885
13885
|
className: "pretext-plus-editor__code-editor-source-badge pretext-plus-editor__code-editor-source-badge--right",
|
|
13886
13886
|
children: r === "latex" ? "LaTeX" : r === "markdown" ? "Markdown" : "PreTeXt"
|
|
13887
13887
|
})]
|
|
@@ -13959,11 +13959,11 @@ var dc = {
|
|
|
13959
13959
|
top: 10,
|
|
13960
13960
|
bottom: 10
|
|
13961
13961
|
}
|
|
13962
|
-
}, fc = l(({ content: e, sourceFormat: r, onChange: i, onRebuild: a, onSave: o, onOpenLatexImport: s, onOpenDocinfoEditor: c, onOpenConvertToPretext: l, canConvertToPretext: u, onOpenAssets: d, onShowFullSource: f, onRequestWrapperEdit: p },
|
|
13963
|
-
let
|
|
13964
|
-
g(
|
|
13962
|
+
}, fc = l(({ content: e, sourceFormat: r, onChange: i, onRebuild: a, onSave: o, onOpenLatexImport: s, onOpenDocinfoEditor: c, onOpenConvertToPretext: l, canConvertToPretext: u, onOpenAssets: d, onShowFullSource: f, onRequestWrapperEdit: p, hideAssets: h }, _) => {
|
|
13963
|
+
let v = y(null), x = y(null), S = y(null), C = y(null), w = y(!1), T = y(0), E = y(null), D = y(null), O = y(p), k = y(null), A = y(null), j = y(!1), [ee, te] = b(!1), [ne, M] = b(!1), N = y(a), re = y(o);
|
|
13964
|
+
g(_, () => ({
|
|
13965
13965
|
insertAtCursor: (e) => {
|
|
13966
|
-
let t =
|
|
13966
|
+
let t = v.current;
|
|
13967
13967
|
if (!t) return;
|
|
13968
13968
|
let n = t.getSelection();
|
|
13969
13969
|
n && (t.executeEdits("insert-asset", [{
|
|
@@ -13973,22 +13973,22 @@ var dc = {
|
|
|
13973
13973
|
}]), t.focus());
|
|
13974
13974
|
},
|
|
13975
13975
|
focus: () => {
|
|
13976
|
-
|
|
13976
|
+
v.current?.focus();
|
|
13977
13977
|
}
|
|
13978
13978
|
}), []), m(() => {
|
|
13979
|
-
|
|
13979
|
+
N.current = a;
|
|
13980
13980
|
}, [a]), m(() => {
|
|
13981
|
-
|
|
13981
|
+
re.current = o;
|
|
13982
13982
|
}, [o]), m(() => {
|
|
13983
|
-
|
|
13983
|
+
O.current = p;
|
|
13984
13984
|
}, [p]), m(() => {
|
|
13985
|
-
|
|
13985
|
+
k.current?.dispose?.();
|
|
13986
13986
|
let e = Zo[r];
|
|
13987
|
-
|
|
13987
|
+
k.current = x.current ? e.registerMonacoExtensions?.(x.current) ?? null : null, P();
|
|
13988
13988
|
}, [r]), m(() => () => {
|
|
13989
|
-
|
|
13989
|
+
E.current?.dispose?.(), k.current?.dispose?.(), D.current?.dispose?.(), S.current?.disposeConstrainer?.(), A.current && clearTimeout(A.current);
|
|
13990
13990
|
}, []);
|
|
13991
|
-
let
|
|
13991
|
+
let ie = (e, t, n) => {
|
|
13992
13992
|
if (r !== "pretext") return;
|
|
13993
13993
|
let i = t.getLineCount();
|
|
13994
13994
|
if (i < 2) return;
|
|
@@ -13998,40 +13998,40 @@ var dc = {
|
|
|
13998
13998
|
if (i !== o + 1) return;
|
|
13999
13999
|
let s = t.getLineContent(i).trim();
|
|
14000
14000
|
if (!/^<\/[A-Za-z][\w.:-]*\s*>$/.test(s)) return;
|
|
14001
|
-
|
|
14001
|
+
j.current = !0;
|
|
14002
14002
|
let c = t.getLineMaxColumn(o);
|
|
14003
14003
|
e.executeEdits("ensure-body-line", [{
|
|
14004
14004
|
range: new n.Range(o, c, o, c),
|
|
14005
14005
|
text: "\n",
|
|
14006
14006
|
forceMoveMarkers: !0
|
|
14007
14007
|
}]), queueMicrotask(() => {
|
|
14008
|
-
|
|
14008
|
+
j.current = !1;
|
|
14009
14009
|
});
|
|
14010
|
-
},
|
|
14010
|
+
}, ae = (e, t, n) => {
|
|
14011
14011
|
if (r !== "pretext") return;
|
|
14012
14012
|
let i = t.getLineCount();
|
|
14013
14013
|
if (i < 2 || t.getLineContent(i).trim() !== "") return;
|
|
14014
14014
|
let a = i - 1;
|
|
14015
14015
|
for (; a > 1 && t.getLineContent(a).trim() === "";) a--;
|
|
14016
14016
|
let o = t.getLineContent(a).trim();
|
|
14017
|
-
/^<\/[A-Za-z][\w.:-]*\s*>$/.test(o) && (
|
|
14017
|
+
/^<\/[A-Za-z][\w.:-]*\s*>$/.test(o) && (j.current = !0, e.executeEdits("trim-trailing-blank-lines", [{
|
|
14018
14018
|
range: new n.Range(a, t.getLineMaxColumn(a), i, t.getLineMaxColumn(i)),
|
|
14019
14019
|
text: "",
|
|
14020
14020
|
forceMoveMarkers: !0
|
|
14021
14021
|
}]), queueMicrotask(() => {
|
|
14022
|
-
|
|
14022
|
+
j.current = !1;
|
|
14023
14023
|
}));
|
|
14024
|
-
},
|
|
14025
|
-
let e =
|
|
14024
|
+
}, P = () => {
|
|
14025
|
+
let e = v.current, t = x.current, n = S.current;
|
|
14026
14026
|
if (!e || !t || !n) return;
|
|
14027
14027
|
let i = e.getModel();
|
|
14028
14028
|
if (!i) return;
|
|
14029
|
-
typeof i.disposeRestrictions == "function" && i.disposeRestrictions(),
|
|
14029
|
+
typeof i.disposeRestrictions == "function" && i.disposeRestrictions(), ae(e, i, t), ie(e, i, t);
|
|
14030
14030
|
let a = uc(i, r);
|
|
14031
|
-
if (
|
|
14031
|
+
if (w.current = a !== null, T.current = a?.leadingLockedLines ?? 0, a && n.addRestrictionsTo(i, [{
|
|
14032
14032
|
range: a.editableRange,
|
|
14033
14033
|
allowMultiline: !0
|
|
14034
|
-
}]), typeof e.createDecorationsCollection == "function") if (
|
|
14034
|
+
}]), typeof e.createDecorationsCollection == "function") if (C.current ||= e.createDecorationsCollection(), !a) C.current.clear();
|
|
14035
14035
|
else {
|
|
14036
14036
|
let e = {
|
|
14037
14037
|
isWholeLine: !0,
|
|
@@ -14040,47 +14040,47 @@ var dc = {
|
|
|
14040
14040
|
stickiness: t.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
|
14041
14041
|
hoverMessage: { value: "These properties are structural — edit them from the Table of Contents." }
|
|
14042
14042
|
};
|
|
14043
|
-
|
|
14043
|
+
C.current.set(a.lockedLines.map((n) => ({
|
|
14044
14044
|
range: new t.Range(n, 1, n, i.getLineMaxColumn(n)),
|
|
14045
14045
|
options: e
|
|
14046
14046
|
})));
|
|
14047
14047
|
}
|
|
14048
|
-
},
|
|
14049
|
-
e.getValue() !== t && (
|
|
14050
|
-
|
|
14048
|
+
}, oe = (e, t) => {
|
|
14049
|
+
e.getValue() !== t && (j.current = !0, typeof e.disposeRestrictions == "function" && e.disposeRestrictions(), e.setValue(t), P(), queueMicrotask(() => {
|
|
14050
|
+
j.current = !1;
|
|
14051
14051
|
}));
|
|
14052
14052
|
};
|
|
14053
14053
|
m(() => {
|
|
14054
|
-
let t =
|
|
14054
|
+
let t = v.current;
|
|
14055
14055
|
if (!t) return;
|
|
14056
14056
|
let n = t.getModel();
|
|
14057
14057
|
if (n && n.getValue() !== e) {
|
|
14058
14058
|
let r = t.getPosition(), i = t.getSelections();
|
|
14059
|
-
|
|
14059
|
+
oe(n, e), r && t.setPosition(r), i && t.setSelections(i);
|
|
14060
14060
|
}
|
|
14061
14061
|
}, [e]);
|
|
14062
|
-
let
|
|
14063
|
-
|
|
14062
|
+
let F = (t, n) => {
|
|
14063
|
+
v.current = t, x.current = n, S.current = Cr(n), S.current.initializeIn(t);
|
|
14064
14064
|
let i = t.getModel();
|
|
14065
|
-
i && i.getValue() !== e &&
|
|
14066
|
-
|
|
14067
|
-
}),
|
|
14065
|
+
i && i.getValue() !== e && oe(i, e), E.current?.dispose?.(), E.current = t.onDidChangeModelContent(() => {
|
|
14066
|
+
se();
|
|
14067
|
+
}), se(), D.current?.dispose?.(), D.current = t.onMouseDown((e) => {
|
|
14068
14068
|
let t = e?.target?.position?.lineNumber;
|
|
14069
|
-
|
|
14069
|
+
w.current && typeof t == "number" && t <= T.current && O.current?.();
|
|
14070
14070
|
}), t.addCommand(n.KeyMod.CtrlCmd | n.KeyCode.Enter, () => {
|
|
14071
|
-
M.current?.();
|
|
14072
|
-
}), t.addCommand(n.KeyMod.CtrlCmd | n.KeyCode.KeyS, () => {
|
|
14073
14071
|
N.current?.();
|
|
14074
|
-
}),
|
|
14075
|
-
|
|
14076
|
-
|
|
14072
|
+
}), t.addCommand(n.KeyMod.CtrlCmd | n.KeyCode.KeyS, () => {
|
|
14073
|
+
re.current?.();
|
|
14074
|
+
}), k.current?.dispose?.(), k.current = Zo[r].registerMonacoExtensions?.(n) ?? null, P();
|
|
14075
|
+
}, se = () => {
|
|
14076
|
+
let e = v.current?.getModel?.();
|
|
14077
14077
|
if (e && typeof e.canUndo == "function" && typeof e.canRedo == "function") try {
|
|
14078
|
-
|
|
14078
|
+
te(e.canUndo()), M(e.canRedo());
|
|
14079
14079
|
return;
|
|
14080
14080
|
} catch {}
|
|
14081
|
-
let t = !!
|
|
14082
|
-
|
|
14083
|
-
},
|
|
14081
|
+
let t = !!v.current;
|
|
14082
|
+
te(t), M(t);
|
|
14083
|
+
}, ce = (e) => {
|
|
14084
14084
|
i(e);
|
|
14085
14085
|
};
|
|
14086
14086
|
return /* @__PURE__ */ n("div", {
|
|
@@ -14092,21 +14092,22 @@ var dc = {
|
|
|
14092
14092
|
children: [/* @__PURE__ */ t(cc, {
|
|
14093
14093
|
content: e,
|
|
14094
14094
|
sourceFormat: r,
|
|
14095
|
-
onContentChange:
|
|
14095
|
+
onContentChange: ce,
|
|
14096
14096
|
onOpenLatexImport: s,
|
|
14097
14097
|
onOpenDocinfoEditor: c,
|
|
14098
14098
|
onUndo: () => {
|
|
14099
|
-
|
|
14099
|
+
v.current?.trigger("", "undo"), se();
|
|
14100
14100
|
},
|
|
14101
14101
|
onRedo: () => {
|
|
14102
|
-
|
|
14102
|
+
v.current?.trigger("", "redo"), se();
|
|
14103
14103
|
},
|
|
14104
|
-
canUndo:
|
|
14105
|
-
canRedo:
|
|
14104
|
+
canUndo: ee,
|
|
14105
|
+
canRedo: ne,
|
|
14106
14106
|
onConvertToPretext: l,
|
|
14107
14107
|
canConvertToPretext: u,
|
|
14108
14108
|
onOpenAssets: d,
|
|
14109
|
-
onShowFullSource: f
|
|
14109
|
+
onShowFullSource: f,
|
|
14110
|
+
hideAssets: h
|
|
14110
14111
|
}), /* @__PURE__ */ t("div", {
|
|
14111
14112
|
style: { flex: 1 },
|
|
14112
14113
|
children: /* @__PURE__ */ t(_r, {
|
|
@@ -14114,10 +14115,10 @@ var dc = {
|
|
|
14114
14115
|
height: "100%",
|
|
14115
14116
|
language: Zo[r].language,
|
|
14116
14117
|
defaultValue: e,
|
|
14117
|
-
onMount:
|
|
14118
|
+
onMount: F,
|
|
14118
14119
|
onChange: (e, t) => {
|
|
14119
|
-
t?.isFlush ||
|
|
14120
|
-
|
|
14120
|
+
t?.isFlush || j.current || (A.current && clearTimeout(A.current), A.current = setTimeout(() => {
|
|
14121
|
+
ce(e || "");
|
|
14121
14122
|
}, 500));
|
|
14122
14123
|
}
|
|
14123
14124
|
})
|
|
@@ -98759,7 +98760,7 @@ function X8(e, t) {
|
|
|
98759
98760
|
}
|
|
98760
98761
|
function Z8(e) {
|
|
98761
98762
|
let { pretextSource: t, pretextError: n } = O6(e.source, "latex");
|
|
98762
|
-
return n || t === void 0 ? null :
|
|
98763
|
+
return n || t === void 0 ? null : t;
|
|
98763
98764
|
}
|
|
98764
98765
|
function Q8(e = "New Section") {
|
|
98765
98766
|
let t = O8();
|
|
@@ -98911,10 +98912,10 @@ function u5(e) {
|
|
|
98911
98912
|
if (!t) return null;
|
|
98912
98913
|
let n = e.slice(t[0].length), r = "section", i = "", a = "", o = "";
|
|
98913
98914
|
for (let e of t[1].split(/\r?\n/)) {
|
|
98914
|
-
let t = /^[ \t]*(xmlid|xml:id|division|label|title)[ \t]*:[ \t]*(.*)$/.exec(e);
|
|
98915
|
+
let t = /^[ \t]*(id|xmlid|xml:id|division|label|title)[ \t]*:[ \t]*(.*)$/.exec(e);
|
|
98915
98916
|
if (!t) continue;
|
|
98916
98917
|
let n = c5(t[2]);
|
|
98917
|
-
t[1] === "division" ? r = n : t[1] === "xmlid" || t[1] === "xml:id" ? i = n : t[1] === "title" ? o = n : a = n;
|
|
98918
|
+
t[1] === "division" ? r = n : t[1] === "id" || t[1] === "xmlid" || t[1] === "xml:id" ? i = n : t[1] === "title" ? o = n : a = n;
|
|
98918
98919
|
}
|
|
98919
98920
|
return {
|
|
98920
98921
|
type: r || "section",
|
|
@@ -98925,7 +98926,7 @@ function u5(e) {
|
|
|
98925
98926
|
};
|
|
98926
98927
|
}
|
|
98927
98928
|
function d5(e) {
|
|
98928
|
-
let t = [`division: ${e.type}`, `
|
|
98929
|
+
let t = [`division: ${e.type}`, `id: ${e.xmlId}`];
|
|
98929
98930
|
return e.title && t.push(`title: ${l5(e.title)}`), e.label && t.push(`label: ${e.label}`), `---\n${t.join("\n")}\n---`;
|
|
98930
98931
|
}
|
|
98931
98932
|
function f5(e) {
|
|
@@ -99170,11 +99171,8 @@ function G5(e) {
|
|
|
99170
99171
|
try {
|
|
99171
99172
|
let t = s8(e), n = t.children.find((e) => e.type === "element"), r = n?.name === "pretext" ? n.children.find((e) => e.type === "element" && W5.has(e.name)) : n && W5.has(n.name) ? n : void 0;
|
|
99172
99173
|
if (!r) return e;
|
|
99173
|
-
|
|
99174
|
-
|
|
99175
|
-
return r.attributes.label = e, gX(t, D8);
|
|
99176
|
-
}
|
|
99177
|
-
return e;
|
|
99174
|
+
let i = r.attributes["xml:id"];
|
|
99175
|
+
return i ||= q5(t, "main"), r.attributes.label ? e : (r.attributes.label = i, gX(t, D8));
|
|
99178
99176
|
} catch (t) {
|
|
99179
99177
|
return console.error("Error ensuring label:", t), e;
|
|
99180
99178
|
}
|
|
@@ -99315,179 +99313,100 @@ var i7 = {
|
|
|
99315
99313
|
function o7(e) {
|
|
99316
99314
|
return `${e}-${Date.now()}`;
|
|
99317
99315
|
}
|
|
99318
|
-
var s7 = ({ open: r, onClose: i, resolveTarget: a, replaceTarget: o,
|
|
99319
|
-
let
|
|
99320
|
-
!s && !c || (N(!0), ie(null), Promise.all([s?.() ?? Promise.resolve(null), c?.() ?? Promise.resolve(null)]).then(([e, t]) => {
|
|
99321
|
-
e !== null && D(e), t !== null && ne(t);
|
|
99322
|
-
}).catch((e) => {
|
|
99323
|
-
ie(e instanceof Error ? e.message : "Failed to load assets.");
|
|
99324
|
-
}).finally(() => N(!1)));
|
|
99325
|
-
}, [
|
|
99326
|
-
s,
|
|
99327
|
-
c,
|
|
99328
|
-
D
|
|
99329
|
-
]), Ke = y(Ge);
|
|
99316
|
+
var s7 = ({ open: r, onClose: i, resolveTarget: a, replaceTarget: o, onUpload: s, onFetchUrl: c, onCreateDoenet: l, onRemoveAsset: u, onDuplicateAsset: d, onAssetAdded: f, onResolveRef: p, onReplaceAsset: h }) => {
|
|
99317
|
+
let g = I6((e) => e.divisions), _ = I6((e) => e.activeDivisionId), v = g?.find((e) => e.xmlId === _)?.sourceFormat ?? "pretext", x = (e, t) => j5(e, t, v), S = I6((e) => e.projectAssets) ?? [], C = I6((e) => e.openAssetEditor), w = I6((e) => e.openAssetResolver), T = I6((e) => e.removeAssetRefFromDocument), [E, D] = b("in-document"), [O, k] = b(null), [A, j] = b("upload"), [ee, te] = b(!1), [ne, M] = b(!1), [N, re] = b(null), ie = y(null), [ae, P] = b(null), [oe, F] = b(null), [se, ce] = b(""), [le, ue] = b(""), [I, de] = b(""), [fe, pe] = b(!1), [me, he] = b(null), [L, ge] = b(""), [_e, ve] = b(""), [ye, be] = b(!1), [xe, Se] = b(null), [R, Ce] = b(null), [we, Te] = b(null), [z, Ee] = b(null);
|
|
99330
99318
|
if (m(() => {
|
|
99331
|
-
Ke.current = Ge;
|
|
99332
|
-
}), m(() => {
|
|
99333
|
-
r && Ke.current();
|
|
99334
|
-
}, [r]), m(() => {
|
|
99335
99319
|
if (!r) return;
|
|
99336
99320
|
let e = (e) => {
|
|
99337
99321
|
e.key === "Escape" && i();
|
|
99338
99322
|
};
|
|
99339
99323
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
99340
99324
|
}, [r, i]), m(() => () => {
|
|
99341
|
-
|
|
99342
|
-
}, [
|
|
99343
|
-
let
|
|
99325
|
+
oe && URL.revokeObjectURL(oe);
|
|
99326
|
+
}, [oe]), !r) return null;
|
|
99327
|
+
let De = n7(g, S), Oe = (e) => {
|
|
99344
99328
|
if (o) {
|
|
99345
|
-
|
|
99329
|
+
h(o, e), i();
|
|
99346
99330
|
return;
|
|
99347
99331
|
}
|
|
99348
|
-
if (
|
|
99349
|
-
e.ref &&
|
|
99332
|
+
if (f(e), a) {
|
|
99333
|
+
e.ref && p(a.kind, a.ref, e.ref), i();
|
|
99350
99334
|
return;
|
|
99351
99335
|
}
|
|
99352
|
-
e.ref && navigator.clipboard.writeText(
|
|
99353
|
-
},
|
|
99336
|
+
e.ref && navigator.clipboard.writeText(x(e.kind, e.ref)).catch(() => {}), Ee(e);
|
|
99337
|
+
}, B = (e, t) => {
|
|
99354
99338
|
let n = `${e}:${t}`;
|
|
99355
|
-
navigator.clipboard.writeText(
|
|
99356
|
-
},
|
|
99357
|
-
|
|
99358
|
-
|
|
99359
|
-
|
|
99360
|
-
|
|
99361
|
-
|
|
99362
|
-
|
|
99363
|
-
}
|
|
99364
|
-
}
|
|
99365
|
-
Je(e, { fromLibrary: !0 });
|
|
99366
|
-
}, Ze = (e) => {
|
|
99367
|
-
ye(null), Se(e), Te(e.name), Ce(URL.createObjectURL(e));
|
|
99368
|
-
}, Qe = () => {
|
|
99369
|
-
Se(null), Ce(null), Te("");
|
|
99370
|
-
}, $e = async () => {
|
|
99371
|
-
if (!(!u || !xe)) {
|
|
99372
|
-
ye(null), _e(!0);
|
|
99339
|
+
navigator.clipboard.writeText(x(e, t)).catch(() => {}), Ce(n), setTimeout(() => Ce((e) => e === n ? null : e), 2e3);
|
|
99340
|
+
}, ke = (e) => {
|
|
99341
|
+
re(null), P(e), ce(e.name), F(URL.createObjectURL(e));
|
|
99342
|
+
}, Ae = () => {
|
|
99343
|
+
P(null), F(null), ce("");
|
|
99344
|
+
}, je = async () => {
|
|
99345
|
+
if (!(!s || !ae)) {
|
|
99346
|
+
re(null), M(!0);
|
|
99373
99347
|
try {
|
|
99374
|
-
|
|
99375
|
-
Je(await u(new File([xe], e, { type: xe.type }))), Qe();
|
|
99348
|
+
Oe(await s(ae, se.trim() || ae.name)), Ae();
|
|
99376
99349
|
} catch (e) {
|
|
99377
|
-
|
|
99350
|
+
re(e instanceof Error ? e.message : "Upload failed.");
|
|
99378
99351
|
} finally {
|
|
99379
|
-
|
|
99352
|
+
M(!1);
|
|
99380
99353
|
}
|
|
99381
99354
|
}
|
|
99382
|
-
},
|
|
99383
|
-
let e =
|
|
99355
|
+
}, Me = async () => {
|
|
99356
|
+
let e = le.trim();
|
|
99384
99357
|
if (!e) return;
|
|
99385
|
-
let t =
|
|
99386
|
-
if (
|
|
99387
|
-
|
|
99358
|
+
let t = I.trim();
|
|
99359
|
+
if (c && s) {
|
|
99360
|
+
he(null), pe(!0);
|
|
99388
99361
|
try {
|
|
99389
|
-
|
|
99390
|
-
Je(await u(t ? new File([n], t, { type: n.type }) : n));
|
|
99362
|
+
Oe(await s(await c(e), t || void 0));
|
|
99391
99363
|
} catch (e) {
|
|
99392
|
-
|
|
99364
|
+
he(e instanceof Error ? e.message : "Failed to add URL.");
|
|
99393
99365
|
} finally {
|
|
99394
|
-
|
|
99366
|
+
pe(!1);
|
|
99395
99367
|
}
|
|
99396
|
-
} else
|
|
99368
|
+
} else Oe({
|
|
99397
99369
|
id: o7("url"),
|
|
99398
99370
|
title: t || e,
|
|
99399
99371
|
ref: e.split("/").pop() ?? "image",
|
|
99400
99372
|
kind: "image",
|
|
99401
99373
|
url: e
|
|
99402
99374
|
});
|
|
99403
|
-
},
|
|
99404
|
-
let e =
|
|
99405
|
-
if (!(!e || !t)) if (
|
|
99406
|
-
|
|
99375
|
+
}, Ne = async () => {
|
|
99376
|
+
let e = L.trim(), t = _e.trim();
|
|
99377
|
+
if (!(!e || !t)) if (l) {
|
|
99378
|
+
Se(null), be(!0);
|
|
99407
99379
|
try {
|
|
99408
|
-
|
|
99380
|
+
Oe(await l(e, t));
|
|
99409
99381
|
} catch (e) {
|
|
99410
|
-
|
|
99382
|
+
Se(e instanceof Error ? e.message : "Failed to create activity.");
|
|
99411
99383
|
} finally {
|
|
99412
|
-
|
|
99384
|
+
be(!1);
|
|
99413
99385
|
}
|
|
99414
|
-
} else
|
|
99386
|
+
} else Oe({
|
|
99415
99387
|
id: o7("doenet"),
|
|
99416
99388
|
title: e,
|
|
99417
99389
|
ref: t,
|
|
99418
99390
|
kind: "doenet"
|
|
99419
99391
|
});
|
|
99420
|
-
},
|
|
99421
|
-
|
|
99422
|
-
return /* @__PURE__ */ n("div", {
|
|
99423
|
-
className: "pretext-plus-editor__am-library",
|
|
99424
|
-
children: [ee && /* @__PURE__ */ n("div", {
|
|
99425
|
-
className: "pretext-plus-editor__am-toolbar",
|
|
99426
|
-
children: [re && /* @__PURE__ */ t("span", {
|
|
99427
|
-
className: "pretext-plus-editor__asset-load-error",
|
|
99428
|
-
children: re
|
|
99429
|
-
}), /* @__PURE__ */ t("button", {
|
|
99430
|
-
type: "button",
|
|
99431
|
-
className: "pretext-plus-editor__asset-library-refresh",
|
|
99432
|
-
onClick: Ge,
|
|
99433
|
-
disabled: M,
|
|
99434
|
-
children: M ? "Loading…" : "Refresh"
|
|
99435
|
-
})]
|
|
99436
|
-
}), M && r.length === 0 ? /* @__PURE__ */ t("p", {
|
|
99437
|
-
className: "pretext-plus-editor__am-empty-text",
|
|
99438
|
-
children: "Loading…"
|
|
99439
|
-
}) : r.length === 0 ? /* @__PURE__ */ n("p", {
|
|
99440
|
-
className: "pretext-plus-editor__am-empty-text",
|
|
99441
|
-
children: [
|
|
99442
|
-
"No ",
|
|
99443
|
-
i7[e].toLowerCase(),
|
|
99444
|
-
" assets in your library."
|
|
99445
|
-
]
|
|
99446
|
-
}) : /* @__PURE__ */ t("ul", {
|
|
99447
|
-
className: "pretext-plus-editor__am-list",
|
|
99448
|
-
children: r.map((e) => {
|
|
99449
|
-
let r = oe.has(e.id), i = pe === e.id;
|
|
99450
|
-
return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ n("button", {
|
|
99451
|
-
type: "button",
|
|
99452
|
-
className: ["pretext-plus-editor__am-lib-row", r ? "pretext-plus-editor__am-lib-row--in-project" : ""].filter(Boolean).join(" "),
|
|
99453
|
-
onClick: () => Xe(e),
|
|
99454
|
-
disabled: i || !e.ref,
|
|
99455
|
-
title: e.ref ? r ? `Use "${e.ref}"` : `Add to project & use "${e.ref}"` : "Asset has no reference — cannot use",
|
|
99456
|
-
children: [/* @__PURE__ */ n("div", {
|
|
99457
|
-
className: "pretext-plus-editor__am-row-info",
|
|
99458
|
-
children: [/* @__PURE__ */ t("span", {
|
|
99459
|
-
className: "pretext-plus-editor__am-row-name",
|
|
99460
|
-
children: e.title
|
|
99461
|
-
}), /* @__PURE__ */ t("span", {
|
|
99462
|
-
className: "pretext-plus-editor__am-row-ref",
|
|
99463
|
-
children: i ? "Adding…" : e.ref
|
|
99464
|
-
})]
|
|
99465
|
-
}), r && /* @__PURE__ */ t("span", {
|
|
99466
|
-
className: "pretext-plus-editor__am-badge",
|
|
99467
|
-
children: "✓"
|
|
99468
|
-
})]
|
|
99469
|
-
}) }, e.id);
|
|
99470
|
-
})
|
|
99471
|
-
})]
|
|
99472
|
-
});
|
|
99473
|
-
}, rt = () => {
|
|
99474
|
-
if (qe.length === 0) return /* @__PURE__ */ n("div", {
|
|
99392
|
+
}, Pe = () => {
|
|
99393
|
+
if (De.length === 0) return /* @__PURE__ */ n("div", {
|
|
99475
99394
|
className: "pretext-plus-editor__am-placeholder",
|
|
99476
99395
|
children: [/* @__PURE__ */ t("p", { children: "No assets in this project yet." }), /* @__PURE__ */ t("button", {
|
|
99477
99396
|
type: "button",
|
|
99478
99397
|
className: "pretext-plus-editor__dialog-button",
|
|
99479
99398
|
onClick: () => {
|
|
99480
|
-
|
|
99399
|
+
D("add"), k(null);
|
|
99481
99400
|
},
|
|
99482
99401
|
children: "Add an asset"
|
|
99483
99402
|
})]
|
|
99484
99403
|
});
|
|
99485
99404
|
let e = a7.map((e) => ({
|
|
99486
99405
|
kind: e,
|
|
99487
|
-
rows:
|
|
99406
|
+
rows: De.filter((t) => t.kind === e)
|
|
99488
99407
|
})).filter((e) => e.rows.length > 0), r = (e) => {
|
|
99489
|
-
let r = `${e.kind}:${e.ref}`, a =
|
|
99490
|
-
e.status === "unlinked" ?
|
|
99408
|
+
let r = `${e.kind}:${e.ref}`, a = we === r, o = () => {
|
|
99409
|
+
e.status === "unlinked" ? w(e.kind, e.ref) : (C(e.kind, e.ref), i());
|
|
99491
99410
|
};
|
|
99492
99411
|
return /* @__PURE__ */ n("li", {
|
|
99493
99412
|
className: "pretext-plus-editor__am-doc-row",
|
|
@@ -99526,31 +99445,31 @@ var s7 = ({ open: r, onClose: i, resolveTarget: a, replaceTarget: o, onLoadAsset
|
|
|
99526
99445
|
}),
|
|
99527
99446
|
/* @__PURE__ */ t("button", {
|
|
99528
99447
|
type: "button",
|
|
99529
|
-
className: `pretext-plus-editor__am-action-btn${
|
|
99530
|
-
onClick: () =>
|
|
99531
|
-
title: `Copy ${
|
|
99532
|
-
children:
|
|
99448
|
+
className: `pretext-plus-editor__am-action-btn${R === r ? " pretext-plus-editor__am-action-btn--done" : ""}`,
|
|
99449
|
+
onClick: () => B(e.kind, e.ref),
|
|
99450
|
+
title: `Copy ${x(e.kind, e.ref)}`,
|
|
99451
|
+
children: R === r ? "Copied!" : "Copy embed code"
|
|
99533
99452
|
}),
|
|
99534
|
-
|
|
99453
|
+
d && e.asset?.url && /* @__PURE__ */ t("button", {
|
|
99535
99454
|
type: "button",
|
|
99536
99455
|
className: "pretext-plus-editor__am-action-btn",
|
|
99537
99456
|
disabled: a,
|
|
99538
99457
|
onClick: async () => {
|
|
99539
|
-
|
|
99458
|
+
Te(r);
|
|
99540
99459
|
try {
|
|
99541
|
-
await
|
|
99460
|
+
await d(e.asset), i();
|
|
99542
99461
|
} catch {
|
|
99543
|
-
|
|
99462
|
+
Te(null);
|
|
99544
99463
|
}
|
|
99545
99464
|
},
|
|
99546
99465
|
title: "Create a copy of this asset under a new reference",
|
|
99547
99466
|
children: a ? "Duplicating…" : "Duplicate"
|
|
99548
99467
|
}),
|
|
99549
|
-
|
|
99468
|
+
u && e.asset && /* @__PURE__ */ t("button", {
|
|
99550
99469
|
type: "button",
|
|
99551
99470
|
className: "pretext-plus-editor__am-action-btn pretext-plus-editor__am-action-btn--danger",
|
|
99552
99471
|
onClick: () => {
|
|
99553
|
-
e.inDocument && !window.confirm(`Remove "${e.asset.title}" from the project? This also deletes its reference(s) from the document.`) || (
|
|
99472
|
+
e.inDocument && !window.confirm(`Remove "${e.asset.title}" from the project? This also deletes its reference(s) from the document.`) || (u(e.asset), T(e.kind, e.ref), i());
|
|
99554
99473
|
},
|
|
99555
99474
|
title: "Remove from project",
|
|
99556
99475
|
children: "Remove"
|
|
@@ -99583,7 +99502,7 @@ var s7 = ({ open: r, onClose: i, resolveTarget: a, replaceTarget: o, onLoadAsset
|
|
|
99583
99502
|
})]
|
|
99584
99503
|
}, e))
|
|
99585
99504
|
});
|
|
99586
|
-
},
|
|
99505
|
+
}, Fe = (e) => /* @__PURE__ */ n("div", {
|
|
99587
99506
|
className: "pretext-plus-editor__am-success",
|
|
99588
99507
|
children: [
|
|
99589
99508
|
/* @__PURE__ */ n("p", {
|
|
@@ -99602,12 +99521,12 @@ var s7 = ({ open: r, onClose: i, resolveTarget: a, replaceTarget: o, onLoadAsset
|
|
|
99602
99521
|
className: "pretext-plus-editor__am-embed-row",
|
|
99603
99522
|
children: [/* @__PURE__ */ t("code", {
|
|
99604
99523
|
className: "pretext-plus-editor__am-embed-code",
|
|
99605
|
-
children:
|
|
99524
|
+
children: x(e.kind, e.ref)
|
|
99606
99525
|
}), /* @__PURE__ */ t("button", {
|
|
99607
99526
|
type: "button",
|
|
99608
|
-
className: `pretext-plus-editor__am-action-btn${
|
|
99609
|
-
onClick: () =>
|
|
99610
|
-
children:
|
|
99527
|
+
className: `pretext-plus-editor__am-action-btn${R === `${e.kind}:${e.ref}` ? " pretext-plus-editor__am-action-btn--done" : ""}`,
|
|
99528
|
+
onClick: () => B(e.kind, e.ref),
|
|
99529
|
+
children: R === `${e.kind}:${e.ref}` ? "Copied!" : "Copy again"
|
|
99611
99530
|
})]
|
|
99612
99531
|
}),
|
|
99613
99532
|
/* @__PURE__ */ n("div", {
|
|
@@ -99616,20 +99535,20 @@ var s7 = ({ open: r, onClose: i, resolveTarget: a, replaceTarget: o, onLoadAsset
|
|
|
99616
99535
|
type: "button",
|
|
99617
99536
|
className: "pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary",
|
|
99618
99537
|
onClick: () => {
|
|
99619
|
-
|
|
99538
|
+
Ee(null), k(null), D("add");
|
|
99620
99539
|
},
|
|
99621
99540
|
children: "Add another"
|
|
99622
99541
|
}), /* @__PURE__ */ t("button", {
|
|
99623
99542
|
type: "button",
|
|
99624
99543
|
className: "pretext-plus-editor__dialog-button",
|
|
99625
99544
|
onClick: () => {
|
|
99626
|
-
|
|
99545
|
+
Ee(null), D("in-document");
|
|
99627
99546
|
},
|
|
99628
99547
|
children: "Done"
|
|
99629
99548
|
})]
|
|
99630
99549
|
})
|
|
99631
99550
|
]
|
|
99632
|
-
}),
|
|
99551
|
+
}), Ie = () => /* @__PURE__ */ n("div", {
|
|
99633
99552
|
className: "pretext-plus-editor__am-kind-picker",
|
|
99634
99553
|
children: [/* @__PURE__ */ t("p", {
|
|
99635
99554
|
className: "pretext-plus-editor__am-kind-picker-label",
|
|
@@ -99641,7 +99560,7 @@ var s7 = ({ open: r, onClose: i, resolveTarget: a, replaceTarget: o, onLoadAsset
|
|
|
99641
99560
|
type: "button",
|
|
99642
99561
|
className: "pretext-plus-editor__am-kind-card",
|
|
99643
99562
|
onClick: () => {
|
|
99644
|
-
|
|
99563
|
+
k("image"), j(s ? "upload" : "url");
|
|
99645
99564
|
},
|
|
99646
99565
|
children: [
|
|
99647
99566
|
/* @__PURE__ */ t("span", {
|
|
@@ -99681,268 +99600,238 @@ var s7 = ({ open: r, onClose: i, resolveTarget: a, replaceTarget: o, onLoadAsset
|
|
|
99681
99600
|
})
|
|
99682
99601
|
]
|
|
99683
99602
|
})]
|
|
99684
|
-
}),
|
|
99603
|
+
}), Le = (e) => /* @__PURE__ */ n("div", {
|
|
99685
99604
|
className: "pretext-plus-editor__am-configure",
|
|
99686
99605
|
children: [
|
|
99687
99606
|
e && /* @__PURE__ */ t("button", {
|
|
99688
99607
|
type: "button",
|
|
99689
99608
|
className: "pretext-plus-editor__am-back-btn",
|
|
99690
|
-
onClick: () =>
|
|
99609
|
+
onClick: () => k(null),
|
|
99691
99610
|
children: "← Back"
|
|
99692
99611
|
}),
|
|
99693
99612
|
/* @__PURE__ */ n("div", {
|
|
99694
99613
|
className: "pretext-plus-editor__dialog-tab-bar pretext-plus-editor__am-sub-tabs",
|
|
99695
|
-
children: [
|
|
99696
|
-
|
|
99697
|
-
|
|
99698
|
-
|
|
99699
|
-
|
|
99700
|
-
|
|
99701
|
-
|
|
99702
|
-
|
|
99703
|
-
|
|
99704
|
-
|
|
99705
|
-
|
|
99706
|
-
children: "Upload"
|
|
99707
|
-
}),
|
|
99708
|
-
/* @__PURE__ */ t("button", {
|
|
99709
|
-
type: "button",
|
|
99710
|
-
className: `pretext-plus-editor__dialog-tab${ue === "url" ? " pretext-plus-editor__dialog-tab--active" : ""}`,
|
|
99711
|
-
onClick: () => I("url"),
|
|
99712
|
-
children: "External URL"
|
|
99713
|
-
})
|
|
99714
|
-
]
|
|
99614
|
+
children: [s && /* @__PURE__ */ t("button", {
|
|
99615
|
+
type: "button",
|
|
99616
|
+
className: `pretext-plus-editor__dialog-tab${A === "upload" ? " pretext-plus-editor__dialog-tab--active" : ""}`,
|
|
99617
|
+
onClick: () => j("upload"),
|
|
99618
|
+
children: "Upload"
|
|
99619
|
+
}), /* @__PURE__ */ t("button", {
|
|
99620
|
+
type: "button",
|
|
99621
|
+
className: `pretext-plus-editor__dialog-tab${A === "url" ? " pretext-plus-editor__dialog-tab--active" : ""}`,
|
|
99622
|
+
onClick: () => j("url"),
|
|
99623
|
+
children: "External URL"
|
|
99624
|
+
})]
|
|
99715
99625
|
}),
|
|
99716
99626
|
/* @__PURE__ */ n("div", {
|
|
99717
99627
|
className: "pretext-plus-editor__am-configure-body",
|
|
99718
|
-
children: [
|
|
99719
|
-
|
|
99720
|
-
|
|
99721
|
-
className: "pretext-plus-editor__am-upload",
|
|
99722
|
-
children: xe ? /* @__PURE__ */ n("div", {
|
|
99723
|
-
className: "pretext-plus-editor__am-url-form",
|
|
99724
|
-
children: [
|
|
99725
|
-
/* @__PURE__ */ t("img", {
|
|
99726
|
-
src: R ?? void 0,
|
|
99727
|
-
alt: "Preview",
|
|
99728
|
-
className: "pretext-plus-editor__am-url-preview"
|
|
99729
|
-
}),
|
|
99730
|
-
/* @__PURE__ */ n("label", {
|
|
99731
|
-
className: "pretext-plus-editor__dialog-label",
|
|
99732
|
-
htmlFor: "am-upload-title",
|
|
99733
|
-
children: ["Title ", /* @__PURE__ */ t("span", {
|
|
99734
|
-
className: "pretext-plus-editor__dialog-helper-copy",
|
|
99735
|
-
children: "(optional)"
|
|
99736
|
-
})]
|
|
99737
|
-
}),
|
|
99738
|
-
/* @__PURE__ */ t("input", {
|
|
99739
|
-
id: "am-upload-title",
|
|
99740
|
-
type: "text",
|
|
99741
|
-
className: "pretext-plus-editor__am-input",
|
|
99742
|
-
placeholder: xe.name,
|
|
99743
|
-
value: we,
|
|
99744
|
-
onChange: (e) => Te(e.target.value),
|
|
99745
|
-
disabled: ge,
|
|
99746
|
-
autoFocus: !0
|
|
99747
|
-
}),
|
|
99748
|
-
ve && /* @__PURE__ */ t("p", {
|
|
99749
|
-
className: "pretext-plus-editor__am-error",
|
|
99750
|
-
children: ve
|
|
99751
|
-
}),
|
|
99752
|
-
/* @__PURE__ */ t("button", {
|
|
99753
|
-
type: "button",
|
|
99754
|
-
className: "pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary",
|
|
99755
|
-
onClick: Qe,
|
|
99756
|
-
disabled: ge,
|
|
99757
|
-
children: "Choose a different file"
|
|
99758
|
-
})
|
|
99759
|
-
]
|
|
99760
|
-
}) : /* @__PURE__ */ n("div", {
|
|
99761
|
-
className: ["pretext-plus-editor__am-drop-zone", he ? "pretext-plus-editor__am-drop-zone--active" : ""].filter(Boolean).join(" "),
|
|
99762
|
-
onDragOver: (e) => {
|
|
99763
|
-
e.preventDefault(), L(!0);
|
|
99764
|
-
},
|
|
99765
|
-
onDragLeave: () => L(!1),
|
|
99766
|
-
onDrop: (e) => {
|
|
99767
|
-
e.preventDefault(), L(!1);
|
|
99768
|
-
let t = e.dataTransfer.files[0];
|
|
99769
|
-
t && Ze(t);
|
|
99770
|
-
},
|
|
99771
|
-
onClick: () => be.current?.click(),
|
|
99772
|
-
role: "button",
|
|
99773
|
-
tabIndex: 0,
|
|
99774
|
-
onKeyDown: (e) => {
|
|
99775
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), be.current?.click());
|
|
99776
|
-
},
|
|
99777
|
-
"aria-label": "Upload image — click or drag and drop",
|
|
99778
|
-
children: [
|
|
99779
|
-
/* @__PURE__ */ t("input", {
|
|
99780
|
-
ref: be,
|
|
99781
|
-
type: "file",
|
|
99782
|
-
accept: "image/*",
|
|
99783
|
-
className: "pretext-plus-editor__dialog-file-input",
|
|
99784
|
-
onChange: (e) => {
|
|
99785
|
-
let t = e.target.files?.[0];
|
|
99786
|
-
t && Ze(t);
|
|
99787
|
-
}
|
|
99788
|
-
}),
|
|
99789
|
-
/* @__PURE__ */ t("span", {
|
|
99790
|
-
className: "pretext-plus-editor__am-drop-icon",
|
|
99791
|
-
"aria-hidden": "true",
|
|
99792
|
-
children: "↑"
|
|
99793
|
-
}),
|
|
99794
|
-
/* @__PURE__ */ t("p", {
|
|
99795
|
-
className: "pretext-plus-editor__am-drop-text",
|
|
99796
|
-
children: "Drag & drop an image, or click to browse"
|
|
99797
|
-
}),
|
|
99798
|
-
/* @__PURE__ */ t("p", {
|
|
99799
|
-
className: "pretext-plus-editor__dialog-helper-copy",
|
|
99800
|
-
children: "PNG, JPEG, GIF, SVG, WebP"
|
|
99801
|
-
})
|
|
99802
|
-
]
|
|
99803
|
-
})
|
|
99804
|
-
}),
|
|
99805
|
-
ue === "url" && /* @__PURE__ */ n("div", {
|
|
99628
|
+
children: [A === "upload" && s && /* @__PURE__ */ t("div", {
|
|
99629
|
+
className: "pretext-plus-editor__am-upload",
|
|
99630
|
+
children: ae ? /* @__PURE__ */ n("div", {
|
|
99806
99631
|
className: "pretext-plus-editor__am-url-form",
|
|
99807
99632
|
children: [
|
|
99808
|
-
/* @__PURE__ */ t("
|
|
99809
|
-
|
|
99810
|
-
|
|
99811
|
-
|
|
99812
|
-
}),
|
|
99813
|
-
/* @__PURE__ */ t("input", {
|
|
99814
|
-
id: "am-url-value",
|
|
99815
|
-
type: "url",
|
|
99816
|
-
className: "pretext-plus-editor__am-input",
|
|
99817
|
-
placeholder: "https://example.com/image.png",
|
|
99818
|
-
value: z,
|
|
99819
|
-
onChange: (e) => Ee(e.target.value),
|
|
99820
|
-
disabled: B,
|
|
99821
|
-
autoFocus: !0
|
|
99633
|
+
/* @__PURE__ */ t("img", {
|
|
99634
|
+
src: oe ?? void 0,
|
|
99635
|
+
alt: "Preview",
|
|
99636
|
+
className: "pretext-plus-editor__am-url-preview"
|
|
99822
99637
|
}),
|
|
99823
99638
|
/* @__PURE__ */ n("label", {
|
|
99824
99639
|
className: "pretext-plus-editor__dialog-label",
|
|
99825
|
-
htmlFor: "am-
|
|
99640
|
+
htmlFor: "am-upload-title",
|
|
99826
99641
|
children: ["Title ", /* @__PURE__ */ t("span", {
|
|
99827
99642
|
className: "pretext-plus-editor__dialog-helper-copy",
|
|
99828
99643
|
children: "(optional)"
|
|
99829
99644
|
})]
|
|
99830
99645
|
}),
|
|
99831
99646
|
/* @__PURE__ */ t("input", {
|
|
99832
|
-
id: "am-
|
|
99647
|
+
id: "am-upload-title",
|
|
99833
99648
|
type: "text",
|
|
99834
99649
|
className: "pretext-plus-editor__am-input",
|
|
99835
|
-
placeholder:
|
|
99836
|
-
value:
|
|
99837
|
-
onChange: (e) =>
|
|
99838
|
-
disabled:
|
|
99650
|
+
placeholder: ae.name,
|
|
99651
|
+
value: se,
|
|
99652
|
+
onChange: (e) => ce(e.target.value),
|
|
99653
|
+
disabled: ne,
|
|
99654
|
+
autoFocus: !0
|
|
99839
99655
|
}),
|
|
99840
|
-
|
|
99656
|
+
N && /* @__PURE__ */ t("p", {
|
|
99841
99657
|
className: "pretext-plus-editor__am-error",
|
|
99842
|
-
children:
|
|
99658
|
+
children: N
|
|
99843
99659
|
}),
|
|
99844
|
-
|
|
99845
|
-
|
|
99846
|
-
|
|
99847
|
-
|
|
99848
|
-
|
|
99849
|
-
|
|
99660
|
+
/* @__PURE__ */ t("button", {
|
|
99661
|
+
type: "button",
|
|
99662
|
+
className: "pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary",
|
|
99663
|
+
onClick: Ae,
|
|
99664
|
+
disabled: ne,
|
|
99665
|
+
children: "Choose a different file"
|
|
99666
|
+
})
|
|
99667
|
+
]
|
|
99668
|
+
}) : /* @__PURE__ */ n("div", {
|
|
99669
|
+
className: ["pretext-plus-editor__am-drop-zone", ee ? "pretext-plus-editor__am-drop-zone--active" : ""].filter(Boolean).join(" "),
|
|
99670
|
+
onDragOver: (e) => {
|
|
99671
|
+
e.preventDefault(), te(!0);
|
|
99672
|
+
},
|
|
99673
|
+
onDragLeave: () => te(!1),
|
|
99674
|
+
onDrop: (e) => {
|
|
99675
|
+
e.preventDefault(), te(!1);
|
|
99676
|
+
let t = e.dataTransfer.files[0];
|
|
99677
|
+
t && ke(t);
|
|
99678
|
+
},
|
|
99679
|
+
onClick: () => ie.current?.click(),
|
|
99680
|
+
role: "button",
|
|
99681
|
+
tabIndex: 0,
|
|
99682
|
+
onKeyDown: (e) => {
|
|
99683
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), ie.current?.click());
|
|
99684
|
+
},
|
|
99685
|
+
"aria-label": "Upload image — click or drag and drop",
|
|
99686
|
+
children: [
|
|
99687
|
+
/* @__PURE__ */ t("input", {
|
|
99688
|
+
ref: ie,
|
|
99689
|
+
type: "file",
|
|
99690
|
+
accept: "image/*",
|
|
99691
|
+
className: "pretext-plus-editor__dialog-file-input",
|
|
99692
|
+
onChange: (e) => {
|
|
99693
|
+
let t = e.target.files?.[0];
|
|
99694
|
+
t && ke(t);
|
|
99850
99695
|
}
|
|
99696
|
+
}),
|
|
99697
|
+
/* @__PURE__ */ t("span", {
|
|
99698
|
+
className: "pretext-plus-editor__am-drop-icon",
|
|
99699
|
+
"aria-hidden": "true",
|
|
99700
|
+
children: "↑"
|
|
99701
|
+
}),
|
|
99702
|
+
/* @__PURE__ */ t("p", {
|
|
99703
|
+
className: "pretext-plus-editor__am-drop-text",
|
|
99704
|
+
children: "Drag & drop an image, or click to browse"
|
|
99705
|
+
}),
|
|
99706
|
+
/* @__PURE__ */ t("p", {
|
|
99707
|
+
className: "pretext-plus-editor__dialog-helper-copy",
|
|
99708
|
+
children: "PNG, JPEG, GIF, SVG, WebP"
|
|
99851
99709
|
})
|
|
99852
99710
|
]
|
|
99853
99711
|
})
|
|
99854
|
-
|
|
99855
|
-
|
|
99856
|
-
]
|
|
99857
|
-
}), st = () => /* @__PURE__ */ t("button", {
|
|
99858
|
-
type: "button",
|
|
99859
|
-
className: "pretext-plus-editor__dialog-button",
|
|
99860
|
-
onClick: et,
|
|
99861
|
-
disabled: !z.trim() || B,
|
|
99862
|
-
children: B ? "Adding…" : f && u ? "Add to Project" : "Add"
|
|
99863
|
-
}), ct = () => /* @__PURE__ */ t("button", {
|
|
99864
|
-
type: "button",
|
|
99865
|
-
className: "pretext-plus-editor__dialog-button",
|
|
99866
|
-
onClick: $e,
|
|
99867
|
-
disabled: !xe || ge,
|
|
99868
|
-
children: ge ? "Uploading…" : "Add to Project"
|
|
99869
|
-
}), lt = (e) => /* @__PURE__ */ n("div", {
|
|
99870
|
-
className: "pretext-plus-editor__am-configure",
|
|
99871
|
-
children: [
|
|
99872
|
-
e && /* @__PURE__ */ t("button", {
|
|
99873
|
-
type: "button",
|
|
99874
|
-
className: "pretext-plus-editor__am-back-btn",
|
|
99875
|
-
onClick: () => le(null),
|
|
99876
|
-
children: "← Back"
|
|
99877
|
-
}),
|
|
99878
|
-
/* @__PURE__ */ n("div", {
|
|
99879
|
-
className: "pretext-plus-editor__dialog-tab-bar pretext-plus-editor__am-sub-tabs",
|
|
99880
|
-
children: [/* @__PURE__ */ t("button", {
|
|
99881
|
-
type: "button",
|
|
99882
|
-
className: `pretext-plus-editor__dialog-tab${de === "library" ? " pretext-plus-editor__dialog-tab--active" : ""}`,
|
|
99883
|
-
onClick: () => fe("library"),
|
|
99884
|
-
children: "Library"
|
|
99885
|
-
}), /* @__PURE__ */ t("button", {
|
|
99886
|
-
type: "button",
|
|
99887
|
-
className: `pretext-plus-editor__dialog-tab${de === "create" ? " pretext-plus-editor__dialog-tab--active" : ""}`,
|
|
99888
|
-
onClick: () => fe("create"),
|
|
99889
|
-
children: "Create New"
|
|
99890
|
-
})]
|
|
99891
|
-
}),
|
|
99892
|
-
/* @__PURE__ */ n("div", {
|
|
99893
|
-
className: "pretext-plus-editor__am-configure-body",
|
|
99894
|
-
children: [de === "library" && nt("doenet"), de === "create" && /* @__PURE__ */ n("div", {
|
|
99895
|
-
className: "pretext-plus-editor__am-create-form",
|
|
99712
|
+
}), A === "url" && /* @__PURE__ */ n("div", {
|
|
99713
|
+
className: "pretext-plus-editor__am-url-form",
|
|
99896
99714
|
children: [
|
|
99897
99715
|
/* @__PURE__ */ t("label", {
|
|
99898
99716
|
className: "pretext-plus-editor__dialog-label",
|
|
99899
|
-
htmlFor: "am-
|
|
99900
|
-
children: "
|
|
99717
|
+
htmlFor: "am-url-value",
|
|
99718
|
+
children: "Image URL"
|
|
99901
99719
|
}),
|
|
99902
99720
|
/* @__PURE__ */ t("input", {
|
|
99903
|
-
id: "am-
|
|
99904
|
-
type: "
|
|
99721
|
+
id: "am-url-value",
|
|
99722
|
+
type: "url",
|
|
99905
99723
|
className: "pretext-plus-editor__am-input",
|
|
99906
|
-
placeholder: "
|
|
99907
|
-
value:
|
|
99908
|
-
onChange: (e) =>
|
|
99909
|
-
disabled:
|
|
99724
|
+
placeholder: "https://example.com/image.png",
|
|
99725
|
+
value: le,
|
|
99726
|
+
onChange: (e) => ue(e.target.value),
|
|
99727
|
+
disabled: fe,
|
|
99910
99728
|
autoFocus: !0
|
|
99911
99729
|
}),
|
|
99912
|
-
/* @__PURE__ */
|
|
99730
|
+
/* @__PURE__ */ n("label", {
|
|
99913
99731
|
className: "pretext-plus-editor__dialog-label",
|
|
99914
|
-
htmlFor: "am-
|
|
99915
|
-
children: "
|
|
99732
|
+
htmlFor: "am-url-title",
|
|
99733
|
+
children: ["Title ", /* @__PURE__ */ t("span", {
|
|
99734
|
+
className: "pretext-plus-editor__dialog-helper-copy",
|
|
99735
|
+
children: "(optional)"
|
|
99736
|
+
})]
|
|
99916
99737
|
}),
|
|
99917
99738
|
/* @__PURE__ */ t("input", {
|
|
99918
|
-
id: "am-
|
|
99739
|
+
id: "am-url-title",
|
|
99919
99740
|
type: "text",
|
|
99920
99741
|
className: "pretext-plus-editor__am-input",
|
|
99921
|
-
placeholder: "
|
|
99922
|
-
value:
|
|
99923
|
-
onChange: (e) =>
|
|
99924
|
-
disabled:
|
|
99925
|
-
}),
|
|
99926
|
-
/* @__PURE__ */ n("p", {
|
|
99927
|
-
className: "pretext-plus-editor__dialog-helper-copy",
|
|
99928
|
-
children: ["The id is used in the embed code: ", /* @__PURE__ */ t("code", { children: T("doenet", Pe || "my-activity") })]
|
|
99742
|
+
placeholder: "My image",
|
|
99743
|
+
value: I,
|
|
99744
|
+
onChange: (e) => de(e.target.value),
|
|
99745
|
+
disabled: fe
|
|
99929
99746
|
}),
|
|
99930
|
-
|
|
99747
|
+
me && /* @__PURE__ */ t("p", {
|
|
99931
99748
|
className: "pretext-plus-editor__am-error",
|
|
99932
|
-
children:
|
|
99749
|
+
children: me
|
|
99933
99750
|
}),
|
|
99934
|
-
/* @__PURE__ */ t("
|
|
99935
|
-
|
|
99936
|
-
|
|
99937
|
-
|
|
99938
|
-
|
|
99939
|
-
|
|
99751
|
+
le.trim() && /* @__PURE__ */ t("img", {
|
|
99752
|
+
src: le.trim(),
|
|
99753
|
+
alt: "Preview",
|
|
99754
|
+
className: "pretext-plus-editor__am-url-preview",
|
|
99755
|
+
onError: (e) => {
|
|
99756
|
+
e.currentTarget.style.display = "none";
|
|
99757
|
+
}
|
|
99940
99758
|
})
|
|
99941
99759
|
]
|
|
99942
99760
|
})]
|
|
99943
99761
|
})
|
|
99944
99762
|
]
|
|
99945
|
-
}),
|
|
99763
|
+
}), Re = () => /* @__PURE__ */ t("button", {
|
|
99764
|
+
type: "button",
|
|
99765
|
+
className: "pretext-plus-editor__dialog-button",
|
|
99766
|
+
onClick: Me,
|
|
99767
|
+
disabled: !le.trim() || fe,
|
|
99768
|
+
children: fe ? "Adding…" : c && s ? "Add to Project" : "Add"
|
|
99769
|
+
}), ze = () => /* @__PURE__ */ t("button", {
|
|
99770
|
+
type: "button",
|
|
99771
|
+
className: "pretext-plus-editor__dialog-button",
|
|
99772
|
+
onClick: je,
|
|
99773
|
+
disabled: !ae || ne,
|
|
99774
|
+
children: ne ? "Uploading…" : "Add to Project"
|
|
99775
|
+
}), Be = (e) => /* @__PURE__ */ n("div", {
|
|
99776
|
+
className: "pretext-plus-editor__am-configure",
|
|
99777
|
+
children: [e && /* @__PURE__ */ t("button", {
|
|
99778
|
+
type: "button",
|
|
99779
|
+
className: "pretext-plus-editor__am-back-btn",
|
|
99780
|
+
onClick: () => k(null),
|
|
99781
|
+
children: "← Back"
|
|
99782
|
+
}), /* @__PURE__ */ t("div", {
|
|
99783
|
+
className: "pretext-plus-editor__am-configure-body",
|
|
99784
|
+
children: /* @__PURE__ */ n("div", {
|
|
99785
|
+
className: "pretext-plus-editor__am-create-form",
|
|
99786
|
+
children: [
|
|
99787
|
+
/* @__PURE__ */ t("label", {
|
|
99788
|
+
className: "pretext-plus-editor__dialog-label",
|
|
99789
|
+
htmlFor: "am-doenet-title",
|
|
99790
|
+
children: "Title"
|
|
99791
|
+
}),
|
|
99792
|
+
/* @__PURE__ */ t("input", {
|
|
99793
|
+
id: "am-doenet-title",
|
|
99794
|
+
type: "text",
|
|
99795
|
+
className: "pretext-plus-editor__am-input",
|
|
99796
|
+
placeholder: "My Activity",
|
|
99797
|
+
value: L,
|
|
99798
|
+
onChange: (e) => ge(e.target.value),
|
|
99799
|
+
disabled: ye,
|
|
99800
|
+
autoFocus: !0
|
|
99801
|
+
}),
|
|
99802
|
+
/* @__PURE__ */ t("label", {
|
|
99803
|
+
className: "pretext-plus-editor__dialog-label",
|
|
99804
|
+
htmlFor: "am-doenet-ref",
|
|
99805
|
+
children: "Id"
|
|
99806
|
+
}),
|
|
99807
|
+
/* @__PURE__ */ t("input", {
|
|
99808
|
+
id: "am-doenet-ref",
|
|
99809
|
+
type: "text",
|
|
99810
|
+
className: "pretext-plus-editor__am-input",
|
|
99811
|
+
placeholder: "my-activity",
|
|
99812
|
+
value: _e,
|
|
99813
|
+
onChange: (e) => ve(e.target.value),
|
|
99814
|
+
disabled: ye
|
|
99815
|
+
}),
|
|
99816
|
+
/* @__PURE__ */ n("p", {
|
|
99817
|
+
className: "pretext-plus-editor__dialog-helper-copy",
|
|
99818
|
+
children: ["The id is used in the embed code: ", /* @__PURE__ */ t("code", { children: x("doenet", _e || "my-activity") })]
|
|
99819
|
+
}),
|
|
99820
|
+
xe && /* @__PURE__ */ t("p", {
|
|
99821
|
+
className: "pretext-plus-editor__am-error",
|
|
99822
|
+
children: xe
|
|
99823
|
+
}),
|
|
99824
|
+
/* @__PURE__ */ t("button", {
|
|
99825
|
+
type: "button",
|
|
99826
|
+
className: "pretext-plus-editor__dialog-button",
|
|
99827
|
+
onClick: Ne,
|
|
99828
|
+
disabled: !L.trim() || !_e.trim() || ye,
|
|
99829
|
+
children: ye ? "Creating…" : l ? "Create" : "Add"
|
|
99830
|
+
})
|
|
99831
|
+
]
|
|
99832
|
+
})
|
|
99833
|
+
})]
|
|
99834
|
+
}), Ve = (r, a, o) => /* @__PURE__ */ n(e, { children: [
|
|
99946
99835
|
/* @__PURE__ */ n("div", {
|
|
99947
99836
|
className: "pretext-plus-editor__dialog-header",
|
|
99948
99837
|
children: [/* @__PURE__ */ t("h2", {
|
|
@@ -99961,7 +99850,7 @@ var s7 = ({ open: r, onClose: i, resolveTarget: a, replaceTarget: o, onLoadAsset
|
|
|
99961
99850
|
children: [/* @__PURE__ */ t("p", {
|
|
99962
99851
|
className: "pretext-plus-editor__dialog-helper-copy pretext-plus-editor__am-resolve-hint",
|
|
99963
99852
|
children: o
|
|
99964
|
-
}), r === "doenet" ?
|
|
99853
|
+
}), r === "doenet" ? Be(!1) : Le(!1)]
|
|
99965
99854
|
}),
|
|
99966
99855
|
/* @__PURE__ */ n("div", {
|
|
99967
99856
|
className: "pretext-plus-editor__dialog-actions",
|
|
@@ -99972,8 +99861,8 @@ var s7 = ({ open: r, onClose: i, resolveTarget: a, replaceTarget: o, onLoadAsset
|
|
|
99972
99861
|
onClick: i,
|
|
99973
99862
|
children: "Cancel"
|
|
99974
99863
|
}),
|
|
99975
|
-
r === "image" &&
|
|
99976
|
-
r === "image" &&
|
|
99864
|
+
r === "image" && A === "url" && Re(),
|
|
99865
|
+
r === "image" && A === "upload" && s && ze()
|
|
99977
99866
|
]
|
|
99978
99867
|
})
|
|
99979
99868
|
] });
|
|
@@ -99985,11 +99874,11 @@ var s7 = ({ open: r, onClose: i, resolveTarget: a, replaceTarget: o, onLoadAsset
|
|
|
99985
99874
|
role: "dialog",
|
|
99986
99875
|
"aria-modal": "true",
|
|
99987
99876
|
"aria-label": "Asset manager",
|
|
99988
|
-
children: a ? ((r) =>
|
|
99877
|
+
children: a ? ((r) => Ve(r.kind, "Link asset", /* @__PURE__ */ n(e, { children: [
|
|
99989
99878
|
"The reference ",
|
|
99990
99879
|
/* @__PURE__ */ t("code", { children: r.ref }),
|
|
99991
99880
|
" has no asset yet. Choose or create one — the reference in your document will be updated to match."
|
|
99992
|
-
] })))(a) : o ? ((r) =>
|
|
99881
|
+
] })))(a) : o ? ((r) => Ve(r.kind, "Replace asset", /* @__PURE__ */ n(e, { children: [
|
|
99993
99882
|
"Choose or upload a new asset to replace ",
|
|
99994
99883
|
/* @__PURE__ */ t("code", { children: r.title }),
|
|
99995
99884
|
". Every place it’s used in your document will show the new asset."
|
|
@@ -100007,30 +99896,30 @@ var s7 = ({ open: r, onClose: i, resolveTarget: a, replaceTarget: o, onLoadAsset
|
|
|
100007
99896
|
children: "✕"
|
|
100008
99897
|
})]
|
|
100009
99898
|
}),
|
|
100010
|
-
|
|
99899
|
+
z ? /* @__PURE__ */ t("div", {
|
|
100011
99900
|
className: "pretext-plus-editor__dialog-content pretext-plus-editor__dialog-content--single",
|
|
100012
|
-
children:
|
|
99901
|
+
children: Fe(z)
|
|
100013
99902
|
}) : /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ n("div", {
|
|
100014
99903
|
className: "pretext-plus-editor__dialog-tab-bar",
|
|
100015
99904
|
children: [/* @__PURE__ */ n("button", {
|
|
100016
99905
|
type: "button",
|
|
100017
|
-
className: `pretext-plus-editor__dialog-tab${
|
|
100018
|
-
onClick: () =>
|
|
100019
|
-
children: ["Assets",
|
|
99906
|
+
className: `pretext-plus-editor__dialog-tab${E === "in-document" ? " pretext-plus-editor__dialog-tab--active" : ""}`,
|
|
99907
|
+
onClick: () => D("in-document"),
|
|
99908
|
+
children: ["Assets", De.length > 0 && /* @__PURE__ */ t("span", {
|
|
100020
99909
|
className: "pretext-plus-editor__asset-tab-count",
|
|
100021
|
-
children:
|
|
99910
|
+
children: De.length
|
|
100022
99911
|
})]
|
|
100023
99912
|
}), /* @__PURE__ */ t("button", {
|
|
100024
99913
|
type: "button",
|
|
100025
|
-
className: `pretext-plus-editor__dialog-tab${
|
|
99914
|
+
className: `pretext-plus-editor__dialog-tab${E === "add" ? " pretext-plus-editor__dialog-tab--active" : ""}`,
|
|
100026
99915
|
onClick: () => {
|
|
100027
|
-
|
|
99916
|
+
D("add"), k(null);
|
|
100028
99917
|
},
|
|
100029
99918
|
children: "Add Asset"
|
|
100030
99919
|
})]
|
|
100031
99920
|
}), /* @__PURE__ */ t("div", {
|
|
100032
99921
|
className: "pretext-plus-editor__dialog-content pretext-plus-editor__dialog-content--single",
|
|
100033
|
-
children:
|
|
99922
|
+
children: E === "in-document" ? Pe() : O === null ? Ie() : O === "image" ? Le(!0) : Be(!0)
|
|
100034
99923
|
})] }),
|
|
100035
99924
|
/* @__PURE__ */ n("div", {
|
|
100036
99925
|
className: "pretext-plus-editor__dialog-actions",
|
|
@@ -100041,8 +99930,8 @@ var s7 = ({ open: r, onClose: i, resolveTarget: a, replaceTarget: o, onLoadAsset
|
|
|
100041
99930
|
onClick: i,
|
|
100042
99931
|
children: "Close"
|
|
100043
99932
|
}),
|
|
100044
|
-
!
|
|
100045
|
-
!
|
|
99933
|
+
!z && E === "add" && O === "image" && A === "url" && Re(),
|
|
99934
|
+
!z && E === "add" && O === "image" && A === "upload" && s && ze()
|
|
100046
99935
|
]
|
|
100047
99936
|
})
|
|
100048
99937
|
] })
|
|
@@ -100640,83 +100529,83 @@ var S7 = ({ draft: e, isNew: r = !1, isRoot: i = !1, parentType: a = null, onDra
|
|
|
100640
100529
|
onCancel: f
|
|
100641
100530
|
})]
|
|
100642
100531
|
});
|
|
100643
|
-
}, T7 = ({ onOpenAssetPicker: r }) => {
|
|
100644
|
-
let
|
|
100532
|
+
}, T7 = ({ onOpenAssetPicker: r, hideAssets: i }) => {
|
|
100533
|
+
let o = I6((e) => e.divisions), s = I6((e) => e.rootDivisionId), c = I6((e) => e.activeDivisionId), l = I6((e) => e.projectAssets) ?? [], u = I6((e) => e.selectSection), d = I6((e) => e.addSection), f = I6((e) => e.removeSection), p = I6((e) => e.divisionContentChange), m = I6((e) => e.insertAtCursor), h = I6((e) => e.openAssetEditor), g = I6((e) => e.openAssetResolver), _ = I6((e) => e.removeAsset), v = I6((e) => e.removeAssetRefFromDocument), y = I6((e) => e.duplicateAsset), x = I6((e) => e.hasAssetDuplicate), S = I6((e) => e.startSectionEdit), C = I6((e) => e.setEditDraft), w = I6((e) => e.commitSectionEdit), T = I6((e) => e.cancelSectionEdit), E = I6((e) => e.editingId), D = I6((e) => e.editDraft), O = I6((e) => e.editingIsNew), k = o ? o.find((e) => e.xmlId === s) ?? o.find((e) => e.type === "book" || e.type === "article" || e.type === "slideshow") ?? o[0] ?? null : null, A = k && o ? H5(o, k.xmlId) : [], j = k && o ? U5(o, k.xmlId) : [], ee = n7(o, l), te = a7.map((e) => ({
|
|
100645
100534
|
kind: e,
|
|
100646
|
-
rows:
|
|
100647
|
-
})).filter((e) => e.rows.length > 0), [
|
|
100648
|
-
if (!(!e.asset ||
|
|
100649
|
-
|
|
100535
|
+
rows: ee.filter((t) => t.kind === e)
|
|
100536
|
+
})).filter((e) => e.rows.length > 0), [ne, M] = b(!1), [N, re] = b(null), ie = async (e) => {
|
|
100537
|
+
if (!(!e.asset || N)) {
|
|
100538
|
+
re(e.ref);
|
|
100650
100539
|
try {
|
|
100651
|
-
await
|
|
100540
|
+
await y(e.asset);
|
|
100652
100541
|
} finally {
|
|
100653
|
-
|
|
100542
|
+
re(null);
|
|
100654
100543
|
}
|
|
100655
100544
|
}
|
|
100656
|
-
}, [
|
|
100657
|
-
|
|
100545
|
+
}, [ae, P] = b(/* @__PURE__ */ new Set()), oe = (e) => !ae.has(e), F = (e) => {
|
|
100546
|
+
P((t) => {
|
|
100658
100547
|
let n = new Set(t);
|
|
100659
100548
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
100660
100549
|
});
|
|
100661
|
-
}, [
|
|
100662
|
-
if (
|
|
100663
|
-
let e = new Map(
|
|
100664
|
-
t.add(
|
|
100665
|
-
let n =
|
|
100550
|
+
}, [se, ce] = b(c);
|
|
100551
|
+
if (c !== se && (ce(c), c && k)) {
|
|
100552
|
+
let e = new Map(A.map((e) => [e.division.xmlId, e])), t = /* @__PURE__ */ new Set();
|
|
100553
|
+
t.add(k.xmlId);
|
|
100554
|
+
let n = c;
|
|
100666
100555
|
for (; n;) {
|
|
100667
100556
|
let r = e.get(n);
|
|
100668
100557
|
if (!r?.parentXmlId) break;
|
|
100669
100558
|
t.add(r.parentXmlId), n = r.parentXmlId;
|
|
100670
100559
|
}
|
|
100671
|
-
|
|
100560
|
+
P((e) => {
|
|
100672
100561
|
if ([...t].every((t) => !e.has(t))) return e;
|
|
100673
100562
|
let n = new Set(e);
|
|
100674
100563
|
return t.forEach((e) => n.delete(e)), n;
|
|
100675
100564
|
});
|
|
100676
100565
|
}
|
|
100677
|
-
let
|
|
100678
|
-
if (
|
|
100566
|
+
let le = new Set(A.map((e) => e.parentXmlId).filter(Boolean)), ue = [];
|
|
100567
|
+
if (k) {
|
|
100679
100568
|
let e = /* @__PURE__ */ new Set();
|
|
100680
|
-
|
|
100681
|
-
for (let t of
|
|
100682
|
-
}
|
|
100683
|
-
let
|
|
100684
|
-
if (!
|
|
100685
|
-
let n =
|
|
100686
|
-
n &&
|
|
100687
|
-
},
|
|
100569
|
+
oe(k.xmlId) && e.add(k.xmlId);
|
|
100570
|
+
for (let t of A) t.parentXmlId && e.has(t.parentXmlId) && (ue.push(t), oe(t.division.xmlId) && e.add(t.division.xmlId));
|
|
100571
|
+
}
|
|
100572
|
+
let I = (e, t) => {
|
|
100573
|
+
if (!o) return;
|
|
100574
|
+
let n = o.find((e) => e.xmlId === t);
|
|
100575
|
+
n && p(n.xmlId, F5(n.source, e));
|
|
100576
|
+
}, de = (e, t) => {
|
|
100688
100577
|
if (window.confirm(`Delete "${e.title || "Untitled"}"? This permanently removes the division.`)) {
|
|
100689
|
-
if (t &&
|
|
100690
|
-
let n =
|
|
100691
|
-
n &&
|
|
100692
|
-
}
|
|
100693
|
-
|
|
100694
|
-
}
|
|
100695
|
-
},
|
|
100696
|
-
|
|
100697
|
-
},
|
|
100698
|
-
|
|
100699
|
-
},
|
|
100700
|
-
navigator.clipboard.writeText(j5(e, t,
|
|
100701
|
-
},
|
|
100578
|
+
if (t && o) {
|
|
100579
|
+
let n = o.find((e) => e.xmlId === t);
|
|
100580
|
+
n && p(n.xmlId, F5(n.source, e.xmlId));
|
|
100581
|
+
}
|
|
100582
|
+
f(e.xmlId);
|
|
100583
|
+
}
|
|
100584
|
+
}, fe = o?.find((e) => e.xmlId === c)?.sourceFormat ?? "pretext", pe = (e) => {
|
|
100585
|
+
m(fe === "markdown" ? `::${e.type}{ref="${e.xmlId}"}` : fe === "latex" ? `\\plus{${e.type}}{${e.xmlId}}` : `<plus:${e.type} ref="${e.xmlId}"/>`);
|
|
100586
|
+
}, me = (e) => {
|
|
100587
|
+
k && p(k.xmlId, P5(k.source, e.xmlId, e.type, null, k.sourceFormat));
|
|
100588
|
+
}, he = (e) => e && o?.find((t) => t.xmlId === e)?.type || null, L = (e) => e.status === "unlinked" ? g(e.kind, e.ref) : h(e.kind, e.ref), ge = (e, t) => {
|
|
100589
|
+
navigator.clipboard.writeText(j5(e, t, fe)).catch(() => {});
|
|
100590
|
+
}, _e = (e) => {
|
|
100702
100591
|
let t = [{
|
|
100703
100592
|
label: e.status === "unlinked" ? "Link / create asset" : "Edit asset",
|
|
100704
|
-
onClick: () =>
|
|
100593
|
+
onClick: () => L(e)
|
|
100705
100594
|
}, {
|
|
100706
100595
|
label: "Copy embed code",
|
|
100707
|
-
onClick: () =>
|
|
100596
|
+
onClick: () => ge(e.kind, e.ref)
|
|
100708
100597
|
}];
|
|
100709
|
-
return
|
|
100598
|
+
return x && e.asset && t.push({
|
|
100710
100599
|
label: "Duplicate asset",
|
|
100711
|
-
onClick: () =>
|
|
100600
|
+
onClick: () => ie(e)
|
|
100712
100601
|
}), e.status === "unlinked" ? t.push({
|
|
100713
100602
|
label: "Remove from document",
|
|
100714
|
-
onClick: () =>
|
|
100603
|
+
onClick: () => v(e.kind, e.ref),
|
|
100715
100604
|
danger: !0
|
|
100716
100605
|
}) : e.asset && t.push({
|
|
100717
100606
|
label: "Remove from project",
|
|
100718
100607
|
onClick: () => {
|
|
100719
|
-
e.inDocument && !window.confirm(`Remove "${e.asset.title}" from the project? This also deletes its ${e.inDocument ? "reference(s)" : "reference"} from the document.`) || (
|
|
100608
|
+
e.inDocument && !window.confirm(`Remove "${e.asset.title}" from the project? This also deletes its ${e.inDocument ? "reference(s)" : "reference"} from the document.`) || (_(e.asset), v(e.kind, e.ref));
|
|
100720
100609
|
},
|
|
100721
100610
|
danger: !0
|
|
100722
100611
|
}), t;
|
|
@@ -100726,165 +100615,165 @@ var S7 = ({ draft: e, isNew: r = !1, isRoot: i = !1, parentType: a = null, onDra
|
|
|
100726
100615
|
className: "pretext-plus-editor__toc-list",
|
|
100727
100616
|
role: "list",
|
|
100728
100617
|
children: [
|
|
100729
|
-
|
|
100730
|
-
division:
|
|
100618
|
+
k && /* @__PURE__ */ t(w7, {
|
|
100619
|
+
division: k,
|
|
100731
100620
|
depth: 0,
|
|
100732
|
-
isActive:
|
|
100733
|
-
hasChildren:
|
|
100734
|
-
isExpanded:
|
|
100735
|
-
onToggleExpand: () =>
|
|
100736
|
-
editDraft:
|
|
100737
|
-
onSelect: () =>
|
|
100738
|
-
onDraftChange:
|
|
100739
|
-
onEditCommit:
|
|
100740
|
-
onEditCancel:
|
|
100621
|
+
isActive: c === k.xmlId,
|
|
100622
|
+
hasChildren: le.has(k.xmlId),
|
|
100623
|
+
isExpanded: oe(k.xmlId),
|
|
100624
|
+
onToggleExpand: () => F(k.xmlId),
|
|
100625
|
+
editDraft: E === k.xmlId ? D : null,
|
|
100626
|
+
onSelect: () => u(k.xmlId),
|
|
100627
|
+
onDraftChange: C,
|
|
100628
|
+
onEditCommit: w,
|
|
100629
|
+
onEditCancel: T,
|
|
100741
100630
|
menuItems: [{
|
|
100742
100631
|
label: "Edit properties",
|
|
100743
|
-
onClick: () =>
|
|
100744
|
-
}, ...g5(
|
|
100632
|
+
onClick: () => S(k)
|
|
100633
|
+
}, ...g5(k.sourceFormat) ? [{
|
|
100745
100634
|
label: "Add new division",
|
|
100746
|
-
onClick: () =>
|
|
100635
|
+
onClick: () => d(k.xmlId)
|
|
100747
100636
|
}] : []],
|
|
100748
|
-
isNew:
|
|
100637
|
+
isNew: E === k.xmlId && O,
|
|
100749
100638
|
isRoot: !0
|
|
100750
100639
|
}),
|
|
100751
|
-
|
|
100640
|
+
ue.length === 0 && k && oe(k.xmlId) && /* @__PURE__ */ t("li", {
|
|
100752
100641
|
className: "pretext-plus-editor__toc-no-sections",
|
|
100753
100642
|
children: /* @__PURE__ */ t("span", { children: "No placed divisions" })
|
|
100754
100643
|
}),
|
|
100755
|
-
|
|
100644
|
+
ue.map((e) => /* @__PURE__ */ t(w7, {
|
|
100756
100645
|
division: e.division,
|
|
100757
100646
|
depth: e.depth + 1,
|
|
100758
|
-
isActive:
|
|
100759
|
-
hasChildren:
|
|
100760
|
-
isExpanded:
|
|
100761
|
-
onToggleExpand: () =>
|
|
100762
|
-
editDraft:
|
|
100763
|
-
onSelect: () =>
|
|
100764
|
-
onDraftChange:
|
|
100765
|
-
onEditCommit:
|
|
100766
|
-
onEditCancel:
|
|
100647
|
+
isActive: c === e.division.xmlId,
|
|
100648
|
+
hasChildren: le.has(e.division.xmlId),
|
|
100649
|
+
isExpanded: oe(e.division.xmlId),
|
|
100650
|
+
onToggleExpand: () => F(e.division.xmlId),
|
|
100651
|
+
editDraft: E === e.division.xmlId ? D : null,
|
|
100652
|
+
onSelect: () => u(e.division.xmlId),
|
|
100653
|
+
onDraftChange: C,
|
|
100654
|
+
onEditCommit: w,
|
|
100655
|
+
onEditCancel: T,
|
|
100767
100656
|
menuItems: [
|
|
100768
100657
|
{
|
|
100769
100658
|
label: "Edit properties",
|
|
100770
|
-
onClick: () =>
|
|
100659
|
+
onClick: () => S(e.division)
|
|
100771
100660
|
},
|
|
100772
100661
|
...g5(e.division.sourceFormat) ? [{
|
|
100773
100662
|
label: "Add new division",
|
|
100774
|
-
onClick: () =>
|
|
100663
|
+
onClick: () => d(e.division.xmlId)
|
|
100775
100664
|
}] : [],
|
|
100776
100665
|
{
|
|
100777
100666
|
label: "Remove from document",
|
|
100778
|
-
onClick: () =>
|
|
100667
|
+
onClick: () => I(e.division.xmlId, e.parentXmlId)
|
|
100779
100668
|
},
|
|
100780
100669
|
{
|
|
100781
100670
|
label: "Delete from project",
|
|
100782
|
-
onClick: () =>
|
|
100671
|
+
onClick: () => de(e.division, e.parentXmlId),
|
|
100783
100672
|
danger: !0
|
|
100784
100673
|
}
|
|
100785
100674
|
],
|
|
100786
|
-
isNew:
|
|
100787
|
-
parentType:
|
|
100675
|
+
isNew: E === e.division.xmlId && O,
|
|
100676
|
+
parentType: he(e.parentXmlId)
|
|
100788
100677
|
}, e.division.xmlId))
|
|
100789
100678
|
]
|
|
100790
100679
|
}),
|
|
100791
|
-
|
|
100680
|
+
j.length > 0 && /* @__PURE__ */ n("div", {
|
|
100792
100681
|
className: "pretext-plus-editor__toc-orphans",
|
|
100793
100682
|
children: [/* @__PURE__ */ t("div", {
|
|
100794
100683
|
className: "pretext-plus-editor__toc-orphans-heading",
|
|
100795
100684
|
children: "Unplaced divisions"
|
|
100796
100685
|
}), /* @__PURE__ */ t("ul", {
|
|
100797
100686
|
className: "pretext-plus-editor__toc-list",
|
|
100798
|
-
children:
|
|
100799
|
-
let r =
|
|
100687
|
+
children: j.map((e) => {
|
|
100688
|
+
let r = o ? H5(o, e.xmlId) : [], i = new Set(r.map((e) => e.parentXmlId).filter(Boolean));
|
|
100800
100689
|
return /* @__PURE__ */ n(a, { children: [/* @__PURE__ */ t(w7, {
|
|
100801
100690
|
division: e,
|
|
100802
100691
|
depth: 0,
|
|
100803
|
-
isActive:
|
|
100804
|
-
hasChildren:
|
|
100805
|
-
isExpanded:
|
|
100806
|
-
onToggleExpand: () =>
|
|
100807
|
-
editDraft:
|
|
100808
|
-
onSelect: () =>
|
|
100809
|
-
onDraftChange:
|
|
100810
|
-
onEditCommit:
|
|
100811
|
-
onEditCancel:
|
|
100692
|
+
isActive: c === e.xmlId,
|
|
100693
|
+
hasChildren: i.has(e.xmlId),
|
|
100694
|
+
isExpanded: oe(e.xmlId),
|
|
100695
|
+
onToggleExpand: () => F(e.xmlId),
|
|
100696
|
+
editDraft: E === e.xmlId ? D : null,
|
|
100697
|
+
onSelect: () => u(e.xmlId),
|
|
100698
|
+
onDraftChange: C,
|
|
100699
|
+
onEditCommit: w,
|
|
100700
|
+
onEditCancel: T,
|
|
100812
100701
|
menuItems: [
|
|
100813
100702
|
{
|
|
100814
100703
|
label: "Edit properties",
|
|
100815
|
-
onClick: () =>
|
|
100704
|
+
onClick: () => S(e)
|
|
100816
100705
|
},
|
|
100817
100706
|
{
|
|
100818
100707
|
label: "Place in document",
|
|
100819
|
-
onClick: () =>
|
|
100708
|
+
onClick: () => me(e)
|
|
100820
100709
|
},
|
|
100821
100710
|
{
|
|
100822
100711
|
label: "Insert at cursor",
|
|
100823
|
-
onClick: () =>
|
|
100712
|
+
onClick: () => pe(e)
|
|
100824
100713
|
},
|
|
100825
100714
|
{
|
|
100826
100715
|
label: "Delete from project",
|
|
100827
|
-
onClick: () =>
|
|
100716
|
+
onClick: () => de(e, null),
|
|
100828
100717
|
danger: !0
|
|
100829
100718
|
}
|
|
100830
100719
|
],
|
|
100831
100720
|
parentType: null
|
|
100832
|
-
}),
|
|
100721
|
+
}), oe(e.xmlId) && r.map((e) => /* @__PURE__ */ t(w7, {
|
|
100833
100722
|
division: e.division,
|
|
100834
100723
|
depth: e.depth + 1,
|
|
100835
|
-
isActive:
|
|
100836
|
-
hasChildren:
|
|
100837
|
-
isExpanded:
|
|
100838
|
-
onToggleExpand: () =>
|
|
100839
|
-
editDraft:
|
|
100840
|
-
onSelect: () =>
|
|
100841
|
-
onDraftChange:
|
|
100842
|
-
onEditCommit:
|
|
100843
|
-
onEditCancel:
|
|
100724
|
+
isActive: c === e.division.xmlId,
|
|
100725
|
+
hasChildren: i.has(e.division.xmlId),
|
|
100726
|
+
isExpanded: oe(e.division.xmlId),
|
|
100727
|
+
onToggleExpand: () => F(e.division.xmlId),
|
|
100728
|
+
editDraft: E === e.division.xmlId ? D : null,
|
|
100729
|
+
onSelect: () => u(e.division.xmlId),
|
|
100730
|
+
onDraftChange: C,
|
|
100731
|
+
onEditCommit: w,
|
|
100732
|
+
onEditCancel: T,
|
|
100844
100733
|
menuItems: [
|
|
100845
100734
|
{
|
|
100846
100735
|
label: "Edit properties",
|
|
100847
|
-
onClick: () =>
|
|
100736
|
+
onClick: () => S(e.division)
|
|
100848
100737
|
},
|
|
100849
100738
|
{
|
|
100850
100739
|
label: "Insert at cursor",
|
|
100851
|
-
onClick: () =>
|
|
100740
|
+
onClick: () => pe(e.division)
|
|
100852
100741
|
},
|
|
100853
100742
|
{
|
|
100854
100743
|
label: "Delete from project",
|
|
100855
|
-
onClick: () =>
|
|
100744
|
+
onClick: () => de(e.division, e.parentXmlId),
|
|
100856
100745
|
danger: !0
|
|
100857
100746
|
}
|
|
100858
100747
|
],
|
|
100859
|
-
parentType:
|
|
100748
|
+
parentType: he(e.parentXmlId)
|
|
100860
100749
|
}, e.division.xmlId))] }, e.xmlId);
|
|
100861
100750
|
})
|
|
100862
100751
|
})]
|
|
100863
100752
|
}),
|
|
100864
|
-
/* @__PURE__ */ n("div", {
|
|
100753
|
+
!i && /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ n("div", {
|
|
100865
100754
|
className: "pretext-plus-editor__toc-assets",
|
|
100866
100755
|
children: [/* @__PURE__ */ t("div", {
|
|
100867
100756
|
className: "pretext-plus-editor__toc-assets-header",
|
|
100868
100757
|
children: /* @__PURE__ */ n("button", {
|
|
100869
100758
|
type: "button",
|
|
100870
100759
|
className: "pretext-plus-editor__toc-assets-toggle",
|
|
100871
|
-
onClick: () =>
|
|
100872
|
-
"aria-expanded":
|
|
100760
|
+
onClick: () => M((e) => !e),
|
|
100761
|
+
"aria-expanded": ne,
|
|
100873
100762
|
children: [
|
|
100874
100763
|
/* @__PURE__ */ t("span", {
|
|
100875
100764
|
className: "pretext-plus-editor__toc-assets-chevron",
|
|
100876
|
-
children:
|
|
100765
|
+
children: ne ? "▾" : "▸"
|
|
100877
100766
|
}),
|
|
100878
100767
|
/* @__PURE__ */ t("span", { children: "Assets" }),
|
|
100879
|
-
|
|
100768
|
+
ee.length > 0 && /* @__PURE__ */ t("span", {
|
|
100880
100769
|
className: "pretext-plus-editor__toc-assets-count",
|
|
100881
|
-
children:
|
|
100770
|
+
children: ee.length
|
|
100882
100771
|
})
|
|
100883
100772
|
]
|
|
100884
100773
|
})
|
|
100885
|
-
}),
|
|
100774
|
+
}), ne && /* @__PURE__ */ t("div", {
|
|
100886
100775
|
className: "pretext-plus-editor__toc-assets-body",
|
|
100887
|
-
children:
|
|
100776
|
+
children: ee.length === 0 ? /* @__PURE__ */ n("p", {
|
|
100888
100777
|
className: "pretext-plus-editor__toc-assets-empty",
|
|
100889
100778
|
children: [
|
|
100890
100779
|
"No assets in this project yet.",
|
|
@@ -100898,7 +100787,7 @@ var S7 = ({ draft: e, isNew: r = !1, isRoot: i = !1, parentType: a = null, onDra
|
|
|
100898
100787
|
]
|
|
100899
100788
|
}) : /* @__PURE__ */ t("div", {
|
|
100900
100789
|
className: "pretext-plus-editor__toc-assets-groups",
|
|
100901
|
-
children:
|
|
100790
|
+
children: te.map(({ kind: e, rows: r }) => /* @__PURE__ */ n("div", { children: [/* @__PURE__ */ t("div", {
|
|
100902
100791
|
className: "pretext-plus-editor__toc-assets-group-header",
|
|
100903
100792
|
children: i7[e]
|
|
100904
100793
|
}), /* @__PURE__ */ t("ul", {
|
|
@@ -100908,16 +100797,16 @@ var S7 = ({ draft: e, isNew: r = !1, isRoot: i = !1, parentType: a = null, onDra
|
|
|
100908
100797
|
"pretext-plus-editor__toc-asset-item",
|
|
100909
100798
|
e.status === "unlinked" ? "pretext-plus-editor__toc-asset-item--unlinked" : "",
|
|
100910
100799
|
e.status === "unused" ? "pretext-plus-editor__toc-asset-item--unused" : "",
|
|
100911
|
-
|
|
100800
|
+
N === e.ref ? "pretext-plus-editor__toc-asset-item--busy" : ""
|
|
100912
100801
|
].filter(Boolean).join(" "),
|
|
100913
100802
|
children: [
|
|
100914
100803
|
e.asset?.url ? /* @__PURE__ */ t("img", {
|
|
100915
100804
|
src: e.asset.url,
|
|
100916
100805
|
className: "pretext-plus-editor__toc-asset-img",
|
|
100917
|
-
onClick: () =>
|
|
100806
|
+
onClick: () => L(e)
|
|
100918
100807
|
}) : /* @__PURE__ */ t("span", {
|
|
100919
100808
|
className: "pretext-plus-editor__toc-asset-img pretext-plus-editor__toc-asset-img--placeholder",
|
|
100920
|
-
onClick: () =>
|
|
100809
|
+
onClick: () => L(e),
|
|
100921
100810
|
title: e.status === "unlinked" ? "No asset — click to link" : void 0,
|
|
100922
100811
|
"aria-hidden": "true",
|
|
100923
100812
|
children: e.status === "unlinked" ? "⚠" : "🖼"
|
|
@@ -100925,7 +100814,7 @@ var S7 = ({ draft: e, isNew: r = !1, isRoot: i = !1, parentType: a = null, onDra
|
|
|
100925
100814
|
/* @__PURE__ */ n("button", {
|
|
100926
100815
|
type: "button",
|
|
100927
100816
|
className: "pretext-plus-editor__toc-asset-name",
|
|
100928
|
-
onClick: () =>
|
|
100817
|
+
onClick: () => L(e),
|
|
100929
100818
|
title: e.status === "unlinked" ? "No asset for this reference — click to link or create one" : "Edit asset",
|
|
100930
100819
|
children: [/* @__PURE__ */ t("span", {
|
|
100931
100820
|
className: "pretext-plus-editor__toc-asset-label",
|
|
@@ -100937,27 +100826,26 @@ var S7 = ({ draft: e, isNew: r = !1, isRoot: i = !1, parentType: a = null, onDra
|
|
|
100937
100826
|
}),
|
|
100938
100827
|
/* @__PURE__ */ t("div", {
|
|
100939
100828
|
className: "pretext-plus-editor__toc-actions",
|
|
100940
|
-
children:
|
|
100829
|
+
children: N === e.ref ? /* @__PURE__ */ t("span", {
|
|
100941
100830
|
className: "pretext-plus-editor__toc-asset-spinner",
|
|
100942
100831
|
role: "status",
|
|
100943
100832
|
"aria-label": "Duplicating asset",
|
|
100944
100833
|
title: "Duplicating…"
|
|
100945
|
-
}) : /* @__PURE__ */ t(C7, { items:
|
|
100834
|
+
}) : /* @__PURE__ */ t(C7, { items: _e(e) })
|
|
100946
100835
|
})
|
|
100947
100836
|
]
|
|
100948
100837
|
}, e.ref))
|
|
100949
100838
|
})] }, e))
|
|
100950
100839
|
})
|
|
100951
100840
|
})]
|
|
100952
|
-
}),
|
|
100953
|
-
r && /* @__PURE__ */ t("button", {
|
|
100841
|
+
}), r && /* @__PURE__ */ t("button", {
|
|
100954
100842
|
type: "button",
|
|
100955
100843
|
className: "pretext-plus-editor__toc-assets-btn",
|
|
100956
100844
|
onClick: r,
|
|
100957
100845
|
children: "Manage Assets"
|
|
100958
|
-
})
|
|
100846
|
+
})] })
|
|
100959
100847
|
] });
|
|
100960
|
-
}, E7 = ({ isCollapsed: e, onToggleCollapse: r, onOpenAssetPicker: i }) => e ? /* @__PURE__ */ t("div", {
|
|
100848
|
+
}, E7 = ({ isCollapsed: e, onToggleCollapse: r, onOpenAssetPicker: i, hideAssets: a }) => e ? /* @__PURE__ */ t("div", {
|
|
100961
100849
|
className: "pretext-plus-editor__toc pretext-plus-editor__toc--collapsed",
|
|
100962
100850
|
children: /* @__PURE__ */ t("button", {
|
|
100963
100851
|
type: "button",
|
|
@@ -100985,7 +100873,10 @@ var S7 = ({ draft: e, isNew: r = !1, isRoot: i = !1, parentType: a = null, onDra
|
|
|
100985
100873
|
children: "✕"
|
|
100986
100874
|
})
|
|
100987
100875
|
})]
|
|
100988
|
-
}), /* @__PURE__ */ t(T7, {
|
|
100876
|
+
}), /* @__PURE__ */ t(T7, {
|
|
100877
|
+
onOpenAssetPicker: i,
|
|
100878
|
+
hideAssets: a
|
|
100879
|
+
})]
|
|
100989
100880
|
}), D7 = class extends i {
|
|
100990
100881
|
state = { error: null };
|
|
100991
100882
|
static getDerivedStateFromError(e) {
|
|
@@ -101039,7 +100930,6 @@ function k7(e) {
|
|
|
101039
100930
|
source: e.source,
|
|
101040
100931
|
sourceFormat: e.sourceFormat,
|
|
101041
100932
|
projectAssets: e.projectAssets,
|
|
101042
|
-
libraryAssets: void 0,
|
|
101043
100933
|
title: e.title,
|
|
101044
100934
|
docinfo: e.docinfo,
|
|
101045
100935
|
commonDocinfo: e.commonDocinfo,
|
|
@@ -101079,7 +100969,6 @@ function k7(e) {
|
|
|
101079
100969
|
}),
|
|
101080
100970
|
patchDivision: (e, n) => t((t) => t.divisions ? { divisions: t.divisions.map((t) => t.xmlId === e ? {
|
|
101081
100971
|
...t,
|
|
101082
|
-
...n.id !== void 0 && { id: n.id },
|
|
101083
100972
|
...n.title !== void 0 && { title: n.title },
|
|
101084
100973
|
...n.type !== void 0 && { type: n.type },
|
|
101085
100974
|
...n.xmlId != null && { xmlId: n.xmlId },
|
|
@@ -101109,10 +100998,13 @@ function k7(e) {
|
|
|
101109
100998
|
updateSection: (e, t) => n.cbs.updateDivision(e, t),
|
|
101110
100999
|
divisionContentChange: (e, t) => n.cbs.divisionContentChange?.(e, t),
|
|
101111
101000
|
startSectionEdit: (e, n) => {
|
|
101112
|
-
let { xmlId: r, label: i } = e.sourceFormat === "markdown" ?
|
|
101113
|
-
|
|
101114
|
-
|
|
101115
|
-
|
|
101001
|
+
let { xmlId: r, label: i } = e.sourceFormat === "markdown" ? (() => {
|
|
101002
|
+
let t = p5(e.source);
|
|
101003
|
+
return {
|
|
101004
|
+
xmlId: t?.xmlId || e.xmlId,
|
|
101005
|
+
label: t?.label ?? ""
|
|
101006
|
+
};
|
|
101007
|
+
})() : e.sourceFormat === "latex" ? {
|
|
101116
101008
|
xmlId: Y8(e.source) || e.xmlId,
|
|
101117
101009
|
label: ""
|
|
101118
101010
|
} : (() => {
|
|
@@ -101187,7 +101079,6 @@ function k7(e) {
|
|
|
101187
101079
|
duplicateAsset: async (e) => {
|
|
101188
101080
|
await n.cbs.assetDuplicate?.(e);
|
|
101189
101081
|
},
|
|
101190
|
-
setProjectAssets: (e) => t({ projectAssets: e }),
|
|
101191
101082
|
addAssetToPool: (e) => t((t) => {
|
|
101192
101083
|
let n = t.projectAssets ?? [];
|
|
101193
101084
|
return n.some((t) => O7(t, e)) ? {} : { projectAssets: [...n, e] };
|
|
@@ -101285,7 +101176,11 @@ var j7 = (e, t) => e.find((e) => t ? e.xmlId === t : e.type === "book" || e.type
|
|
|
101285
101176
|
}
|
|
101286
101177
|
i !== n.xmlId && De(i);
|
|
101287
101178
|
}, z = (t) => {
|
|
101288
|
-
|
|
101179
|
+
let n = {
|
|
101180
|
+
...t,
|
|
101181
|
+
id: void 0
|
|
101182
|
+
};
|
|
101183
|
+
I(n), e.onDivisionAdd?.(n);
|
|
101289
101184
|
}, Ee = (t) => {
|
|
101290
101185
|
de(t), e.onDivisionRemove?.(t);
|
|
101291
101186
|
}, De = (t) => {
|
|
@@ -101368,7 +101263,7 @@ var j7 = (e, t) => e.find((e) => t ? e.xmlId === t : e.type === "book" || e.type
|
|
|
101368
101263
|
ee(e);
|
|
101369
101264
|
}, Ne = (t) => {
|
|
101370
101265
|
M(t), e.onAssetRemove?.(t);
|
|
101371
|
-
}, Pe = !!(e.onAssetUpload && e.onAssetFetchUrl && e.onAssetUpdate), Fe = !!(e.onAssetRemove &&
|
|
101266
|
+
}, Pe = !!(e.onAssetUpload && e.onAssetFetchUrl && e.onAssetUpdate), Fe = !!(e.onAssetRemove && e.onAssetUpload), Ie = async (t) => {
|
|
101372
101267
|
if (!e.onAssetUpload || !e.onAssetFetchUrl || !t.ref || !t.url) return;
|
|
101373
101268
|
let n = new Set(n7(ie, j).map((e) => e.ref)), r = r7(t.ref, n), i = await e.onAssetFetchUrl(t.url), a = /\.[^./\\]+$/.exec(i.name)?.[0] ?? "", o = new File([i], `${r}${a}`, { type: i.type }), s = {
|
|
101374
101269
|
...await e.onAssetUpload(o),
|
|
@@ -101377,18 +101272,14 @@ var j7 = (e, t) => e.find((e) => t ? e.xmlId === t : e.type === "book" || e.type
|
|
|
101377
101272
|
source: t.source
|
|
101378
101273
|
};
|
|
101379
101274
|
await e.onAssetUpdate?.(s), ee(s), S(s.kind, r);
|
|
101380
|
-
}, Le = async (t, n
|
|
101381
|
-
|
|
101382
|
-
|
|
101383
|
-
|
|
101384
|
-
|
|
101385
|
-
|
|
101386
|
-
|
|
101387
|
-
|
|
101388
|
-
};
|
|
101389
|
-
await e.onAssetUpdate?.(r), te(r);
|
|
101390
|
-
}
|
|
101391
|
-
e.onAssetRemove?.(t), M(t);
|
|
101275
|
+
}, Le = async (t, n) => {
|
|
101276
|
+
let r = {
|
|
101277
|
+
...n,
|
|
101278
|
+
ref: t.ref,
|
|
101279
|
+
title: t.title,
|
|
101280
|
+
source: t.source
|
|
101281
|
+
};
|
|
101282
|
+
await e.onAssetUpdate?.(r), te(r), e.onAssetRemove?.(t), M(t);
|
|
101392
101283
|
}, Re = (e, t, n) => {
|
|
101393
101284
|
if (t !== n) for (let r of ie) {
|
|
101394
101285
|
let i = k5(r.source, e, t, n);
|
|
@@ -101429,7 +101320,6 @@ var j7 = (e, t) => e.find((e) => t ? e.xmlId === t : e.type === "book" || e.type
|
|
|
101429
101320
|
A({
|
|
101430
101321
|
source: R,
|
|
101431
101322
|
sourceFormat: Se,
|
|
101432
|
-
libraryAssets: e.libraryAssets,
|
|
101433
101323
|
projectType: e.projectType,
|
|
101434
101324
|
projectUrl: e.projectUrl,
|
|
101435
101325
|
rootDivisionId: be?.xmlId,
|
|
@@ -101524,7 +101414,8 @@ var j7 = (e, t) => e.find((e) => t ? e.xmlId === t : e.type === "book" || e.type
|
|
|
101524
101414
|
canConvertToPretext: Oe !== void 0,
|
|
101525
101415
|
onOpenAssets: e.projectAssets !== void 0 && Se === "pretext" ? () => O("isAssetPickerOpen") : void 0,
|
|
101526
101416
|
onShowFullSource: () => O("isFullSourceOpen"),
|
|
101527
|
-
onRequestWrapperEdit: Ae
|
|
101417
|
+
onRequestWrapperEdit: Ae,
|
|
101418
|
+
hideAssets: e.hideAssets
|
|
101528
101419
|
}), Ze;
|
|
101529
101420
|
Ze = i && e.onPreviewRebuild ? /* @__PURE__ */ t(jR, {
|
|
101530
101421
|
ref: _e,
|
|
@@ -101540,6 +101431,7 @@ var j7 = (e, t) => e.find((e) => t ? e.xmlId === t : e.type === "book" || e.type
|
|
|
101540
101431
|
let Qe = /* @__PURE__ */ t(E7, {
|
|
101541
101432
|
isCollapsed: l,
|
|
101542
101433
|
onToggleCollapse: () => u((e) => !e),
|
|
101434
|
+
hideAssets: e.hideAssets,
|
|
101543
101435
|
onOpenAssetPicker: e.projectAssets === void 0 ? void 0 : () => O("isAssetPickerOpen")
|
|
101544
101436
|
}), $e = "pretext-plus-tab-editor", et = "pretext-plus-tab-preview", tt = "pretext-plus-tabpanel", nt;
|
|
101545
101437
|
return nt = a ? /* @__PURE__ */ n("div", {
|
|
@@ -101653,9 +101545,6 @@ var j7 = (e, t) => e.find((e) => t ? e.xmlId === t : e.type === "book" || e.type
|
|
|
101653
101545
|
onClose: () => {
|
|
101654
101546
|
k("isAssetPickerOpen"), T(), D(null);
|
|
101655
101547
|
},
|
|
101656
|
-
onLoadAssets: e.onLoadAssets,
|
|
101657
|
-
onLoadLibraryAssets: e.onLoadLibraryAssets,
|
|
101658
|
-
onAddFromLibrary: e.onAssetAddFromLibrary,
|
|
101659
101548
|
onUpload: e.onAssetUpload,
|
|
101660
101549
|
onFetchUrl: e.onAssetFetchUrl,
|
|
101661
101550
|
onCreateDoenet: e.onCreateDoenet,
|