@w100n/documents 0.16.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{SheetView-EFBSMY7K.js → SheetView-FVLKQR7J.js} +4 -4
- package/dist/{TextEditor-MGCSGGGA.js → TextEditor-BF6HCNHL.js} +389 -343
- package/dist/TextEditor-BF6HCNHL.js.map +1 -0
- package/dist/{chunk-2L3TK7UF.js → chunk-GN3ZOD36.js} +3 -3
- package/dist/{chunk-2L3TK7UF.js.map → chunk-GN3ZOD36.js.map} +1 -1
- package/dist/{chunk-RKV3N6OS.js → chunk-LZYITB56.js} +22 -1
- package/dist/chunk-LZYITB56.js.map +1 -0
- package/dist/{chunk-3OLRFIHQ.js → chunk-NPVH2YDI.js} +2 -2
- package/dist/collab.cjs +22 -1
- package/dist/collab.cjs.map +1 -1
- package/dist/collab.d.cts +1 -1
- package/dist/collab.d.ts +1 -1
- package/dist/collab.js +2 -2
- package/dist/index.cjs +992 -873
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +52 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +58 -14
- package/dist/index.js.map +1 -1
- package/dist/kinds.d.cts +1 -1
- package/dist/kinds.d.ts +1 -1
- package/dist/memory.cjs +25 -2
- package/dist/memory.cjs.map +1 -1
- package/dist/memory.d.cts +3 -2
- package/dist/memory.d.ts +3 -2
- package/dist/memory.js +25 -2
- package/dist/memory.js.map +1 -1
- package/dist/{types-BTsVooZw.d.cts → types-DNcaU6SK.d.cts} +9 -0
- package/dist/{types-BTsVooZw.d.ts → types-DNcaU6SK.d.ts} +9 -0
- package/package.json +1 -1
- package/dist/TextEditor-MGCSGGGA.js.map +0 -1
- package/dist/chunk-RKV3N6OS.js.map +0 -1
- /package/dist/{SheetView-EFBSMY7K.js.map → SheetView-FVLKQR7J.js.map} +0 -0
- /package/dist/{chunk-3OLRFIHQ.js.map → chunk-NPVH2YDI.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -98,6 +98,13 @@ var init_text = __esm({
|
|
|
98
98
|
retry: "Try again",
|
|
99
99
|
loading: "Loading",
|
|
100
100
|
unsupported: "This file cannot be shown yet",
|
|
101
|
+
teamTemplates: "Team templates",
|
|
102
|
+
saveTemplate: "Save as template",
|
|
103
|
+
templateSaved: "Saved to Templates",
|
|
104
|
+
templateFailed: "Could not save the template",
|
|
105
|
+
assignTo: "Assign to {name}",
|
|
106
|
+
assignedTo: "Assigned to {name}",
|
|
107
|
+
assignedYou: "Assigned to you",
|
|
101
108
|
printLayout: "Print layout",
|
|
102
109
|
cut: "Cut",
|
|
103
110
|
paste: "Paste",
|
|
@@ -432,6 +439,13 @@ var init_text = __esm({
|
|
|
432
439
|
retry: "Spr\xF3buj ponownie",
|
|
433
440
|
loading: "Wczytywanie",
|
|
434
441
|
unsupported: "Tego pliku nie da si\u0119 jeszcze pokaza\u0107",
|
|
442
|
+
teamTemplates: "Szablony zespo\u0142u",
|
|
443
|
+
saveTemplate: "Zapisz jako szablon",
|
|
444
|
+
templateSaved: "Zapisano w Szablonach",
|
|
445
|
+
templateFailed: "Nie uda\u0142o si\u0119 zapisa\u0107 szablonu",
|
|
446
|
+
assignTo: "Przypisz do: {name}",
|
|
447
|
+
assignedTo: "Przypisane: {name}",
|
|
448
|
+
assignedYou: "Przypisane do Ciebie",
|
|
435
449
|
printLayout: "Uk\u0142ad wydruku",
|
|
436
450
|
cut: "Wytnij",
|
|
437
451
|
paste: "Wklej",
|
|
@@ -766,6 +780,13 @@ var init_text = __esm({
|
|
|
766
780
|
retry: "\u0421\u043F\u0440\u043E\u0431\u0443\u0432\u0430\u0442\u0438 \u0449\u0435",
|
|
767
781
|
loading: "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F",
|
|
768
782
|
unsupported: "\u0426\u0435\u0439 \u0444\u0430\u0439\u043B \u043F\u043E\u043A\u0438 \u043D\u0435 \u043C\u043E\u0436\u043D\u0430 \u043F\u043E\u043A\u0430\u0437\u0430\u0442\u0438",
|
|
783
|
+
teamTemplates: "\u0428\u0430\u0431\u043B\u043E\u043D\u0438 \u043A\u043E\u043C\u0430\u043D\u0434\u0438",
|
|
784
|
+
saveTemplate: "\u0417\u0431\u0435\u0440\u0435\u0433\u0442\u0438 \u044F\u043A \u0448\u0430\u0431\u043B\u043E\u043D",
|
|
785
|
+
templateSaved: "\u0417\u0431\u0435\u0440\u0435\u0436\u0435\u043D\u043E \u0432 Templates",
|
|
786
|
+
templateFailed: "\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0437\u0431\u0435\u0440\u0435\u0433\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D",
|
|
787
|
+
assignTo: "\u0414\u043E\u0440\u0443\u0447\u0438\u0442\u0438: {name}",
|
|
788
|
+
assignedTo: "\u0414\u043E\u0440\u0443\u0447\u0435\u043D\u043E: {name}",
|
|
789
|
+
assignedYou: "\u0414\u043E\u0440\u0443\u0447\u0435\u043D\u043E \u0432\u0430\u043C",
|
|
769
790
|
printLayout: "\u0420\u043E\u0437\u043C\u0456\u0442\u043A\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438",
|
|
770
791
|
cut: "\u0412\u0438\u0440\u0456\u0437\u0430\u0442\u0438",
|
|
771
792
|
paste: "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u0438",
|
|
@@ -4714,7 +4735,7 @@ var init_extensions = __esm({
|
|
|
4714
4735
|
var version;
|
|
4715
4736
|
var init_package = __esm({
|
|
4716
4737
|
"package.json"() {
|
|
4717
|
-
version = "0.16.
|
|
4738
|
+
version = "0.16.1";
|
|
4718
4739
|
}
|
|
4719
4740
|
});
|
|
4720
4741
|
|
|
@@ -8000,6 +8021,74 @@ var init_live = __esm({
|
|
|
8000
8021
|
}
|
|
8001
8022
|
});
|
|
8002
8023
|
|
|
8024
|
+
// src/editor/Mentions.tsx
|
|
8025
|
+
function Mentions({ value: value3, onChange, onSend, people, label, placeholder, autoFocus }) {
|
|
8026
|
+
const field = (0, import_react9.useRef)(null);
|
|
8027
|
+
const [caret, setCaret] = (0, import_react9.useState)(0);
|
|
8028
|
+
const [at2, setAt] = (0, import_react9.useState)(0);
|
|
8029
|
+
const [shut, setShut] = (0, import_react9.useState)(false);
|
|
8030
|
+
const typed = /(?:^|\s)@([\p{L}\p{N}.'-]*)$/u.exec(value3.slice(0, caret));
|
|
8031
|
+
const query = typed?.[1].toLocaleLowerCase() ?? "";
|
|
8032
|
+
const found = typed && !shut ? people.filter((p) => p.name.toLocaleLowerCase().split(/\s+/).some((w) => w.startsWith(query)) || p.name.toLocaleLowerCase().startsWith(query)).slice(0, 6) : [];
|
|
8033
|
+
const choose = (p) => {
|
|
8034
|
+
const start = caret - query.length - 1;
|
|
8035
|
+
const next = `${value3.slice(0, start)}@${p.name} ${value3.slice(caret)}`;
|
|
8036
|
+
const end = start + p.name.length + 2;
|
|
8037
|
+
onChange(next);
|
|
8038
|
+
setCaret(end);
|
|
8039
|
+
requestAnimationFrame(() => field.current?.setSelectionRange(end, end));
|
|
8040
|
+
};
|
|
8041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "w100n-text-mentions", children: [
|
|
8042
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
8043
|
+
"textarea",
|
|
8044
|
+
{
|
|
8045
|
+
ref: field,
|
|
8046
|
+
autoFocus,
|
|
8047
|
+
value: value3,
|
|
8048
|
+
placeholder,
|
|
8049
|
+
"aria-label": label,
|
|
8050
|
+
"aria-autocomplete": "list",
|
|
8051
|
+
"aria-expanded": found.length > 0,
|
|
8052
|
+
onChange: (e) => {
|
|
8053
|
+
onChange(e.target.value);
|
|
8054
|
+
setCaret(e.target.selectionStart);
|
|
8055
|
+
setAt(0);
|
|
8056
|
+
setShut(false);
|
|
8057
|
+
},
|
|
8058
|
+
onClick: (e) => setCaret(e.currentTarget.selectionStart),
|
|
8059
|
+
onKeyUp: (e) => {
|
|
8060
|
+
if (["ArrowLeft", "ArrowRight", "Home", "End"].includes(e.key)) setCaret(e.currentTarget.selectionStart);
|
|
8061
|
+
},
|
|
8062
|
+
onKeyDown: (e) => {
|
|
8063
|
+
if (found.length && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
|
|
8064
|
+
e.preventDefault();
|
|
8065
|
+
setAt((at2 + (e.key === "ArrowDown" ? 1 : found.length - 1)) % found.length);
|
|
8066
|
+
} else if (found.length && (e.key === "Enter" || e.key === "Tab") && !e.metaKey && !e.ctrlKey) {
|
|
8067
|
+
e.preventDefault();
|
|
8068
|
+
choose(found[Math.min(at2, found.length - 1)]);
|
|
8069
|
+
} else if (found.length && e.key === "Escape") {
|
|
8070
|
+
e.stopPropagation();
|
|
8071
|
+
setShut(true);
|
|
8072
|
+
} else if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) onSend();
|
|
8073
|
+
}
|
|
8074
|
+
}
|
|
8075
|
+
),
|
|
8076
|
+
found.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "w100n-text-pop w100n-text-menu w100n-text-people-list", role: "listbox", "aria-label": label, children: found.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { type: "button", role: "option", "aria-selected": i === Math.min(at2, found.length - 1), onMouseDown: (e) => e.preventDefault(), onClick: () => choose(p), children: [
|
|
8077
|
+
p.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("img", { className: "w100n-text-face", src: p.avatarUrl, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "w100n-text-face", "aria-hidden": true, children: p.name.slice(0, 1).toUpperCase() }),
|
|
8078
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: p.name })
|
|
8079
|
+
] }, p.id)) })
|
|
8080
|
+
] });
|
|
8081
|
+
}
|
|
8082
|
+
var import_react9, import_jsx_runtime6, tagged;
|
|
8083
|
+
var init_Mentions = __esm({
|
|
8084
|
+
"src/editor/Mentions.tsx"() {
|
|
8085
|
+
"use strict";
|
|
8086
|
+
import_react9 = require("react");
|
|
8087
|
+
import_jsx_runtime6 = require("react/jsx-runtime");
|
|
8088
|
+
tagged = (body, people) => people.filter((p) => body.toLocaleLowerCase().includes(`@${p.name.toLocaleLowerCase()}`));
|
|
8089
|
+
}
|
|
8090
|
+
});
|
|
8091
|
+
|
|
8003
8092
|
// src/editor/TextEditor.tsx
|
|
8004
8093
|
var TextEditor_exports = {};
|
|
8005
8094
|
__export(TextEditor_exports, {
|
|
@@ -8016,47 +8105,47 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
|
|
|
8016
8105
|
const live = useLive(together ? host : void 0, documentId, kind, bytes, source.data?.doc, language, can.edit, onSaved);
|
|
8017
8106
|
const shared = live?.ready ? live.wire : null;
|
|
8018
8107
|
if (live?.readonly) can.edit = false;
|
|
8019
|
-
const baseline = (0,
|
|
8020
|
-
const anchors2 = (0,
|
|
8021
|
-
const scroller = (0,
|
|
8022
|
-
const root = (0,
|
|
8023
|
-
const [pop, setPop] = (0,
|
|
8024
|
-
const [spot3, setSpot] = (0,
|
|
8025
|
-
const touch = (0,
|
|
8026
|
-
const [spell, setSpell] = (0,
|
|
8027
|
-
const [dialog, setDialog] = (0,
|
|
8028
|
-
const field = (0,
|
|
8029
|
-
const [more, setMore] = (0,
|
|
8030
|
-
const [zoom, setZoom] = (0,
|
|
8031
|
-
const [layout2, setLayout] = (0,
|
|
8032
|
-
const [room, setRoom] = (0,
|
|
8033
|
-
const [printed, setPrinted] = (0,
|
|
8108
|
+
const baseline = (0, import_react11.useRef)(null);
|
|
8109
|
+
const anchors2 = (0, import_react11.useRef)(/* @__PURE__ */ new Map());
|
|
8110
|
+
const scroller = (0, import_react11.useRef)(null);
|
|
8111
|
+
const root = (0, import_react11.useRef)(null);
|
|
8112
|
+
const [pop, setPop] = (0, import_react11.useState)(null);
|
|
8113
|
+
const [spot3, setSpot] = (0, import_react11.useState)({ x: 0, y: 0 });
|
|
8114
|
+
const touch = (0, import_react11.useRef)(false);
|
|
8115
|
+
const [spell, setSpell] = (0, import_react11.useState)(() => typeof localStorage === "undefined" || localStorage.getItem("w100n-docs-spell") !== "0");
|
|
8116
|
+
const [dialog, setDialog] = (0, import_react11.useState)(null);
|
|
8117
|
+
const field = (0, import_react11.useRef)(null);
|
|
8118
|
+
const [more, setMore] = (0, import_react11.useState)(() => typeof localStorage !== "undefined" && localStorage.getItem("w100n-docs-more") === "1");
|
|
8119
|
+
const [zoom, setZoom] = (0, import_react11.useState)(null);
|
|
8120
|
+
const [layout2, setLayout] = (0, import_react11.useState)(null);
|
|
8121
|
+
const [room, setRoom] = (0, import_react11.useState)(0);
|
|
8122
|
+
const [printed, setPrinted] = (0, import_react11.useState)(null);
|
|
8034
8123
|
const flow = docx2 && !(printed ?? !(room > 0 && room < 640));
|
|
8035
|
-
const [saving, setSaving] = (0,
|
|
8036
|
-
const [href, setHref] = (0,
|
|
8037
|
-
const [grid3, setGrid] = (0,
|
|
8038
|
-
const [draft, setDraft] = (0,
|
|
8039
|
-
const [reply, setReply] = (0,
|
|
8040
|
-
const [active, setActive] = (0,
|
|
8041
|
-
const [resolved, setResolved] = (0,
|
|
8042
|
-
const [posting, setPosting] = (0,
|
|
8043
|
-
const [added, setAdded] = (0,
|
|
8044
|
-
const [changed2, setChanged] = (0,
|
|
8045
|
-
const [editing, setEditing] = (0,
|
|
8046
|
-
const [dropping, setDropping] = (0,
|
|
8047
|
-
const [failed, setFailed] = (0,
|
|
8048
|
-
const [paint2, setPaint] = (0,
|
|
8049
|
-
const [query, setQuery] = (0,
|
|
8050
|
-
const [swap, setSwap] = (0,
|
|
8051
|
-
const [matchCase, setMatchCase] = (0,
|
|
8052
|
-
const [count, setCount] = (0,
|
|
8053
|
-
const [marg, setMarg] = (0,
|
|
8054
|
-
const [unsetup, setUnsetup] = (0,
|
|
8055
|
-
const [draft2, setDraft2] = (0,
|
|
8124
|
+
const [saving, setSaving] = (0, import_react11.useState)("idle");
|
|
8125
|
+
const [href, setHref] = (0, import_react11.useState)("");
|
|
8126
|
+
const [grid3, setGrid] = (0, import_react11.useState)({ rows: 0, cols: 0 });
|
|
8127
|
+
const [draft, setDraft] = (0, import_react11.useState)(null);
|
|
8128
|
+
const [reply, setReply] = (0, import_react11.useState)(null);
|
|
8129
|
+
const [active, setActive] = (0, import_react11.useState)(null);
|
|
8130
|
+
const [resolved, setResolved] = (0, import_react11.useState)(false);
|
|
8131
|
+
const [posting, setPosting] = (0, import_react11.useState)("idle");
|
|
8132
|
+
const [added, setAdded] = (0, import_react11.useState)([]);
|
|
8133
|
+
const [changed2, setChanged] = (0, import_react11.useState)({});
|
|
8134
|
+
const [editing, setEditing] = (0, import_react11.useState)(null);
|
|
8135
|
+
const [dropping, setDropping] = (0, import_react11.useState)(null);
|
|
8136
|
+
const [failed, setFailed] = (0, import_react11.useState)(false);
|
|
8137
|
+
const [paint2, setPaint] = (0, import_react11.useState)(null);
|
|
8138
|
+
const [query, setQuery] = (0, import_react11.useState)("");
|
|
8139
|
+
const [swap, setSwap] = (0, import_react11.useState)("");
|
|
8140
|
+
const [matchCase, setMatchCase] = (0, import_react11.useState)(false);
|
|
8141
|
+
const [count, setCount] = (0, import_react11.useState)({ words: 0, pages: 0 });
|
|
8142
|
+
const [marg, setMarg] = (0, import_react11.useState)(null);
|
|
8143
|
+
const [unsetup, setUnsetup] = (0, import_react11.useState)(false);
|
|
8144
|
+
const [draft2, setDraft2] = (0, import_react11.useState)(null);
|
|
8056
8145
|
useRestore(pop !== null);
|
|
8057
8146
|
useRestore(editing !== null);
|
|
8058
8147
|
useRestore(dropping !== null);
|
|
8059
|
-
const editor = (0,
|
|
8148
|
+
const editor = (0, import_react10.useEditor)({
|
|
8060
8149
|
extensions: kit(kind, t, shared),
|
|
8061
8150
|
content: shared ? null : source.data?.doc ?? null,
|
|
8062
8151
|
editable: can.edit && (!live || !!shared),
|
|
@@ -8067,7 +8156,7 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
|
|
|
8067
8156
|
if (source.data && !live) baseline.current = { bytes, doc: made2.state.doc, base: source.data.md && track(source.data.md, made2.state.doc) };
|
|
8068
8157
|
}
|
|
8069
8158
|
}, [source.data, can.edit, shared]);
|
|
8070
|
-
const state = (0,
|
|
8159
|
+
const state = (0, import_react10.useEditorState)({
|
|
8071
8160
|
editor,
|
|
8072
8161
|
selector: ({ editor: e }) => {
|
|
8073
8162
|
if (!e) return null;
|
|
@@ -8137,10 +8226,10 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8137
8226
|
setTimeout(() => frame.remove(), 1e3);
|
|
8138
8227
|
};
|
|
8139
8228
|
const marginal = marg ?? (source.data && "marginal" in source.data ? source.data.marginal : null) ?? { header: "", footer: "", numbers: false };
|
|
8140
|
-
(0,
|
|
8229
|
+
(0, import_react11.useEffect)(() => {
|
|
8141
8230
|
if (editor && docx2 && source.data) editor.view.dispatch(editor.state.tr.setMeta(paging, { page, marks: { header: marginal.header, footer: marginal.footer }, flow }));
|
|
8142
8231
|
}, [editor, source.data, page, marginal.header, marginal.footer, flow]);
|
|
8143
|
-
(0,
|
|
8232
|
+
(0, import_react11.useEffect)(() => {
|
|
8144
8233
|
if (!shared || !docx2) return;
|
|
8145
8234
|
const map = shared.doc.getMap("setup");
|
|
8146
8235
|
const sync = () => {
|
|
@@ -8153,21 +8242,23 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8153
8242
|
return () => map.unobserve(sync);
|
|
8154
8243
|
}, [shared, docx2]);
|
|
8155
8244
|
const loaded = useLoad((signal) => host?.comments ? host.comments(documentId, { signal }) : Promise.resolve([]), [host, documentId]);
|
|
8245
|
+
const crowd = useLoad((signal) => host?.people && can.comment ? host.people(documentId, { signal }) : Promise.resolve([]), [host, documentId]);
|
|
8246
|
+
const people = (crowd.data ?? []).filter((p) => p.id !== host?.me.id);
|
|
8156
8247
|
const all = [...loaded.data ?? [], ...added].flatMap((c) => c.id in changed2 ? changed2[c.id] ?? [] : [c]).filter((c) => !c.replyTo || changed2[c.replyTo] !== null);
|
|
8157
8248
|
const open = all.filter((c) => !c.replyTo && !c.resolved);
|
|
8158
8249
|
const threads = all.filter((c) => !c.replyTo && (resolved || !c.resolved)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
8159
8250
|
const openIds = open.map((c) => c.id).join();
|
|
8160
|
-
(0,
|
|
8251
|
+
(0, import_react11.useEffect)(() => {
|
|
8161
8252
|
if (!editor || !source.data) return;
|
|
8162
8253
|
const have = new Map(notes.getState(editor.state).spots.map((s) => [s.id, s]));
|
|
8163
8254
|
const fresh2 = open.filter((c) => !have.has(c.id));
|
|
8164
8255
|
const found2 = locate(editor.state.doc, fresh2.map((c) => ({ id: c.id, quote: c.quote, anchor: anchors2.current.get(c.id) })));
|
|
8165
8256
|
editor.view.dispatch(editor.state.tr.setMeta(notes, { spots: [...open.flatMap((c) => have.get(c.id) ?? []), ...found2] }));
|
|
8166
8257
|
}, [editor, source.data, openIds]);
|
|
8167
|
-
(0,
|
|
8258
|
+
(0, import_react11.useEffect)(() => {
|
|
8168
8259
|
if (editor && source.data) editor.view.dispatch(editor.state.tr.setMeta(notes, { active }));
|
|
8169
8260
|
}, [editor, source.data, active]);
|
|
8170
|
-
(0,
|
|
8261
|
+
(0, import_react11.useEffect)(() => {
|
|
8171
8262
|
if (!editor || !source.data) return;
|
|
8172
8263
|
let timer = 0;
|
|
8173
8264
|
let last2 = "";
|
|
@@ -8198,7 +8289,7 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8198
8289
|
editor.off("update", later);
|
|
8199
8290
|
};
|
|
8200
8291
|
}, [editor, source.data, onOutline]);
|
|
8201
|
-
(0,
|
|
8292
|
+
(0, import_react11.useEffect)(() => {
|
|
8202
8293
|
const el = scroller.current;
|
|
8203
8294
|
if (!el || !editor || !onReading) return;
|
|
8204
8295
|
let frame = 0;
|
|
@@ -8228,32 +8319,32 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8228
8319
|
}, [editor, source.data, onReading, documentId]);
|
|
8229
8320
|
const dirty = live ? live.pending : !!state?.dirty || unsetup;
|
|
8230
8321
|
const unsent = live ? live.unsynced && can.edit : dirty;
|
|
8231
|
-
(0,
|
|
8322
|
+
(0, import_react11.useEffect)(() => {
|
|
8232
8323
|
if (!guard || live || !dirty || !source.data || !editor) return;
|
|
8233
8324
|
guard.current = save2;
|
|
8234
8325
|
return () => {
|
|
8235
8326
|
guard.current = null;
|
|
8236
8327
|
};
|
|
8237
8328
|
});
|
|
8238
|
-
(0,
|
|
8329
|
+
(0, import_react11.useEffect)(() => {
|
|
8239
8330
|
if (live || !dirty || !can.edit || saving === "busy" || !editor) return;
|
|
8240
8331
|
const timer = window.setTimeout(() => void save2(true), 3e3);
|
|
8241
8332
|
return () => clearTimeout(timer);
|
|
8242
8333
|
});
|
|
8243
|
-
(0,
|
|
8334
|
+
(0, import_react11.useEffect)(() => {
|
|
8244
8335
|
if (!unsent) return;
|
|
8245
8336
|
const stop = (e) => e.preventDefault();
|
|
8246
8337
|
window.addEventListener("beforeunload", stop);
|
|
8247
8338
|
return () => window.removeEventListener("beforeunload", stop);
|
|
8248
8339
|
}, [unsent]);
|
|
8249
|
-
(0,
|
|
8340
|
+
(0, import_react11.useEffect)(() => {
|
|
8250
8341
|
const el = scroller.current;
|
|
8251
8342
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
8252
8343
|
const watch = new ResizeObserver(() => setRoom(el.clientWidth));
|
|
8253
8344
|
watch.observe(el);
|
|
8254
8345
|
return () => watch.disconnect();
|
|
8255
8346
|
}, [editor, source.data]);
|
|
8256
|
-
(0,
|
|
8347
|
+
(0, import_react11.useEffect)(() => {
|
|
8257
8348
|
const view = window.visualViewport;
|
|
8258
8349
|
const el = root.current;
|
|
8259
8350
|
if (!view || !el) return;
|
|
@@ -8265,7 +8356,7 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8265
8356
|
view.removeEventListener("scroll", lift);
|
|
8266
8357
|
};
|
|
8267
8358
|
}, [editor, source.data]);
|
|
8268
|
-
(0,
|
|
8359
|
+
(0, import_react11.useEffect)(() => {
|
|
8269
8360
|
const el = root.current;
|
|
8270
8361
|
if (!el) return;
|
|
8271
8362
|
const open2 = () => {
|
|
@@ -8275,11 +8366,11 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8275
8366
|
el.addEventListener("docs-find", open2);
|
|
8276
8367
|
return () => el.removeEventListener("docs-find", open2);
|
|
8277
8368
|
}, [editor, source.data]);
|
|
8278
|
-
(0,
|
|
8369
|
+
(0, import_react11.useEffect)(() => {
|
|
8279
8370
|
const shown = pop === "find" ? query : "";
|
|
8280
8371
|
if (editor && searching.getState(editor.state).query !== shown) editor.view.dispatch(editor.state.tr.setMeta(searching, { query: shown }));
|
|
8281
8372
|
}, [editor, pop, query]);
|
|
8282
|
-
(0,
|
|
8373
|
+
(0, import_react11.useEffect)(() => {
|
|
8283
8374
|
const press = (e) => {
|
|
8284
8375
|
if (!(e.metaKey || e.ctrlKey) || e.altKey || e.shiftKey || e.key.toLowerCase() !== "p") return;
|
|
8285
8376
|
e.preventDefault();
|
|
@@ -8289,7 +8380,7 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8289
8380
|
window.addEventListener("keydown", press, true);
|
|
8290
8381
|
return () => window.removeEventListener("keydown", press, true);
|
|
8291
8382
|
});
|
|
8292
|
-
(0,
|
|
8383
|
+
(0, import_react11.useEffect)(() => {
|
|
8293
8384
|
if (!pop) return;
|
|
8294
8385
|
const close = (e) => {
|
|
8295
8386
|
if (!e.target.closest(".w100n-text-pop, [data-pop]")) setPop(null);
|
|
@@ -8306,8 +8397,8 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8306
8397
|
window.removeEventListener("scroll", off, true);
|
|
8307
8398
|
};
|
|
8308
8399
|
}, [pop]);
|
|
8309
|
-
if (source.error) return docx2 ? /* @__PURE__ */ (0,
|
|
8310
|
-
if (!source.data || !editor || !state || live && !live.ready && !live.late && !live.denied) return /* @__PURE__ */ (0,
|
|
8400
|
+
if (source.error) return docx2 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-docs-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DocxView, { bytes, onOutline, failed: t.failed }) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-docs-empty", children: t.failed });
|
|
8401
|
+
if (!source.data || !editor || !state || live && !live.ready && !live.late && !live.denied) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-docs-empty", children: t.loading });
|
|
8311
8402
|
const save2 = async (auto = false) => {
|
|
8312
8403
|
if (live) {
|
|
8313
8404
|
if (!can.edit || !live.ready || !live.online || !live.pending || saving === "busy") return false;
|
|
@@ -8371,7 +8462,7 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8371
8462
|
const { from, to, empty } = editor.state.selection;
|
|
8372
8463
|
if (empty || !can.comment) return;
|
|
8373
8464
|
editor.view.dispatch(editor.state.tr.setMeta(notes, { pending: { from, to } }));
|
|
8374
|
-
setDraft({ quote: editor.state.doc.textBetween(from, to, "\n", " "), body: "" });
|
|
8465
|
+
setDraft({ quote: editor.state.doc.textBetween(from, to, "\n", " "), body: "", give: false });
|
|
8375
8466
|
setPosting("idle");
|
|
8376
8467
|
onPanel?.("comments");
|
|
8377
8468
|
};
|
|
@@ -8384,7 +8475,7 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8384
8475
|
setPosting("busy");
|
|
8385
8476
|
try {
|
|
8386
8477
|
const anchor = uid2();
|
|
8387
|
-
const made2 = await host.comment(documentId, { body: draft.body.trim(), quote: draft.quote, replyTo: null, anchor });
|
|
8478
|
+
const made2 = await host.comment(documentId, { body: draft.body.trim(), quote: draft.quote, replyTo: null, anchor, assignee: draft.give ? tagged(draft.body, people)[0]?.id ?? null : null });
|
|
8388
8479
|
anchors2.current.set(made2.id, anchor);
|
|
8389
8480
|
const range = notes.getState(editor.state).pending;
|
|
8390
8481
|
editor.view.dispatch(editor.state.tr.setMeta(notes, { pending: null, spots: [...notes.getState(editor.state).spots, ...range ? [{ id: made2.id, ...range }] : []] }));
|
|
@@ -8482,11 +8573,11 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8482
8573
|
};
|
|
8483
8574
|
const tool = (icon, label, run3, pressed, disabled) => {
|
|
8484
8575
|
const Icon = icon;
|
|
8485
|
-
return /* @__PURE__ */ (0,
|
|
8576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "aria-label": label, title: label, "aria-pressed": pressed, disabled, onClick: () => {
|
|
8486
8577
|
run3();
|
|
8487
|
-
}, children: /* @__PURE__ */ (0,
|
|
8578
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { "aria-hidden": true }) });
|
|
8488
8579
|
};
|
|
8489
|
-
const gap = /* @__PURE__ */ (0,
|
|
8580
|
+
const gap = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-pdf-gap" });
|
|
8490
8581
|
const known = source.data.styles;
|
|
8491
8582
|
const named3 = (test) => {
|
|
8492
8583
|
const name = known.find(test)?.name;
|
|
@@ -8505,28 +8596,28 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8505
8596
|
];
|
|
8506
8597
|
const margins = [[t.marginsNormal, [96, 96, 96, 96]], [t.marginsNarrow, [48, 48, 48, 48]], [t.marginsWide, [96, 192, 96, 192]]];
|
|
8507
8598
|
const when = (iso) => new Intl.DateTimeFormat(language, { day: "numeric", month: "short", hour: "2-digit", minute: "2-digit" }).format(new Date(iso));
|
|
8508
|
-
const person = (c) => /* @__PURE__ */ (0,
|
|
8509
|
-
c.author.avatarUrl ? /* @__PURE__ */ (0,
|
|
8510
|
-
/* @__PURE__ */ (0,
|
|
8511
|
-
/* @__PURE__ */ (0,
|
|
8599
|
+
const person = (c) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("header", { children: [
|
|
8600
|
+
c.author.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("img", { className: "w100n-text-face", src: c.author.avatarUrl, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-text-face", "aria-hidden": true, children: c.author.name.slice(0, 1).toUpperCase() }),
|
|
8601
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-who", children: [
|
|
8602
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("b", { children: [
|
|
8512
8603
|
c.author.name,
|
|
8513
|
-
c.author.id.startsWith("guest:") && /* @__PURE__ */ (0,
|
|
8604
|
+
c.author.id.startsWith("guest:") && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-docs-badge", children: t.guest })
|
|
8514
8605
|
] }),
|
|
8515
|
-
/* @__PURE__ */ (0,
|
|
8606
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { children: when(c.createdAt) })
|
|
8516
8607
|
] }),
|
|
8517
|
-
drops(c) && /* @__PURE__ */ (0,
|
|
8518
|
-
mine(c) && host.editComment && /* @__PURE__ */ (0,
|
|
8608
|
+
drops(c) && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-own", onClick: (e) => e.stopPropagation(), children: [
|
|
8609
|
+
mine(c) && host.editComment && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "aria-label": t.editComment, title: t.editComment, onClick: () => {
|
|
8519
8610
|
setDropping(null);
|
|
8520
8611
|
setEditing({ id: c.id, body: c.body });
|
|
8521
|
-
}, children: /* @__PURE__ */ (0,
|
|
8522
|
-
host.deleteComment && /* @__PURE__ */ (0,
|
|
8612
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Pencil, { "aria-hidden": true }) }),
|
|
8613
|
+
host.deleteComment && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "data-tone": "red", "aria-label": t.delete, title: t.delete, onClick: () => {
|
|
8523
8614
|
setEditing(null);
|
|
8524
8615
|
setDropping(c.id);
|
|
8525
|
-
}, children: /* @__PURE__ */ (0,
|
|
8616
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Trash2, { "aria-hidden": true }) })
|
|
8526
8617
|
] })
|
|
8527
8618
|
] });
|
|
8528
|
-
const words3 = (c) => editing?.id === c.id ? /* @__PURE__ */ (0,
|
|
8529
|
-
/* @__PURE__ */ (0,
|
|
8619
|
+
const words3 = (c) => editing?.id === c.id ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w100n-text-reply w100n-text-edit", onClick: (e) => e.stopPropagation(), children: [
|
|
8620
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
8530
8621
|
"textarea",
|
|
8531
8622
|
{
|
|
8532
8623
|
autoFocus: true,
|
|
@@ -8538,33 +8629,33 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8538
8629
|
}
|
|
8539
8630
|
}
|
|
8540
8631
|
),
|
|
8541
|
-
/* @__PURE__ */ (0,
|
|
8542
|
-
/* @__PURE__ */ (0,
|
|
8543
|
-
/* @__PURE__ */ (0,
|
|
8544
|
-
/* @__PURE__ */ (0,
|
|
8632
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-pdf-dialog-end", children: [
|
|
8633
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: () => setEditing(null), children: t.cancel }),
|
|
8634
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-docs-action", disabled: !editing.body.trim() || editing.body.trim() === c.body || posting === "busy", onClick: () => void change(c.id, editing.body.trim()), children: [
|
|
8635
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Save, { "aria-hidden": true }),
|
|
8545
8636
|
t.save
|
|
8546
8637
|
] })
|
|
8547
8638
|
] })
|
|
8548
|
-
] }) : dropping === c.id ? /* @__PURE__ */ (0,
|
|
8549
|
-
/* @__PURE__ */ (0,
|
|
8550
|
-
/* @__PURE__ */ (0,
|
|
8551
|
-
/* @__PURE__ */ (0,
|
|
8552
|
-
/* @__PURE__ */ (0,
|
|
8553
|
-
/* @__PURE__ */ (0,
|
|
8639
|
+
] }) : dropping === c.id ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w100n-text-confirm", role: "group", "aria-label": t.delete, onClick: (e) => e.stopPropagation(), children: [
|
|
8640
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: c.replyTo || !all.some((r) => r.replyTo === c.id) ? t.deleteAsk : t.deleteThread }),
|
|
8641
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-pdf-dialog-end", children: [
|
|
8642
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "w100n-pdf-link", autoFocus: true, onClick: () => setDropping(null), children: t.cancel }),
|
|
8643
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", disabled: posting === "busy", onClick: () => void change(c.id, null), children: [
|
|
8644
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Trash2, { "aria-hidden": true }),
|
|
8554
8645
|
t.delete
|
|
8555
8646
|
] })
|
|
8556
8647
|
] })
|
|
8557
|
-
] }) : /* @__PURE__ */ (0,
|
|
8648
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: c.body });
|
|
8558
8649
|
const pick = (next) => setPop(pop === next ? null : next);
|
|
8559
|
-
const swatches = (list, current, set, none) => /* @__PURE__ */ (0,
|
|
8560
|
-
/* @__PURE__ */ (0,
|
|
8650
|
+
const swatches = (list, current, set, none) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-pop w100n-text-swatches", role: "group", children: [
|
|
8651
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "w100n-text-none", onClick: () => {
|
|
8561
8652
|
set(null);
|
|
8562
8653
|
setPop(null);
|
|
8563
8654
|
}, children: none }),
|
|
8564
|
-
list.map((c, i) => /* @__PURE__ */ (0,
|
|
8655
|
+
list.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "aria-label": c, "aria-pressed": current === c, onClick: () => {
|
|
8565
8656
|
set(c);
|
|
8566
8657
|
setPop(null);
|
|
8567
|
-
}, children: /* @__PURE__ */ (0,
|
|
8658
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("i", { style: { background: c } }) }, i))
|
|
8568
8659
|
] });
|
|
8569
8660
|
const mod = /Mac|iPhone|iPad/.test(navigator.platform) ? "\u2318" : "Ctrl+";
|
|
8570
8661
|
const item = (label, run3, more2 = {}) => ({ label, run: run3, ...more2 });
|
|
@@ -8582,9 +8673,10 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8582
8673
|
item(t.print, print, { keys: `${mod}P` }),
|
|
8583
8674
|
...docx2 ? ["-", item(t.pageSetup, () => setDraft2({ width: page.width, height: page.height, margins: page.margins.map(cm), ...marginal }))] : []
|
|
8584
8675
|
] : [],
|
|
8585
|
-
...can.edit && (file?.formats.length || file?.copy || file?.rename) ? ["-"] : [],
|
|
8676
|
+
...can.edit && (file?.formats.length || file?.copy || file?.rename || file?.template) ? ["-"] : [],
|
|
8586
8677
|
...(file?.formats ?? []).map((f) => item(`${t.downloadAs} ${f === "md" ? "Markdown" : f.toUpperCase()}`, () => file.download(f))),
|
|
8587
8678
|
!!file?.copy && item(t.makeCopy, file.copy),
|
|
8679
|
+
!!file?.template && item(t.saveTemplate, file.template),
|
|
8588
8680
|
!!file?.rename && item(t.rename, file.rename)
|
|
8589
8681
|
]],
|
|
8590
8682
|
["edit", t.menuEdit, can.edit ? [
|
|
@@ -8689,17 +8781,17 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8689
8781
|
item(t.deleteColumn, () => editor.chain().focus().deleteColumn().run())
|
|
8690
8782
|
] : []
|
|
8691
8783
|
];
|
|
8692
|
-
const rows = (list) => list.filter((x) => x !== false).filter((x, i, all2) => x !== "-" || i > 0 && all2[i - 1] !== "-" && i < all2.length - 1).map((x, i) => x === "-" ? /* @__PURE__ */ (0,
|
|
8784
|
+
const rows = (list) => list.filter((x) => x !== false).filter((x, i, all2) => x !== "-" || i > 0 && all2[i - 1] !== "-" && i < all2.length - 1).map((x, i) => x === "-" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("hr", {}, i) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", role: x.on === void 0 ? "menuitem" : "menuitemcheckbox", "aria-checked": x.on, disabled: x.off, onClick: () => {
|
|
8693
8785
|
setPop(null);
|
|
8694
8786
|
x.run();
|
|
8695
8787
|
}, children: [
|
|
8696
|
-
/* @__PURE__ */ (0,
|
|
8697
|
-
/* @__PURE__ */ (0,
|
|
8698
|
-
x.keys && /* @__PURE__ */ (0,
|
|
8788
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Check, { "aria-hidden": true }),
|
|
8789
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: x.label }),
|
|
8790
|
+
x.keys && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("kbd", { children: x.keys })
|
|
8699
8791
|
] }, i));
|
|
8700
|
-
const menu = ([key2, label, list]) => /* @__PURE__ */ (0,
|
|
8701
|
-
/* @__PURE__ */ (0,
|
|
8702
|
-
pop === key2 && /* @__PURE__ */ (0,
|
|
8792
|
+
const menu = ([key2, label, list]) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-anchor", children: [
|
|
8793
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "w100n-text-menu-button", "data-pop": true, "aria-haspopup": "menu", "aria-expanded": pop === key2, onClick: () => pick(key2), children: label }),
|
|
8794
|
+
pop === key2 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-text-pop w100n-text-menu", role: "menu", "aria-label": label, children: rows(list) })
|
|
8703
8795
|
] }, key2);
|
|
8704
8796
|
const seek = (next) => {
|
|
8705
8797
|
editor.view.dispatch(editor.state.tr.setMeta(searching, next));
|
|
@@ -8711,11 +8803,11 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8711
8803
|
}
|
|
8712
8804
|
};
|
|
8713
8805
|
const found = searching.getState(editor.state);
|
|
8714
|
-
const finder = /* @__PURE__ */ (0,
|
|
8715
|
-
/* @__PURE__ */ (0,
|
|
8716
|
-
pop === "find" && /* @__PURE__ */ (0,
|
|
8717
|
-
/* @__PURE__ */ (0,
|
|
8718
|
-
/* @__PURE__ */ (0,
|
|
8806
|
+
const finder = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-anchor", children: [
|
|
8807
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "data-pop": true, "aria-expanded": pop === "find", "aria-label": t.findReplace, title: t.findReplace, onClick: () => pick("find"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Search, { "aria-hidden": true }) }),
|
|
8808
|
+
pop === "find" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-pop w100n-text-find", role: "search", "aria-label": t.findReplace, children: [
|
|
8809
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-docs-row", children: [
|
|
8810
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
8719
8811
|
"input",
|
|
8720
8812
|
{
|
|
8721
8813
|
autoFocus: true,
|
|
@@ -8735,23 +8827,23 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8735
8827
|
}
|
|
8736
8828
|
}
|
|
8737
8829
|
),
|
|
8738
|
-
/* @__PURE__ */ (0,
|
|
8739
|
-
/* @__PURE__ */ (0,
|
|
8740
|
-
/* @__PURE__ */ (0,
|
|
8830
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { "aria-live": "polite", children: query ? found?.hits.length ? `${(found.at ?? 0) + 1} / ${found.hits.length}` : t.noHits : "" }),
|
|
8831
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "aria-label": t.previous, title: t.previous, disabled: !found?.hits.length, onClick: () => seek({ at: found.at - 1 }), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.ChevronUp, { "aria-hidden": true }) }),
|
|
8832
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "aria-label": t.next, title: t.next, disabled: !found?.hits.length, onClick: () => seek({ at: found.at + 1 }), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.ChevronDown, { "aria-hidden": true }) })
|
|
8741
8833
|
] }),
|
|
8742
|
-
can.edit && /* @__PURE__ */ (0,
|
|
8743
|
-
/* @__PURE__ */ (0,
|
|
8744
|
-
/* @__PURE__ */ (0,
|
|
8834
|
+
can.edit && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-docs-row", children: [
|
|
8835
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { value: swap, placeholder: t.replaceWith, "aria-label": t.replaceWith, onChange: (e) => setSwap(e.target.value) }),
|
|
8836
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "w100n-pdf-link", disabled: !found?.hits.length, onClick: () => {
|
|
8745
8837
|
replace(editor, swap, false);
|
|
8746
8838
|
seek({});
|
|
8747
8839
|
}, children: t.replaceOne }),
|
|
8748
|
-
/* @__PURE__ */ (0,
|
|
8840
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "w100n-docs-action", disabled: !found?.hits.length, onClick: () => {
|
|
8749
8841
|
replace(editor, swap, true);
|
|
8750
8842
|
seek({});
|
|
8751
8843
|
}, children: t.replaceAll })
|
|
8752
8844
|
] }),
|
|
8753
|
-
/* @__PURE__ */ (0,
|
|
8754
|
-
/* @__PURE__ */ (0,
|
|
8845
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "w100n-setup-check", children: [
|
|
8846
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", checked: matchCase, onChange: (e) => {
|
|
8755
8847
|
setMatchCase(e.target.checked);
|
|
8756
8848
|
seek({ matchCase: e.target.checked, at: 0 });
|
|
8757
8849
|
} }),
|
|
@@ -8776,47 +8868,47 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8776
8868
|
spacing(editor, { line: paint2.block.line, after: paint2.block.after });
|
|
8777
8869
|
if (!paint2.keep) setPaint(null);
|
|
8778
8870
|
};
|
|
8779
|
-
const fontPicker = /* @__PURE__ */ (0,
|
|
8780
|
-
/* @__PURE__ */ (0,
|
|
8781
|
-
/* @__PURE__ */ (0,
|
|
8782
|
-
/* @__PURE__ */ (0,
|
|
8871
|
+
const fontPicker = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-anchor", children: [
|
|
8872
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-text-picker", "data-size": "mid", "data-pop": true, "aria-haspopup": "listbox", "aria-expanded": pop === "font", "aria-label": t.font, title: t.font, onClick: () => pick("font"), children: [
|
|
8873
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { fontFamily: state.font ?? void 0 }, children: state.font ?? t.defaultFont }),
|
|
8874
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.ChevronDown, { "aria-hidden": true })
|
|
8783
8875
|
] }),
|
|
8784
|
-
pop === "font" && /* @__PURE__ */ (0,
|
|
8785
|
-
/* @__PURE__ */ (0,
|
|
8876
|
+
pop === "font" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-pop w100n-text-styles", role: "listbox", "aria-label": t.font, children: [
|
|
8877
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", role: "option", "aria-selected": !state.font, onClick: () => {
|
|
8786
8878
|
editor.chain().focus().unsetFontFamily().run();
|
|
8787
8879
|
setPop(null);
|
|
8788
8880
|
}, children: t.defaultFont }),
|
|
8789
|
-
faces.map((f) => /* @__PURE__ */ (0,
|
|
8881
|
+
faces.map((f) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", role: "option", "aria-selected": state.font === f, style: { fontFamily: f }, onClick: () => {
|
|
8790
8882
|
editor.chain().focus().setFontFamily(f).run();
|
|
8791
8883
|
setPop(null);
|
|
8792
8884
|
}, children: f }, f))
|
|
8793
8885
|
] })
|
|
8794
8886
|
] });
|
|
8795
|
-
const sizePicker = /* @__PURE__ */ (0,
|
|
8796
|
-
/* @__PURE__ */ (0,
|
|
8887
|
+
const sizePicker = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-anchor", children: [
|
|
8888
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-text-picker", "data-size": "small", "data-pop": true, "aria-haspopup": "listbox", "aria-expanded": pop === "size", "aria-label": t.fontSize, title: t.fontSize, onClick: () => pick("size"), children: [
|
|
8797
8889
|
state.size ? parseFloat(state.size) : t.defaultFont,
|
|
8798
|
-
/* @__PURE__ */ (0,
|
|
8890
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.ChevronDown, { "aria-hidden": true })
|
|
8799
8891
|
] }),
|
|
8800
|
-
pop === "size" && /* @__PURE__ */ (0,
|
|
8801
|
-
/* @__PURE__ */ (0,
|
|
8892
|
+
pop === "size" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-pop w100n-text-styles", role: "listbox", "aria-label": t.fontSize, children: [
|
|
8893
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", role: "option", "aria-selected": !state.size, onClick: () => {
|
|
8802
8894
|
editor.chain().focus().unsetFontSize().run();
|
|
8803
8895
|
setPop(null);
|
|
8804
8896
|
}, children: t.defaultFont }),
|
|
8805
|
-
sizes.map((n) => /* @__PURE__ */ (0,
|
|
8897
|
+
sizes.map((n) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", role: "option", "aria-selected": state.size !== null && parseFloat(state.size) === n, onClick: () => {
|
|
8806
8898
|
editor.chain().focus().setFontSize(`${n}pt`).run();
|
|
8807
8899
|
setPop(null);
|
|
8808
8900
|
}, children: n }, n))
|
|
8809
8901
|
] })
|
|
8810
8902
|
] });
|
|
8811
|
-
const spacer = /* @__PURE__ */ (0,
|
|
8812
|
-
/* @__PURE__ */ (0,
|
|
8813
|
-
pop === "spacing" && /* @__PURE__ */ (0,
|
|
8814
|
-
lines2.map(([v, label]) => /* @__PURE__ */ (0,
|
|
8903
|
+
const spacer = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-anchor", children: [
|
|
8904
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "data-pop": true, "aria-expanded": pop === "spacing", "aria-label": t.lineSpacing, title: t.lineSpacing, onClick: () => pick("spacing"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.UnfoldVertical, { "aria-hidden": true }) }),
|
|
8905
|
+
pop === "spacing" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-pop w100n-text-styles", role: "listbox", "aria-label": t.lineSpacing, children: [
|
|
8906
|
+
lines2.map(([v, label]) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", role: "option", "aria-selected": state.line === v, onClick: () => {
|
|
8815
8907
|
spacing(editor, { line: v });
|
|
8816
8908
|
setPop(null);
|
|
8817
8909
|
}, children: label }, v)),
|
|
8818
|
-
/* @__PURE__ */ (0,
|
|
8819
|
-
/* @__PURE__ */ (0,
|
|
8910
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("hr", {}),
|
|
8911
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", role: "option", "aria-selected": false, onClick: () => {
|
|
8820
8912
|
spacing(editor, { after: state.after === 0 ? 8 : 0 });
|
|
8821
8913
|
setPop(null);
|
|
8822
8914
|
}, children: state.after === 0 ? t.spaceAfter : t.noSpaceAfter })
|
|
@@ -8839,18 +8931,18 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8839
8931
|
setDraft2(null);
|
|
8840
8932
|
};
|
|
8841
8933
|
const zooms = [50, 75, 90, 100, 125, 150, 200];
|
|
8842
|
-
const zoomer = /* @__PURE__ */ (0,
|
|
8843
|
-
/* @__PURE__ */ (0,
|
|
8934
|
+
const zoomer = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-anchor", children: [
|
|
8935
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-text-picker", "data-size": "small", "data-pop": true, "aria-haspopup": "listbox", "aria-expanded": pop === "zoom", "aria-label": t.zoom, title: t.zoom, onClick: () => pick("zoom"), children: [
|
|
8844
8936
|
percent,
|
|
8845
8937
|
"%",
|
|
8846
|
-
/* @__PURE__ */ (0,
|
|
8938
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.ChevronDown, { "aria-hidden": true })
|
|
8847
8939
|
] }),
|
|
8848
|
-
pop === "zoom" && /* @__PURE__ */ (0,
|
|
8849
|
-
docx2 && /* @__PURE__ */ (0,
|
|
8940
|
+
pop === "zoom" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-pop w100n-text-styles", role: "listbox", "aria-label": t.zoom, children: [
|
|
8941
|
+
docx2 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", role: "option", "aria-selected": zoom === null, onClick: () => {
|
|
8850
8942
|
setZoom(null);
|
|
8851
8943
|
setPop(null);
|
|
8852
8944
|
}, children: t.fitWidth }),
|
|
8853
|
-
zooms.map((z) => /* @__PURE__ */ (0,
|
|
8945
|
+
zooms.map((z) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", role: "option", "aria-selected": zoom === z, onClick: () => {
|
|
8854
8946
|
setZoom(z);
|
|
8855
8947
|
setPop(null);
|
|
8856
8948
|
}, children: [
|
|
@@ -8860,9 +8952,9 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8860
8952
|
] })
|
|
8861
8953
|
] });
|
|
8862
8954
|
const Aligned = aligns.find(([, , value3]) => value3 === state.align)?.[0] ?? import_lucide_react5.AlignLeft;
|
|
8863
|
-
const aligner = /* @__PURE__ */ (0,
|
|
8864
|
-
/* @__PURE__ */ (0,
|
|
8865
|
-
pop === "align" && /* @__PURE__ */ (0,
|
|
8955
|
+
const aligner = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-anchor", children: [
|
|
8956
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "data-pop": true, "aria-expanded": pop === "align", "aria-label": t.align, title: t.align, onClick: () => pick("align"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Aligned, { "aria-hidden": true }) }),
|
|
8957
|
+
pop === "align" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-text-pop", role: "group", "aria-label": t.align, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-text-tools", children: aligns.map(([icon, label, value3], i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.Fragment, { children: tool(icon, label, () => {
|
|
8866
8958
|
align2(editor, value3);
|
|
8867
8959
|
setPop(null);
|
|
8868
8960
|
}, state.align === value3) }, i)) }) })
|
|
@@ -8871,13 +8963,13 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8871
8963
|
localStorage.setItem("w100n-docs-more", more ? "" : "1");
|
|
8872
8964
|
setMore(!more);
|
|
8873
8965
|
};
|
|
8874
|
-
const main = can.edit ? /* @__PURE__ */ (0,
|
|
8875
|
-
/* @__PURE__ */ (0,
|
|
8876
|
-
/* @__PURE__ */ (0,
|
|
8966
|
+
const main = can.edit ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
8967
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-anchor", children: [
|
|
8968
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-text-picker", "data-size": "mid", "data-pop": true, "aria-haspopup": "listbox", "aria-expanded": pop === "style", "aria-label": t.paragraphStyle, title: t.paragraphStyle, onClick: () => pick("style"), children: [
|
|
8877
8969
|
styles2.find(([key2]) => key2 === state.style)?.[1] ?? t.normal,
|
|
8878
|
-
/* @__PURE__ */ (0,
|
|
8970
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.ChevronDown, { "aria-hidden": true })
|
|
8879
8971
|
] }),
|
|
8880
|
-
pop === "style" && /* @__PURE__ */ (0,
|
|
8972
|
+
pop === "style" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-text-pop w100n-text-styles", role: "listbox", "aria-label": t.paragraphStyle, children: styles2.map(([key2, label, run3]) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
8881
8973
|
"button",
|
|
8882
8974
|
{
|
|
8883
8975
|
type: "button",
|
|
@@ -8898,10 +8990,10 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8898
8990
|
tool(import_lucide_react5.Italic, t.italic, () => editor.chain().focus().toggleItalic().run(), state.italic),
|
|
8899
8991
|
docx2 ? tool(import_lucide_react5.Underline, t.underline, () => editor.chain().focus().toggleUnderline().run(), state.underline) : tool(import_lucide_react5.Strikethrough, t.strike, () => editor.chain().focus().toggleStrike().run(), state.strike),
|
|
8900
8992
|
!docx2 && tool(import_lucide_react5.Code, t.code, () => editor.chain().focus().toggleCode().run(), state.code),
|
|
8901
|
-
docx2 && /* @__PURE__ */ (0,
|
|
8902
|
-
/* @__PURE__ */ (0,
|
|
8903
|
-
/* @__PURE__ */ (0,
|
|
8904
|
-
/* @__PURE__ */ (0,
|
|
8993
|
+
docx2 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-anchor", children: [
|
|
8994
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", "data-pop": true, "aria-expanded": pop === "color", "aria-label": t.textColour, title: t.textColour, onClick: () => pick("color"), children: [
|
|
8995
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Baseline, { "aria-hidden": true }),
|
|
8996
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("i", { className: "w100n-text-bar", style: { background: state.color ?? "currentColor" } })
|
|
8905
8997
|
] }),
|
|
8906
8998
|
pop === "color" && swatches(inks, state.color, (c) => c ? editor.chain().focus().setColor(c).run() : editor.chain().focus().unsetColor().run(), t.automatic)
|
|
8907
8999
|
] }),
|
|
@@ -8911,35 +9003,35 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8911
9003
|
tool(import_lucide_react5.ListOrdered, t.numbers, () => editor.chain().focus().toggleOrderedList().run(), state.numbers),
|
|
8912
9004
|
!docx2 && tool(import_lucide_react5.ListChecks, t.tasks, () => editor.chain().focus().toggleTaskList().run(), state.tasks),
|
|
8913
9005
|
gap,
|
|
8914
|
-
/* @__PURE__ */ (0,
|
|
8915
|
-
/* @__PURE__ */ (0,
|
|
8916
|
-
pop === "link" && /* @__PURE__ */ (0,
|
|
8917
|
-
/* @__PURE__ */ (0,
|
|
9006
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-anchor", children: [
|
|
9007
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "data-pop": true, "aria-expanded": pop === "link", "aria-pressed": state.link, "aria-label": t.link, title: t.link, onClick: () => pop === "link" ? setPop(null) : linkUp(), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Link, { "aria-hidden": true }) }),
|
|
9008
|
+
pop === "link" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-pop w100n-text-form", children: [
|
|
9009
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { autoFocus: true, value: href, placeholder: t.linkAddress, "aria-label": t.linkAddress, onChange: (e) => setHref(e.target.value), onKeyDown: (e) => {
|
|
8918
9010
|
if (e.key === "Enter") putLink();
|
|
8919
9011
|
} }),
|
|
8920
|
-
/* @__PURE__ */ (0,
|
|
8921
|
-
state.link && /* @__PURE__ */ (0,
|
|
9012
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-docs-row", children: [
|
|
9013
|
+
state.link && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-pdf-link", onClick: () => {
|
|
8922
9014
|
editor.chain().focus().extendMarkRange("link").unsetLink().run();
|
|
8923
9015
|
setPop(null);
|
|
8924
9016
|
}, children: [
|
|
8925
|
-
/* @__PURE__ */ (0,
|
|
9017
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Link2Off, { "aria-hidden": true }),
|
|
8926
9018
|
t.unlink
|
|
8927
9019
|
] }),
|
|
8928
|
-
/* @__PURE__ */ (0,
|
|
8929
|
-
/* @__PURE__ */ (0,
|
|
9020
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-docs-action", disabled: !href.trim(), onClick: putLink, children: [
|
|
9021
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Link, { "aria-hidden": true }),
|
|
8930
9022
|
t.apply
|
|
8931
9023
|
] })
|
|
8932
9024
|
] })
|
|
8933
9025
|
] })
|
|
8934
9026
|
] }),
|
|
8935
9027
|
can.comment && tool(import_lucide_react5.MessageSquarePlus, t.addComment, begin, void 0, state.empty),
|
|
8936
|
-
/* @__PURE__ */ (0,
|
|
8937
|
-
/* @__PURE__ */ (0,
|
|
9028
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-anchor", children: [
|
|
9029
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "data-pop": true, "aria-expanded": pop === "image", "aria-label": t.image, title: t.image, onClick: () => {
|
|
8938
9030
|
setHref("");
|
|
8939
9031
|
pick("image");
|
|
8940
|
-
}, children: /* @__PURE__ */ (0,
|
|
8941
|
-
pop === "image" && /* @__PURE__ */ (0,
|
|
8942
|
-
/* @__PURE__ */ (0,
|
|
9032
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.ImagePlus, { "aria-hidden": true }) }),
|
|
9033
|
+
pop === "image" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-pop w100n-text-form", children: [
|
|
9034
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
8943
9035
|
"input",
|
|
8944
9036
|
{
|
|
8945
9037
|
autoFocus: true,
|
|
@@ -8955,10 +9047,10 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8955
9047
|
}
|
|
8956
9048
|
}
|
|
8957
9049
|
),
|
|
8958
|
-
/* @__PURE__ */ (0,
|
|
8959
|
-
docx2 && /* @__PURE__ */ (0,
|
|
9050
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-docs-row", children: [
|
|
9051
|
+
docx2 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "w100n-pdf-link", children: [
|
|
8960
9052
|
t.chooseFile,
|
|
8961
|
-
/* @__PURE__ */ (0,
|
|
9053
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "file", accept: "image/png,image/jpeg,image/gif", hidden: true, onChange: (e) => {
|
|
8962
9054
|
const file2 = e.target.files?.[0];
|
|
8963
9055
|
if (!file2) return;
|
|
8964
9056
|
const reader = new FileReader();
|
|
@@ -8969,23 +9061,23 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8969
9061
|
reader.readAsDataURL(file2);
|
|
8970
9062
|
} })
|
|
8971
9063
|
] }),
|
|
8972
|
-
/* @__PURE__ */ (0,
|
|
9064
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-docs-action", disabled: !href.trim(), onClick: () => {
|
|
8973
9065
|
editor.chain().focus().setImage({ src: href.trim() }).run();
|
|
8974
9066
|
setPop(null);
|
|
8975
9067
|
}, children: [
|
|
8976
|
-
/* @__PURE__ */ (0,
|
|
9068
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.ImagePlus, { "aria-hidden": true }),
|
|
8977
9069
|
t.put
|
|
8978
9070
|
] })
|
|
8979
9071
|
] })
|
|
8980
9072
|
] })
|
|
8981
9073
|
] }),
|
|
8982
|
-
/* @__PURE__ */ (0,
|
|
8983
|
-
/* @__PURE__ */ (0,
|
|
8984
|
-
pop === "table" && /* @__PURE__ */ (0,
|
|
8985
|
-
/* @__PURE__ */ (0,
|
|
9074
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-anchor", children: [
|
|
9075
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "data-pop": true, "aria-expanded": pop === "table", "aria-label": t.table, title: t.table, onClick: () => pick("table"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Table, { "aria-hidden": true }) }),
|
|
9076
|
+
pop === "table" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-pop w100n-text-grid", role: "group", "aria-label": t.table, onPointerLeave: () => setGrid({ rows: 0, cols: 0 }), children: [
|
|
9077
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: Array.from({ length: 48 }, (_, i) => {
|
|
8986
9078
|
const rows2 = Math.floor(i / 8) + 1;
|
|
8987
9079
|
const cols = i % 8 + 1;
|
|
8988
|
-
return /* @__PURE__ */ (0,
|
|
9080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
8989
9081
|
"button",
|
|
8990
9082
|
{
|
|
8991
9083
|
type: "button",
|
|
@@ -9000,31 +9092,31 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9000
9092
|
i
|
|
9001
9093
|
);
|
|
9002
9094
|
}) }),
|
|
9003
|
-
/* @__PURE__ */ (0,
|
|
9095
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { children: grid3.rows ? `${grid3.rows} \xD7 ${grid3.cols}` : t.table })
|
|
9004
9096
|
] })
|
|
9005
9097
|
] }),
|
|
9006
9098
|
gap,
|
|
9007
|
-
/* @__PURE__ */ (0,
|
|
9008
|
-
] }) : /* @__PURE__ */ (0,
|
|
9009
|
-
/* @__PURE__ */ (0,
|
|
9010
|
-
/* @__PURE__ */ (0,
|
|
9099
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "aria-expanded": more, "aria-label": more ? t.fewerTools : t.moreTools, title: more ? t.fewerTools : t.moreTools, onClick: widen, children: more ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.ChevronDown, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.ChevronUp, { "aria-hidden": true }) })
|
|
9100
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
9101
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-text-word", onClick: () => onPanel?.("outline"), children: [
|
|
9102
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.ListTree, { "aria-hidden": true }),
|
|
9011
9103
|
t.outline
|
|
9012
9104
|
] }),
|
|
9013
|
-
can.comment && /* @__PURE__ */ (0,
|
|
9014
|
-
/* @__PURE__ */ (0,
|
|
9015
|
-
/* @__PURE__ */ (0,
|
|
9016
|
-
/* @__PURE__ */ (0,
|
|
9105
|
+
can.comment && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
9106
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-text-grow" }),
|
|
9107
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-docs-action", disabled: state.empty, onClick: begin, children: [
|
|
9108
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.MessageSquarePlus, { "aria-hidden": true }),
|
|
9017
9109
|
t.addComment
|
|
9018
9110
|
] })
|
|
9019
9111
|
] }),
|
|
9020
|
-
!!host?.comments && (can.comment || open.length > 0) && /* @__PURE__ */ (0,
|
|
9021
|
-
/* @__PURE__ */ (0,
|
|
9112
|
+
!!host?.comments && (can.comment || open.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-text-word", onClick: () => onPanel?.("comments"), children: [
|
|
9113
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.MessagesSquare, { "aria-hidden": true }),
|
|
9022
9114
|
t.comments,
|
|
9023
|
-
/* @__PURE__ */ (0,
|
|
9115
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("b", { children: open.length })
|
|
9024
9116
|
] })
|
|
9025
9117
|
] });
|
|
9026
|
-
const extra = can.edit && more && /* @__PURE__ */ (0,
|
|
9027
|
-
docx2 && /* @__PURE__ */ (0,
|
|
9118
|
+
const extra = can.edit && more && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
9119
|
+
docx2 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
9028
9120
|
fontPicker,
|
|
9029
9121
|
sizePicker,
|
|
9030
9122
|
gap
|
|
@@ -9032,11 +9124,11 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9032
9124
|
docx2 && tool(import_lucide_react5.Strikethrough, t.strike, () => editor.chain().focus().toggleStrike().run(), state.strike),
|
|
9033
9125
|
docx2 && tool(import_lucide_react5.Superscript, t.superscript, () => editor.chain().focus().toggleMark("superscript").run(), state.sup),
|
|
9034
9126
|
docx2 && tool(import_lucide_react5.Subscript, t.subscript, () => editor.chain().focus().toggleMark("subscript").run(), state.sub),
|
|
9035
|
-
docx2 && /* @__PURE__ */ (0,
|
|
9036
|
-
/* @__PURE__ */ (0,
|
|
9127
|
+
docx2 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-anchor", children: [
|
|
9128
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "data-pop": true, "aria-expanded": pop === "mark", "aria-pressed": state.glow, "aria-label": t.highlight, title: t.highlight, onClick: () => pick("mark"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Highlighter, { "aria-hidden": true }) }),
|
|
9037
9129
|
pop === "mark" && swatches(glows, null, (c) => c ? editor.chain().focus().setHighlight({ color: c }).run() : editor.chain().focus().unsetHighlight().run(), t.noColour)
|
|
9038
9130
|
] }),
|
|
9039
|
-
docx2 && /* @__PURE__ */ (0,
|
|
9131
|
+
docx2 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
9040
9132
|
gap,
|
|
9041
9133
|
spacer
|
|
9042
9134
|
] }),
|
|
@@ -9044,24 +9136,24 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9044
9136
|
tool(import_lucide_react5.ListIndentIncrease, t.indent, () => indent(editor, 1)),
|
|
9045
9137
|
docx2 && tool(import_lucide_react5.ListChecks, t.tasks, () => editor.chain().focus().toggleTaskList().run(), state.tasks),
|
|
9046
9138
|
gap,
|
|
9047
|
-
/* @__PURE__ */ (0,
|
|
9139
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "aria-label": t.painter, title: paint2 ? t.painterHint : t.painter, "aria-pressed": !!paint2, onClick: () => take(false), onDoubleClick: () => take(true), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.PaintRoller, { "aria-hidden": true }) }),
|
|
9048
9140
|
tool(import_lucide_react5.RemoveFormatting, t.clearFormat, () => clear(editor)),
|
|
9049
|
-
docx2 && /* @__PURE__ */ (0,
|
|
9141
|
+
docx2 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
9050
9142
|
gap,
|
|
9051
9143
|
tool(import_lucide_react5.FilePenLine, t.suggest, suggest, state.suggest)
|
|
9052
9144
|
] })
|
|
9053
9145
|
] });
|
|
9054
|
-
const context = can.edit && (state.table ? /* @__PURE__ */ (0,
|
|
9146
|
+
const context = can.edit && (state.table ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
9055
9147
|
tool(import_lucide_react5.BetweenHorizontalStart, t.rowAbove, () => editor.chain().focus().addRowBefore().run()),
|
|
9056
9148
|
tool(import_lucide_react5.BetweenHorizontalEnd, t.rowBelow, () => editor.chain().focus().addRowAfter().run()),
|
|
9057
9149
|
tool(import_lucide_react5.BetweenVerticalStart, t.columnLeft, () => editor.chain().focus().addColumnBefore().run()),
|
|
9058
9150
|
tool(import_lucide_react5.BetweenVerticalEnd, t.columnRight, () => editor.chain().focus().addColumnAfter().run()),
|
|
9059
9151
|
tool(import_lucide_react5.PanelTop, t.headerRow, () => editor.chain().focus().toggleHeaderRow().run()),
|
|
9060
9152
|
docx2 && tool(import_lucide_react5.TableCellsMerge, t.mergeCells, () => editor.chain().focus().mergeOrSplit().run()),
|
|
9061
|
-
docx2 && /* @__PURE__ */ (0,
|
|
9062
|
-
/* @__PURE__ */ (0,
|
|
9063
|
-
/* @__PURE__ */ (0,
|
|
9064
|
-
/* @__PURE__ */ (0,
|
|
9153
|
+
docx2 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-anchor", children: [
|
|
9154
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", "data-pop": true, "aria-expanded": pop === "fill", "aria-label": t.cellFill, title: t.cellFill, onClick: () => pick("fill"), children: [
|
|
9155
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.PaintBucket, { "aria-hidden": true }),
|
|
9156
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("i", { className: "w100n-text-bar", style: { background: state.fill ?? "transparent" } })
|
|
9065
9157
|
] }),
|
|
9066
9158
|
pop === "fill" && swatches(glows, state.fill, (c) => editor.chain().focus().setCellAttribute("background", c).run(), t.noColour)
|
|
9067
9159
|
] }),
|
|
@@ -9069,33 +9161,33 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9069
9161
|
tool(import_lucide_react5.TableRowsSplit, t.deleteRow, () => editor.chain().focus().deleteRow().run()),
|
|
9070
9162
|
tool(import_lucide_react5.TableColumnsSplit, t.deleteColumn, () => editor.chain().focus().deleteColumn().run()),
|
|
9071
9163
|
tool(import_lucide_react5.Trash2, t.deleteTable, () => editor.chain().focus().deleteTable().run())
|
|
9072
|
-
] }) : state.img && /* @__PURE__ */ (0,
|
|
9073
|
-
const status = (can.edit || live) && /* @__PURE__ */ (0,
|
|
9074
|
-
live && (live.ready ? !live.online : live.late || live.denied) && /* @__PURE__ */ (0,
|
|
9075
|
-
/* @__PURE__ */ (0,
|
|
9164
|
+
] }) : state.img && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: [[import_lucide_react5.Image, t.wrapInline, "inline"], [import_lucide_react5.PanelLeft, t.wrapLeft, "left"], [import_lucide_react5.PanelRight, t.wrapRight, "right"]].map(([icon, label, value3]) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.Fragment, { children: tool(icon, label, () => editor.chain().focus().updateAttributes("image", { wrap: value3 === "inline" ? null : value3 }).run(), state.img === value3) }, value3)) }));
|
|
9165
|
+
const status = (can.edit || live) && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-end", children: [
|
|
9166
|
+
live && (live.ready ? !live.online : live.late || live.denied) && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-live", title: live.denied ? void 0 : t.offlineHint, children: [
|
|
9167
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.WifiOff, { "aria-hidden": true }),
|
|
9076
9168
|
live.denied ? t.liveOff : t.offline
|
|
9077
9169
|
] }),
|
|
9078
|
-
state.suggest && /* @__PURE__ */ (0,
|
|
9079
|
-
can.edit && saving === "failed" && /* @__PURE__ */ (0,
|
|
9080
|
-
/* @__PURE__ */ (0,
|
|
9081
|
-
/* @__PURE__ */ (0,
|
|
9170
|
+
state.suggest && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-docs-badge", children: t.suggesting }),
|
|
9171
|
+
can.edit && saving === "failed" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-text-saved", title: `${t.save} (${mod}S)`, onClick: () => void save2(), children: [
|
|
9172
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.CloudAlert, { "aria-hidden": true }),
|
|
9173
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: t.saveFailed })
|
|
9082
9174
|
] }),
|
|
9083
|
-
live && live.people.length > 0 && /* @__PURE__ */ (0,
|
|
9175
|
+
live && live.people.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-text-people", role: "group", "aria-label": t.people, children: live.people.map((p) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-text-face", title: p.me ? `${p.name} (${t.you})` : p.name, style: { "--face": p.color }, children: p.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("img", { src: p.avatarUrl, alt: "" }) : p.name.split(/\s+/).map((w) => w[0]).join("").slice(0, 2).toUpperCase() }, p.id)) })
|
|
9084
9176
|
] });
|
|
9085
|
-
const menubar = /* @__PURE__ */ (0,
|
|
9177
|
+
const menubar = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-text-menus", role: "menubar", "aria-label": t.textTools, children: menus.filter(([, , list]) => list.some((x) => x && x !== "-")).map(menu) });
|
|
9086
9178
|
const keep = (e) => {
|
|
9087
9179
|
if (e.target.closest("button")) e.preventDefault();
|
|
9088
9180
|
};
|
|
9089
9181
|
const sheet2 = docx2 ? { "--page-w": `${page.width}px`, "--page-h": `${page.height}px`, "--mt": `${page.margins[0]}px`, "--mr": `${page.margins[1]}px`, "--mb": `${page.margins[2]}px`, "--ml": `${page.margins[3]}px` } : void 0;
|
|
9090
|
-
return /* @__PURE__ */ (0,
|
|
9091
|
-
head2 ? /* @__PURE__ */ (0,
|
|
9092
|
-
head2.menus && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0,
|
|
9093
|
-
head2.status && status && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0,
|
|
9094
|
-
] }) : /* @__PURE__ */ (0,
|
|
9182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { ref: root, className: "w100n-text", "data-kind": kind, "data-docs-find": true, onKeyDown: keys2, children: [
|
|
9183
|
+
head2 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
9184
|
+
head2.menus && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-text-ribbon w100n-text-docbar", onKeyDown: rove, onPointerDown: keep, children: menubar }), head2.menus),
|
|
9185
|
+
head2.status && status && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-text-ribbon w100n-text-docbar", onPointerDown: keep, children: status }), head2.status)
|
|
9186
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w100n-text-ribbon w100n-text-top", onKeyDown: rove, onPointerDown: keep, children: [
|
|
9095
9187
|
menubar,
|
|
9096
9188
|
status
|
|
9097
9189
|
] }),
|
|
9098
|
-
/* @__PURE__ */ (0,
|
|
9190
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: scroller, className: "w100n-text-scroll", "data-paint": !!paint2, onMouseUp: lay, onPointerDown: (e) => {
|
|
9099
9191
|
touch.current = e.pointerType === "touch";
|
|
9100
9192
|
}, onContextMenu: (e) => {
|
|
9101
9193
|
if (touch.current || e.shiftKey || pop === "context" || !e.target.closest(".ProseMirror")) return setPop(null);
|
|
@@ -9118,49 +9210,49 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9118
9210
|
if (!id) return;
|
|
9119
9211
|
setActive(id);
|
|
9120
9212
|
onPanel?.("comments");
|
|
9121
|
-
}, children: /* @__PURE__ */ (0,
|
|
9122
|
-
pop === "context" && /* @__PURE__ */ (0,
|
|
9213
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-text-zoomed", style: { zoom: percent / 100 }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: docx2 ? `w100n-text-sheet${flow ? " is-flow" : ""}` : "w100n-docs-page w100n-text-column", style: sheet2, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react10.EditorContent, { editor }) }) }) }),
|
|
9214
|
+
pop === "context" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-pop w100n-text-menu w100n-text-context", role: "menu", "aria-label": t.textTools, style: { left: spot3.x, top: spot3.y }, onPointerDown: keep, children: [
|
|
9123
9215
|
rows(near),
|
|
9124
|
-
spell && /* @__PURE__ */ (0,
|
|
9216
|
+
spell && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { className: "w100n-text-hint", children: t.spellHint })
|
|
9125
9217
|
] }),
|
|
9126
|
-
/* @__PURE__ */ (0,
|
|
9218
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-text-ribbon w100n-text-corner", "data-side": "left", onPointerDown: keep, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w100n-text-tools", role: "group", "aria-label": t.zoom, children: [
|
|
9127
9219
|
tool(import_lucide_react5.Minus, t.zoomOut, () => zoomBy(-10)),
|
|
9128
9220
|
zoomer,
|
|
9129
9221
|
tool(import_lucide_react5.Plus, t.zoomIn, () => zoomBy(10))
|
|
9130
9222
|
] }) }),
|
|
9131
|
-
/* @__PURE__ */ (0,
|
|
9132
|
-
context && /* @__PURE__ */ (0,
|
|
9133
|
-
extra && /* @__PURE__ */ (0,
|
|
9134
|
-
/* @__PURE__ */ (0,
|
|
9223
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w100n-text-ribbon w100n-text-island", role: "toolbar", "aria-label": t.textTools, onKeyDown: rove, onPointerDown: keep, children: [
|
|
9224
|
+
context && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-text-tools", role: "group", "aria-label": state.table ? t.table : t.image, children: context }),
|
|
9225
|
+
extra && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-text-tools", role: "group", "aria-label": t.moreTools, children: extra }),
|
|
9226
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-text-tools", role: "group", "aria-label": t.textTools, children: main })
|
|
9135
9227
|
] }),
|
|
9136
|
-
/* @__PURE__ */ (0,
|
|
9137
|
-
can.edit && /* @__PURE__ */ (0,
|
|
9228
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-text-ribbon w100n-text-corner", "data-side": "right", onPointerDown: keep, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w100n-text-tools", role: "group", "aria-label": t.findReplace, children: [
|
|
9229
|
+
can.edit && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
9138
9230
|
tool(import_lucide_react5.Undo2, t.undo, () => editor.chain().focus().undo().run(), void 0, !state.undo),
|
|
9139
9231
|
tool(import_lucide_react5.Redo2, t.redo, () => editor.chain().focus().redo().run(), void 0, !state.redo),
|
|
9140
9232
|
gap
|
|
9141
9233
|
] }),
|
|
9142
9234
|
finder
|
|
9143
9235
|
] }) }),
|
|
9144
|
-
dialog && /* @__PURE__ */ (0,
|
|
9236
|
+
dialog && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-pdf-back", onKeyDown: (e) => {
|
|
9145
9237
|
if (e.key === "Escape") {
|
|
9146
9238
|
e.stopPropagation();
|
|
9147
9239
|
setDialog(null);
|
|
9148
9240
|
}
|
|
9149
|
-
}, children: dialog.kind === "symbol" ? /* @__PURE__ */ (0,
|
|
9150
|
-
/* @__PURE__ */ (0,
|
|
9151
|
-
/* @__PURE__ */ (0,
|
|
9152
|
-
/* @__PURE__ */ (0,
|
|
9153
|
-
/* @__PURE__ */ (0,
|
|
9241
|
+
}, children: dialog.kind === "symbol" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w100n-pdf-dialog w100n-insert", role: "dialog", "aria-modal": true, "aria-label": t.symbols, children: [
|
|
9242
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w100n-new-head", children: [
|
|
9243
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-new-tile", "data-tone": "pink", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Omega, { "aria-hidden": true }) }),
|
|
9244
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("b", { className: "w100n-pdf-dialog-title", children: t.symbols }),
|
|
9245
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "w100n-docs-close", onClick: () => setDialog(null), "aria-label": t.close, title: t.close, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.X, { "aria-hidden": true }) })
|
|
9154
9246
|
] }),
|
|
9155
|
-
/* @__PURE__ */ (0,
|
|
9156
|
-
/* @__PURE__ */ (0,
|
|
9157
|
-
/* @__PURE__ */ (0,
|
|
9247
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "w100n-docs-field w100n-docs-search", children: [
|
|
9248
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Search, { "aria-hidden": true }),
|
|
9249
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { autoFocus: true, value: dialog.query, placeholder: t.symbolSearch, "aria-label": t.symbolSearch, onChange: (e) => setDialog({ kind: "symbol", query: e.target.value }) })
|
|
9158
9250
|
] }),
|
|
9159
|
-
/* @__PURE__ */ (0,
|
|
9251
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-insert-grid", role: "group", "aria-label": t.symbols, children: symbols.filter(([ch, name]) => !dialog.query.trim() || name.includes(dialog.query.trim().toLowerCase()) || ch === dialog.query.trim()).map(([ch, name]) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "aria-label": name, title: name, onClick: () => {
|
|
9160
9252
|
editor.chain().focus().insertContent(ch).run();
|
|
9161
9253
|
setDialog(null);
|
|
9162
9254
|
}, children: ch }, ch)) })
|
|
9163
|
-
] }) : dialog.kind === "formula" ? /* @__PURE__ */ (0,
|
|
9255
|
+
] }) : dialog.kind === "formula" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("form", { className: "w100n-pdf-dialog w100n-insert", role: "dialog", "aria-modal": true, "aria-label": t.formula, onSubmit: (e) => {
|
|
9164
9256
|
e.preventDefault();
|
|
9165
9257
|
const latex = dialog.latex.trim();
|
|
9166
9258
|
if (!latex) return;
|
|
@@ -9171,13 +9263,13 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9171
9263
|
else editor.chain().focus().insertContent({ type: "math", attrs: { latex } }).run();
|
|
9172
9264
|
setDialog(null);
|
|
9173
9265
|
}, children: [
|
|
9174
|
-
/* @__PURE__ */ (0,
|
|
9175
|
-
/* @__PURE__ */ (0,
|
|
9176
|
-
/* @__PURE__ */ (0,
|
|
9177
|
-
/* @__PURE__ */ (0,
|
|
9266
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w100n-new-head", children: [
|
|
9267
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-new-tile", "data-tone": "blue", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Sigma, { "aria-hidden": true }) }),
|
|
9268
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("b", { className: "w100n-pdf-dialog-title", children: t.formula }),
|
|
9269
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "w100n-docs-close", onClick: () => setDialog(null), "aria-label": t.close, title: t.close, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.X, { "aria-hidden": true }) })
|
|
9178
9270
|
] }),
|
|
9179
|
-
/* @__PURE__ */ (0,
|
|
9180
|
-
/* @__PURE__ */ (0,
|
|
9271
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { ref: field, autoFocus: true, className: "w100n-insert-latex", value: dialog.latex, "aria-label": t.formula, placeholder: "F = 900 + 12 \\\\cdot n", onChange: (e) => setDialog({ ...dialog, latex: e.target.value }) }),
|
|
9272
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-insert-tools", role: "group", "aria-label": t.formula, children: helpers.map(([label, code]) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", onClick: () => {
|
|
9181
9273
|
const el = field.current;
|
|
9182
9274
|
const at2 = el.selectionStart ?? dialog.latex.length;
|
|
9183
9275
|
const latex = dialog.latex.slice(0, at2) + code + dialog.latex.slice(el.selectionEnd ?? at2);
|
|
@@ -9188,15 +9280,15 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9188
9280
|
el.setSelectionRange(caret, caret);
|
|
9189
9281
|
});
|
|
9190
9282
|
}, children: label }, label)) }),
|
|
9191
|
-
/* @__PURE__ */ (0,
|
|
9192
|
-
/* @__PURE__ */ (0,
|
|
9193
|
-
/* @__PURE__ */ (0,
|
|
9194
|
-
/* @__PURE__ */ (0,
|
|
9195
|
-
/* @__PURE__ */ (0,
|
|
9283
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-insert-preview", "aria-live": "polite", dangerouslySetInnerHTML: { __html: dialog.latex.trim() ? mathml(dialog.latex) : "" } }),
|
|
9284
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-pdf-dialog-end", children: [
|
|
9285
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: () => setDialog(null), children: t.cancel }),
|
|
9286
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "submit", className: "w100n-docs-action", disabled: !dialog.latex.trim(), children: [
|
|
9287
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Check, { "aria-hidden": true }),
|
|
9196
9288
|
dialog.at !== null ? t.update : t.put
|
|
9197
9289
|
] })
|
|
9198
9290
|
] })
|
|
9199
|
-
] }) : /* @__PURE__ */ (0,
|
|
9291
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("form", { className: "w100n-pdf-dialog w100n-insert", role: "dialog", "aria-modal": true, "aria-label": t.footnote, onSubmit: (e) => {
|
|
9200
9292
|
e.preventDefault();
|
|
9201
9293
|
const text = dialog.text.trim();
|
|
9202
9294
|
if (!text) return;
|
|
@@ -9213,12 +9305,12 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9213
9305
|
}
|
|
9214
9306
|
setDialog(null);
|
|
9215
9307
|
}, children: [
|
|
9216
|
-
/* @__PURE__ */ (0,
|
|
9217
|
-
/* @__PURE__ */ (0,
|
|
9218
|
-
/* @__PURE__ */ (0,
|
|
9219
|
-
/* @__PURE__ */ (0,
|
|
9308
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w100n-new-head", children: [
|
|
9309
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-new-tile", "data-tone": "violet", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Superscript, { "aria-hidden": true }) }),
|
|
9310
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("b", { className: "w100n-pdf-dialog-title", children: t.footnote }),
|
|
9311
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "w100n-docs-close", onClick: () => setDialog(null), "aria-label": t.close, title: t.close, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.X, { "aria-hidden": true }) })
|
|
9220
9312
|
] }),
|
|
9221
|
-
/* @__PURE__ */ (0,
|
|
9313
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
9222
9314
|
"textarea",
|
|
9223
9315
|
{
|
|
9224
9316
|
autoFocus: true,
|
|
@@ -9232,40 +9324,40 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9232
9324
|
}
|
|
9233
9325
|
}
|
|
9234
9326
|
),
|
|
9235
|
-
/* @__PURE__ */ (0,
|
|
9236
|
-
dialog.at !== null && /* @__PURE__ */ (0,
|
|
9327
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-pdf-dialog-end", children: [
|
|
9328
|
+
dialog.at !== null && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: () => {
|
|
9237
9329
|
editor.chain().focus().deleteRange({ from: dialog.at, to: dialog.at + 1 }).run();
|
|
9238
9330
|
setDialog(null);
|
|
9239
9331
|
}, children: t.removeFootnote }),
|
|
9240
|
-
/* @__PURE__ */ (0,
|
|
9241
|
-
/* @__PURE__ */ (0,
|
|
9242
|
-
/* @__PURE__ */ (0,
|
|
9332
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: () => setDialog(null), children: t.cancel }),
|
|
9333
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "submit", className: "w100n-docs-action", disabled: !dialog.text.trim(), children: [
|
|
9334
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Check, { "aria-hidden": true }),
|
|
9243
9335
|
dialog.at !== null ? t.update : t.put
|
|
9244
9336
|
] })
|
|
9245
9337
|
] })
|
|
9246
9338
|
] }) }),
|
|
9247
|
-
draft2 && /* @__PURE__ */ (0,
|
|
9339
|
+
draft2 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-pdf-back", onKeyDown: (e) => {
|
|
9248
9340
|
if (e.key === "Escape") {
|
|
9249
9341
|
e.stopPropagation();
|
|
9250
9342
|
setDraft2(null);
|
|
9251
9343
|
}
|
|
9252
|
-
}, children: /* @__PURE__ */ (0,
|
|
9344
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("form", { className: "w100n-pdf-dialog w100n-setup", role: "dialog", "aria-modal": true, "aria-label": t.pageSetup, onSubmit: (e) => {
|
|
9253
9345
|
e.preventDefault();
|
|
9254
9346
|
applySetup();
|
|
9255
9347
|
}, children: [
|
|
9256
|
-
/* @__PURE__ */ (0,
|
|
9257
|
-
/* @__PURE__ */ (0,
|
|
9258
|
-
/* @__PURE__ */ (0,
|
|
9259
|
-
/* @__PURE__ */ (0,
|
|
9348
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w100n-new-head", children: [
|
|
9349
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-new-tile", "data-tone": "blue", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Ruler, { "aria-hidden": true }) }),
|
|
9350
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("b", { className: "w100n-pdf-dialog-title", children: t.pageSetup }),
|
|
9351
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "w100n-docs-close", onClick: () => setDraft2(null), "aria-label": t.close, title: t.close, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.X, { "aria-hidden": true }) })
|
|
9260
9352
|
] }),
|
|
9261
|
-
/* @__PURE__ */ (0,
|
|
9262
|
-
/* @__PURE__ */ (0,
|
|
9353
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "w100n-docs-caption", children: t.pageSize }),
|
|
9354
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.pageSize, children: [["A4", a4], ["Letter", letter], ["Legal", legal]].map(([label, size2]) => {
|
|
9263
9355
|
const land = draft2.width > draft2.height;
|
|
9264
9356
|
const on2 = Math.abs(Math.min(draft2.width, draft2.height) - size2.width) < 2 && Math.abs(Math.max(draft2.width, draft2.height) - size2.height) < 2;
|
|
9265
|
-
return /* @__PURE__ */ (0,
|
|
9357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "aria-pressed": on2, onClick: () => setDraft2({ ...draft2, width: land ? size2.height : size2.width, height: land ? size2.width : size2.height }), children: label }, label);
|
|
9266
9358
|
}) }),
|
|
9267
|
-
/* @__PURE__ */ (0,
|
|
9268
|
-
/* @__PURE__ */ (0,
|
|
9359
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "w100n-docs-caption", children: t.orientation }),
|
|
9360
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.orientation, children: [[false, t.portrait], [true, t.landscape]].map(([land, label]) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
9269
9361
|
"button",
|
|
9270
9362
|
{
|
|
9271
9363
|
type: "button",
|
|
@@ -9277,11 +9369,11 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9277
9369
|
},
|
|
9278
9370
|
label
|
|
9279
9371
|
)) }),
|
|
9280
|
-
/* @__PURE__ */ (0,
|
|
9281
|
-
/* @__PURE__ */ (0,
|
|
9282
|
-
/* @__PURE__ */ (0,
|
|
9283
|
-
/* @__PURE__ */ (0,
|
|
9284
|
-
/* @__PURE__ */ (0,
|
|
9372
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "w100n-docs-caption", children: t.marginsCm }),
|
|
9373
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.margins, children: margins.map(([label, values]) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "aria-pressed": values.every((v, n) => Math.abs(cm(v) - draft2.margins[n]) < 0.05), onClick: () => setDraft2({ ...draft2, margins: values.map(cm) }), children: label }, label)) }),
|
|
9374
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-setup-grid", children: [t.mTop, t.mRight, t.mBottom, t.mLeft].map((label, n) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { children: [
|
|
9375
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: label }),
|
|
9376
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
9285
9377
|
"input",
|
|
9286
9378
|
{
|
|
9287
9379
|
className: "w100n-docs-field",
|
|
@@ -9294,130 +9386,111 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9294
9386
|
}
|
|
9295
9387
|
)
|
|
9296
9388
|
] }, n)) }),
|
|
9297
|
-
/* @__PURE__ */ (0,
|
|
9298
|
-
/* @__PURE__ */ (0,
|
|
9299
|
-
/* @__PURE__ */ (0,
|
|
9389
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "w100n-setup-line", children: [
|
|
9390
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: t.headerText }),
|
|
9391
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { className: "w100n-docs-field", value: draft2.header, onChange: (e) => setDraft2({ ...draft2, header: e.target.value }) })
|
|
9300
9392
|
] }),
|
|
9301
|
-
/* @__PURE__ */ (0,
|
|
9302
|
-
/* @__PURE__ */ (0,
|
|
9303
|
-
/* @__PURE__ */ (0,
|
|
9393
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "w100n-setup-line", children: [
|
|
9394
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: t.footerText }),
|
|
9395
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { className: "w100n-docs-field", value: draft2.footer, onChange: (e) => setDraft2({ ...draft2, footer: e.target.value }) })
|
|
9304
9396
|
] }),
|
|
9305
|
-
/* @__PURE__ */ (0,
|
|
9306
|
-
/* @__PURE__ */ (0,
|
|
9397
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "w100n-setup-check", children: [
|
|
9398
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", checked: draft2.numbers, onChange: (e) => setDraft2({ ...draft2, numbers: e.target.checked }) }),
|
|
9307
9399
|
t.pageNumbers
|
|
9308
9400
|
] }),
|
|
9309
|
-
/* @__PURE__ */ (0,
|
|
9310
|
-
/* @__PURE__ */ (0,
|
|
9311
|
-
/* @__PURE__ */ (0,
|
|
9312
|
-
/* @__PURE__ */ (0,
|
|
9401
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w100n-pdf-dialog-end", children: [
|
|
9402
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: () => setDraft2(null), children: t.cancel }),
|
|
9403
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-docs-action", onClick: applySetup, children: [
|
|
9404
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Check, { "aria-hidden": true }),
|
|
9313
9405
|
t.apply
|
|
9314
9406
|
] })
|
|
9315
9407
|
] })
|
|
9316
9408
|
] }) }),
|
|
9317
|
-
slot && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0,
|
|
9318
|
-
draft && /* @__PURE__ */ (0,
|
|
9319
|
-
/* @__PURE__ */ (0,
|
|
9320
|
-
/* @__PURE__ */ (0,
|
|
9321
|
-
|
|
9322
|
-
{
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
|
|
9327
|
-
|
|
9328
|
-
|
|
9329
|
-
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) void post();
|
|
9330
|
-
}
|
|
9331
|
-
}
|
|
9332
|
-
),
|
|
9333
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "w100n-pdf-dialog-end", children: [
|
|
9334
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: drop2, children: t.cancel }),
|
|
9335
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { type: "button", className: "w100n-docs-action", disabled: !draft.body.trim() || posting === "busy", onClick: () => void post(), children: [
|
|
9336
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react5.MessageSquarePlus, { "aria-hidden": true }),
|
|
9409
|
+
slot && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w100n-text-notes", children: [
|
|
9410
|
+
draft && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w100n-text-card w100n-text-draft", children: [
|
|
9411
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("blockquote", { children: draft.quote }),
|
|
9412
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Mentions, { autoFocus: true, value: draft.body, placeholder: t.writeComment, label: t.writeComment, people, onChange: (body) => setDraft({ ...draft, body }), onSend: () => void post() }),
|
|
9413
|
+
tagged(draft.body, people).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "w100n-setup-check", children: [
|
|
9414
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", checked: draft.give, onChange: (e) => setDraft({ ...draft, give: e.target.checked }) }),
|
|
9415
|
+
t.assignTo.replace("{name}", tagged(draft.body, people)[0].name)
|
|
9416
|
+
] }),
|
|
9417
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-pdf-dialog-end", children: [
|
|
9418
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: drop2, children: t.cancel }),
|
|
9419
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-docs-action", disabled: !draft.body.trim() || posting === "busy", onClick: () => void post(), children: [
|
|
9420
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.MessageSquarePlus, { "aria-hidden": true }),
|
|
9337
9421
|
t.post
|
|
9338
9422
|
] })
|
|
9339
9423
|
] })
|
|
9340
9424
|
] }),
|
|
9341
|
-
suggested.length > 0 && /* @__PURE__ */ (0,
|
|
9342
|
-
/* @__PURE__ */ (0,
|
|
9343
|
-
/* @__PURE__ */ (0,
|
|
9425
|
+
suggested.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
9426
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
9427
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.FilePenLine, { "aria-hidden": true }),
|
|
9344
9428
|
t.suggestions,
|
|
9345
|
-
/* @__PURE__ */ (0,
|
|
9429
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: suggested.length })
|
|
9346
9430
|
] }),
|
|
9347
|
-
suggested.map((c, i) => /* @__PURE__ */ (0,
|
|
9348
|
-
/* @__PURE__ */ (0,
|
|
9349
|
-
/* @__PURE__ */ (0,
|
|
9350
|
-
/* @__PURE__ */ (0,
|
|
9351
|
-
/* @__PURE__ */ (0,
|
|
9352
|
-
c.date && /* @__PURE__ */ (0,
|
|
9431
|
+
suggested.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("article", { className: "w100n-text-card w100n-text-change", "data-kind": c.kind, onClick: () => jump(c.from), children: [
|
|
9432
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("header", { children: [
|
|
9433
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-text-face", "aria-hidden": true, children: (c.author || "?").slice(0, 1).toUpperCase() }),
|
|
9434
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-who", children: [
|
|
9435
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("b", { children: c.author || t.someone }),
|
|
9436
|
+
c.date && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { children: when(c.date) })
|
|
9353
9437
|
] })
|
|
9354
9438
|
] }),
|
|
9355
|
-
/* @__PURE__ */ (0,
|
|
9439
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { children: [
|
|
9356
9440
|
c.kind === "insertion" ? t.added : t.removed,
|
|
9357
9441
|
" ",
|
|
9358
|
-
/* @__PURE__ */ (0,
|
|
9442
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("q", { children: c.text })
|
|
9359
9443
|
] }),
|
|
9360
|
-
can.edit && /* @__PURE__ */ (0,
|
|
9361
|
-
/* @__PURE__ */ (0,
|
|
9362
|
-
/* @__PURE__ */ (0,
|
|
9444
|
+
can.edit && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-actions", onClick: (e) => e.stopPropagation(), children: [
|
|
9445
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "green", onClick: () => decide(editor, true, c.id), children: [
|
|
9446
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Check, { "aria-hidden": true }),
|
|
9363
9447
|
t.accept
|
|
9364
9448
|
] }),
|
|
9365
|
-
/* @__PURE__ */ (0,
|
|
9366
|
-
/* @__PURE__ */ (0,
|
|
9449
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", onClick: () => decide(editor, false, c.id), children: [
|
|
9450
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.X, { "aria-hidden": true }),
|
|
9367
9451
|
t.reject
|
|
9368
9452
|
] })
|
|
9369
9453
|
] })
|
|
9370
9454
|
] }, i))
|
|
9371
9455
|
] }),
|
|
9372
|
-
posting === "failed" && /* @__PURE__ */ (0,
|
|
9373
|
-
failed && /* @__PURE__ */ (0,
|
|
9374
|
-
/* @__PURE__ */ (0,
|
|
9375
|
-
/* @__PURE__ */ (0,
|
|
9376
|
-
/* @__PURE__ */ (0,
|
|
9456
|
+
posting === "failed" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.commentFailed }),
|
|
9457
|
+
failed && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.changeFailed }),
|
|
9458
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w100n-docs-row", children: [
|
|
9459
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
9460
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.MessagesSquare, { "aria-hidden": true }),
|
|
9377
9461
|
t.comments,
|
|
9378
|
-
/* @__PURE__ */ (0,
|
|
9462
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: open.length })
|
|
9379
9463
|
] }),
|
|
9380
|
-
/* @__PURE__ */ (0,
|
|
9464
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-docs-chips", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "aria-pressed": resolved, onClick: () => setResolved(!resolved), children: t.showResolved }) })
|
|
9381
9465
|
] }),
|
|
9382
|
-
!threads.length && !draft && /* @__PURE__ */ (0,
|
|
9383
|
-
threads.map((c) => /* @__PURE__ */ (0,
|
|
9466
|
+
!threads.length && !draft && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "w100n-docs-muted", children: can.comment ? t.commentHint : t.noComments }),
|
|
9467
|
+
threads.map((c) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("article", { className: "w100n-text-card", "aria-current": active === c.id, "data-resolved": c.resolved, onClick: () => show(c), children: [
|
|
9384
9468
|
person(c),
|
|
9385
|
-
c.
|
|
9469
|
+
c.assignee && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-text-given", "data-me": c.assignee.id === host?.me.id, children: c.assignee.id === host?.me.id ? t.assignedYou : t.assignedTo.replace("{name}", c.assignee.name) }),
|
|
9470
|
+
c.quote && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("blockquote", { children: c.quote }),
|
|
9386
9471
|
words3(c),
|
|
9387
|
-
all.filter((r) => r.replyTo === c.id).map((r) => /* @__PURE__ */ (0,
|
|
9472
|
+
all.filter((r) => r.replyTo === c.id).map((r) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w100n-text-reply", children: [
|
|
9388
9473
|
person(r),
|
|
9389
9474
|
words3(r)
|
|
9390
9475
|
] }, r.id)),
|
|
9391
|
-
reply?.id === c.id && /* @__PURE__ */ (0,
|
|
9392
|
-
/* @__PURE__ */ (0,
|
|
9393
|
-
|
|
9394
|
-
{
|
|
9395
|
-
|
|
9396
|
-
|
|
9397
|
-
placeholder: t.writeComment,
|
|
9398
|
-
"aria-label": t.reply,
|
|
9399
|
-
onChange: (e) => setReply({ ...reply, body: e.target.value }),
|
|
9400
|
-
onKeyDown: (e) => {
|
|
9401
|
-
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) void answer(c);
|
|
9402
|
-
}
|
|
9403
|
-
}
|
|
9404
|
-
),
|
|
9405
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "w100n-pdf-dialog-end", children: [
|
|
9406
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: () => setReply(null), children: t.cancel }),
|
|
9407
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { type: "button", className: "w100n-docs-action", disabled: !reply.body.trim() || posting === "busy", onClick: () => void answer(c), children: [
|
|
9408
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react5.Reply, { "aria-hidden": true }),
|
|
9476
|
+
reply?.id === c.id && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w100n-text-reply", onClick: (e) => e.stopPropagation(), children: [
|
|
9477
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Mentions, { autoFocus: true, value: reply.body, placeholder: t.writeComment, label: t.reply, people, onChange: (body) => setReply({ ...reply, body }), onSend: () => void answer(c) }),
|
|
9478
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-pdf-dialog-end", children: [
|
|
9479
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: () => setReply(null), children: t.cancel }),
|
|
9480
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-docs-action", disabled: !reply.body.trim() || posting === "busy", onClick: () => void answer(c), children: [
|
|
9481
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Reply, { "aria-hidden": true }),
|
|
9409
9482
|
t.reply
|
|
9410
9483
|
] })
|
|
9411
9484
|
] })
|
|
9412
9485
|
] }),
|
|
9413
|
-
can.comment && reply?.id !== c.id && /* @__PURE__ */ (0,
|
|
9414
|
-
c.resolved && /* @__PURE__ */ (0,
|
|
9415
|
-
!c.resolved && /* @__PURE__ */ (0,
|
|
9416
|
-
/* @__PURE__ */ (0,
|
|
9486
|
+
can.comment && reply?.id !== c.id && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-actions", onClick: (e) => e.stopPropagation(), children: [
|
|
9487
|
+
c.resolved && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w100n-docs-badge", children: t.resolved }),
|
|
9488
|
+
!c.resolved && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-docs-action", onClick: () => setReply({ id: c.id, body: "" }), children: [
|
|
9489
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Reply, { "aria-hidden": true }),
|
|
9417
9490
|
t.reply
|
|
9418
9491
|
] }),
|
|
9419
|
-
host?.resolveComment && /* @__PURE__ */ (0,
|
|
9420
|
-
c.resolved ? /* @__PURE__ */ (0,
|
|
9492
|
+
host?.resolveComment && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "green", onClick: () => void settle2(c), children: [
|
|
9493
|
+
c.resolved ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.RotateCcw, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Check, { "aria-hidden": true }),
|
|
9421
9494
|
c.resolved ? t.reopen : t.resolve
|
|
9422
9495
|
] })
|
|
9423
9496
|
] })
|
|
@@ -9425,13 +9498,13 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9425
9498
|
] }), slot)
|
|
9426
9499
|
] });
|
|
9427
9500
|
}
|
|
9428
|
-
var
|
|
9501
|
+
var import_react10, import_lucide_react5, import_react11, import_react_dom2, import_jsx_runtime7, legal, symbols, helpers, cm, inks, glows, faces, sizes, uid2;
|
|
9429
9502
|
var init_TextEditor = __esm({
|
|
9430
9503
|
"src/editor/TextEditor.tsx"() {
|
|
9431
9504
|
"use strict";
|
|
9432
|
-
|
|
9505
|
+
import_react10 = require("@tiptap/react");
|
|
9433
9506
|
import_lucide_react5 = require("lucide-react");
|
|
9434
|
-
|
|
9507
|
+
import_react11 = require("react");
|
|
9435
9508
|
import_react_dom2 = require("react-dom");
|
|
9436
9509
|
init_docx();
|
|
9437
9510
|
init_focus();
|
|
@@ -9441,8 +9514,9 @@ var init_TextEditor = __esm({
|
|
|
9441
9514
|
init_live();
|
|
9442
9515
|
init_markdown();
|
|
9443
9516
|
init_math();
|
|
9517
|
+
init_Mentions();
|
|
9444
9518
|
init_pager();
|
|
9445
|
-
|
|
9519
|
+
import_jsx_runtime7 = require("react/jsx-runtime");
|
|
9446
9520
|
legal = { width: 816, height: 1344 };
|
|
9447
9521
|
symbols = [
|
|
9448
9522
|
["\xA9", "copyright"],
|
|
@@ -10118,21 +10192,21 @@ function autoSum(r, numeric2) {
|
|
|
10118
10192
|
}
|
|
10119
10193
|
function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSaveRequest, guard, host, together, documentId = "", onSaved }) {
|
|
10120
10194
|
const t = sheetTexts[language];
|
|
10121
|
-
const box2 = (0,
|
|
10122
|
-
const live = (0,
|
|
10195
|
+
const box2 = (0, import_react12.useRef)(null);
|
|
10196
|
+
const live = (0, import_react12.useRef)(null);
|
|
10123
10197
|
const room = useLive(together ? host : void 0, documentId, kind, bytes, void 0, language, rights.edit && !!onSaveRequest, onSaved);
|
|
10124
10198
|
const shared = room?.ready ? room.wire : null;
|
|
10125
10199
|
const waiting2 = !!room && !shared && !room.late && !room.denied;
|
|
10126
|
-
const [phase, setPhase] = (0,
|
|
10127
|
-
const [attempt, setAttempt] = (0,
|
|
10128
|
-
const [dirty, setDirty] = (0,
|
|
10129
|
-
const [saving, setSaving] = (0,
|
|
10130
|
-
const [refusal, setRefusal] = (0,
|
|
10131
|
-
const [pop, setPop] = (0,
|
|
10132
|
-
const [look, setLook] = (0,
|
|
10200
|
+
const [phase, setPhase] = (0, import_react12.useState)("loading");
|
|
10201
|
+
const [attempt, setAttempt] = (0, import_react12.useState)(0);
|
|
10202
|
+
const [dirty, setDirty] = (0, import_react12.useState)(false);
|
|
10203
|
+
const [saving, setSaving] = (0, import_react12.useState)("idle");
|
|
10204
|
+
const [refusal, setRefusal] = (0, import_react12.useState)(null);
|
|
10205
|
+
const [pop, setPop] = (0, import_react12.useState)(null);
|
|
10206
|
+
const [look, setLook] = (0, import_react12.useState)(null);
|
|
10133
10207
|
const edit = rights.edit && !!onSaveRequest && (!room || !!shared && !room.readonly);
|
|
10134
10208
|
const notes3 = !edit && rights.comment && !!onSaveRequest && !room;
|
|
10135
|
-
(0,
|
|
10209
|
+
(0, import_react12.useEffect)(() => {
|
|
10136
10210
|
if (waiting2) return;
|
|
10137
10211
|
let gone = false;
|
|
10138
10212
|
let stop = () => {
|
|
@@ -10224,15 +10298,15 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
|
|
|
10224
10298
|
live.current = null;
|
|
10225
10299
|
};
|
|
10226
10300
|
}, [bytes, kind, attempt, shared, waiting2]);
|
|
10227
|
-
(0,
|
|
10301
|
+
(0, import_react12.useEffect)(() => {
|
|
10228
10302
|
live.current?.marks?.show((room?.people ?? []).flatMap((p) => !p.me && p.selection ? [{ ...p.selection, color: p.color }] : []));
|
|
10229
10303
|
}, [room?.people, phase]);
|
|
10230
|
-
(0,
|
|
10304
|
+
(0, import_react12.useEffect)(() => {
|
|
10231
10305
|
live.current?.api.setLocale(language === "pl" ? "plPL" : "enUS");
|
|
10232
10306
|
}, [language]);
|
|
10233
10307
|
const pending2 = room ? room.pending : dirty;
|
|
10234
10308
|
const unsent = room ? room.unsynced && edit : dirty;
|
|
10235
|
-
(0,
|
|
10309
|
+
(0, import_react12.useEffect)(() => {
|
|
10236
10310
|
if (!unsent) return;
|
|
10237
10311
|
const stop = (e) => e.preventDefault();
|
|
10238
10312
|
window.addEventListener("beforeunload", stop);
|
|
@@ -10274,7 +10348,7 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
|
|
|
10274
10348
|
return false;
|
|
10275
10349
|
}
|
|
10276
10350
|
};
|
|
10277
|
-
(0,
|
|
10351
|
+
(0, import_react12.useEffect)(() => {
|
|
10278
10352
|
if (!guard || room || !dirty) return;
|
|
10279
10353
|
guard.current = save2;
|
|
10280
10354
|
return () => {
|
|
@@ -10300,15 +10374,15 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
|
|
|
10300
10374
|
setPop(null);
|
|
10301
10375
|
}
|
|
10302
10376
|
};
|
|
10303
|
-
const tool = (Icon, label, onClick, pressed) => /* @__PURE__ */ (0,
|
|
10304
|
-
const gap = /* @__PURE__ */ (0,
|
|
10305
|
-
const anchor = (key2, trigger, body) => /* @__PURE__ */ (0,
|
|
10377
|
+
const tool = (Icon, label, onClick, pressed) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", "aria-label": label, title: label, "aria-pressed": pressed, disabled: phase !== "ready", onClick, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { "aria-hidden": true }) });
|
|
10378
|
+
const gap = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "w100n-sheet-gap" });
|
|
10379
|
+
const anchor = (key2, trigger, body) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "w100n-sheet-anchor", children: [
|
|
10306
10380
|
trigger,
|
|
10307
|
-
pop === key2 && /* @__PURE__ */ (0,
|
|
10381
|
+
pop === key2 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "w100n-sheet-pop", role: "dialog", children: body })
|
|
10308
10382
|
] });
|
|
10309
|
-
const opener = (key2, Icon, label, bar) => /* @__PURE__ */ (0,
|
|
10310
|
-
/* @__PURE__ */ (0,
|
|
10311
|
-
bar !== void 0 && /* @__PURE__ */ (0,
|
|
10383
|
+
const opener = (key2, Icon, label, bar) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("button", { type: "button", "aria-label": label, title: label, "aria-expanded": pop === key2, disabled: phase !== "ready", onClick: () => setPop(pop === key2 ? null : key2), children: [
|
|
10384
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { "aria-hidden": true }),
|
|
10385
|
+
bar !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("i", { className: "w100n-sheet-bar", style: { background: bar || "currentColor" } })
|
|
10312
10386
|
] });
|
|
10313
10387
|
const currency = language === "pl" ? '#,##0.00 "z\u0142"' : language === "uk" ? '#,##0.00 "\u20B4"' : '"$"#,##0.00';
|
|
10314
10388
|
const formats = [
|
|
@@ -10340,22 +10414,22 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
|
|
|
10340
10414
|
if (rows) ws.deleteRows(r.startRow, r.endRow - r.startRow + 1);
|
|
10341
10415
|
else ws.deleteColumns(r.startColumn, r.endColumn - r.startColumn + 1);
|
|
10342
10416
|
};
|
|
10343
|
-
const swatches = (list, pick, none, reset, current) => /* @__PURE__ */ (0,
|
|
10344
|
-
list.map((c, i) => /* @__PURE__ */ (0,
|
|
10345
|
-
/* @__PURE__ */ (0,
|
|
10417
|
+
const swatches = (list, pick, none, reset, current) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "w100n-sheet-swatches", children: [
|
|
10418
|
+
list.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", "aria-label": c, "aria-pressed": current.toLowerCase() === c, onClick: () => pick(c), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("i", { style: { background: c } }) }, i)),
|
|
10419
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: "w100n-sheet-none", onClick: reset, children: none })
|
|
10346
10420
|
] });
|
|
10347
|
-
return /* @__PURE__ */ (0,
|
|
10348
|
-
/* @__PURE__ */ (0,
|
|
10421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "w100n-sheet", "data-theme": theme, onKeyDownCapture: keys2, children: [
|
|
10422
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "w100n-sheet-ribbon", role: "toolbar", "aria-label": t.tools, onKeyDown: rove, onPointerDown: (e) => {
|
|
10349
10423
|
if (e.target.closest("button")) e.preventDefault();
|
|
10350
10424
|
}, children: [
|
|
10351
|
-
/* @__PURE__ */ (0,
|
|
10352
|
-
edit && /* @__PURE__ */ (0,
|
|
10425
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "w100n-sheet-tools", children: [
|
|
10426
|
+
edit && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
10353
10427
|
tool(import_lucide_react6.Undo2, t.undo, () => void api()?.undo()),
|
|
10354
10428
|
tool(import_lucide_react6.Redo2, t.redo, () => void api()?.redo()),
|
|
10355
10429
|
gap,
|
|
10356
10430
|
anchor(
|
|
10357
10431
|
"format",
|
|
10358
|
-
/* @__PURE__ */ (0,
|
|
10432
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
10359
10433
|
"button",
|
|
10360
10434
|
{
|
|
10361
10435
|
type: "button",
|
|
@@ -10366,12 +10440,12 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
|
|
|
10366
10440
|
disabled: phase !== "ready",
|
|
10367
10441
|
onClick: () => setPop(pop === "format" ? null : "format"),
|
|
10368
10442
|
children: [
|
|
10369
|
-
/* @__PURE__ */ (0,
|
|
10370
|
-
/* @__PURE__ */ (0,
|
|
10443
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: shown }),
|
|
10444
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react6.ChevronDown, { "aria-hidden": true })
|
|
10371
10445
|
]
|
|
10372
10446
|
}
|
|
10373
10447
|
),
|
|
10374
|
-
/* @__PURE__ */ (0,
|
|
10448
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "w100n-sheet-list", children: formats.map(([label, pattern], i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
10375
10449
|
"button",
|
|
10376
10450
|
{
|
|
10377
10451
|
type: "button",
|
|
@@ -10382,7 +10456,7 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
|
|
|
10382
10456
|
},
|
|
10383
10457
|
children: [
|
|
10384
10458
|
label,
|
|
10385
|
-
/* @__PURE__ */ (0,
|
|
10459
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("small", { children: pattern === "General" ? "" : pattern })
|
|
10386
10460
|
]
|
|
10387
10461
|
},
|
|
10388
10462
|
i
|
|
@@ -10422,8 +10496,8 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
|
|
|
10422
10496
|
anchor(
|
|
10423
10497
|
"border",
|
|
10424
10498
|
opener("border", import_lucide_react6.Grid2x2, t.borders),
|
|
10425
|
-
/* @__PURE__ */ (0,
|
|
10426
|
-
/* @__PURE__ */ (0,
|
|
10499
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "w100n-sheet-list", children: [[import_lucide_react6.Grid2x2, t.borderAll, "all"], [import_lucide_react6.Square, t.borderOuter, "outside"], [import_lucide_react6.PanelBottom, t.borderBottom, "bottom"], [import_lucide_react6.SquareDashed, t.borderNone, "none"]].map(([Icon, label, type]) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("button", { type: "button", onClick: () => border(type), children: [
|
|
10500
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { "aria-hidden": true }),
|
|
10427
10501
|
label
|
|
10428
10502
|
] }, type)) })
|
|
10429
10503
|
),
|
|
@@ -10443,17 +10517,17 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
|
|
|
10443
10517
|
anchor(
|
|
10444
10518
|
"freeze",
|
|
10445
10519
|
opener("freeze", import_lucide_react6.Snowflake, t.freeze),
|
|
10446
|
-
/* @__PURE__ */ (0,
|
|
10447
|
-
/* @__PURE__ */ (0,
|
|
10520
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "w100n-sheet-list", children: [
|
|
10521
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", onClick: () => {
|
|
10448
10522
|
sheet2()?.setFrozenRows(1);
|
|
10449
10523
|
setPop(null);
|
|
10450
10524
|
}, children: t.freezeRow }),
|
|
10451
|
-
/* @__PURE__ */ (0,
|
|
10525
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", onClick: () => {
|
|
10452
10526
|
sheet2()?.setFrozenColumns(1);
|
|
10453
10527
|
setPop(null);
|
|
10454
10528
|
}, children: t.freezeColumn }),
|
|
10455
|
-
/* @__PURE__ */ (0,
|
|
10456
|
-
/* @__PURE__ */ (0,
|
|
10529
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", onClick: () => run3("sheet.command.set-selection-frozen"), children: t.freezeHere }),
|
|
10530
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", onClick: () => {
|
|
10457
10531
|
sheet2()?.cancelFreeze();
|
|
10458
10532
|
setPop(null);
|
|
10459
10533
|
}, children: t.freezeNone })
|
|
@@ -10469,34 +10543,34 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
|
|
|
10469
10543
|
(edit || notes3) && tool(import_lucide_react6.StickyNote, t.note, () => run3("sheet.operation.add-note-popup")),
|
|
10470
10544
|
tool(import_lucide_react6.Search, t.find, () => run3("ui.operation.open-find-dialog"))
|
|
10471
10545
|
] }),
|
|
10472
|
-
/* @__PURE__ */ (0,
|
|
10473
|
-
room && (room.ready ? !room.online : room.late || room.denied) && /* @__PURE__ */ (0,
|
|
10474
|
-
/* @__PURE__ */ (0,
|
|
10546
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "w100n-sheet-end", children: [
|
|
10547
|
+
room && (room.ready ? !room.online : room.late || room.denied) && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "w100n-text-live", title: room.denied ? void 0 : t.offlineHint, children: [
|
|
10548
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react6.WifiOff, { "aria-hidden": true }),
|
|
10475
10549
|
room.denied ? t.liveOff : t.offline
|
|
10476
10550
|
] }),
|
|
10477
|
-
room && room.people.length > 0 && /* @__PURE__ */ (0,
|
|
10478
|
-
!edit && /* @__PURE__ */ (0,
|
|
10479
|
-
saving === "failed" && /* @__PURE__ */ (0,
|
|
10480
|
-
(edit || notes3) && /* @__PURE__ */ (0,
|
|
10481
|
-
/* @__PURE__ */ (0,
|
|
10551
|
+
room && room.people.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "w100n-text-people", role: "group", "aria-label": t.people, children: room.people.map((p) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "w100n-text-face", title: p.me ? `${p.name} (${t.you})` : p.name, style: { "--face": p.color }, children: p.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("img", { src: p.avatarUrl, alt: "" }) : p.name.split(/\s+/).map((w) => w[0]).join("").slice(0, 2).toUpperCase() }, p.id)) }),
|
|
10552
|
+
!edit && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "w100n-docs-badge", children: notes3 ? t.notesOnly : t.viewOnly }),
|
|
10553
|
+
saving === "failed" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "w100n-sheet-muted", role: "alert", children: refusal ? t.refused[refusal.code].replace("{sheet}", refusal.sheet) : t.saveFailed }),
|
|
10554
|
+
(edit || notes3) && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("button", { type: "button", className: "w100n-docs-action", disabled: !pending2 || saving === "busy" || phase !== "ready" || !!room && !room.online, onClick: () => void save2(), children: [
|
|
10555
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react6.Save, { "aria-hidden": true }),
|
|
10482
10556
|
saving === "busy" ? t.saving : !pending2 && saving === "done" ? t.saved : t.save
|
|
10483
10557
|
] })
|
|
10484
10558
|
] })
|
|
10485
10559
|
] }),
|
|
10486
|
-
/* @__PURE__ */ (0,
|
|
10487
|
-
/* @__PURE__ */ (0,
|
|
10488
|
-
phase !== "ready" && /* @__PURE__ */ (0,
|
|
10560
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "w100n-sheet-stage", onPointerDown: () => setPop(null), children: [
|
|
10561
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ref: box2, className: "w100n-sheet-grid" }),
|
|
10562
|
+
phase !== "ready" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "w100n-sheet-cover", children: phase === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: t.loading }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { children: [
|
|
10489
10563
|
t.failed,
|
|
10490
|
-
/* @__PURE__ */ (0,
|
|
10564
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: "w100n-docs-action", onClick: () => setAttempt((n) => n + 1), children: t.retry })
|
|
10491
10565
|
] }) })
|
|
10492
10566
|
] })
|
|
10493
10567
|
] });
|
|
10494
10568
|
}
|
|
10495
|
-
var
|
|
10569
|
+
var import_react12, import_lucide_react6, import_core5, import_jsx_runtime8, decimals, letters2, SheetView_default;
|
|
10496
10570
|
var init_SheetView = __esm({
|
|
10497
10571
|
"src/sheets/SheetView.tsx"() {
|
|
10498
10572
|
"use strict";
|
|
10499
|
-
|
|
10573
|
+
import_react12 = require("react");
|
|
10500
10574
|
import_lucide_react6 = require("lucide-react");
|
|
10501
10575
|
import_core5 = require("@univerjs/core");
|
|
10502
10576
|
init_live();
|
|
@@ -10510,7 +10584,7 @@ var init_SheetView = __esm({
|
|
|
10510
10584
|
init_text2();
|
|
10511
10585
|
init_xlsx();
|
|
10512
10586
|
init_sheets();
|
|
10513
|
-
|
|
10587
|
+
import_jsx_runtime8 = require("react/jsx-runtime");
|
|
10514
10588
|
decimals = (pattern, step) => {
|
|
10515
10589
|
const p = pattern === "General" ? "0" : pattern;
|
|
10516
10590
|
const next = Math.max(0, (/0(?:\.(0+))?/.exec(p)?.[1]?.length ?? 0) + step);
|
|
@@ -10595,15 +10669,15 @@ function changes2(before, after) {
|
|
|
10595
10669
|
}
|
|
10596
10670
|
function Compare({ host, documentId, kind, older, t }) {
|
|
10597
10671
|
const rows = useLoad(async (signal) => changes2(await textOf2(kind, older), await textOf2(kind, await host.content(documentId, null, { signal }))), [host, documentId, older]);
|
|
10598
|
-
if (rows.error) return /* @__PURE__ */ (0,
|
|
10599
|
-
if (!rows.data) return /* @__PURE__ */ (0,
|
|
10672
|
+
if (rows.error) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "w100n-docs-empty", children: t.failed });
|
|
10673
|
+
if (!rows.data) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "w100n-docs-empty", children: t.loading });
|
|
10600
10674
|
const added = rows.data.filter((r) => r.op === "+").length, removed = rows.data.filter((r) => r.op === "-").length, edited = rows.data.filter((r) => r.op === "~").length;
|
|
10601
|
-
return /* @__PURE__ */ (0,
|
|
10602
|
-
/* @__PURE__ */ (0,
|
|
10603
|
-
rows.data.map((r, i) => /* @__PURE__ */ (0,
|
|
10675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "w100n-docs-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-docs-page w100n-compare", children: [
|
|
10676
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "w100n-compare-sum", children: added + removed + edited ? t.changeCount.replace("{added}", String(added)).replace("{edited}", String(edited)).replace("{removed}", String(removed)) : t.noChanges }),
|
|
10677
|
+
rows.data.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { "data-op": r.op, children: r.parts.map((p, k) => p.op === "=" ? p.text : p.op === "+" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ins", { children: p.text }, k) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("del", { children: p.text }, k)) }, i))
|
|
10604
10678
|
] }) });
|
|
10605
10679
|
}
|
|
10606
|
-
var
|
|
10680
|
+
var import_jsx_runtime13, words2, alike;
|
|
10607
10681
|
var init_Compare = __esm({
|
|
10608
10682
|
"src/Compare.tsx"() {
|
|
10609
10683
|
"use strict";
|
|
@@ -10611,7 +10685,7 @@ var init_Compare = __esm({
|
|
|
10611
10685
|
init_diff();
|
|
10612
10686
|
init_markdown();
|
|
10613
10687
|
init_useLoad();
|
|
10614
|
-
|
|
10688
|
+
import_jsx_runtime13 = require("react/jsx-runtime");
|
|
10615
10689
|
words2 = (text) => text.split(/(\s+)/).filter(Boolean);
|
|
10616
10690
|
alike = (a, b) => {
|
|
10617
10691
|
const x = a.split(/\s+/).filter(Boolean), y = b.split(/\s+/).filter(Boolean);
|
|
@@ -10641,7 +10715,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
10641
10715
|
|
|
10642
10716
|
// src/DocumentOverlay.tsx
|
|
10643
10717
|
var import_lucide_react7 = require("lucide-react");
|
|
10644
|
-
var
|
|
10718
|
+
var import_react13 = require("react");
|
|
10645
10719
|
var import_react_dom3 = require("react-dom");
|
|
10646
10720
|
init_focus();
|
|
10647
10721
|
|
|
@@ -13048,9 +13122,9 @@ function PdfView({ bytes, t, language, worker, rights, host, documentId, onSaved
|
|
|
13048
13122
|
}
|
|
13049
13123
|
|
|
13050
13124
|
// src/DocumentOverlay.tsx
|
|
13051
|
-
var
|
|
13052
|
-
var TextEditor2 = (0,
|
|
13053
|
-
var SheetView2 = (0,
|
|
13125
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
13126
|
+
var TextEditor2 = (0, import_react13.lazy)(() => Promise.resolve().then(() => (init_TextEditor(), TextEditor_exports)));
|
|
13127
|
+
var SheetView2 = (0, import_react13.lazy)(() => Promise.resolve().then(() => (init_SheetView(), SheetView_exports)));
|
|
13054
13128
|
var icons = { docx: import_lucide_react7.FileText, markdown: import_lucide_react7.FileType, pdf: import_lucide_react7.Files, sheet: import_lucide_react7.FileSpreadsheet, slides: import_lucide_react7.Presentation };
|
|
13055
13129
|
var read = { view: true, comment: false, edit: false };
|
|
13056
13130
|
var quiet2 = () => {
|
|
@@ -13059,7 +13133,7 @@ function DocumentOverlay({ source, name, mimeType, info, download, actions, onCl
|
|
|
13059
13133
|
const t = texts[language];
|
|
13060
13134
|
const kind = kindOf(name, mimeType) ?? "pdf";
|
|
13061
13135
|
const Kind = icons[kind];
|
|
13062
|
-
const [saved, setSaved] = (0,
|
|
13136
|
+
const [saved, setSaved] = (0, import_react13.useState)(null);
|
|
13063
13137
|
const loaded = useLoad(async (signal) => {
|
|
13064
13138
|
if (source instanceof ArrayBuffer) return source;
|
|
13065
13139
|
if (source instanceof Blob) return source.arrayBuffer();
|
|
@@ -13069,15 +13143,15 @@ function DocumentOverlay({ source, name, mimeType, info, download, actions, onCl
|
|
|
13069
13143
|
}, [source]);
|
|
13070
13144
|
const doc = useLoad((signal) => host && documentId ? host.document(documentId, { signal }) : Promise.resolve(null), [host, documentId]);
|
|
13071
13145
|
const bytes = saved ?? loaded.data;
|
|
13072
|
-
const guard = (0,
|
|
13073
|
-
const box2 = (0,
|
|
13146
|
+
const guard = (0, import_react13.useRef)(null);
|
|
13147
|
+
const box2 = (0, import_react13.useRef)(null);
|
|
13074
13148
|
const { ask, dialog } = useUnsaved(guard, t);
|
|
13075
13149
|
const close = () => ask(onClose);
|
|
13076
13150
|
useRestore(true);
|
|
13077
|
-
(0,
|
|
13151
|
+
(0, import_react13.useEffect)(() => {
|
|
13078
13152
|
box2.current.focus();
|
|
13079
13153
|
}, []);
|
|
13080
|
-
(0,
|
|
13154
|
+
(0, import_react13.useEffect)(() => {
|
|
13081
13155
|
const escape3 = (e) => {
|
|
13082
13156
|
if (e.key !== "Escape") return;
|
|
13083
13157
|
e.stopPropagation();
|
|
@@ -13100,10 +13174,10 @@ function DocumentOverlay({ source, name, mimeType, info, download, actions, onCl
|
|
|
13100
13174
|
setTimeout(() => URL.revokeObjectURL(url), 1e3);
|
|
13101
13175
|
};
|
|
13102
13176
|
const sheet2 = readable(name, mimeType) !== "sheet" ? null : /\.csv$/i.test(name) || mimeType === "text/csv" ? "csv" : "xlsx";
|
|
13103
|
-
const wait = /* @__PURE__ */ (0,
|
|
13177
|
+
const wait = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w100n-docs-empty", children: t.loading });
|
|
13104
13178
|
let stage = null;
|
|
13105
13179
|
if (bytes && !doc.loading) {
|
|
13106
|
-
if (kind === "pdf") stage = /* @__PURE__ */ (0,
|
|
13180
|
+
if (kind === "pdf") stage = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
13107
13181
|
PdfView,
|
|
13108
13182
|
{
|
|
13109
13183
|
bytes,
|
|
@@ -13117,51 +13191,51 @@ function DocumentOverlay({ source, name, mimeType, info, download, actions, onCl
|
|
|
13117
13191
|
guard
|
|
13118
13192
|
}
|
|
13119
13193
|
);
|
|
13120
|
-
else if (kind === "docx" || kind === "markdown") stage = /* @__PURE__ */ (0,
|
|
13121
|
-
else if (kind === "slides") stage = /* @__PURE__ */ (0,
|
|
13122
|
-
else if (sheet2) stage = /* @__PURE__ */ (0,
|
|
13123
|
-
else stage = /* @__PURE__ */ (0,
|
|
13124
|
-
}
|
|
13125
|
-
return (0, import_react_dom3.createPortal)(/* @__PURE__ */ (0,
|
|
13126
|
-
/* @__PURE__ */ (0,
|
|
13127
|
-
/* @__PURE__ */ (0,
|
|
13128
|
-
/* @__PURE__ */ (0,
|
|
13129
|
-
/* @__PURE__ */ (0,
|
|
13130
|
-
info && /* @__PURE__ */ (0,
|
|
13194
|
+
else if (kind === "docx" || kind === "markdown") stage = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react13.Suspense, { fallback: wait, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TextEditor2, { kind, bytes, t, language, rights: read, documentId: documentId ?? name, onOutline: quiet2, slot: null }) });
|
|
13195
|
+
else if (kind === "slides") stage = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SlidesView, { html: new TextDecoder().decode(bytes), name, rights: read, language, theme, onOutline: quiet2 });
|
|
13196
|
+
else if (sheet2) stage = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react13.Suspense, { fallback: wait, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SheetView2, { bytes, name, kind: sheet2, rights: read, language, theme, documentId: documentId ?? name }) });
|
|
13197
|
+
else stage = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w100n-docs-empty", children: t.unsupported });
|
|
13198
|
+
}
|
|
13199
|
+
return (0, import_react_dom3.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { ref: box2, className: "w100n-docs w100n-docs-overlay", "data-theme": theme, role: "dialog", "aria-modal": true, "aria-label": name, tabIndex: -1, children: [
|
|
13200
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("header", { className: "w100n-docs-bar", children: [
|
|
13201
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w100n-docs-tile", "data-kind": kind, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Kind, { "aria-hidden": true }) }),
|
|
13202
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w100n-docs-heading", children: [
|
|
13203
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { className: "w100n-docs-title", children: name }),
|
|
13204
|
+
info && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w100n-docs-crumbs", children: info })
|
|
13131
13205
|
] }),
|
|
13132
|
-
/* @__PURE__ */ (0,
|
|
13206
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w100n-docs-end", children: [
|
|
13133
13207
|
actions,
|
|
13134
|
-
download && !saved || !bytes ? /* @__PURE__ */ (0,
|
|
13135
|
-
/* @__PURE__ */ (0,
|
|
13136
|
-
/* @__PURE__ */ (0,
|
|
13137
|
-
] }) : /* @__PURE__ */ (0,
|
|
13138
|
-
/* @__PURE__ */ (0,
|
|
13139
|
-
/* @__PURE__ */ (0,
|
|
13208
|
+
download && !saved || !bytes ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("a", { className: "w100n-docs-action", href: download ?? (typeof source === "string" ? source : void 0), download: name, "aria-label": t.download, children: [
|
|
13209
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react7.Download, { "aria-hidden": true }),
|
|
13210
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: t.download })
|
|
13211
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", className: "w100n-docs-action", onClick: save2, "aria-label": t.download, children: [
|
|
13212
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react7.Download, { "aria-hidden": true }),
|
|
13213
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: t.download })
|
|
13140
13214
|
] }),
|
|
13141
|
-
onOpen && /* @__PURE__ */ (0,
|
|
13142
|
-
/* @__PURE__ */ (0,
|
|
13143
|
-
/* @__PURE__ */ (0,
|
|
13215
|
+
onOpen && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", className: "w100n-docs-action", onClick: () => ask(onOpen), "aria-label": t.openInDocuments, children: [
|
|
13216
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react7.ExternalLink, { "aria-hidden": true }),
|
|
13217
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: t.openInDocuments })
|
|
13144
13218
|
] }),
|
|
13145
|
-
/* @__PURE__ */ (0,
|
|
13219
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "w100n-docs-close", onClick: close, "aria-label": t.close, title: t.close, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react7.X, { "aria-hidden": true }) })
|
|
13146
13220
|
] })
|
|
13147
13221
|
] }),
|
|
13148
|
-
/* @__PURE__ */ (0,
|
|
13222
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w100n-docs-body", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("main", { className: "w100n-docs-stage", children: loaded.error ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w100n-docs-empty", children: [
|
|
13149
13223
|
t.failed,
|
|
13150
|
-
/* @__PURE__ */ (0,
|
|
13224
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: loaded.retry, children: t.retry })
|
|
13151
13225
|
] }) : stage ?? wait }) }),
|
|
13152
13226
|
dialog
|
|
13153
13227
|
] }), document.body);
|
|
13154
13228
|
}
|
|
13155
13229
|
|
|
13156
13230
|
// src/DocumentsWorkspace.tsx
|
|
13157
|
-
var
|
|
13231
|
+
var import_react17 = require("react");
|
|
13158
13232
|
var import_react_dom4 = require("react-dom");
|
|
13159
13233
|
var import_lucide_react10 = require("lucide-react");
|
|
13160
13234
|
init_focus();
|
|
13161
13235
|
|
|
13162
13236
|
// src/NewDocument.tsx
|
|
13163
13237
|
var import_lucide_react8 = require("lucide-react");
|
|
13164
|
-
var
|
|
13238
|
+
var import_react14 = require("react");
|
|
13165
13239
|
|
|
13166
13240
|
// src/blank.ts
|
|
13167
13241
|
var import_fflate2 = require("fflate");
|
|
@@ -13286,80 +13360,104 @@ function blank4(kind, name, template = "blank") {
|
|
|
13286
13360
|
|
|
13287
13361
|
// src/NewDocument.tsx
|
|
13288
13362
|
init_focus();
|
|
13289
|
-
|
|
13363
|
+
init_useLoad();
|
|
13364
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
13290
13365
|
var icons2 = { docx: import_lucide_react8.FileText, markdown: import_lucide_react8.FileType, sheet: import_lucide_react8.FileSpreadsheet, slides: import_lucide_react8.Presentation };
|
|
13291
13366
|
var shaped = ["blank", "letter", "contract", "notes", "invoice", "report"];
|
|
13292
13367
|
function NewDocument({ host, t, onClose, onMade }) {
|
|
13293
|
-
const id = (0,
|
|
13294
|
-
const [kind, setKind] = (0,
|
|
13295
|
-
const [template, setTemplate] = (0,
|
|
13296
|
-
const [name, setName] = (0,
|
|
13297
|
-
const [
|
|
13368
|
+
const id = (0, import_react14.useId)();
|
|
13369
|
+
const [kind, setKind] = (0, import_react14.useState)("docx");
|
|
13370
|
+
const [template, setTemplate] = (0, import_react14.useState)("blank");
|
|
13371
|
+
const [name, setName] = (0, import_react14.useState)("");
|
|
13372
|
+
const [team, setTeam] = (0, import_react14.useState)(null);
|
|
13373
|
+
const shared = useLoad((signal) => host.templates ? host.templates({ signal }) : Promise.resolve([]), [host]);
|
|
13374
|
+
const ours2 = (shared.data ?? []).filter((item) => item.kind === kind);
|
|
13375
|
+
const stem = (file) => file.replace(/\.[^.]+$/, "");
|
|
13376
|
+
const [state, setState] = (0, import_react14.useState)("idle");
|
|
13298
13377
|
useRestore(true);
|
|
13299
13378
|
const choices = kind === "docx" || kind === "markdown" ? shaped : ["blank"];
|
|
13300
13379
|
const make2 = async () => {
|
|
13301
|
-
const title = name.trim() || (template === "blank" ? t.untitled : t.templates[template]);
|
|
13380
|
+
const title = name.trim() || (team ? stem(team.name) : template === "blank" ? t.untitled : t.templates[template]);
|
|
13302
13381
|
setState("busy");
|
|
13303
13382
|
try {
|
|
13304
|
-
|
|
13383
|
+
const ext = team ? team.name.split(".").pop() : extensions[kind];
|
|
13384
|
+
const bytes = team ? await host.content(team.id) : blank4(kind, title, template);
|
|
13385
|
+
onMade(await host.create({ name: `${title.replace(/[\\/:*?"<>|\s]+/g, " ").trim()}.${ext}`, bytes, mimeType: mimes2[kind] }));
|
|
13305
13386
|
} catch {
|
|
13306
13387
|
setState("failed");
|
|
13307
13388
|
}
|
|
13308
13389
|
};
|
|
13309
|
-
return /* @__PURE__ */ (0,
|
|
13390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "w100n-pdf-back", onKeyDown: (e) => {
|
|
13310
13391
|
if (e.key === "Escape") {
|
|
13311
13392
|
e.stopPropagation();
|
|
13312
13393
|
onClose();
|
|
13313
13394
|
}
|
|
13314
|
-
}, children: /* @__PURE__ */ (0,
|
|
13395
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("form", { className: "w100n-pdf-dialog w100n-new", role: "dialog", "aria-modal": true, "aria-labelledby": `${id}t`, onSubmit: (e) => {
|
|
13315
13396
|
e.preventDefault();
|
|
13316
13397
|
void make2();
|
|
13317
13398
|
}, children: [
|
|
13318
|
-
/* @__PURE__ */ (0,
|
|
13319
|
-
/* @__PURE__ */ (0,
|
|
13320
|
-
/* @__PURE__ */ (0,
|
|
13321
|
-
/* @__PURE__ */ (0,
|
|
13399
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w100n-new-head", children: [
|
|
13400
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "w100n-new-tile", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react8.Plus, { "aria-hidden": true }) }),
|
|
13401
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("b", { id: `${id}t`, className: "w100n-pdf-dialog-title", children: t.newTitle }),
|
|
13402
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "w100n-docs-close", onClick: onClose, "aria-label": t.close, title: t.close, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react8.X, { "aria-hidden": true }) })
|
|
13322
13403
|
] }),
|
|
13323
|
-
/* @__PURE__ */ (0,
|
|
13404
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { role: "radiogroup", "aria-label": t.kind, className: "w100n-new-kinds", children: Object.keys(icons2).map((item) => {
|
|
13324
13405
|
const Icon = icons2[item];
|
|
13325
|
-
return /* @__PURE__ */ (0,
|
|
13406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", role: "radio", "aria-checked": kind === item, "data-kind": item, onClick: () => {
|
|
13326
13407
|
setKind(item);
|
|
13408
|
+
setTeam(null);
|
|
13327
13409
|
if (item === "sheet" || item === "slides") setTemplate("blank");
|
|
13328
13410
|
}, children: [
|
|
13329
|
-
/* @__PURE__ */ (0,
|
|
13330
|
-
/* @__PURE__ */ (0,
|
|
13331
|
-
/* @__PURE__ */ (0,
|
|
13332
|
-
/* @__PURE__ */ (0,
|
|
13411
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "w100n-docs-tile", "data-kind": item, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { "aria-hidden": true }) }),
|
|
13412
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
|
|
13413
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("b", { children: t.newKinds[item] }),
|
|
13414
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("small", { children: t.kindHints[item] })
|
|
13333
13415
|
] })
|
|
13334
13416
|
] }, item);
|
|
13335
13417
|
}) }),
|
|
13336
|
-
/* @__PURE__ */ (0,
|
|
13337
|
-
/* @__PURE__ */ (0,
|
|
13338
|
-
|
|
13339
|
-
|
|
13340
|
-
|
|
13341
|
-
|
|
13342
|
-
/* @__PURE__ */ (0,
|
|
13343
|
-
/* @__PURE__ */ (0,
|
|
13344
|
-
/* @__PURE__ */ (0,
|
|
13418
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "w100n-docs-caption", children: t.startFrom }),
|
|
13419
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { role: "radiogroup", "aria-label": t.startFrom, className: "w100n-new-templates", children: choices.map((item) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", role: "radio", "aria-checked": !team && template === item, onClick: () => {
|
|
13420
|
+
setTeam(null);
|
|
13421
|
+
setTemplate(item);
|
|
13422
|
+
}, children: [
|
|
13423
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "w100n-new-sheet", "data-blank": item === "blank", children: item === "blank" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react8.Plus, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
13424
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("i", { "data-head": true }),
|
|
13425
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("i", {}),
|
|
13426
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("i", {}),
|
|
13427
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("i", { "data-accent": true }),
|
|
13428
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("i", {}),
|
|
13429
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("i", {})
|
|
13345
13430
|
] }) }),
|
|
13346
|
-
/* @__PURE__ */ (0,
|
|
13431
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: t.templates[item] })
|
|
13347
13432
|
] }, item)) }),
|
|
13348
|
-
/* @__PURE__ */ (0,
|
|
13349
|
-
/* @__PURE__ */ (0,
|
|
13350
|
-
|
|
13351
|
-
/* @__PURE__ */ (0,
|
|
13433
|
+
ours2.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
13434
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "w100n-docs-caption", children: t.teamTemplates }),
|
|
13435
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { role: "radiogroup", "aria-label": t.teamTemplates, className: "w100n-new-templates", children: ours2.map((item) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", role: "radio", "aria-checked": team?.id === item.id, onClick: () => setTeam(item), children: [
|
|
13436
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "w100n-new-sheet", children: [
|
|
13437
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("i", { "data-head": true }),
|
|
13438
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("i", {}),
|
|
13439
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("i", { "data-accent": true }),
|
|
13440
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("i", {}),
|
|
13441
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("i", {})
|
|
13442
|
+
] }),
|
|
13443
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { title: item.name, children: stem(item.name) })
|
|
13444
|
+
] }, item.id)) })
|
|
13445
|
+
] }),
|
|
13446
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w100n-new-fields", children: [
|
|
13447
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
|
|
13448
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "w100n-docs-caption", children: t.name }),
|
|
13449
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { className: "w100n-docs-field", autoFocus: true, value: name, onChange: (e) => setName(e.target.value), placeholder: team ? stem(team.name) : template === "blank" ? t.untitled : t.templates[template] })
|
|
13352
13450
|
] }),
|
|
13353
|
-
host.createIn && /* @__PURE__ */ (0,
|
|
13354
|
-
/* @__PURE__ */ (0,
|
|
13355
|
-
/* @__PURE__ */ (0,
|
|
13451
|
+
host.createIn && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
|
|
13452
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "w100n-docs-caption", children: t.savesTo }),
|
|
13453
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "w100n-docs-field w100n-new-place", children: host.createIn })
|
|
13356
13454
|
] })
|
|
13357
13455
|
] }),
|
|
13358
|
-
state === "failed" && /* @__PURE__ */ (0,
|
|
13359
|
-
/* @__PURE__ */ (0,
|
|
13360
|
-
/* @__PURE__ */ (0,
|
|
13361
|
-
/* @__PURE__ */ (0,
|
|
13362
|
-
/* @__PURE__ */ (0,
|
|
13456
|
+
state === "failed" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.makeFailed }),
|
|
13457
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w100n-pdf-dialog-end", children: [
|
|
13458
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: onClose, children: t.cancel }),
|
|
13459
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "submit", className: "w100n-docs-action", disabled: state === "busy", children: [
|
|
13460
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react8.Check, { "aria-hidden": true }),
|
|
13363
13461
|
state === "busy" ? t.making : t.make
|
|
13364
13462
|
] })
|
|
13365
13463
|
] })
|
|
@@ -13367,10 +13465,10 @@ function NewDocument({ host, t, onClose, onMade }) {
|
|
|
13367
13465
|
}
|
|
13368
13466
|
|
|
13369
13467
|
// src/Sharing.tsx
|
|
13370
|
-
var
|
|
13468
|
+
var import_react15 = require("react");
|
|
13371
13469
|
var import_lucide_react9 = require("lucide-react");
|
|
13372
13470
|
init_useLoad();
|
|
13373
|
-
var
|
|
13471
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
13374
13472
|
var blank5 = { id: null, comment: false, download: false, askName: true, works: "30", day: "", password: false, secret: "", had: false };
|
|
13375
13473
|
var local = (iso) => {
|
|
13376
13474
|
const at2 = new Date(iso);
|
|
@@ -13378,9 +13476,9 @@ var local = (iso) => {
|
|
|
13378
13476
|
};
|
|
13379
13477
|
function Sharing({ host, doc, t, language, team }) {
|
|
13380
13478
|
const links = useLoad((signal) => host.links(doc.id, { signal }), [host, doc.id]);
|
|
13381
|
-
const [form, setForm] = (0,
|
|
13382
|
-
const [state, setState] = (0,
|
|
13383
|
-
const [copied, setCopied] = (0,
|
|
13479
|
+
const [form, setForm] = (0, import_react15.useState)(null);
|
|
13480
|
+
const [state, setState] = (0, import_react15.useState)("idle");
|
|
13481
|
+
const [copied, setCopied] = (0, import_react15.useState)(null);
|
|
13384
13482
|
const text = doc.kind === "docx" || doc.kind === "markdown";
|
|
13385
13483
|
const rules = new Intl.PluralRules(language);
|
|
13386
13484
|
const count = (n, forms) => `${n} ${forms[rules.select(n)] ?? forms.other}`;
|
|
@@ -13442,31 +13540,31 @@ function Sharing({ host, doc, t, language, team }) {
|
|
|
13442
13540
|
setCopied(null);
|
|
13443
13541
|
}
|
|
13444
13542
|
};
|
|
13445
|
-
if (form) return /* @__PURE__ */ (0,
|
|
13446
|
-
/* @__PURE__ */ (0,
|
|
13447
|
-
/* @__PURE__ */ (0,
|
|
13543
|
+
if (form) return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-share", children: [
|
|
13544
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
13545
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Link, { "aria-hidden": true }),
|
|
13448
13546
|
form.id ? t.changeLink : t.newLink
|
|
13449
13547
|
] }),
|
|
13450
|
-
text && /* @__PURE__ */ (0,
|
|
13451
|
-
/* @__PURE__ */ (0,
|
|
13452
|
-
/* @__PURE__ */ (0,
|
|
13453
|
-
/* @__PURE__ */ (0,
|
|
13454
|
-
/* @__PURE__ */ (0,
|
|
13548
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-share-field", children: [
|
|
13549
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: t.guestsCan }),
|
|
13550
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-docs-chips", children: [
|
|
13551
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", "aria-pressed": !form.comment, onClick: () => setForm({ ...form, comment: false }), children: [
|
|
13552
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Eye, { "aria-hidden": true }),
|
|
13455
13553
|
t.canRead
|
|
13456
13554
|
] }),
|
|
13457
|
-
/* @__PURE__ */ (0,
|
|
13458
|
-
/* @__PURE__ */ (0,
|
|
13555
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", "aria-pressed": form.comment, onClick: () => setForm({ ...form, comment: true }), children: [
|
|
13556
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.MessageSquarePlus, { "aria-hidden": true }),
|
|
13459
13557
|
t.canComment
|
|
13460
13558
|
] })
|
|
13461
13559
|
] })
|
|
13462
13560
|
] }),
|
|
13463
|
-
/* @__PURE__ */ (0,
|
|
13464
|
-
/* @__PURE__ */ (0,
|
|
13465
|
-
/* @__PURE__ */ (0,
|
|
13466
|
-
key2 === "day" && /* @__PURE__ */ (0,
|
|
13561
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-share-field", children: [
|
|
13562
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: t.linkWorks }),
|
|
13563
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w100n-docs-chips", children: [["7", t.days7], ["30", t.days30], ["off", t.untilTurnOff], ["day", t.pickDay]].map(([key2, label]) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", "aria-pressed": form.works === key2, onClick: () => setForm({ ...form, works: key2 }), children: [
|
|
13564
|
+
key2 === "day" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.CalendarDays, { "aria-hidden": true }),
|
|
13467
13565
|
label
|
|
13468
13566
|
] }, key2)) }),
|
|
13469
|
-
form.works === "day" && /* @__PURE__ */ (0,
|
|
13567
|
+
form.works === "day" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
13470
13568
|
"input",
|
|
13471
13569
|
{
|
|
13472
13570
|
type: "date",
|
|
@@ -13478,14 +13576,14 @@ function Sharing({ host, doc, t, language, team }) {
|
|
|
13478
13576
|
}
|
|
13479
13577
|
)
|
|
13480
13578
|
] }),
|
|
13481
|
-
/* @__PURE__ */ (0,
|
|
13482
|
-
/* @__PURE__ */ (0,
|
|
13483
|
-
/* @__PURE__ */ (0,
|
|
13484
|
-
/* @__PURE__ */ (0,
|
|
13485
|
-
/* @__PURE__ */ (0,
|
|
13579
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "w100n-share-toggle", children: [
|
|
13580
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "checkbox", checked: form.password, onChange: (e) => setForm({ ...form, password: e.target.checked }) }),
|
|
13581
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
|
|
13582
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("b", { children: t.passwordOn }),
|
|
13583
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("small", { children: t.passwordHint })
|
|
13486
13584
|
] })
|
|
13487
13585
|
] }),
|
|
13488
|
-
form.password && /* @__PURE__ */ (0,
|
|
13586
|
+
form.password && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
13489
13587
|
"input",
|
|
13490
13588
|
{
|
|
13491
13589
|
type: "password",
|
|
@@ -13497,120 +13595,120 @@ function Sharing({ host, doc, t, language, team }) {
|
|
|
13497
13595
|
onChange: (e) => setForm({ ...form, secret: e.target.value })
|
|
13498
13596
|
}
|
|
13499
13597
|
),
|
|
13500
|
-
/* @__PURE__ */ (0,
|
|
13501
|
-
/* @__PURE__ */ (0,
|
|
13502
|
-
/* @__PURE__ */ (0,
|
|
13503
|
-
/* @__PURE__ */ (0,
|
|
13504
|
-
/* @__PURE__ */ (0,
|
|
13598
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "w100n-share-toggle", children: [
|
|
13599
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "checkbox", checked: form.download, onChange: (e) => setForm({ ...form, download: e.target.checked }) }),
|
|
13600
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
|
|
13601
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("b", { children: t.downloadFile }),
|
|
13602
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("small", { children: t.downloadHint })
|
|
13505
13603
|
] })
|
|
13506
13604
|
] }),
|
|
13507
|
-
/* @__PURE__ */ (0,
|
|
13508
|
-
/* @__PURE__ */ (0,
|
|
13509
|
-
/* @__PURE__ */ (0,
|
|
13510
|
-
/* @__PURE__ */ (0,
|
|
13511
|
-
/* @__PURE__ */ (0,
|
|
13605
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "w100n-share-toggle", children: [
|
|
13606
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "checkbox", checked: form.askName, onChange: (e) => setForm({ ...form, askName: e.target.checked }) }),
|
|
13607
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
|
|
13608
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("b", { children: t.askName }),
|
|
13609
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("small", { children: t.askNameHint })
|
|
13512
13610
|
] })
|
|
13513
13611
|
] }),
|
|
13514
|
-
/* @__PURE__ */ (0,
|
|
13515
|
-
state === "failed" && /* @__PURE__ */ (0,
|
|
13516
|
-
/* @__PURE__ */ (0,
|
|
13517
|
-
/* @__PURE__ */ (0,
|
|
13612
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "w100n-docs-muted", children: t.lastSaved }),
|
|
13613
|
+
state === "failed" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.shareFailed }),
|
|
13614
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "w100n-pdf-dialog-end", children: [
|
|
13615
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: () => {
|
|
13518
13616
|
setForm(null);
|
|
13519
13617
|
setState("idle");
|
|
13520
13618
|
}, children: t.cancel }),
|
|
13521
|
-
/* @__PURE__ */ (0,
|
|
13522
|
-
/* @__PURE__ */ (0,
|
|
13619
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "w100n-docs-action", disabled: !ready || state === "busy", onClick: () => void submit(), children: [
|
|
13620
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Link, { "aria-hidden": true }),
|
|
13523
13621
|
form.id ? t.saveLink : t.makeLink
|
|
13524
13622
|
] })
|
|
13525
13623
|
] })
|
|
13526
13624
|
] });
|
|
13527
13625
|
const on2 = links.data ?? [];
|
|
13528
|
-
return /* @__PURE__ */ (0,
|
|
13529
|
-
/* @__PURE__ */ (0,
|
|
13530
|
-
/* @__PURE__ */ (0,
|
|
13626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-share", children: [
|
|
13627
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
13628
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Link, { "aria-hidden": true }),
|
|
13531
13629
|
t.guestLinks,
|
|
13532
|
-
on2.length > 0 && /* @__PURE__ */ (0,
|
|
13630
|
+
on2.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: on2.filter((l) => !l.ended).length })
|
|
13533
13631
|
] }),
|
|
13534
|
-
links.error && /* @__PURE__ */ (0,
|
|
13632
|
+
links.error && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-docs-note", children: [
|
|
13535
13633
|
t.failed,
|
|
13536
|
-
/* @__PURE__ */ (0,
|
|
13634
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: links.retry, children: t.retry })
|
|
13537
13635
|
] }),
|
|
13538
|
-
links.data && !on2.length && /* @__PURE__ */ (0,
|
|
13539
|
-
state === "failed" && /* @__PURE__ */ (0,
|
|
13540
|
-
on2.map((l) => /* @__PURE__ */ (0,
|
|
13541
|
-
/* @__PURE__ */ (0,
|
|
13542
|
-
/* @__PURE__ */ (0,
|
|
13543
|
-
/* @__PURE__ */ (0,
|
|
13544
|
-
/* @__PURE__ */ (0,
|
|
13545
|
-
/* @__PURE__ */ (0,
|
|
13636
|
+
links.data && !on2.length && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "w100n-docs-muted", children: t.noLinks }),
|
|
13637
|
+
state === "failed" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.shareFailed }),
|
|
13638
|
+
on2.map((l) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("article", { className: "w100n-share-link", "data-ended": l.ended, children: [
|
|
13639
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("header", { children: [
|
|
13640
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-share-tile", "data-tone": l.comment ? "amber" : "blue", children: l.comment ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.MessageSquarePlus, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Eye, { "aria-hidden": true }) }),
|
|
13641
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
|
|
13642
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("b", { children: l.comment ? t.commentLink : t.viewLink }),
|
|
13643
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("small", { children: [
|
|
13546
13644
|
t.madeBy.replace("{name}", l.createdBy.name),
|
|
13547
13645
|
" \xB7 ",
|
|
13548
13646
|
day(l.createdAt)
|
|
13549
13647
|
] })
|
|
13550
13648
|
] })
|
|
13551
13649
|
] }),
|
|
13552
|
-
/* @__PURE__ */ (0,
|
|
13553
|
-
/* @__PURE__ */ (0,
|
|
13554
|
-
/* @__PURE__ */ (0,
|
|
13650
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-share-chips", children: [
|
|
13651
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
|
|
13652
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Clock, { "aria-hidden": true }),
|
|
13555
13653
|
l.ended ? t.linkEnded : l.endsAt ? t.endsOn.replace("{date}", day(l.endsAt)) : t.untilOff
|
|
13556
13654
|
] }),
|
|
13557
|
-
l.download && /* @__PURE__ */ (0,
|
|
13558
|
-
/* @__PURE__ */ (0,
|
|
13655
|
+
l.download && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
|
|
13656
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Download, { "aria-hidden": true }),
|
|
13559
13657
|
t.downloadOn
|
|
13560
13658
|
] }),
|
|
13561
|
-
l.password && /* @__PURE__ */ (0,
|
|
13562
|
-
/* @__PURE__ */ (0,
|
|
13659
|
+
l.password && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
|
|
13660
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Lock, { "aria-hidden": true }),
|
|
13563
13661
|
t.passwordOn
|
|
13564
13662
|
] }),
|
|
13565
|
-
/* @__PURE__ */ (0,
|
|
13566
|
-
/* @__PURE__ */ (0,
|
|
13663
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
|
|
13664
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Eye, { "aria-hidden": true }),
|
|
13567
13665
|
count(l.guests.reduce((n, g) => n + g.opens, 0), t.openForms)
|
|
13568
13666
|
] })
|
|
13569
13667
|
] }),
|
|
13570
|
-
/* @__PURE__ */ (0,
|
|
13571
|
-
/* @__PURE__ */ (0,
|
|
13572
|
-
/* @__PURE__ */ (0,
|
|
13573
|
-
/* @__PURE__ */ (0,
|
|
13668
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-share-url", children: [
|
|
13669
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: l.url.replace(/^https?:\/\//, "") }),
|
|
13670
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", onClick: () => void copy2(l), children: [
|
|
13671
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Copy, { "aria-hidden": true }),
|
|
13574
13672
|
copied === l.id ? t.copied : t.copy
|
|
13575
13673
|
] })
|
|
13576
13674
|
] }),
|
|
13577
|
-
l.guests.length > 0 && /* @__PURE__ */ (0,
|
|
13578
|
-
/* @__PURE__ */ (0,
|
|
13579
|
-
/* @__PURE__ */ (0,
|
|
13580
|
-
/* @__PURE__ */ (0,
|
|
13675
|
+
l.guests.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w100n-share-who", children: l.guests.map((g, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
|
|
13676
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-text-face", "aria-hidden": true, children: (g.name || "?").slice(0, 1).toUpperCase() }),
|
|
13677
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("b", { children: g.name || t.unnamed }),
|
|
13678
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("small", { children: [
|
|
13581
13679
|
g.comments ? count(g.comments, t.commentForms) : count(g.opens, t.openForms),
|
|
13582
13680
|
" \xB7 ",
|
|
13583
13681
|
ago(g.lastAt)
|
|
13584
13682
|
] })
|
|
13585
13683
|
] }, i)) }),
|
|
13586
|
-
/* @__PURE__ */ (0,
|
|
13587
|
-
/* @__PURE__ */ (0,
|
|
13588
|
-
/* @__PURE__ */ (0,
|
|
13684
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-share-tools", children: [
|
|
13685
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "slate", disabled: state === "busy", onClick: () => edit(l), children: [
|
|
13686
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Clock, { "aria-hidden": true }),
|
|
13589
13687
|
t.changeLink
|
|
13590
13688
|
] }),
|
|
13591
|
-
/* @__PURE__ */ (0,
|
|
13592
|
-
/* @__PURE__ */ (0,
|
|
13689
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", disabled: state === "busy", onClick: () => void off(l), children: [
|
|
13690
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Ban, { "aria-hidden": true }),
|
|
13593
13691
|
t.turnOff
|
|
13594
13692
|
] })
|
|
13595
13693
|
] })
|
|
13596
13694
|
] }, l.id)),
|
|
13597
|
-
/* @__PURE__ */ (0,
|
|
13695
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "w100n-docs-action w100n-share-new", onClick: () => {
|
|
13598
13696
|
setState("idle");
|
|
13599
13697
|
setForm(blank5);
|
|
13600
13698
|
}, children: [
|
|
13601
|
-
/* @__PURE__ */ (0,
|
|
13699
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Plus, { "aria-hidden": true }),
|
|
13602
13700
|
t.newLink
|
|
13603
13701
|
] }),
|
|
13604
|
-
team && /* @__PURE__ */ (0,
|
|
13605
|
-
/* @__PURE__ */ (0,
|
|
13606
|
-
/* @__PURE__ */ (0,
|
|
13702
|
+
team && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
13703
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
13704
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Users, { "aria-hidden": true }),
|
|
13607
13705
|
t.inTeam
|
|
13608
13706
|
] }),
|
|
13609
|
-
/* @__PURE__ */ (0,
|
|
13610
|
-
/* @__PURE__ */ (0,
|
|
13611
|
-
/* @__PURE__ */ (0,
|
|
13612
|
-
/* @__PURE__ */ (0,
|
|
13613
|
-
/* @__PURE__ */ (0,
|
|
13707
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-share-team", children: [
|
|
13708
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-share-tile", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Users, { "aria-hidden": true }) }),
|
|
13709
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
|
|
13710
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("b", { children: t.peopleOf.replace("{space}", team) }),
|
|
13711
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("small", { children: t.teamHint })
|
|
13614
13712
|
] })
|
|
13615
13713
|
] })
|
|
13616
13714
|
] })
|
|
@@ -13621,7 +13719,7 @@ function Sharing({ host, doc, t, language, team }) {
|
|
|
13621
13719
|
init_text();
|
|
13622
13720
|
|
|
13623
13721
|
// src/Thumb.tsx
|
|
13624
|
-
var
|
|
13722
|
+
var import_react16 = require("react");
|
|
13625
13723
|
|
|
13626
13724
|
// src/preview.ts
|
|
13627
13725
|
var cache = /* @__PURE__ */ new Map();
|
|
@@ -13674,12 +13772,12 @@ function preview(host, doc) {
|
|
|
13674
13772
|
}
|
|
13675
13773
|
|
|
13676
13774
|
// src/Thumb.tsx
|
|
13677
|
-
var
|
|
13775
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
13678
13776
|
function Thumb({ host, item, label }) {
|
|
13679
|
-
const box2 = (0,
|
|
13680
|
-
const [seen2, setSeen] = (0,
|
|
13681
|
-
const [shot, setShot] = (0,
|
|
13682
|
-
(0,
|
|
13777
|
+
const box2 = (0, import_react16.useRef)(null);
|
|
13778
|
+
const [seen2, setSeen] = (0, import_react16.useState)(false);
|
|
13779
|
+
const [shot, setShot] = (0, import_react16.useState)(null);
|
|
13780
|
+
(0, import_react16.useEffect)(() => {
|
|
13683
13781
|
if (item.thumbnailUrl || item.excerpt || typeof IntersectionObserver === "undefined") return;
|
|
13684
13782
|
const watch = new IntersectionObserver((entries2) => {
|
|
13685
13783
|
if (entries2.some((entry2) => entry2.isIntersecting)) setSeen(true);
|
|
@@ -13687,7 +13785,7 @@ function Thumb({ host, item, label }) {
|
|
|
13687
13785
|
watch.observe(box2.current);
|
|
13688
13786
|
return () => watch.disconnect();
|
|
13689
13787
|
}, [item.thumbnailUrl, item.excerpt]);
|
|
13690
|
-
(0,
|
|
13788
|
+
(0, import_react16.useEffect)(() => {
|
|
13691
13789
|
if (!seen2) return;
|
|
13692
13790
|
let live = true;
|
|
13693
13791
|
void preview(host, item).then((found) => {
|
|
@@ -13700,53 +13798,53 @@ function Thumb({ host, item, label }) {
|
|
|
13700
13798
|
const text = item.excerpt ?? shot?.text ?? "";
|
|
13701
13799
|
const lines2 = text.split("\n").filter((line) => !line.trim().startsWith("```")).map((line) => line.replace(/^#+\s*/, "").replace(/[*_`>|]/g, "").trim()).filter(Boolean);
|
|
13702
13800
|
const image = item.thumbnailUrl ?? shot?.image;
|
|
13703
|
-
return /* @__PURE__ */ (0,
|
|
13704
|
-
image ? /* @__PURE__ */ (0,
|
|
13705
|
-
/* @__PURE__ */ (0,
|
|
13801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { ref: box2, className: "w100n-docs-thumb", "data-kind": item.kind, children: [
|
|
13802
|
+
image ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("img", { src: image, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-paper", "aria-hidden": true, children: lines2.length ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
13803
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("b", { children: lines2[0] }),
|
|
13706
13804
|
lines2.slice(1, 14).join(" ")
|
|
13707
|
-
] }) : /* @__PURE__ */ (0,
|
|
13708
|
-
/* @__PURE__ */ (0,
|
|
13709
|
-
/* @__PURE__ */ (0,
|
|
13710
|
-
/* @__PURE__ */ (0,
|
|
13711
|
-
/* @__PURE__ */ (0,
|
|
13712
|
-
/* @__PURE__ */ (0,
|
|
13805
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
13806
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {}),
|
|
13807
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {}),
|
|
13808
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {}),
|
|
13809
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {}),
|
|
13810
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {})
|
|
13713
13811
|
] }) }),
|
|
13714
|
-
/* @__PURE__ */ (0,
|
|
13812
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-kind", "data-kind": item.kind, children: label })
|
|
13715
13813
|
] });
|
|
13716
13814
|
}
|
|
13717
13815
|
|
|
13718
13816
|
// src/DocumentsWorkspace.tsx
|
|
13719
13817
|
init_useLoad();
|
|
13720
|
-
var
|
|
13721
|
-
var TextEditor3 = (0,
|
|
13722
|
-
var SheetView3 = (0,
|
|
13723
|
-
var Compare2 = (0,
|
|
13818
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
13819
|
+
var TextEditor3 = (0, import_react17.lazy)(() => Promise.resolve().then(() => (init_TextEditor(), TextEditor_exports)));
|
|
13820
|
+
var SheetView3 = (0, import_react17.lazy)(() => Promise.resolve().then(() => (init_SheetView(), SheetView_exports)));
|
|
13821
|
+
var Compare2 = (0, import_react17.lazy)(() => Promise.resolve().then(() => (init_Compare(), Compare_exports)));
|
|
13724
13822
|
var icons3 = { docx: import_lucide_react10.FileText, markdown: import_lucide_react10.FileType, pdf: import_lucide_react10.Files, sheet: import_lucide_react10.FileSpreadsheet, slides: import_lucide_react10.Presentation };
|
|
13725
13823
|
function DocumentsWorkspace({ host, language = "en", theme = "light", place: place2, onPlace, start, end, aside, actions }) {
|
|
13726
13824
|
const t = texts[language];
|
|
13727
|
-
const [own, setOwn] = (0,
|
|
13825
|
+
const [own, setOwn] = (0, import_react17.useState)({ spaceId: null, documentId: null });
|
|
13728
13826
|
const here = place2 ?? own;
|
|
13729
13827
|
const go = (next) => {
|
|
13730
13828
|
setOwn(next);
|
|
13731
13829
|
onPlace?.(next);
|
|
13732
13830
|
};
|
|
13733
|
-
const [query, setQuery] = (0,
|
|
13734
|
-
const [picked, setPicked] = (0,
|
|
13735
|
-
const [typing, setTyping] = (0,
|
|
13736
|
-
const [menusAt, setMenusAt] = (0,
|
|
13737
|
-
const [renaming, setRenaming] = (0,
|
|
13738
|
-
const [renamed2, setRenamed] = (0,
|
|
13739
|
-
const [statusAt, setStatusAt] = (0,
|
|
13740
|
-
const [listOpen, setListOpen] = (0,
|
|
13741
|
-
const [panelOpen, setPanelOpen] = (0,
|
|
13742
|
-
const [narrow, setNarrow] = (0,
|
|
13743
|
-
const body = (0,
|
|
13744
|
-
const listButton = (0,
|
|
13745
|
-
const panelButton = (0,
|
|
13746
|
-
const listClose = (0,
|
|
13747
|
-
const panel = (0,
|
|
13748
|
-
const guard = (0,
|
|
13749
|
-
(0,
|
|
13831
|
+
const [query, setQuery] = (0, import_react17.useState)("");
|
|
13832
|
+
const [picked, setPicked] = (0, import_react17.useState)([]);
|
|
13833
|
+
const [typing, setTyping] = (0, import_react17.useState)(false);
|
|
13834
|
+
const [menusAt, setMenusAt] = (0, import_react17.useState)(null);
|
|
13835
|
+
const [renaming, setRenaming] = (0, import_react17.useState)(null);
|
|
13836
|
+
const [renamed2, setRenamed] = (0, import_react17.useState)("idle");
|
|
13837
|
+
const [statusAt, setStatusAt] = (0, import_react17.useState)(null);
|
|
13838
|
+
const [listOpen, setListOpen] = (0, import_react17.useState)(true);
|
|
13839
|
+
const [panelOpen, setPanelOpen] = (0, import_react17.useState)(true);
|
|
13840
|
+
const [narrow, setNarrow] = (0, import_react17.useState)(false);
|
|
13841
|
+
const body = (0, import_react17.useRef)(null);
|
|
13842
|
+
const listButton = (0, import_react17.useRef)(null);
|
|
13843
|
+
const panelButton = (0, import_react17.useRef)(null);
|
|
13844
|
+
const listClose = (0, import_react17.useRef)(null);
|
|
13845
|
+
const panel = (0, import_react17.useRef)(null);
|
|
13846
|
+
const guard = (0, import_react17.useRef)(null);
|
|
13847
|
+
(0, import_react17.useLayoutEffect)(() => {
|
|
13750
13848
|
const el = body.current;
|
|
13751
13849
|
let was = false;
|
|
13752
13850
|
const check = () => {
|
|
@@ -13764,9 +13862,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13764
13862
|
watch.observe(el);
|
|
13765
13863
|
return () => watch.disconnect();
|
|
13766
13864
|
}, [here.documentId]);
|
|
13767
|
-
const [picking, setPicking] = (0,
|
|
13768
|
-
const [adding, setAdding] = (0,
|
|
13769
|
-
(0,
|
|
13865
|
+
const [picking, setPicking] = (0, import_react17.useState)(false);
|
|
13866
|
+
const [adding, setAdding] = (0, import_react17.useState)(false);
|
|
13867
|
+
(0, import_react17.useEffect)(() => {
|
|
13770
13868
|
if (!adding) return;
|
|
13771
13869
|
const close = (e) => {
|
|
13772
13870
|
if (!e.target.closest(".w100n-docs-new")) setAdding(false);
|
|
@@ -13774,7 +13872,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13774
13872
|
document.addEventListener("pointerdown", close);
|
|
13775
13873
|
return () => document.removeEventListener("pointerdown", close);
|
|
13776
13874
|
}, [adding]);
|
|
13777
|
-
(0,
|
|
13875
|
+
(0, import_react17.useEffect)(() => {
|
|
13778
13876
|
if (!typing) return;
|
|
13779
13877
|
const close = (e) => {
|
|
13780
13878
|
if (!e.target.closest(".w100n-docs-types")) setTyping(false);
|
|
@@ -13782,7 +13880,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13782
13880
|
document.addEventListener("pointerdown", close);
|
|
13783
13881
|
return () => document.removeEventListener("pointerdown", close);
|
|
13784
13882
|
}, [typing]);
|
|
13785
|
-
(0,
|
|
13883
|
+
(0, import_react17.useEffect)(() => {
|
|
13786
13884
|
if (!picking) return;
|
|
13787
13885
|
const close = (e) => {
|
|
13788
13886
|
if (!e.target.closest(".w100n-docs-picker")) setPicking(false);
|
|
@@ -13790,21 +13888,22 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13790
13888
|
document.addEventListener("pointerdown", close);
|
|
13791
13889
|
return () => document.removeEventListener("pointerdown", close);
|
|
13792
13890
|
}, [picking]);
|
|
13793
|
-
const [tab, setTab] = (0,
|
|
13794
|
-
const [outline2, setOutline] = (0,
|
|
13795
|
-
const [reading, setReading] = (0,
|
|
13796
|
-
const [hunt, setHunt] = (0,
|
|
13797
|
-
const [fold, setFold] = (0,
|
|
13798
|
-
const [version2, setVersion] = (0,
|
|
13891
|
+
const [tab, setTab] = (0, import_react17.useState)("outline");
|
|
13892
|
+
const [outline2, setOutline] = (0, import_react17.useState)([]);
|
|
13893
|
+
const [reading, setReading] = (0, import_react17.useState)(null);
|
|
13894
|
+
const [hunt, setHunt] = (0, import_react17.useState)("");
|
|
13895
|
+
const [fold, setFold] = (0, import_react17.useState)({});
|
|
13896
|
+
const [version2, setVersion] = (0, import_react17.useState)({ documentId: null, id: null });
|
|
13799
13897
|
const versionId = version2.documentId === here.documentId ? version2.id : null;
|
|
13800
|
-
const [comparing, setComparing] = (0,
|
|
13801
|
-
const [restoring, setRestoring] = (0,
|
|
13802
|
-
const [exporting, setExporting] = (0,
|
|
13803
|
-
const [copying, setCopying] = (0,
|
|
13804
|
-
const [
|
|
13805
|
-
const [
|
|
13806
|
-
const [
|
|
13807
|
-
const
|
|
13898
|
+
const [comparing, setComparing] = (0, import_react17.useState)(false);
|
|
13899
|
+
const [restoring, setRestoring] = (0, import_react17.useState)("idle");
|
|
13900
|
+
const [exporting, setExporting] = (0, import_react17.useState)("idle");
|
|
13901
|
+
const [copying, setCopying] = (0, import_react17.useState)("idle");
|
|
13902
|
+
const [kept, setKept] = (0, import_react17.useState)(null);
|
|
13903
|
+
const [box2, setBox] = (0, import_react17.useState)(null);
|
|
13904
|
+
const [making, setMaking] = (0, import_react17.useState)(false);
|
|
13905
|
+
const [sending, setSending] = (0, import_react17.useState)("idle");
|
|
13906
|
+
const upload = (0, import_react17.useRef)(null);
|
|
13808
13907
|
const spaces = useLoad((signal) => host.spaces({ signal }), [host]);
|
|
13809
13908
|
const single = spaces.data?.length === 1 ? spaces.data[0].id : null;
|
|
13810
13909
|
const spaceId = here.spaceId ?? single;
|
|
@@ -13815,7 +13914,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13815
13914
|
const all2 = await host.spaces({ signal });
|
|
13816
13915
|
return (await Promise.all(all2.map((item) => host.documents(item.id, { signal })))).flat();
|
|
13817
13916
|
}, [host, spaceId]);
|
|
13818
|
-
(0,
|
|
13917
|
+
(0, import_react17.useEffect)(() => {
|
|
13819
13918
|
const sync = () => {
|
|
13820
13919
|
if (document.visibilityState !== "visible") return;
|
|
13821
13920
|
spaces.retry();
|
|
@@ -13838,7 +13937,14 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13838
13937
|
const docbar = text && !versionId && !narrow;
|
|
13839
13938
|
const signatures = useLoad((signal) => here.documentId && pdf && host.signatures ? host.signatures(here.documentId, { signal }) : Promise.resolve([]), [host, here.documentId, pdf]);
|
|
13840
13939
|
const all = list.data ?? [];
|
|
13841
|
-
const
|
|
13940
|
+
const deep = useLoad(async (signal) => {
|
|
13941
|
+
const text2 = query.trim();
|
|
13942
|
+
if (!host.search || text2.length < 2) return [];
|
|
13943
|
+
await new Promise((done) => setTimeout(done, 300));
|
|
13944
|
+
return signal.aborted ? [] : host.search(text2, { signal });
|
|
13945
|
+
}, [host, query]);
|
|
13946
|
+
const inside2 = new Map((deep.data ?? []).map((hit2) => [hit2.id, hit2.excerpt]));
|
|
13947
|
+
const shown = all.filter((item) => matches(item, query, picked) || inside2.has(item.id) && matches(item, "", picked));
|
|
13842
13948
|
const present = kinds.filter((item) => all.some((doc2) => doc2.kind === item));
|
|
13843
13949
|
const folders = spaceId ? [.../* @__PURE__ */ new Set(["", ...shown.map((item) => item.folder ?? "")])].filter((folder2) => shown.some((item) => (item.folder ?? "") === folder2)) : [""];
|
|
13844
13950
|
const names2 = new Map((spaces.data ?? []).map((item) => [item.id, item.name]));
|
|
@@ -13855,9 +13961,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13855
13961
|
return new Intl.DateTimeFormat(language, { day: "numeric", month: "short", year: "numeric" }).format(new Date(iso));
|
|
13856
13962
|
};
|
|
13857
13963
|
const size2 = (bytes) => bytes < 1024 ? `${bytes} B` : bytes < 1048576 ? `${(bytes / 1024).toFixed(0)} KB` : `${(bytes / 1048576).toFixed(1)} MB`;
|
|
13858
|
-
const failed = (retry) => /* @__PURE__ */ (0,
|
|
13964
|
+
const failed = (retry) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-note", children: [
|
|
13859
13965
|
t.failed,
|
|
13860
|
-
/* @__PURE__ */ (0,
|
|
13966
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", onClick: retry, children: t.retry })
|
|
13861
13967
|
] });
|
|
13862
13968
|
const { ask, dialog } = useUnsaved(guard, t);
|
|
13863
13969
|
const side2 = (which, open2) => {
|
|
@@ -13948,6 +14054,15 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13948
14054
|
setCopying("failed");
|
|
13949
14055
|
}
|
|
13950
14056
|
};
|
|
14057
|
+
const keep = async (file) => {
|
|
14058
|
+
setKept({ id: file.id, state: "busy" });
|
|
14059
|
+
try {
|
|
14060
|
+
await host.saveTemplate(file.id);
|
|
14061
|
+
setKept({ id: file.id, state: "done" });
|
|
14062
|
+
} catch {
|
|
14063
|
+
setKept({ id: file.id, state: "failed" });
|
|
14064
|
+
}
|
|
14065
|
+
};
|
|
13951
14066
|
const rename = async (file, draft) => {
|
|
13952
14067
|
setRenaming(null);
|
|
13953
14068
|
const ext = /\.[^.]+$/.exec(file.name)?.[0] ?? "";
|
|
@@ -13976,8 +14091,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13976
14091
|
setSending("failed");
|
|
13977
14092
|
}
|
|
13978
14093
|
};
|
|
13979
|
-
let stage = /* @__PURE__ */ (0,
|
|
13980
|
-
/* @__PURE__ */ (0,
|
|
14094
|
+
let stage = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-empty", children: [
|
|
14095
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.FileText, { "aria-hidden": true }),
|
|
13981
14096
|
t.pick
|
|
13982
14097
|
] });
|
|
13983
14098
|
if (here.documentId) {
|
|
@@ -13985,9 +14100,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13985
14100
|
doc.retry();
|
|
13986
14101
|
content.retry();
|
|
13987
14102
|
});
|
|
13988
|
-
else if (!doc.data || !content.data) stage = /* @__PURE__ */ (0,
|
|
13989
|
-
else if (comparing && versionId && (doc.data.kind === "markdown" || doc.data.kind === "docx")) stage = /* @__PURE__ */ (0,
|
|
13990
|
-
else if (doc.data.kind === "markdown" || doc.data.kind === "docx") stage = /* @__PURE__ */ (0,
|
|
14103
|
+
else if (!doc.data || !content.data) stage = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w100n-docs-empty", children: t.loading });
|
|
14104
|
+
else if (comparing && versionId && (doc.data.kind === "markdown" || doc.data.kind === "docx")) stage = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react17.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Compare2, { host, documentId: doc.data.id, kind: doc.data.kind, older: content.data, t }, versionId) });
|
|
14105
|
+
else if (doc.data.kind === "markdown" || doc.data.kind === "docx") stage = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react17.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
13991
14106
|
TextEditor3,
|
|
13992
14107
|
{
|
|
13993
14108
|
kind: doc.data.kind,
|
|
@@ -14012,7 +14127,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14012
14127
|
formats: host.exportAs ? doc.data.exports ?? [] : [],
|
|
14013
14128
|
download: (f) => void exportAs(doc.data, f),
|
|
14014
14129
|
copy: host.create ? () => void copy2(doc.data) : void 0,
|
|
14015
|
-
rename: host.rename && doc.data.rights.edit ? () => setRenaming(doc.data.name.replace(/\.[^.]+$/, "")) : void 0
|
|
14130
|
+
rename: host.rename && doc.data.rights.edit ? () => setRenaming(doc.data.name.replace(/\.[^.]+$/, "")) : void 0,
|
|
14131
|
+
template: host.saveTemplate && doc.data.rights.edit ? () => void keep(doc.data) : void 0
|
|
14016
14132
|
},
|
|
14017
14133
|
onSaved: () => {
|
|
14018
14134
|
versions.retry();
|
|
@@ -14022,7 +14138,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14022
14138
|
},
|
|
14023
14139
|
doc.data.id
|
|
14024
14140
|
) });
|
|
14025
|
-
else if (doc.data.kind === "pdf") stage = /* @__PURE__ */ (0,
|
|
14141
|
+
else if (doc.data.kind === "pdf") stage = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
14026
14142
|
PdfView,
|
|
14027
14143
|
{
|
|
14028
14144
|
bytes: content.data,
|
|
@@ -14044,7 +14160,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14044
14160
|
},
|
|
14045
14161
|
`${doc.data.id}:${versionId ?? ""}`
|
|
14046
14162
|
);
|
|
14047
|
-
else if (doc.data.kind === "slides") stage = /* @__PURE__ */ (0,
|
|
14163
|
+
else if (doc.data.kind === "slides") stage = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
14048
14164
|
SlidesView,
|
|
14049
14165
|
{
|
|
14050
14166
|
html: new TextDecoder().decode(content.data),
|
|
@@ -14063,7 +14179,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14063
14179
|
},
|
|
14064
14180
|
doc.data.id
|
|
14065
14181
|
);
|
|
14066
|
-
else if (doc.data.kind === "sheet") stage = /* @__PURE__ */ (0,
|
|
14182
|
+
else if (doc.data.kind === "sheet") stage = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react17.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
14067
14183
|
SheetView3,
|
|
14068
14184
|
{
|
|
14069
14185
|
bytes: content.data,
|
|
@@ -14090,7 +14206,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14090
14206
|
},
|
|
14091
14207
|
`${doc.data.id}:${versionId ?? ""}`
|
|
14092
14208
|
) });
|
|
14093
|
-
else stage = /* @__PURE__ */ (0,
|
|
14209
|
+
else stage = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w100n-docs-empty", children: t.unsupported });
|
|
14094
14210
|
}
|
|
14095
14211
|
const Kind = doc.data ? icons3[doc.data.kind] : import_lucide_react10.FileText;
|
|
14096
14212
|
const top = Math.min(...outline2.map((h) => h.level));
|
|
@@ -14110,7 +14226,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14110
14226
|
if (text && host.comments && !versionId) panelTabs.push(["comments", import_lucide_react10.MessagesSquare, t.comments]);
|
|
14111
14227
|
const sharing = !!host.links && !!doc.data?.rights.edit && !versionId;
|
|
14112
14228
|
if (sharing) panelTabs.push(["sharing", import_lucide_react10.Share2, t.sharing]);
|
|
14113
|
-
const listToggle = /* @__PURE__ */ (0,
|
|
14229
|
+
const listToggle = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
14114
14230
|
"button",
|
|
14115
14231
|
{
|
|
14116
14232
|
ref: listButton,
|
|
@@ -14120,10 +14236,10 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14120
14236
|
onClick: () => side2("list", !listOpen),
|
|
14121
14237
|
"aria-label": listOpen ? t.closeList : t.openList,
|
|
14122
14238
|
title: listOpen ? t.closeList : t.openList,
|
|
14123
|
-
children: listOpen ? /* @__PURE__ */ (0,
|
|
14239
|
+
children: listOpen ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.PanelLeftClose, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.PanelLeftOpen, { "aria-hidden": true })
|
|
14124
14240
|
}
|
|
14125
14241
|
);
|
|
14126
|
-
const panelToggle = doc.data && /* @__PURE__ */ (0,
|
|
14242
|
+
const panelToggle = doc.data && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
14127
14243
|
"button",
|
|
14128
14244
|
{
|
|
14129
14245
|
ref: panelButton,
|
|
@@ -14133,16 +14249,16 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14133
14249
|
onClick: () => side2("panel", !panelOpen),
|
|
14134
14250
|
"aria-label": panelOpen ? t.closePanel : t.openPanel,
|
|
14135
14251
|
title: panelOpen ? t.closePanel : t.openPanel,
|
|
14136
|
-
children: panelOpen ? /* @__PURE__ */ (0,
|
|
14252
|
+
children: panelOpen ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.PanelRightClose, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.PanelRightOpen, { "aria-hidden": true })
|
|
14137
14253
|
}
|
|
14138
14254
|
);
|
|
14139
|
-
return /* @__PURE__ */ (0,
|
|
14140
|
-
/* @__PURE__ */ (0,
|
|
14141
|
-
start && /* @__PURE__ */ (0,
|
|
14255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs", "data-theme": theme, children: [
|
|
14256
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("header", { className: "w100n-docs-bar", children: [
|
|
14257
|
+
start && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-start w100n-docs-slot", children: slot(start) }),
|
|
14142
14258
|
narrow && listToggle,
|
|
14143
|
-
/* @__PURE__ */ (0,
|
|
14144
|
-
/* @__PURE__ */ (0,
|
|
14145
|
-
renaming !== null && doc.data ? /* @__PURE__ */ (0,
|
|
14259
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-tile", "data-kind": doc.data?.kind, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Kind, { "aria-hidden": true }) }),
|
|
14260
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-heading", children: [
|
|
14261
|
+
renaming !== null && doc.data ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
14146
14262
|
"input",
|
|
14147
14263
|
{
|
|
14148
14264
|
className: "w100n-docs-title w100n-docs-rename",
|
|
@@ -14160,7 +14276,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14160
14276
|
}
|
|
14161
14277
|
}
|
|
14162
14278
|
}
|
|
14163
|
-
) : /* @__PURE__ */ (0,
|
|
14279
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
14164
14280
|
"strong",
|
|
14165
14281
|
{
|
|
14166
14282
|
className: "w100n-docs-title",
|
|
@@ -14169,195 +14285,198 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14169
14285
|
children: doc.data?.name ?? t.documents
|
|
14170
14286
|
}
|
|
14171
14287
|
),
|
|
14172
|
-
docbar ? /* @__PURE__ */ (0,
|
|
14173
|
-
i > 0 && /* @__PURE__ */ (0,
|
|
14288
|
+
docbar ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { ref: setMenusAt, className: "w100n-docs-menus" }) : crumbs.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-crumbs", children: crumbs.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { children: [
|
|
14289
|
+
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.ChevronRight, { "aria-hidden": true }),
|
|
14174
14290
|
item
|
|
14175
|
-
] }, i)) }) : /* @__PURE__ */ (0,
|
|
14291
|
+
] }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-hint", children: t.hint })
|
|
14176
14292
|
] }),
|
|
14177
|
-
versionId && /* @__PURE__ */ (0,
|
|
14178
|
-
versionId && text && /* @__PURE__ */ (0,
|
|
14179
|
-
/* @__PURE__ */ (0,
|
|
14293
|
+
versionId && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-badge", children: versions.data?.find((v) => v.id === versionId) && date(versions.data.find((v) => v.id === versionId).createdAt) }),
|
|
14294
|
+
versionId && text && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", "aria-pressed": comparing, onClick: () => setComparing(!comparing), children: [
|
|
14295
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.FileDiff, { "aria-hidden": true }),
|
|
14180
14296
|
comparing ? t.hideChanges : t.showChanges
|
|
14181
14297
|
] }),
|
|
14182
|
-
versionId && here.documentId && host.restore && doc.data?.rights.edit && /* @__PURE__ */ (0,
|
|
14183
|
-
/* @__PURE__ */ (0,
|
|
14298
|
+
versionId && here.documentId && host.restore && doc.data?.rights.edit && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", className: "w100n-docs-action", disabled: restoring === "busy", onClick: () => void restore(here.documentId, versionId), children: [
|
|
14299
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.RotateCcw, { "aria-hidden": true }),
|
|
14184
14300
|
t.restore
|
|
14185
14301
|
] }),
|
|
14186
|
-
restoring === "failed" && /* @__PURE__ */ (0,
|
|
14187
|
-
doc.data?.convert && host.copyAs && !versionId && /* @__PURE__ */ (0,
|
|
14188
|
-
/* @__PURE__ */ (0,
|
|
14302
|
+
restoring === "failed" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-muted", children: t.restoreFailed }),
|
|
14303
|
+
doc.data?.convert && host.copyAs && !versionId && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "green", disabled: copying === "busy", onClick: () => void copyAs(doc.data), children: [
|
|
14304
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.FileSpreadsheet, { "aria-hidden": true }),
|
|
14189
14305
|
t.copyAs
|
|
14190
14306
|
] }),
|
|
14191
|
-
copying === "failed" && /* @__PURE__ */ (0,
|
|
14192
|
-
|
|
14193
|
-
|
|
14194
|
-
|
|
14307
|
+
copying === "failed" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-muted", children: t.copyFailed }),
|
|
14308
|
+
kept?.id === here.documentId && kept.state === "done" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-muted", role: "status", children: t.templateSaved }),
|
|
14309
|
+
kept?.id === here.documentId && kept.state === "failed" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-muted", role: "alert", children: t.templateFailed }),
|
|
14310
|
+
renamed2 === "failed" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-muted", children: t.renameFailed }),
|
|
14311
|
+
docbar && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { ref: setStatusAt, className: "w100n-docs-status" }),
|
|
14312
|
+
sharing && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", className: "w100n-docs-action", "aria-label": t.share, title: t.share, onClick: () => {
|
|
14195
14313
|
setTab("sharing");
|
|
14196
14314
|
side2("panel", true);
|
|
14197
14315
|
}, children: [
|
|
14198
|
-
/* @__PURE__ */ (0,
|
|
14199
|
-
/* @__PURE__ */ (0,
|
|
14316
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Share2, { "aria-hidden": true }),
|
|
14317
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: t.share })
|
|
14200
14318
|
] }),
|
|
14201
14319
|
doc.data && !versionId && actions?.(doc.data),
|
|
14202
14320
|
narrow && panelToggle,
|
|
14203
|
-
end && /* @__PURE__ */ (0,
|
|
14321
|
+
end && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w100n-docs-end w100n-docs-slot", children: slot(end) })
|
|
14204
14322
|
] }),
|
|
14205
|
-
/* @__PURE__ */ (0,
|
|
14206
|
-
listOpen && /* @__PURE__ */ (0,
|
|
14207
|
-
/* @__PURE__ */ (0,
|
|
14208
|
-
/* @__PURE__ */ (0,
|
|
14209
|
-
/* @__PURE__ */ (0,
|
|
14210
|
-
/* @__PURE__ */ (0,
|
|
14323
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { ref: body, className: "w100n-docs-body", children: [
|
|
14324
|
+
listOpen && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("aside", { className: "w100n-docs-side w100n-docs-list", "aria-label": t.documents, children: [
|
|
14325
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-head", children: [
|
|
14326
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-row", children: [
|
|
14327
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
14328
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Files, { "aria-hidden": true }),
|
|
14211
14329
|
t.documents,
|
|
14212
|
-
/* @__PURE__ */ (0,
|
|
14330
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: all.length })
|
|
14213
14331
|
] }),
|
|
14214
|
-
host.create && /* @__PURE__ */ (0,
|
|
14332
|
+
host.create && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-new", onKeyDown: (e) => {
|
|
14215
14333
|
if (e.key === "Escape" && adding) {
|
|
14216
14334
|
e.stopPropagation();
|
|
14217
14335
|
setAdding(false);
|
|
14218
14336
|
}
|
|
14219
14337
|
}, children: [
|
|
14220
|
-
/* @__PURE__ */ (0,
|
|
14221
|
-
/* @__PURE__ */ (0,
|
|
14222
|
-
/* @__PURE__ */ (0,
|
|
14223
|
-
/* @__PURE__ */ (0,
|
|
14338
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", className: "w100n-docs-action", "aria-haspopup": "menu", "aria-expanded": adding, disabled: sending === "busy", onClick: () => setAdding(!adding), children: [
|
|
14339
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Plus, { "aria-hidden": true }),
|
|
14340
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: sending === "busy" ? t.uploading : t.create }),
|
|
14341
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.ChevronDown, { "aria-hidden": true })
|
|
14224
14342
|
] }),
|
|
14225
|
-
adding && /* @__PURE__ */ (0,
|
|
14226
|
-
/* @__PURE__ */ (0,
|
|
14343
|
+
adding && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { role: "menu", className: "w100n-docs-menu", children: [
|
|
14344
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
14227
14345
|
setAdding(false);
|
|
14228
14346
|
setMaking(true);
|
|
14229
14347
|
}, children: [
|
|
14230
|
-
/* @__PURE__ */ (0,
|
|
14231
|
-
/* @__PURE__ */ (0,
|
|
14348
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-all", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.FilePlus, { "aria-hidden": true }) }),
|
|
14349
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("b", { children: t.newTitle })
|
|
14232
14350
|
] }),
|
|
14233
|
-
/* @__PURE__ */ (0,
|
|
14351
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
14234
14352
|
setAdding(false);
|
|
14235
14353
|
upload.current.click();
|
|
14236
14354
|
}, children: [
|
|
14237
|
-
/* @__PURE__ */ (0,
|
|
14238
|
-
/* @__PURE__ */ (0,
|
|
14355
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-all", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Upload, { "aria-hidden": true }) }),
|
|
14356
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("b", { children: t.uploadFile })
|
|
14239
14357
|
] })
|
|
14240
14358
|
] }),
|
|
14241
|
-
/* @__PURE__ */ (0,
|
|
14359
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { ref: upload, type: "file", hidden: true, "aria-label": t.uploadFile, accept: ".docx,.md,.markdown,.pdf,.xlsx,.csv,.html,.htm", onChange: (e) => {
|
|
14242
14360
|
const file = e.target.files?.[0];
|
|
14243
14361
|
e.target.value = "";
|
|
14244
14362
|
if (file) void send(file);
|
|
14245
14363
|
} })
|
|
14246
14364
|
] }),
|
|
14247
|
-
/* @__PURE__ */ (0,
|
|
14365
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { ref: listClose, type: "button", className: "w100n-docs-close", onClick: () => side2("list", false), "aria-label": t.closeList, title: t.closeList, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.X, { "aria-hidden": true }) })
|
|
14248
14366
|
] }),
|
|
14249
|
-
(spaces.data?.length ?? 0) > 1 && /* @__PURE__ */ (0,
|
|
14367
|
+
(spaces.data?.length ?? 0) > 1 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-picker", onKeyDown: (e) => {
|
|
14250
14368
|
if (e.key !== "Escape" || !picking) return;
|
|
14251
14369
|
e.stopPropagation();
|
|
14252
14370
|
setPicking(false);
|
|
14253
14371
|
e.currentTarget.querySelector("button").focus();
|
|
14254
14372
|
}, children: [
|
|
14255
|
-
/* @__PURE__ */ (0,
|
|
14256
|
-
space ? /* @__PURE__ */ (0,
|
|
14257
|
-
/* @__PURE__ */ (0,
|
|
14258
|
-
!space && /* @__PURE__ */ (0,
|
|
14259
|
-
/* @__PURE__ */ (0,
|
|
14373
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", className: "w100n-docs-field", "aria-haspopup": "listbox", "aria-expanded": picking, onClick: () => setPicking(!picking), children: [
|
|
14374
|
+
space ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-dot", style: { background: space.color ?? void 0 } }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-all", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.LayoutGrid, { "aria-hidden": true }) }),
|
|
14375
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("b", { children: space?.name ?? t.allProjects }),
|
|
14376
|
+
!space && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-count", children: all.length }),
|
|
14377
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.ChevronDown, { "aria-hidden": true })
|
|
14260
14378
|
] }),
|
|
14261
|
-
picking && /* @__PURE__ */ (0,
|
|
14262
|
-
/* @__PURE__ */ (0,
|
|
14263
|
-
/* @__PURE__ */ (0,
|
|
14264
|
-
/* @__PURE__ */ (0,
|
|
14265
|
-
!spaceId && /* @__PURE__ */ (0,
|
|
14379
|
+
picking && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { role: "listbox", className: "w100n-docs-menu", children: [
|
|
14380
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", role: "option", "aria-selected": !spaceId, onClick: () => pick(null), children: [
|
|
14381
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-all", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.LayoutGrid, { "aria-hidden": true }) }),
|
|
14382
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("b", { children: t.allProjects }),
|
|
14383
|
+
!spaceId && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Check, { "aria-hidden": true })
|
|
14266
14384
|
] }),
|
|
14267
|
-
groups2.map((group) => /* @__PURE__ */ (0,
|
|
14268
|
-
group && /* @__PURE__ */ (0,
|
|
14269
|
-
(spaces.data ?? []).filter((item) => (item.group ?? "") === group).map((item) => /* @__PURE__ */ (0,
|
|
14270
|
-
/* @__PURE__ */ (0,
|
|
14271
|
-
/* @__PURE__ */ (0,
|
|
14272
|
-
!spaceId && counts.get(item.id) ? /* @__PURE__ */ (0,
|
|
14273
|
-
item.id === spaceId && /* @__PURE__ */ (0,
|
|
14385
|
+
groups2.map((group) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { role: "group", "aria-label": group || void 0, children: [
|
|
14386
|
+
group && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "w100n-docs-menu-caption", children: group }),
|
|
14387
|
+
(spaces.data ?? []).filter((item) => (item.group ?? "") === group).map((item) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", role: "option", "aria-selected": item.id === spaceId, onClick: () => pick(item.id), children: [
|
|
14388
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-dot", style: { background: item.color ?? void 0 } }),
|
|
14389
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("b", { children: item.name }),
|
|
14390
|
+
!spaceId && counts.get(item.id) ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-count", children: counts.get(item.id) }) : null,
|
|
14391
|
+
item.id === spaceId && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Check, { "aria-hidden": true })
|
|
14274
14392
|
] }, item.id))
|
|
14275
14393
|
] }, group))
|
|
14276
14394
|
] })
|
|
14277
14395
|
] }),
|
|
14278
|
-
/* @__PURE__ */ (0,
|
|
14279
|
-
/* @__PURE__ */ (0,
|
|
14280
|
-
/* @__PURE__ */ (0,
|
|
14281
|
-
/* @__PURE__ */ (0,
|
|
14396
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-filters", children: [
|
|
14397
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "w100n-docs-field w100n-docs-search", children: [
|
|
14398
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Search, { "aria-hidden": true }),
|
|
14399
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { value: query, onChange: (event) => setQuery(event.target.value), placeholder: t.search, "aria-label": t.search })
|
|
14282
14400
|
] }),
|
|
14283
|
-
present.length > 1 && /* @__PURE__ */ (0,
|
|
14401
|
+
present.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-types", onKeyDown: (e) => {
|
|
14284
14402
|
if (e.key !== "Escape" || !typing) return;
|
|
14285
14403
|
e.stopPropagation();
|
|
14286
14404
|
setTyping(false);
|
|
14287
14405
|
e.currentTarget.querySelector("button").focus();
|
|
14288
14406
|
}, children: [
|
|
14289
|
-
/* @__PURE__ */ (0,
|
|
14290
|
-
/* @__PURE__ */ (0,
|
|
14291
|
-
/* @__PURE__ */ (0,
|
|
14292
|
-
picked.length > 0 && /* @__PURE__ */ (0,
|
|
14293
|
-
/* @__PURE__ */ (0,
|
|
14407
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", className: "w100n-docs-field", "aria-haspopup": "listbox", "aria-expanded": typing, "data-on": picked.length > 0, onClick: () => setTyping(!typing), children: [
|
|
14408
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.ListFilter, { "aria-hidden": true }),
|
|
14409
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("b", { children: t.typeFilter }),
|
|
14410
|
+
picked.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-badge", children: picked.length }),
|
|
14411
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.ChevronDown, { "aria-hidden": true })
|
|
14294
14412
|
] }),
|
|
14295
|
-
typing && /* @__PURE__ */ (0,
|
|
14413
|
+
typing && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { role: "listbox", "aria-multiselectable": true, "aria-label": t.kind, className: "w100n-docs-menu", children: [
|
|
14296
14414
|
present.map((item) => {
|
|
14297
14415
|
const Icon = icons3[item];
|
|
14298
14416
|
const on2 = picked.includes(item);
|
|
14299
|
-
return /* @__PURE__ */ (0,
|
|
14300
|
-
/* @__PURE__ */ (0,
|
|
14301
|
-
/* @__PURE__ */ (0,
|
|
14302
|
-
/* @__PURE__ */ (0,
|
|
14303
|
-
/* @__PURE__ */ (0,
|
|
14417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", role: "option", "aria-selected": on2, onClick: () => setPicked(on2 ? picked.filter((k) => k !== item) : [...picked, item]), children: [
|
|
14418
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-box", children: on2 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Check, { "aria-hidden": true }) }),
|
|
14419
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-tile", "data-kind": item, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { "aria-hidden": true }) }),
|
|
14420
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("b", { children: t.kinds[item] }),
|
|
14421
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-count", children: all.filter((doc2) => doc2.kind === item).length })
|
|
14304
14422
|
] }, item);
|
|
14305
14423
|
}),
|
|
14306
|
-
/* @__PURE__ */ (0,
|
|
14307
|
-
/* @__PURE__ */ (0,
|
|
14308
|
-
/* @__PURE__ */ (0,
|
|
14424
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-menu-foot", children: [
|
|
14425
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", onClick: () => setPicked(present), children: t.selectAll }),
|
|
14426
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", onClick: () => setPicked([]), children: t.clearPick })
|
|
14309
14427
|
] })
|
|
14310
14428
|
] })
|
|
14311
14429
|
] })
|
|
14312
14430
|
] }),
|
|
14313
|
-
picked.length > 0 && /* @__PURE__ */ (0,
|
|
14431
|
+
picked.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.kind, children: picked.map((item) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", "aria-pressed": true, "aria-label": `${t.clearPick}: ${t.kinds[item]}`, onClick: () => setPicked(picked.filter((k) => k !== item)), children: [
|
|
14314
14432
|
t.kinds[item],
|
|
14315
|
-
/* @__PURE__ */ (0,
|
|
14433
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.X, { "aria-hidden": true })
|
|
14316
14434
|
] }, item)) })
|
|
14317
14435
|
] }),
|
|
14318
|
-
/* @__PURE__ */ (0,
|
|
14319
|
-
sending === "failed" && /* @__PURE__ */ (0,
|
|
14436
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-cards", children: [
|
|
14437
|
+
sending === "failed" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.uploadFailed }),
|
|
14320
14438
|
list.error && failed(list.retry),
|
|
14321
|
-
list.loading && !list.data && /* @__PURE__ */ (0,
|
|
14322
|
-
list.data && !shown.length && /* @__PURE__ */ (0,
|
|
14323
|
-
folders.map((folder2) => /* @__PURE__ */ (0,
|
|
14324
|
-
folders.length > 1 && /* @__PURE__ */ (0,
|
|
14325
|
-
/* @__PURE__ */ (0,
|
|
14326
|
-
/* @__PURE__ */ (0,
|
|
14327
|
-
/* @__PURE__ */ (0,
|
|
14328
|
-
/* @__PURE__ */ (0,
|
|
14329
|
-
/* @__PURE__ */ (0,
|
|
14439
|
+
list.loading && !list.data && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "w100n-docs-muted", children: t.loading }),
|
|
14440
|
+
list.data && !shown.length && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "w100n-docs-muted", children: all.length ? t.nothing : t.empty }),
|
|
14441
|
+
folders.map((folder2) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-folder", role: "group", "aria-label": folder2 || t.loose, children: [
|
|
14442
|
+
folders.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "w100n-docs-group", children: folder2 || t.loose }),
|
|
14443
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w100n-docs-grid", children: shown.filter((item) => !spaceId || (item.folder ?? "") === folder2).map((item) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", className: "w100n-docs-card", "aria-current": item.id === here.documentId, onClick: () => open(item), title: item.name, children: [
|
|
14444
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Thumb, { host, item, label: t.kinds[item.kind] }),
|
|
14445
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "w100n-docs-card-text", children: [
|
|
14446
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("b", { children: item.name }),
|
|
14447
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("small", { children: [!spaceId && names2.get(item.spaceId), ago(item.updatedAt)].filter(Boolean).join(" \xB7 ") }),
|
|
14448
|
+
inside2.get(item.id) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("small", { className: "w100n-docs-hit", children: inside2.get(item.id).split(/[«»]/).map((part, i) => i % 2 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("mark", { children: part }, i) : part) })
|
|
14330
14449
|
] })
|
|
14331
14450
|
] }, item.id)) })
|
|
14332
14451
|
] }, folder2))
|
|
14333
14452
|
] })
|
|
14334
14453
|
] }),
|
|
14335
14454
|
!narrow && !listOpen && listToggle,
|
|
14336
|
-
/* @__PURE__ */ (0,
|
|
14455
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("main", { className: "w100n-docs-stage", children: [
|
|
14337
14456
|
!narrow && !panelOpen && panelToggle,
|
|
14338
|
-
/* @__PURE__ */ (0,
|
|
14457
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w100n-docs-bare", children: stage })
|
|
14339
14458
|
] }),
|
|
14340
|
-
doc.data && panelOpen && /* @__PURE__ */ (0,
|
|
14341
|
-
/* @__PURE__ */ (0,
|
|
14342
|
-
/* @__PURE__ */ (0,
|
|
14343
|
-
/* @__PURE__ */ (0,
|
|
14344
|
-
(panelTabs.length < 4 || tab === key2 && panelTabs.length < 5) && /* @__PURE__ */ (0,
|
|
14459
|
+
doc.data && panelOpen && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("aside", { ref: panel, className: "w100n-docs-side w100n-docs-panel", "aria-label": t.details, children: [
|
|
14460
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w100n-docs-head", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-row", children: [
|
|
14461
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w100n-docs-tabs", role: "tablist", "aria-label": t.details, "data-compact": panelTabs.length > 3, onKeyDown: rove, children: panelTabs.map(([key2, Icon, label]) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", role: "tab", "aria-selected": tab === key2, tabIndex: tab === key2 ? 0 : -1, "aria-label": label, title: label, onClick: () => setTab(key2), children: [
|
|
14462
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { "aria-hidden": true }),
|
|
14463
|
+
(panelTabs.length < 4 || tab === key2 && panelTabs.length < 5) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: label })
|
|
14345
14464
|
] }, key2)) }),
|
|
14346
|
-
/* @__PURE__ */ (0,
|
|
14465
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: "w100n-docs-close", onClick: () => side2("panel", false), "aria-label": t.closePanel, title: t.closePanel, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.X, { "aria-hidden": true }) })
|
|
14347
14466
|
] }) }),
|
|
14348
|
-
/* @__PURE__ */ (0,
|
|
14349
|
-
tab === "outline" && (outline2.length ? /* @__PURE__ */ (0,
|
|
14350
|
-
now && /* @__PURE__ */ (0,
|
|
14351
|
-
/* @__PURE__ */ (0,
|
|
14352
|
-
/* @__PURE__ */ (0,
|
|
14467
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-panel-body", role: "tabpanel", "aria-label": panelTabs.find(([key2]) => key2 === tab)?.[2], children: [
|
|
14468
|
+
tab === "outline" && (outline2.length ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("nav", { className: "w100n-docs-outline", "aria-label": t.outline, children: [
|
|
14469
|
+
now && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-reading", children: [
|
|
14470
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("i", { style: { width: `${Math.round(now.progress * 100)}%` } }) }),
|
|
14471
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("small", { children: [
|
|
14353
14472
|
Math.round(now.progress * 100),
|
|
14354
14473
|
"% ",
|
|
14355
14474
|
t.read
|
|
14356
14475
|
] })
|
|
14357
14476
|
] }),
|
|
14358
|
-
outline2.length > 8 && /* @__PURE__ */ (0,
|
|
14359
|
-
/* @__PURE__ */ (0,
|
|
14360
|
-
/* @__PURE__ */ (0,
|
|
14477
|
+
outline2.length > 8 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "w100n-docs-field w100n-docs-search", children: [
|
|
14478
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Search, { "aria-hidden": true }),
|
|
14479
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { value: hunt, onChange: (e) => setHunt(e.target.value), placeholder: t.findHeading, "aria-label": t.findHeading })
|
|
14361
14480
|
] }),
|
|
14362
14481
|
chapters.map((c, i) => {
|
|
14363
14482
|
const subs = words3.length ? c.subs.filter(hit) : c.subs;
|
|
@@ -14365,13 +14484,13 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14365
14484
|
const opened3 = words3.length > 0 || (fold[c.head.id] ?? i === reached);
|
|
14366
14485
|
const named3 = /^(\d+)[.)]?\s+(.+)$/.exec(c.head.text);
|
|
14367
14486
|
const mark = c.subs.findIndex((s) => s.id === now?.id);
|
|
14368
|
-
return /* @__PURE__ */ (0,
|
|
14369
|
-
/* @__PURE__ */ (0,
|
|
14370
|
-
/* @__PURE__ */ (0,
|
|
14371
|
-
/* @__PURE__ */ (0,
|
|
14372
|
-
/* @__PURE__ */ (0,
|
|
14487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-chapter", "data-state": reached < 0 ? void 0 : i < reached ? "done" : i === reached ? "now" : void 0, children: [
|
|
14488
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-chapter-row", children: [
|
|
14489
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", className: "w100n-docs-chapter-go", "aria-label": c.head.text, "aria-current": now?.id === c.head.id ? "location" : void 0, onClick: () => reach(c.head), children: [
|
|
14490
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-chapter-num", children: named3 ? named3[1] : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Bookmark, { "aria-hidden": true }) }),
|
|
14491
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("b", { children: named3 ? named3[2] : c.head.text })
|
|
14373
14492
|
] }),
|
|
14374
|
-
c.subs.length > 0 && /* @__PURE__ */ (0,
|
|
14493
|
+
c.subs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
14375
14494
|
"button",
|
|
14376
14495
|
{
|
|
14377
14496
|
type: "button",
|
|
@@ -14381,13 +14500,13 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14381
14500
|
title: opened3 ? t.hideSections : t.showSections,
|
|
14382
14501
|
onClick: () => setFold({ ...fold, [c.head.id]: !opened3 }),
|
|
14383
14502
|
children: [
|
|
14384
|
-
/* @__PURE__ */ (0,
|
|
14385
|
-
opened3 ? /* @__PURE__ */ (0,
|
|
14503
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("small", { children: c.subs.length }),
|
|
14504
|
+
opened3 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.ChevronDown, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.ChevronRight, { "aria-hidden": true })
|
|
14386
14505
|
]
|
|
14387
14506
|
}
|
|
14388
14507
|
)
|
|
14389
14508
|
] }),
|
|
14390
|
-
opened3 && subs.length > 0 && /* @__PURE__ */ (0,
|
|
14509
|
+
opened3 && subs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w100n-docs-sections", children: subs.map((s) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
14391
14510
|
"button",
|
|
14392
14511
|
{
|
|
14393
14512
|
type: "button",
|
|
@@ -14396,7 +14515,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14396
14515
|
"data-state": i < reached || i === reached && c.subs.indexOf(s) < mark ? "done" : void 0,
|
|
14397
14516
|
"aria-current": now?.id === s.id ? "location" : void 0,
|
|
14398
14517
|
children: [
|
|
14399
|
-
/* @__PURE__ */ (0,
|
|
14518
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("i", { "aria-hidden": true }),
|
|
14400
14519
|
s.text
|
|
14401
14520
|
]
|
|
14402
14521
|
},
|
|
@@ -14404,46 +14523,46 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14404
14523
|
)) })
|
|
14405
14524
|
] }, c.head.id);
|
|
14406
14525
|
})
|
|
14407
|
-
] }) : /* @__PURE__ */ (0,
|
|
14408
|
-
tab === "versions" && /* @__PURE__ */ (0,
|
|
14526
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "w100n-docs-muted", children: t.noOutline })),
|
|
14527
|
+
tab === "versions" && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-versions", children: [
|
|
14409
14528
|
versions.error && failed(versions.retry),
|
|
14410
|
-
(versions.data ?? []).map((item) => /* @__PURE__ */ (0,
|
|
14529
|
+
(versions.data ?? []).map((item) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
14411
14530
|
"button",
|
|
14412
14531
|
{
|
|
14413
14532
|
type: "button",
|
|
14414
14533
|
"aria-pressed": (versionId ?? "current") === item.id || !versionId && item.current,
|
|
14415
14534
|
onClick: () => view(item.current ? null : item.id),
|
|
14416
14535
|
children: [
|
|
14417
|
-
/* @__PURE__ */ (0,
|
|
14536
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("b", { children: [
|
|
14418
14537
|
date(item.createdAt),
|
|
14419
|
-
item.current && /* @__PURE__ */ (0,
|
|
14538
|
+
item.current && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-badge", children: t.current })
|
|
14420
14539
|
] }),
|
|
14421
|
-
/* @__PURE__ */ (0,
|
|
14540
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("small", { children: [item.author?.name, size2(item.size), item.note].filter(Boolean).join(" \xB7 ") })
|
|
14422
14541
|
]
|
|
14423
14542
|
},
|
|
14424
14543
|
item.id
|
|
14425
14544
|
))
|
|
14426
14545
|
] }),
|
|
14427
|
-
tab === "details" && /* @__PURE__ */ (0,
|
|
14428
|
-
/* @__PURE__ */ (0,
|
|
14429
|
-
/* @__PURE__ */ (0,
|
|
14430
|
-
/* @__PURE__ */ (0,
|
|
14431
|
-
/* @__PURE__ */ (0,
|
|
14432
|
-
/* @__PURE__ */ (0,
|
|
14433
|
-
/* @__PURE__ */ (0,
|
|
14434
|
-
doc.data.updatedBy && /* @__PURE__ */ (0,
|
|
14435
|
-
/* @__PURE__ */ (0,
|
|
14436
|
-
/* @__PURE__ */ (0,
|
|
14546
|
+
tab === "details" && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("dl", { className: "w100n-docs-details", children: [
|
|
14547
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dt", { children: t.kind }),
|
|
14548
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dd", { children: t.kinds[doc.data.kind] }),
|
|
14549
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dt", { children: t.size }),
|
|
14550
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dd", { children: size2(doc.data.size) }),
|
|
14551
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dt", { children: t.updated }),
|
|
14552
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dd", { children: date(doc.data.updatedAt) }),
|
|
14553
|
+
doc.data.updatedBy && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
14554
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dt", { children: t.by }),
|
|
14555
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dd", { children: doc.data.updatedBy.name })
|
|
14437
14556
|
] }),
|
|
14438
|
-
/* @__PURE__ */ (0,
|
|
14439
|
-
/* @__PURE__ */ (0,
|
|
14557
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dt", { children: t.rights }),
|
|
14558
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dd", { children: [doc.data.rights.view && t.view, doc.data.rights.comment && t.comment, doc.data.rights.edit && t.edit].filter(Boolean).join(", ") })
|
|
14440
14559
|
] }),
|
|
14441
|
-
tab === "details" && host.exportAs && !!doc.data.exports?.length && /* @__PURE__ */ (0,
|
|
14442
|
-
/* @__PURE__ */ (0,
|
|
14443
|
-
/* @__PURE__ */ (0,
|
|
14560
|
+
tab === "details" && host.exportAs && !!doc.data.exports?.length && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-about", children: [
|
|
14561
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
14562
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.FileDown, { "aria-hidden": true }),
|
|
14444
14563
|
t.exportAs
|
|
14445
14564
|
] }),
|
|
14446
|
-
/* @__PURE__ */ (0,
|
|
14565
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w100n-docs-chips", children: doc.data.exports.map((format) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
14447
14566
|
"button",
|
|
14448
14567
|
{
|
|
14449
14568
|
type: "button",
|
|
@@ -14451,22 +14570,22 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14451
14570
|
disabled: exporting === "busy",
|
|
14452
14571
|
onClick: () => void exportAs(doc.data, format),
|
|
14453
14572
|
children: [
|
|
14454
|
-
/* @__PURE__ */ (0,
|
|
14573
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.FileDown, { "aria-hidden": true }),
|
|
14455
14574
|
format.toUpperCase()
|
|
14456
14575
|
]
|
|
14457
14576
|
},
|
|
14458
14577
|
format
|
|
14459
14578
|
)) }),
|
|
14460
|
-
exporting === "failed" && /* @__PURE__ */ (0,
|
|
14579
|
+
exporting === "failed" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "w100n-docs-muted", children: t.exportFailed })
|
|
14461
14580
|
] }),
|
|
14462
|
-
tab === "comments" && /* @__PURE__ */ (0,
|
|
14463
|
-
tab === "sharing" && sharing && /* @__PURE__ */ (0,
|
|
14464
|
-
tab === "signatures" && /* @__PURE__ */ (0,
|
|
14581
|
+
tab === "comments" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { ref: setBox }),
|
|
14582
|
+
tab === "sharing" && sharing && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Sharing, { host, doc: doc.data, t, language, team: names2.get(doc.data.spaceId) }),
|
|
14583
|
+
tab === "signatures" && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-versions", children: [
|
|
14465
14584
|
signatures.error && failed(signatures.retry),
|
|
14466
|
-
signatures.data?.length === 0 && /* @__PURE__ */ (0,
|
|
14585
|
+
signatures.data?.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "w100n-docs-muted", children: t.noSignatures }),
|
|
14467
14586
|
(signatures.data ?? []).map((entry2) => {
|
|
14468
14587
|
const signed = versions.data?.find((v) => v.id === entry2.versionId);
|
|
14469
|
-
return /* @__PURE__ */ (0,
|
|
14588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
14470
14589
|
"button",
|
|
14471
14590
|
{
|
|
14472
14591
|
type: "button",
|
|
@@ -14474,15 +14593,15 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14474
14593
|
"aria-pressed": !!signed && (versionId ?? versions.data?.find((v) => v.current)?.id) === signed.id,
|
|
14475
14594
|
onClick: () => view(signed.current ? null : signed.id),
|
|
14476
14595
|
children: [
|
|
14477
|
-
/* @__PURE__ */ (0,
|
|
14596
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("b", { children: [
|
|
14478
14597
|
entry2.signer.name,
|
|
14479
|
-
/* @__PURE__ */ (0,
|
|
14598
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "w100n-docs-badge", children: [
|
|
14480
14599
|
t.page,
|
|
14481
14600
|
" ",
|
|
14482
14601
|
entry2.page
|
|
14483
14602
|
] })
|
|
14484
14603
|
] }),
|
|
14485
|
-
/* @__PURE__ */ (0,
|
|
14604
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("small", { children: [date(entry2.signedAt), t.methods[entry2.method], signed && (signed.current ? t.current : `${t.version} ${date(signed.createdAt)}`)].filter(Boolean).join(" \xB7 ") })
|
|
14486
14605
|
]
|
|
14487
14606
|
},
|
|
14488
14607
|
entry2.id
|
|
@@ -14493,7 +14612,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14493
14612
|
] })
|
|
14494
14613
|
] })
|
|
14495
14614
|
] }),
|
|
14496
|
-
making && /* @__PURE__ */ (0,
|
|
14615
|
+
making && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(NewDocument, { host, t, onClose: () => setMaking(false), onMade: (made2) => {
|
|
14497
14616
|
setMaking(false);
|
|
14498
14617
|
opened2(made2);
|
|
14499
14618
|
} }),
|
|
@@ -14502,13 +14621,13 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14502
14621
|
}
|
|
14503
14622
|
|
|
14504
14623
|
// src/GuestDocument.tsx
|
|
14505
|
-
var
|
|
14624
|
+
var import_react18 = require("react");
|
|
14506
14625
|
var import_lucide_react11 = require("lucide-react");
|
|
14507
14626
|
init_text();
|
|
14508
14627
|
init_useLoad();
|
|
14509
|
-
var
|
|
14510
|
-
var TextEditor4 = (0,
|
|
14511
|
-
var SheetView4 = (0,
|
|
14628
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
14629
|
+
var TextEditor4 = (0, import_react18.lazy)(() => Promise.resolve().then(() => (init_TextEditor(), TextEditor_exports)));
|
|
14630
|
+
var SheetView4 = (0, import_react18.lazy)(() => Promise.resolve().then(() => (init_SheetView(), SheetView_exports)));
|
|
14512
14631
|
var icons4 = { docx: import_lucide_react11.FileText, markdown: import_lucide_react11.FileType, pdf: import_lucide_react11.Files, sheet: import_lucide_react11.FileSpreadsheet, slides: import_lucide_react11.Presentation };
|
|
14513
14632
|
var GuestRefused = class extends Error {
|
|
14514
14633
|
constructor(reason, file = "", sharedBy = "") {
|
|
@@ -14534,14 +14653,14 @@ var remember = (name) => {
|
|
|
14534
14653
|
};
|
|
14535
14654
|
function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
14536
14655
|
const t = texts[language];
|
|
14537
|
-
const [ask, setAsk] = (0,
|
|
14538
|
-
const [typed, setTyped] = (0,
|
|
14539
|
-
const [name, setName] = (0,
|
|
14540
|
-
const named3 = (0,
|
|
14541
|
-
const [slot, setSlot] = (0,
|
|
14542
|
-
const [saving, setSaving] = (0,
|
|
14656
|
+
const [ask, setAsk] = (0, import_react18.useState)(() => ({ name: remembered() || void 0 }));
|
|
14657
|
+
const [typed, setTyped] = (0, import_react18.useState)("");
|
|
14658
|
+
const [name, setName] = (0, import_react18.useState)(remembered);
|
|
14659
|
+
const named3 = (0, import_react18.useRef)(name);
|
|
14660
|
+
const [slot, setSlot] = (0, import_react18.useState)(null);
|
|
14661
|
+
const [saving, setSaving] = (0, import_react18.useState)("idle");
|
|
14543
14662
|
const opened2 = useLoad((signal) => host.open(ask, { signal }), [host, ask]);
|
|
14544
|
-
const [notes3] = (0,
|
|
14663
|
+
const [notes3] = (0, import_react18.useState)(() => ({
|
|
14545
14664
|
me: { id: "", name: "" },
|
|
14546
14665
|
spaces: async () => [],
|
|
14547
14666
|
documents: async () => [],
|
|
@@ -14568,17 +14687,17 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
14568
14687
|
const top = (file2, badge) => {
|
|
14569
14688
|
const kind2 = file2 ? kindOf(file2.name, file2.mimeType) : null;
|
|
14570
14689
|
const Kind = kind2 ? icons4[kind2] : import_lucide_react11.FileText;
|
|
14571
|
-
return /* @__PURE__ */ (0,
|
|
14572
|
-
brand && /* @__PURE__ */ (0,
|
|
14573
|
-
file2 && /* @__PURE__ */ (0,
|
|
14574
|
-
/* @__PURE__ */ (0,
|
|
14575
|
-
/* @__PURE__ */ (0,
|
|
14576
|
-
/* @__PURE__ */ (0,
|
|
14577
|
-
file2.sharedBy && /* @__PURE__ */ (0,
|
|
14690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("header", { className: "w100n-docs-bar w100n-guest-bar", children: [
|
|
14691
|
+
brand && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w100n-guest-brand", children: brand }),
|
|
14692
|
+
file2 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
14693
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w100n-docs-tile", "data-kind": kind2, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Kind, { "aria-hidden": true }) }),
|
|
14694
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w100n-docs-heading", children: [
|
|
14695
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { className: "w100n-docs-title", children: file2.name }),
|
|
14696
|
+
file2.sharedBy && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w100n-docs-crumbs", children: t.sharedBy.replace("{name}", file2.sharedBy) })
|
|
14578
14697
|
] }),
|
|
14579
|
-
badge && /* @__PURE__ */ (0,
|
|
14580
|
-
file2.download && /* @__PURE__ */ (0,
|
|
14581
|
-
(kind2 === "docx" || kind2 === "markdown" || kind2 === "sheet" || kind2 === "slides") && /* @__PURE__ */ (0,
|
|
14698
|
+
badge && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w100n-docs-badge", "data-kind": kind2, children: badge }),
|
|
14699
|
+
file2.download && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w100n-docs-end", children: [
|
|
14700
|
+
(kind2 === "docx" || kind2 === "markdown" || kind2 === "sheet" || kind2 === "slides") && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
14582
14701
|
"button",
|
|
14583
14702
|
{
|
|
14584
14703
|
type: "button",
|
|
@@ -14589,25 +14708,25 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
14589
14708
|
"aria-label": t.pdfCopy,
|
|
14590
14709
|
title: t.pdfCopy,
|
|
14591
14710
|
children: [
|
|
14592
|
-
/* @__PURE__ */ (0,
|
|
14593
|
-
/* @__PURE__ */ (0,
|
|
14711
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react11.FileDown, { "aria-hidden": true }),
|
|
14712
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: t.pdfCopy })
|
|
14594
14713
|
]
|
|
14595
14714
|
}
|
|
14596
14715
|
),
|
|
14597
|
-
/* @__PURE__ */ (0,
|
|
14598
|
-
/* @__PURE__ */ (0,
|
|
14599
|
-
/* @__PURE__ */ (0,
|
|
14716
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", disabled: saving === "busy", onClick: () => void download("file"), "aria-label": t.download, title: t.download, children: [
|
|
14717
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react11.Download, { "aria-hidden": true }),
|
|
14718
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: t.download })
|
|
14600
14719
|
] })
|
|
14601
14720
|
] })
|
|
14602
14721
|
] })
|
|
14603
14722
|
] });
|
|
14604
14723
|
};
|
|
14605
|
-
const gate = (tone, Icon, title, body, form) => /* @__PURE__ */ (0,
|
|
14724
|
+
const gate = (tone, Icon, title, body, form) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
|
|
14606
14725
|
top(null, null),
|
|
14607
|
-
/* @__PURE__ */ (0,
|
|
14608
|
-
/* @__PURE__ */ (0,
|
|
14609
|
-
/* @__PURE__ */ (0,
|
|
14610
|
-
/* @__PURE__ */ (0,
|
|
14726
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "w100n-guest-gate", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w100n-guest-card", children: [
|
|
14727
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w100n-share-tile", "data-tone": tone, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon, { "aria-hidden": true }) }),
|
|
14728
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h2", { children: title }),
|
|
14729
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children: body }),
|
|
14611
14730
|
form
|
|
14612
14731
|
] }) })
|
|
14613
14732
|
] });
|
|
@@ -14623,7 +14742,7 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
14623
14742
|
password ? import_lucide_react11.Lock : import_lucide_react11.UserRound,
|
|
14624
14743
|
refused.file || t.documents,
|
|
14625
14744
|
shared + (password ? t.passwordAsk : t.nameAsk),
|
|
14626
|
-
/* @__PURE__ */ (0,
|
|
14745
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("form", { className: "w100n-guest-form", onSubmit: (e) => {
|
|
14627
14746
|
e.preventDefault();
|
|
14628
14747
|
if (!typed.trim()) return;
|
|
14629
14748
|
if (password) setAsk({ ...ask, password: typed });
|
|
@@ -14633,7 +14752,7 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
14633
14752
|
}
|
|
14634
14753
|
setTyped("");
|
|
14635
14754
|
}, children: [
|
|
14636
|
-
/* @__PURE__ */ (0,
|
|
14755
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
14637
14756
|
"input",
|
|
14638
14757
|
{
|
|
14639
14758
|
className: "w100n-share-input",
|
|
@@ -14646,21 +14765,21 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
14646
14765
|
onChange: (e) => setTyped(e.target.value)
|
|
14647
14766
|
}
|
|
14648
14767
|
),
|
|
14649
|
-
refused.reason === "wrong" && /* @__PURE__ */ (0,
|
|
14650
|
-
/* @__PURE__ */ (0,
|
|
14651
|
-
/* @__PURE__ */ (0,
|
|
14768
|
+
refused.reason === "wrong" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.wrongPassword }),
|
|
14769
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "submit", className: "w100n-docs-action", disabled: !typed.trim(), children: [
|
|
14770
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react11.Eye, { "aria-hidden": true }),
|
|
14652
14771
|
t.openDoc
|
|
14653
14772
|
] })
|
|
14654
14773
|
] })
|
|
14655
14774
|
);
|
|
14656
14775
|
}
|
|
14657
14776
|
if (refused?.reason === "busy") return gate("slate", import_lucide_react11.Ban, t.failed, t.tooMany);
|
|
14658
|
-
return gate("slate", import_lucide_react11.Ban, t.failed, "", /* @__PURE__ */ (0,
|
|
14777
|
+
return gate("slate", import_lucide_react11.Ban, t.failed, "", /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "w100n-docs-action", onClick: opened2.retry, children: t.retry }));
|
|
14659
14778
|
}
|
|
14660
14779
|
const file = opened2.data;
|
|
14661
|
-
if (!file) return /* @__PURE__ */ (0,
|
|
14780
|
+
if (!file) return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
|
|
14662
14781
|
top(null, null),
|
|
14663
|
-
/* @__PURE__ */ (0,
|
|
14782
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "w100n-docs-empty", children: t.loading })
|
|
14664
14783
|
] });
|
|
14665
14784
|
const kind = kindOf(file.name, file.mimeType);
|
|
14666
14785
|
const text = kind === "docx" || kind === "markdown";
|
|
@@ -14668,23 +14787,23 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
14668
14787
|
const rights = { view: true, comment: talk, edit: false };
|
|
14669
14788
|
const quiet3 = () => {
|
|
14670
14789
|
};
|
|
14671
|
-
let stage = /* @__PURE__ */ (0,
|
|
14672
|
-
if (text) stage = /* @__PURE__ */ (0,
|
|
14673
|
-
else if (kind === "pdf") stage = /* @__PURE__ */ (0,
|
|
14674
|
-
else if (kind === "slides") stage = /* @__PURE__ */ (0,
|
|
14675
|
-
else if (kind === "sheet") stage = /* @__PURE__ */ (0,
|
|
14676
|
-
return /* @__PURE__ */ (0,
|
|
14790
|
+
let stage = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "w100n-docs-empty", children: t.unsupported });
|
|
14791
|
+
if (text) stage = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react18.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TextEditor4, { kind, bytes: file.bytes, t, language, rights, host: talk ? notes3 : void 0, documentId: file.id, onOutline: quiet3, slot: talk ? slot : null }) });
|
|
14792
|
+
else if (kind === "pdf") stage = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PdfView, { bytes: file.bytes, t, language, worker: host.pdfWorker, rights, documentId: file.id, onOutline: quiet3 });
|
|
14793
|
+
else if (kind === "slides") stage = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SlidesView, { html: new TextDecoder().decode(file.bytes), name: file.name, rights, language, theme, onOutline: quiet3 });
|
|
14794
|
+
else if (kind === "sheet") stage = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react18.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SheetView4, { bytes: file.bytes, name: file.name, kind: /\.csv$/i.test(file.name) || file.mimeType === "text/csv" ? "csv" : "xlsx", rights, language, theme, documentId: file.id }) });
|
|
14795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
|
|
14677
14796
|
top(file, talk ? t.badgeComment : t.badgeRead),
|
|
14678
|
-
saving === "failed" && /* @__PURE__ */ (0,
|
|
14679
|
-
/* @__PURE__ */ (0,
|
|
14680
|
-
/* @__PURE__ */ (0,
|
|
14681
|
-
talk && /* @__PURE__ */ (0,
|
|
14682
|
-
/* @__PURE__ */ (0,
|
|
14683
|
-
/* @__PURE__ */ (0,
|
|
14684
|
-
/* @__PURE__ */ (0,
|
|
14797
|
+
saving === "failed" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "w100n-docs-muted w100n-guest-note", role: "alert", children: t.exportFailed }),
|
|
14798
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w100n-docs-body w100n-guest-body", children: [
|
|
14799
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("main", { className: "w100n-docs-stage", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "w100n-docs-bare", children: stage }) }),
|
|
14800
|
+
talk && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("aside", { className: "w100n-docs-side w100n-docs-panel w100n-guest-panel", "aria-label": t.comments, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w100n-docs-panel-body", children: [
|
|
14801
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "w100n-share-field", children: [
|
|
14802
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: t.yourName }),
|
|
14803
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { className: "w100n-share-input", value: name, autoComplete: "name", placeholder: t.yourName, onChange: (e) => typeName(e.target.value) })
|
|
14685
14804
|
] }),
|
|
14686
|
-
/* @__PURE__ */ (0,
|
|
14687
|
-
/* @__PURE__ */ (0,
|
|
14805
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "w100n-docs-muted", children: name.trim() ? t.nameHint : t.nameNeeded }),
|
|
14806
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { ref: setSlot })
|
|
14688
14807
|
] }) })
|
|
14689
14808
|
] })
|
|
14690
14809
|
] });
|