@bendyline/docblocks-react 2.7.6 → 2.7.7
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/THIRD_PARTY_NOTICES.txt +23 -23
- package/dist/{AiDiagrams-VOCEZS6U.js → AiDiagrams-7KBAOXPB.js} +3 -3
- package/dist/{AiEditorAssistant-2MW6UYNI.js → AiEditorAssistant-4B2PFFOT.js} +85 -9
- package/dist/{AiStudyDialog-DQZVTBI7.js → AiStudyDialog-JPVFFZBB.js} +2 -2
- package/dist/{ExportDialog-LGWBXIWN.js → ExportDialog-EYDGTJ3S.js} +1 -1
- package/dist/{ExportToolbarControls-4LYTXGT3.js → ExportToolbarControls-2XY2CKGH.js} +44 -3
- package/dist/{PresentationMaker-T526TBRJ.js → PresentationMaker-VYQKNL3L.js} +2 -2
- package/dist/{chunk-45YTIVYS.js → chunk-5OIHB3SR.js} +2 -2
- package/dist/{chunk-NOYDVL6M.js → chunk-6QHZNL6C.js} +45 -17
- package/dist/{chunk-GFK4TCKN.js → chunk-G63YXKBC.js} +8 -5
- package/dist/{chunk-T42BH6YX.js → chunk-N7AKLJPY.js} +21 -7
- package/dist/{chunk-PRUEYW3G.js → chunk-T2PA7QEF.js} +1 -1
- package/dist/editor.js +2 -2
- package/dist/export/index.js +1 -1
- package/dist/index.js +219 -122
- package/package.json +8 -8
- package/src/styles/docblocks.css +47 -1
package/dist/index.js
CHANGED
|
@@ -101,17 +101,17 @@ import {
|
|
|
101
101
|
matchShortcut,
|
|
102
102
|
shortcutLabel
|
|
103
103
|
} from "./chunk-ACQF63SB.js";
|
|
104
|
-
import "./chunk-
|
|
104
|
+
import "./chunk-T2PA7QEF.js";
|
|
105
105
|
import {
|
|
106
106
|
buildIssueReportUrl,
|
|
107
107
|
displayBuildDate,
|
|
108
108
|
localDateStamp,
|
|
109
109
|
openExternalUrl
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-N7AKLJPY.js";
|
|
111
111
|
import "./chunk-K4I3NJFL.js";
|
|
112
112
|
import {
|
|
113
113
|
ExportDialog
|
|
114
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-G63YXKBC.js";
|
|
115
115
|
import "./chunk-H3BK5MK6.js";
|
|
116
116
|
import {
|
|
117
117
|
DEFAULT_OPTIONS,
|
|
@@ -126,8 +126,7 @@ import {
|
|
|
126
126
|
import { useCallback as useCallback5, useEffect as useEffect5, useMemo, useRef as useRef5, useState as useState4 } from "react";
|
|
127
127
|
import {
|
|
128
128
|
isFileSystemMoveStateError,
|
|
129
|
-
parseWorkspacePath as parseWorkspacePath4
|
|
130
|
-
tryParseWorkspacePath as tryParseWorkspacePath2
|
|
129
|
+
parseWorkspacePath as parseWorkspacePath4
|
|
131
130
|
} from "@bendyline/docblocks/filesystem";
|
|
132
131
|
|
|
133
132
|
// src/FileExplorer/useFileTree.ts
|
|
@@ -631,6 +630,54 @@ function useFileTree(provider, metadataRefreshKey, metadataRefreshPath) {
|
|
|
631
630
|
};
|
|
632
631
|
}
|
|
633
632
|
|
|
633
|
+
// src/FileExplorer/read-issue-text.ts
|
|
634
|
+
import { tryParseWorkspacePath } from "@bendyline/docblocks/filesystem";
|
|
635
|
+
function readIssueText(issue) {
|
|
636
|
+
const failingPath = tryParseWorkspacePath(issue.path);
|
|
637
|
+
if (failingPath && failingPath !== issue.directoryPath) {
|
|
638
|
+
return fileIssueText(issue, failingPath);
|
|
639
|
+
}
|
|
640
|
+
return issue.directoryPath === "" ? workspaceIssueText(issue) : folderIssueText(issue);
|
|
641
|
+
}
|
|
642
|
+
function fileIssueText(issue, path) {
|
|
643
|
+
switch (issue.code) {
|
|
644
|
+
case "not-found":
|
|
645
|
+
return `${path} can't be found.`;
|
|
646
|
+
case "permission-denied":
|
|
647
|
+
return `DocBlocks doesn't have permission to open ${path}.`;
|
|
648
|
+
default:
|
|
649
|
+
return `${path} couldn't be read.`;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
function workspaceIssueText(issue) {
|
|
653
|
+
switch (issue.code) {
|
|
654
|
+
case "not-found":
|
|
655
|
+
return "This workspace's folder can't be found. It may have been moved or deleted.";
|
|
656
|
+
case "permission-denied":
|
|
657
|
+
return "DocBlocks doesn't have permission to open this workspace.";
|
|
658
|
+
case "quota-exceeded":
|
|
659
|
+
return "Your device is out of storage space.";
|
|
660
|
+
case "corrupt":
|
|
661
|
+
return "Some of this workspace's saved data couldn't be read.";
|
|
662
|
+
default:
|
|
663
|
+
return "Your documents couldn't be loaded.";
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
function folderIssueText(issue) {
|
|
667
|
+
switch (issue.code) {
|
|
668
|
+
case "not-found":
|
|
669
|
+
return "This folder can't be found.";
|
|
670
|
+
case "permission-denied":
|
|
671
|
+
return "DocBlocks doesn't have permission to open this folder.";
|
|
672
|
+
case "quota-exceeded":
|
|
673
|
+
return "Your device is out of storage space.";
|
|
674
|
+
case "corrupt":
|
|
675
|
+
return "Some of this folder's saved data couldn't be read.";
|
|
676
|
+
default:
|
|
677
|
+
return "This folder couldn't be opened.";
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
|
|
634
681
|
// src/FileExplorer/FileTreeNode.tsx
|
|
635
682
|
import { useCallback as useCallback3, useState as useState2, useRef as useRef3, useEffect as useEffect3, useLayoutEffect } from "react";
|
|
636
683
|
import { createPortal } from "react-dom";
|
|
@@ -1363,7 +1410,7 @@ import { useCallback as useCallback4, useEffect as useEffect4, useId, useLayoutE
|
|
|
1363
1410
|
import { createPortal as createPortal2 } from "react-dom";
|
|
1364
1411
|
|
|
1365
1412
|
// src/DocBlocksShell/pinned-documents.ts
|
|
1366
|
-
import { tryParseWorkspacePath } from "@bendyline/docblocks/filesystem";
|
|
1413
|
+
import { tryParseWorkspacePath as tryParseWorkspacePath2 } from "@bendyline/docblocks/filesystem";
|
|
1367
1414
|
var PINNED_DOCUMENTS_STORAGE_KEY = "docblocks-pinned-documents-v1";
|
|
1368
1415
|
var MAX_PINNED_DOCUMENTS = 100;
|
|
1369
1416
|
var MAX_WORKSPACE_ID_LENGTH = 256;
|
|
@@ -1381,11 +1428,11 @@ function resolvePinnedDocumentStorage() {
|
|
|
1381
1428
|
}
|
|
1382
1429
|
}
|
|
1383
1430
|
function pinnedDocumentKey(document2) {
|
|
1384
|
-
const path =
|
|
1431
|
+
const path = tryParseWorkspacePath2(document2.path);
|
|
1385
1432
|
return `${document2.workspaceId}\0${path ?? document2.path}`;
|
|
1386
1433
|
}
|
|
1387
1434
|
function pinnedDocumentName(document2) {
|
|
1388
|
-
const canonical =
|
|
1435
|
+
const canonical = tryParseWorkspacePath2(document2.path);
|
|
1389
1436
|
const path = canonical ?? document2.path;
|
|
1390
1437
|
return path.slice(path.lastIndexOf("/") + 1);
|
|
1391
1438
|
}
|
|
@@ -1402,7 +1449,7 @@ function parsePinnedDocument(value) {
|
|
|
1402
1449
|
if (keys.some((key) => key !== "workspaceId" && key !== "workspaceName" && key !== "path") || typeof record.workspaceId !== "string" || record.workspaceId.length === 0 || record.workspaceId.length > MAX_WORKSPACE_ID_LENGTH || typeof record.workspaceName !== "string" || record.workspaceName.length === 0 || record.workspaceName.length > MAX_WORKSPACE_NAME_LENGTH || typeof record.path !== "string" || record.path.length === 0 || record.path.length > MAX_DOCUMENT_PATH_LENGTH) {
|
|
1403
1450
|
return null;
|
|
1404
1451
|
}
|
|
1405
|
-
const path =
|
|
1452
|
+
const path = tryParseWorkspacePath2(record.path);
|
|
1406
1453
|
if (!path) return null;
|
|
1407
1454
|
return {
|
|
1408
1455
|
workspaceId: record.workspaceId,
|
|
@@ -1454,8 +1501,8 @@ function removePinnedDocument(documents, target) {
|
|
|
1454
1501
|
return documents.filter((document2) => pinnedDocumentKey(document2) !== key);
|
|
1455
1502
|
}
|
|
1456
1503
|
function relocatePinnedDocuments(documents, workspaceId, oldPath, newPath) {
|
|
1457
|
-
const oldCanonical =
|
|
1458
|
-
const newCanonical =
|
|
1504
|
+
const oldCanonical = tryParseWorkspacePath2(oldPath);
|
|
1505
|
+
const newCanonical = tryParseWorkspacePath2(newPath);
|
|
1459
1506
|
if (!oldCanonical || !newCanonical) return [...documents];
|
|
1460
1507
|
return parsePinnedDocuments(
|
|
1461
1508
|
documents.map((document2) => {
|
|
@@ -2429,8 +2476,11 @@ function isSupportedImportFile(file) {
|
|
|
2429
2476
|
if (mimeType.startsWith("text/") || mimeType.startsWith("image/")) return true;
|
|
2430
2477
|
return !extension && DIRECT_IMPORT_BASENAMES.has(file.name.toLowerCase());
|
|
2431
2478
|
}
|
|
2479
|
+
function isEditorMediaMimeType(mimeType) {
|
|
2480
|
+
return /^(?:image|video|audio)\//i.test(mimeType);
|
|
2481
|
+
}
|
|
2432
2482
|
function isEditorDocumentImportFile(file) {
|
|
2433
|
-
if (file.type
|
|
2483
|
+
if (isEditorMediaMimeType(file.type)) return false;
|
|
2434
2484
|
const extension = extensionOfFileName(file.name);
|
|
2435
2485
|
if (DIRECT_IMPORT_IMAGE_EXTENSIONS.has(extension)) return false;
|
|
2436
2486
|
return isSupportedImportFile(file);
|
|
@@ -2501,10 +2551,6 @@ var NEW_ITEM_HINT_ID = "db-new-item-hint";
|
|
|
2501
2551
|
function normalisePath2(path) {
|
|
2502
2552
|
return parseWorkspacePath4(path);
|
|
2503
2553
|
}
|
|
2504
|
-
function readIssueText(issue) {
|
|
2505
|
-
const failingPath = tryParseWorkspacePath2(issue.path);
|
|
2506
|
-
return failingPath && failingPath !== issue.directoryPath ? `${failingPath}: ${issue.message}` : issue.message;
|
|
2507
|
-
}
|
|
2508
2554
|
function hasEquivalentPath2(paths, path) {
|
|
2509
2555
|
const canonical = normalisePath2(path);
|
|
2510
2556
|
return paths.has(path) || paths.has(canonical) || canonical !== "" && paths.has(`/${canonical}`);
|
|
@@ -3763,7 +3809,7 @@ import {
|
|
|
3763
3809
|
useCallback as useCallback19,
|
|
3764
3810
|
useEffect as useEffect30,
|
|
3765
3811
|
useLayoutEffect as useLayoutEffect4,
|
|
3766
|
-
useRef as
|
|
3812
|
+
useRef as useRef21,
|
|
3767
3813
|
useMemo as useMemo6,
|
|
3768
3814
|
lazy as lazy2,
|
|
3769
3815
|
Suspense as Suspense2
|
|
@@ -3772,7 +3818,7 @@ import {
|
|
|
3772
3818
|
DocumentVersionManager
|
|
3773
3819
|
} from "@bendyline/squisq/versions";
|
|
3774
3820
|
import {
|
|
3775
|
-
FileSystemContentContainer as
|
|
3821
|
+
FileSystemContentContainer as FileSystemContentContainer3,
|
|
3776
3822
|
createFileMediaProvider,
|
|
3777
3823
|
decodeUtf8Text,
|
|
3778
3824
|
FsError as FsError6,
|
|
@@ -3795,8 +3841,8 @@ import {
|
|
|
3795
3841
|
getDocBlocksHost,
|
|
3796
3842
|
getHostEnvironment as getHostEnvironment2,
|
|
3797
3843
|
hasDocBlocksHost,
|
|
3798
|
-
hostSupports as
|
|
3799
|
-
maybeGetDocBlocksHost as
|
|
3844
|
+
hostSupports as hostSupports3,
|
|
3845
|
+
maybeGetDocBlocksHost as maybeGetDocBlocksHost5
|
|
3800
3846
|
} from "@bendyline/docblocks/host";
|
|
3801
3847
|
import {
|
|
3802
3848
|
parseSharedDocumentHash
|
|
@@ -3810,7 +3856,7 @@ import {
|
|
|
3810
3856
|
saveWorkspace as saveWorkspace3,
|
|
3811
3857
|
touchWorkspace as touchWorkspace2,
|
|
3812
3858
|
registerTransientWorkspace,
|
|
3813
|
-
getTransientWorkspace,
|
|
3859
|
+
getTransientWorkspace as getTransientWorkspace2,
|
|
3814
3860
|
unregisterTransientWorkspace,
|
|
3815
3861
|
appendWorkspaceBackup,
|
|
3816
3862
|
finishWorkspaceBackup
|
|
@@ -5233,7 +5279,7 @@ function useDocumentSession(autoSaveDelayMs = 500) {
|
|
|
5233
5279
|
import { lazy, Suspense } from "react";
|
|
5234
5280
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
5235
5281
|
var ExportToolbarControlsImplementation = lazy(
|
|
5236
|
-
() => import("./ExportToolbarControls-
|
|
5282
|
+
() => import("./ExportToolbarControls-2XY2CKGH.js").then((module) => ({
|
|
5237
5283
|
default: module.ExportToolbarControls
|
|
5238
5284
|
}))
|
|
5239
5285
|
);
|
|
@@ -6811,10 +6857,14 @@ function useEdgeSwipe({
|
|
|
6811
6857
|
}
|
|
6812
6858
|
|
|
6813
6859
|
// src/DocBlocksShell/useEditorFileDrop.ts
|
|
6814
|
-
import { useEffect as useEffect27, useState as useState21 } from "react";
|
|
6860
|
+
import { useEffect as useEffect27, useRef as useRef18, useState as useState21 } from "react";
|
|
6815
6861
|
var INTERNAL_DRAG_TYPE2 = "application/x-docblocks-entry";
|
|
6816
6862
|
function useEditorFileDrop(targetRef, enabled, onFiles) {
|
|
6817
6863
|
const [dropActive, setDropActive] = useState21(false);
|
|
6864
|
+
const onFilesRef = useRef18(onFiles);
|
|
6865
|
+
useEffect27(() => {
|
|
6866
|
+
onFilesRef.current = onFiles;
|
|
6867
|
+
}, [onFiles]);
|
|
6818
6868
|
useEffect27(() => {
|
|
6819
6869
|
const element = targetRef.current;
|
|
6820
6870
|
if (!enabled || !element) {
|
|
@@ -6829,7 +6879,7 @@ function useEditorFileDrop(targetRef, enabled, onFiles) {
|
|
|
6829
6879
|
if (items.length === 0) return false;
|
|
6830
6880
|
return items.some((item) => {
|
|
6831
6881
|
const file = item.getAsFile();
|
|
6832
|
-
return file ? isEditorDocumentImportFile(file) : !item.type
|
|
6882
|
+
return file ? isEditorDocumentImportFile(file) : !isEditorMediaMimeType(item.type);
|
|
6833
6883
|
});
|
|
6834
6884
|
};
|
|
6835
6885
|
const onDragEnter = (event) => {
|
|
@@ -6859,7 +6909,7 @@ function useEditorFileDrop(targetRef, enabled, onFiles) {
|
|
|
6859
6909
|
if (files.length === 0) return;
|
|
6860
6910
|
event.preventDefault();
|
|
6861
6911
|
event.stopPropagation();
|
|
6862
|
-
|
|
6912
|
+
onFilesRef.current(files);
|
|
6863
6913
|
};
|
|
6864
6914
|
element.addEventListener("dragenter", onDragEnter, true);
|
|
6865
6915
|
element.addEventListener("dragover", onDragOver, true);
|
|
@@ -6872,14 +6922,14 @@ function useEditorFileDrop(targetRef, enabled, onFiles) {
|
|
|
6872
6922
|
element.removeEventListener("drop", onDrop, true);
|
|
6873
6923
|
setDropActive(false);
|
|
6874
6924
|
};
|
|
6875
|
-
}, [targetRef, enabled
|
|
6925
|
+
}, [targetRef, enabled]);
|
|
6876
6926
|
return dropActive;
|
|
6877
6927
|
}
|
|
6878
6928
|
|
|
6879
6929
|
// src/DocBlocksShell/useShellShortcuts.ts
|
|
6880
|
-
import { useEffect as useEffect28, useRef as
|
|
6930
|
+
import { useEffect as useEffect28, useRef as useRef19 } from "react";
|
|
6881
6931
|
function useShellShortcuts(handlers, layoutMode) {
|
|
6882
|
-
const handlersRef =
|
|
6932
|
+
const handlersRef = useRef19(handlers);
|
|
6883
6933
|
handlersRef.current = handlers;
|
|
6884
6934
|
useEffect28(() => {
|
|
6885
6935
|
if (typeof window === "undefined") return;
|
|
@@ -7116,7 +7166,7 @@ function useDocumentLinkProvider(index, selectedFile, ensureIndex) {
|
|
|
7116
7166
|
}
|
|
7117
7167
|
|
|
7118
7168
|
// src/WorkspaceIndex/useWorkspaceIndex.ts
|
|
7119
|
-
import { useCallback as useCallback18, useEffect as useEffect29, useMemo as useMemo5, useRef as
|
|
7169
|
+
import { useCallback as useCallback18, useEffect as useEffect29, useMemo as useMemo5, useRef as useRef20, useState as useState23, useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
7120
7170
|
import { getFileSystemProviderV2 as getFileSystemProviderV29 } from "@bendyline/docblocks/filesystem";
|
|
7121
7171
|
import { maybeGetDocBlocksHost as maybeGetDocBlocksHost3 } from "@bendyline/docblocks/host";
|
|
7122
7172
|
var IDLE_WORKSPACE_INDEX_STATUS = Object.freeze({
|
|
@@ -7149,7 +7199,7 @@ function whenIdle(callback) {
|
|
|
7149
7199
|
function useWorkspaceIndex(provider, workspaceId, mode = "eager") {
|
|
7150
7200
|
const providerV2 = provider && mode !== "off" ? getFileSystemProviderV29(provider) : null;
|
|
7151
7201
|
const [index, setIndex] = useState23(null);
|
|
7152
|
-
const startRequestedRef =
|
|
7202
|
+
const startRequestedRef = useRef20(false);
|
|
7153
7203
|
useEffect29(() => {
|
|
7154
7204
|
setIndex(null);
|
|
7155
7205
|
startRequestedRef.current = false;
|
|
@@ -7404,6 +7454,47 @@ async function copyTransientWorkspaceContents(source, destination) {
|
|
|
7404
7454
|
}
|
|
7405
7455
|
}
|
|
7406
7456
|
|
|
7457
|
+
// src/DocBlocksShell/document-relative-media.ts
|
|
7458
|
+
import {
|
|
7459
|
+
FileSystemContentContainer as FileSystemContentContainer2,
|
|
7460
|
+
isDocumentMediaPath,
|
|
7461
|
+
resolveDocumentRelativeMediaPath,
|
|
7462
|
+
tryParseWorkspacePath as tryParseWorkspacePath5
|
|
7463
|
+
} from "@bendyline/docblocks/filesystem";
|
|
7464
|
+
import { hostSupports as hostSupports2, maybeGetDocBlocksHost as maybeGetDocBlocksHost4 } from "@bendyline/docblocks/host";
|
|
7465
|
+
import { getTransientWorkspace } from "@bendyline/docblocks/workspace";
|
|
7466
|
+
function looseFileMediaReader(workspaceId) {
|
|
7467
|
+
const origin = getTransientWorkspace(workspaceId)?.descriptor.origin;
|
|
7468
|
+
if (origin?.kind !== "loose-file" || !hostSupports2("externalRelativeMedia")) return null;
|
|
7469
|
+
const external = maybeGetDocBlocksHost4()?.external;
|
|
7470
|
+
if (!external?.readRelativeMedia) return null;
|
|
7471
|
+
const { resourceId } = origin;
|
|
7472
|
+
return async (path) => await external.readRelativeMedia?.(resourceId, path) ?? null;
|
|
7473
|
+
}
|
|
7474
|
+
var LooseFileMediaContainer = class extends FileSystemContentContainer2 {
|
|
7475
|
+
constructor(provider, directory, readBeside) {
|
|
7476
|
+
super(provider, directory);
|
|
7477
|
+
this.directory = directory;
|
|
7478
|
+
this.readBeside = readBeside;
|
|
7479
|
+
}
|
|
7480
|
+
async readFile(path) {
|
|
7481
|
+
const data = await super.readFile(path);
|
|
7482
|
+
if (data) return data;
|
|
7483
|
+
const beside = tryParseWorkspacePath5(this.directory ? `${this.directory}/${path}` : path);
|
|
7484
|
+
if (!beside || !isDocumentMediaPath(beside)) return null;
|
|
7485
|
+
return this.readBeside(beside).catch(() => null);
|
|
7486
|
+
}
|
|
7487
|
+
};
|
|
7488
|
+
function createMediaContainer(provider, directory, readBesideLooseFile) {
|
|
7489
|
+
return readBesideLooseFile ? new LooseFileMediaContainer(provider, directory, readBesideLooseFile) : new FileSystemContentContainer2(provider, directory);
|
|
7490
|
+
}
|
|
7491
|
+
function createDocumentRelativeMediaReader(root, documentDirectory) {
|
|
7492
|
+
return async (ref) => {
|
|
7493
|
+
const path = resolveDocumentRelativeMediaPath(documentDirectory, ref);
|
|
7494
|
+
return path === null ? null : root.readFile(path);
|
|
7495
|
+
};
|
|
7496
|
+
}
|
|
7497
|
+
|
|
7407
7498
|
// src/DocBlocksShell/native-file-actions.ts
|
|
7408
7499
|
function createNativeFileActions(entry, workspaceId, host) {
|
|
7409
7500
|
if (entry.kind !== "file" || workspaceId === null || host === null) return [];
|
|
@@ -7539,22 +7630,22 @@ var GitToolbarControl = lazy2(
|
|
|
7539
7630
|
() => import("./GitToolbarControl-B7KG4MFP.js").then((m) => ({ default: m.GitToolbarControl }))
|
|
7540
7631
|
);
|
|
7541
7632
|
var AiToolbarControl = lazy2(
|
|
7542
|
-
() => import("./AiEditorAssistant-
|
|
7633
|
+
() => import("./AiEditorAssistant-4B2PFFOT.js").then((module) => ({
|
|
7543
7634
|
default: module.AiToolbarControl
|
|
7544
7635
|
}))
|
|
7545
7636
|
);
|
|
7546
7637
|
var PresentationMaker = lazy2(
|
|
7547
|
-
() => import("./PresentationMaker-
|
|
7638
|
+
() => import("./PresentationMaker-VYQKNL3L.js").then((module) => ({
|
|
7548
7639
|
default: module.PresentationMaker
|
|
7549
7640
|
}))
|
|
7550
7641
|
);
|
|
7551
7642
|
var AiReviewPanel = lazy2(
|
|
7552
|
-
() => import("./AiEditorAssistant-
|
|
7643
|
+
() => import("./AiEditorAssistant-4B2PFFOT.js").then((module) => ({
|
|
7553
7644
|
default: module.AiReviewPanel
|
|
7554
7645
|
}))
|
|
7555
7646
|
);
|
|
7556
7647
|
var AiIllustratePanel = lazy2(
|
|
7557
|
-
() => import("./AiDiagrams-
|
|
7648
|
+
() => import("./AiDiagrams-7KBAOXPB.js").then((module) => ({
|
|
7558
7649
|
default: module.AiIllustratePanel
|
|
7559
7650
|
}))
|
|
7560
7651
|
);
|
|
@@ -7932,13 +8023,13 @@ function DocBlocksShell({
|
|
|
7932
8023
|
[writeCanvasSettings]
|
|
7933
8024
|
);
|
|
7934
8025
|
const resolvedTheme = resolveShellTheme({ preference: themePreference, hostTheme, osTheme });
|
|
7935
|
-
const ai =
|
|
7936
|
-
const speech =
|
|
7937
|
-
const trayMenu =
|
|
8026
|
+
const ai = hostSupports3("aiAssist") ? maybeGetDocBlocksHost5()?.ai : void 0;
|
|
8027
|
+
const speech = hostSupports3("speechModelManagement") ? maybeGetDocBlocksHost5()?.speech : void 0;
|
|
8028
|
+
const trayMenu = hostSupports3("trayIcon") ? maybeGetDocBlocksHost5()?.menu : void 0;
|
|
7938
8029
|
const [settingsRequest, setSettingsRequest] = useState24(0);
|
|
7939
8030
|
const openSettings = useCallback19(() => setSettingsRequest((count) => count + 1), []);
|
|
7940
8031
|
const speechInput = useMemo6(
|
|
7941
|
-
() => speech &&
|
|
8032
|
+
() => speech && hostSupports3("speechInput") ? createSpeechInputProvider(speech, { onRequestSetup: openSettings }) : null,
|
|
7942
8033
|
[speech, openSettings]
|
|
7943
8034
|
);
|
|
7944
8035
|
const handleThemeChange = useCallback19((pref) => {
|
|
@@ -7946,7 +8037,7 @@ function DocBlocksShell({
|
|
|
7946
8037
|
saveThemePreference(pref);
|
|
7947
8038
|
}, []);
|
|
7948
8039
|
useEffect30(() => {
|
|
7949
|
-
if (
|
|
8040
|
+
if (hostSupports3("ownsWindowChrome") || typeof document === "undefined") return;
|
|
7950
8041
|
const metas = document.querySelectorAll('meta[name="theme-color"]');
|
|
7951
8042
|
metas.forEach((meta) => {
|
|
7952
8043
|
meta.content = DB_CHROME_COLORS[resolvedTheme];
|
|
@@ -7970,7 +8061,7 @@ function DocBlocksShell({
|
|
|
7970
8061
|
setViewPreferences(prefs);
|
|
7971
8062
|
saveViewPreferences(prefs);
|
|
7972
8063
|
}, []);
|
|
7973
|
-
const shellRef =
|
|
8064
|
+
const shellRef = useRef21(null);
|
|
7974
8065
|
const formFactor = useFormFactor(shellRef);
|
|
7975
8066
|
const [sidebarPreference, setSidebarPreference] = useState24(loadSidebarPreference);
|
|
7976
8067
|
const layoutMode = resolveLayoutMode(formFactor, sidebarPreference);
|
|
@@ -7992,7 +8083,7 @@ function DocBlocksShell({
|
|
|
7992
8083
|
const drawerOpen = singlePane && !mobileShowEditor;
|
|
7993
8084
|
const [sidebarWidth, setSidebarWidth] = useState24(loadSidebarWidth);
|
|
7994
8085
|
const canRestoreSplitView = sidebarPreference === "collapsed" && formFactor.splitPaneAllowed;
|
|
7995
|
-
const editorAreaRef =
|
|
8086
|
+
const editorAreaRef = useRef21(null);
|
|
7996
8087
|
const [desktopToolbarWrapped, setDesktopToolbarWrapped] = useState24(false);
|
|
7997
8088
|
useEffect30(() => {
|
|
7998
8089
|
const editorArea = editorAreaRef.current;
|
|
@@ -8000,7 +8091,7 @@ function DocBlocksShell({
|
|
|
8000
8091
|
setDesktopToolbarWrapped(false);
|
|
8001
8092
|
return;
|
|
8002
8093
|
}
|
|
8003
|
-
const wrapWidth =
|
|
8094
|
+
const wrapWidth = hostSupports3("ownsWindowChrome") ? DESKTOP_TOOLBAR_WRAP_WIDTH : WEB_TOOLBAR_WRAP_WIDTH;
|
|
8004
8095
|
const updateWrappedState = () => {
|
|
8005
8096
|
setDesktopToolbarWrapped(editorArea.getBoundingClientRect().width <= wrapWidth);
|
|
8006
8097
|
};
|
|
@@ -8013,7 +8104,7 @@ function DocBlocksShell({
|
|
|
8013
8104
|
observer.observe(editorArea);
|
|
8014
8105
|
return () => observer.disconnect();
|
|
8015
8106
|
}, [singlePane]);
|
|
8016
|
-
const showBrowserStorageWarning =
|
|
8107
|
+
const showBrowserStorageWarning = hostSupports3("browserOriginStorage");
|
|
8017
8108
|
const hostEnvironment = getHostEnvironment2();
|
|
8018
8109
|
const desktopApp = hostEnvironment?.surface === "electron";
|
|
8019
8110
|
const appVersion = hostEnvironment ? `${hostEnvironment.appVersion} ${hostEnvironment.surfaceLabel}` : issueReportVersion ?? "web";
|
|
@@ -8024,7 +8115,7 @@ function DocBlocksShell({
|
|
|
8024
8115
|
});
|
|
8025
8116
|
const [browserStoragePersistent, setBrowserStoragePersistent] = useState24(false);
|
|
8026
8117
|
const [saveToast, setSaveToast] = useState24(null);
|
|
8027
|
-
const saveToastTimerRef =
|
|
8118
|
+
const saveToastTimerRef = useRef21(null);
|
|
8028
8119
|
const showToast = useCallback19((kind, message) => {
|
|
8029
8120
|
setSaveToast({ kind, message });
|
|
8030
8121
|
if (saveToastTimerRef.current) clearTimeout(saveToastTimerRef.current);
|
|
@@ -8045,8 +8136,8 @@ function DocBlocksShell({
|
|
|
8045
8136
|
const [installPromptEvent, setInstallPromptEvent] = useState24(
|
|
8046
8137
|
null
|
|
8047
8138
|
);
|
|
8048
|
-
const panesRef =
|
|
8049
|
-
const sidebarRef =
|
|
8139
|
+
const panesRef = useRef21(null);
|
|
8140
|
+
const sidebarRef = useRef21(null);
|
|
8050
8141
|
useInert(sidebarRef, singlePane && !drawerOpen);
|
|
8051
8142
|
useInert(editorAreaRef, drawerOpen);
|
|
8052
8143
|
const openDrawer = useCallback19(() => setMobileShowEditor(false), []);
|
|
@@ -8059,7 +8150,7 @@ function DocBlocksShell({
|
|
|
8059
8150
|
onOpen: openDrawer,
|
|
8060
8151
|
onClose: closeDrawer
|
|
8061
8152
|
});
|
|
8062
|
-
const dragStateRef =
|
|
8153
|
+
const dragStateRef = useRef21(null);
|
|
8063
8154
|
const handleResizerPointerDown = useCallback19(
|
|
8064
8155
|
(e) => {
|
|
8065
8156
|
if (e.button !== 0) return;
|
|
@@ -8123,7 +8214,7 @@ function DocBlocksShell({
|
|
|
8123
8214
|
const rememberNewFileFormat = useCallback19(
|
|
8124
8215
|
(format) => {
|
|
8125
8216
|
setDefaultNewFileFormat(format);
|
|
8126
|
-
if (activeWorkspaceId &&
|
|
8217
|
+
if (activeWorkspaceId && getTransientWorkspace2(activeWorkspaceId) === null) {
|
|
8127
8218
|
saveLastNewFileFormat(activeWorkspaceId, format);
|
|
8128
8219
|
}
|
|
8129
8220
|
},
|
|
@@ -8136,7 +8227,7 @@ function DocBlocksShell({
|
|
|
8136
8227
|
);
|
|
8137
8228
|
const effectiveProofingIgnoreStore = proofingIgnoreStore === void 0 ? defaultProofingIgnoreStore : proofingIgnoreStore;
|
|
8138
8229
|
useEffect30(() => {
|
|
8139
|
-
if (!provider ||
|
|
8230
|
+
if (!provider || getTransientWorkspace2(provider.id)) return;
|
|
8140
8231
|
const providerV2 = getFileSystemProviderV211(provider);
|
|
8141
8232
|
return providerV2 ? retainFileSystemProvider(providerV2) : void 0;
|
|
8142
8233
|
}, [provider]);
|
|
@@ -8160,8 +8251,8 @@ function DocBlocksShell({
|
|
|
8160
8251
|
savePinnedDocuments(pinnedDocuments);
|
|
8161
8252
|
}, [pinnedDocuments]);
|
|
8162
8253
|
useEffect30(() => {
|
|
8163
|
-
const menu =
|
|
8164
|
-
if (!
|
|
8254
|
+
const menu = maybeGetDocBlocksHost5()?.menu;
|
|
8255
|
+
if (!hostSupports3("pinnedDocumentMirror") || !menu) return;
|
|
8165
8256
|
menu.setPinnedDocuments(
|
|
8166
8257
|
pinnedDocuments.map((document2) => ({
|
|
8167
8258
|
workspaceId: document2.workspaceId,
|
|
@@ -8248,7 +8339,7 @@ function DocBlocksShell({
|
|
|
8248
8339
|
return;
|
|
8249
8340
|
}
|
|
8250
8341
|
let cancelled = false;
|
|
8251
|
-
const electron =
|
|
8342
|
+
const electron = hostSupports3("nativeWorkspaces");
|
|
8252
8343
|
void listWorkspaces2().then((workspaces) => {
|
|
8253
8344
|
if (cancelled) return;
|
|
8254
8345
|
setTransientMoveDestinations(
|
|
@@ -8264,19 +8355,19 @@ function DocBlocksShell({
|
|
|
8264
8355
|
};
|
|
8265
8356
|
}, [activeWorkspaceDescriptor]);
|
|
8266
8357
|
const nativeWorkspaceId = provider && activeWorkspaceDescriptor?.id === activeWorkspaceId && provider.id === activeWorkspaceId && activeWorkspaceDescriptor.type === "host-native" ? activeWorkspaceDescriptor.id : null;
|
|
8267
|
-
const workingTreeChangedRef =
|
|
8358
|
+
const workingTreeChangedRef = useRef21(() => void 0);
|
|
8268
8359
|
const handleWorkingTreeChanged = useCallback19(() => workingTreeChangedRef.current(), []);
|
|
8269
8360
|
const git = useGit(provider, nativeWorkspaceId, resolvedTheme, handleWorkingTreeChanged);
|
|
8270
|
-
const gitRef =
|
|
8361
|
+
const gitRef = useRef21(git);
|
|
8271
8362
|
gitRef.current = git;
|
|
8272
8363
|
const { scheduleRefresh: gitScheduleRefresh } = git;
|
|
8273
|
-
const workspaceSettingsEnabled = provider !== null && provider.id === activeWorkspaceId &&
|
|
8364
|
+
const workspaceSettingsEnabled = provider !== null && provider.id === activeWorkspaceId && getTransientWorkspace2(provider.id) === null;
|
|
8274
8365
|
const workspaceSettings = useWorkspaceSettings(provider, workspaceSettingsEnabled);
|
|
8275
8366
|
const { refresh: refreshWorkspaceSettings, save: saveWorkspaceSettings } = workspaceSettings;
|
|
8276
8367
|
const workspaceDefaultThemeId = resolveWorkspaceDefaultThemeId(workspaceSettings.settings);
|
|
8277
|
-
const workspaceDefaultThemeRef =
|
|
8368
|
+
const workspaceDefaultThemeRef = useRef21(workspaceDefaultThemeId);
|
|
8278
8369
|
workspaceDefaultThemeRef.current = workspaceDefaultThemeId;
|
|
8279
|
-
const outsideInRenderRef =
|
|
8370
|
+
const outsideInRenderRef = useRef21({
|
|
8280
8371
|
defaultThemeId: () => workspaceDefaultThemeRef.current
|
|
8281
8372
|
});
|
|
8282
8373
|
const workspaceOutputs = useWorkspaceOutputs(
|
|
@@ -8285,10 +8376,10 @@ function DocBlocksShell({
|
|
|
8285
8376
|
workspaceSettings.settings,
|
|
8286
8377
|
workspaceSettingsEnabled
|
|
8287
8378
|
);
|
|
8288
|
-
const workspaceOutputsSchedulerRef =
|
|
8379
|
+
const workspaceOutputsSchedulerRef = useRef21(workspaceOutputs.scheduler);
|
|
8289
8380
|
workspaceOutputsSchedulerRef.current = workspaceOutputs.scheduler;
|
|
8290
8381
|
const workspaceIndex = useWorkspaceIndex(provider, activeWorkspaceId, workspaceIndexMode);
|
|
8291
|
-
const workspaceIndexRef =
|
|
8382
|
+
const workspaceIndexRef = useRef21(workspaceIndex.index);
|
|
8292
8383
|
workspaceIndexRef.current = workspaceIndex.index;
|
|
8293
8384
|
const notifyWorkspaceChanged = useCallback19(
|
|
8294
8385
|
(workspaceId, path) => {
|
|
@@ -8350,7 +8441,7 @@ function DocBlocksShell({
|
|
|
8350
8441
|
const [selectedImage, setSelectedImage] = useState24(void 0);
|
|
8351
8442
|
const [selectedManagedOutput, setSelectedManagedOutput] = useState24(void 0);
|
|
8352
8443
|
const [findMode, setFindMode] = useState24(false);
|
|
8353
|
-
const findModeRef =
|
|
8444
|
+
const findModeRef = useRef21(findMode);
|
|
8354
8445
|
findModeRef.current = findMode;
|
|
8355
8446
|
useEffect30(() => {
|
|
8356
8447
|
setFindMode(false);
|
|
@@ -8373,7 +8464,7 @@ function DocBlocksShell({
|
|
|
8373
8464
|
const [searchFocusRequest, setSearchFocusRequest] = useState24(0);
|
|
8374
8465
|
useEffect30(() => {
|
|
8375
8466
|
if (!activeWorkspaceId || !selectedFile) return;
|
|
8376
|
-
if (
|
|
8467
|
+
if (getTransientWorkspace2(activeWorkspaceId) === null) {
|
|
8377
8468
|
recordRecentDocument(activeWorkspaceId, selectedFile);
|
|
8378
8469
|
}
|
|
8379
8470
|
workspaceIndex.index?.prioritize([selectedFile]);
|
|
@@ -8422,8 +8513,8 @@ function DocBlocksShell({
|
|
|
8422
8513
|
useDocumentTitle(selectedFile, homeDocumentTitle, homeDocumentPath);
|
|
8423
8514
|
const exportDestinationAdapter = useMemo6(() => {
|
|
8424
8515
|
if (!selectedFile) return void 0;
|
|
8425
|
-
const exports =
|
|
8426
|
-
if (
|
|
8516
|
+
const exports = maybeGetDocBlocksHost5()?.exports;
|
|
8517
|
+
if (hostSupports3("exportRememberedTargets") && exports?.resolveTarget && exports.pickTarget) {
|
|
8427
8518
|
if (activeWorkspaceId) {
|
|
8428
8519
|
const documentId = JSON.stringify([activeWorkspaceId, selectedFile]);
|
|
8429
8520
|
const resolveTarget = exports.resolveTarget.bind(exports);
|
|
@@ -8432,7 +8523,7 @@ function DocBlocksShell({
|
|
|
8432
8523
|
resolveTarget: (filename) => resolveTarget(documentId, filename),
|
|
8433
8524
|
pickTarget: (filename, currentTarget) => pickTarget(documentId, filename, currentTarget?.grantId ?? null),
|
|
8434
8525
|
saveBlob: (blob, filename, target) => saveBlobToHost(exports, documentId, blob, filename, target?.grantId ?? null),
|
|
8435
|
-
...
|
|
8526
|
+
...hostSupports3("openSavedExports") && exports.openSaved ? {
|
|
8436
8527
|
openSaved: async (target) => {
|
|
8437
8528
|
if (!target.grantId) throw new Error("The saved export has no native target.");
|
|
8438
8529
|
await exports.openSaved(documentId, target.grantId);
|
|
@@ -8441,7 +8532,7 @@ function DocBlocksShell({
|
|
|
8441
8532
|
};
|
|
8442
8533
|
}
|
|
8443
8534
|
}
|
|
8444
|
-
if (
|
|
8535
|
+
if (hostSupports3("exportDestinations") && exports && activeWorkspaceId) {
|
|
8445
8536
|
const documentId = JSON.stringify([activeWorkspaceId, selectedFile]);
|
|
8446
8537
|
return {
|
|
8447
8538
|
showDestination: false,
|
|
@@ -8456,7 +8547,7 @@ function DocBlocksShell({
|
|
|
8456
8547
|
return createBrowserSaveAsAdapter();
|
|
8457
8548
|
}, [activeWorkspaceId, selectedFile]);
|
|
8458
8549
|
const saveRenderedImageOutput = useMemo6(
|
|
8459
|
-
() =>
|
|
8550
|
+
() => hostSupports3("exportDestinations") && exportDestinationAdapter ? createImageSaveOutput(exportDestinationAdapter) : void 0,
|
|
8460
8551
|
[exportDestinationAdapter]
|
|
8461
8552
|
);
|
|
8462
8553
|
const [selectedFolder, setSelectedFolder] = useState24(null);
|
|
@@ -8508,7 +8599,7 @@ function DocBlocksShell({
|
|
|
8508
8599
|
const [initialSharedMode, setInitialSharedMode] = useState24(null);
|
|
8509
8600
|
const [showWelcomeGateway, setShowWelcomeGateway] = useState24(false);
|
|
8510
8601
|
const welcomeScreenShown = showWelcomeGateway && !singlePane;
|
|
8511
|
-
const welcomeCoveredRef =
|
|
8602
|
+
const welcomeCoveredRef = useRef21(null);
|
|
8512
8603
|
useInert(welcomeCoveredRef, welcomeScreenShown);
|
|
8513
8604
|
const closeWelcomeGateway = useCallback19(() => {
|
|
8514
8605
|
setShowWelcomeGateway((showing) => {
|
|
@@ -8517,10 +8608,10 @@ function DocBlocksShell({
|
|
|
8517
8608
|
});
|
|
8518
8609
|
}, []);
|
|
8519
8610
|
const [aiPanel, setAiPanel] = useState24(null);
|
|
8520
|
-
const navigationRequestRef =
|
|
8611
|
+
const navigationRequestRef = useRef21(0);
|
|
8521
8612
|
const workspaceAuthorityBarrier = useMemo6(() => new WorkspaceAuthorityBarrier(), []);
|
|
8522
|
-
const preparedCloseRequestRef =
|
|
8523
|
-
const pendingDbkConflictsRef =
|
|
8613
|
+
const preparedCloseRequestRef = useRef21(null);
|
|
8614
|
+
const pendingDbkConflictsRef = useRef21(/* @__PURE__ */ new Map());
|
|
8524
8615
|
const afterWorkspaceCommit = useCallback19(
|
|
8525
8616
|
(workspaceId, path) => {
|
|
8526
8617
|
gitScheduleRefresh();
|
|
@@ -8538,11 +8629,11 @@ function DocBlocksShell({
|
|
|
8538
8629
|
outsideInRenderRef.current
|
|
8539
8630
|
);
|
|
8540
8631
|
}
|
|
8541
|
-
const transient =
|
|
8632
|
+
const transient = getTransientWorkspace2(workspaceId);
|
|
8542
8633
|
const baseTarget = createFileSystemDocumentTarget2(fsProvider, filePath);
|
|
8543
8634
|
const originKind = transient?.descriptor.origin?.kind;
|
|
8544
8635
|
const needsExternalResources = originKind === "loose-file" || originKind === "dbk";
|
|
8545
|
-
if (!transient?.descriptor.origin || needsExternalResources && !
|
|
8636
|
+
if (!transient?.descriptor.origin || needsExternalResources && !hostSupports3("externalResources")) {
|
|
8546
8637
|
return {
|
|
8547
8638
|
key: baseTarget.key,
|
|
8548
8639
|
async commit(request) {
|
|
@@ -8704,12 +8795,12 @@ function DocBlocksShell({
|
|
|
8704
8795
|
},
|
|
8705
8796
|
[afterWorkspaceCommit, gitScheduleRefresh]
|
|
8706
8797
|
);
|
|
8707
|
-
const mediaContainerRef =
|
|
8798
|
+
const mediaContainerRef = useRef21(null);
|
|
8708
8799
|
const [mediaProvider, setMediaProvider] = useState24(null);
|
|
8709
8800
|
const [mediaProviderScope, setMediaProviderScope] = useState24(null);
|
|
8710
8801
|
const mediaProviderCurrent = mediaProviderScope !== null && mediaProviderScope.provider === provider && mediaProviderScope.file === selectedFile && mediaProviderScope.outsideIn === selectedOutsideIn;
|
|
8711
8802
|
const [mediaEpoch, setMediaEpoch] = useState24(0);
|
|
8712
|
-
const versionsContainerRef =
|
|
8803
|
+
const versionsContainerRef = useRef21(null);
|
|
8713
8804
|
const [versionsContainer, setVersionsContainer] = useState24(null);
|
|
8714
8805
|
const pushHash = useCallback19((wsId, filePath) => {
|
|
8715
8806
|
const hash = buildHash(wsId, filePath);
|
|
@@ -8721,7 +8812,7 @@ function DocBlocksShell({
|
|
|
8721
8812
|
async (wsId, filePath, push, view, navigationRequestId, sharedMode = null) => {
|
|
8722
8813
|
const requestId = navigationRequestId ?? ++navigationRequestRef.current;
|
|
8723
8814
|
if (requestId !== navigationRequestRef.current) return null;
|
|
8724
|
-
const transient =
|
|
8815
|
+
const transient = getTransientWorkspace2(wsId);
|
|
8725
8816
|
let ws;
|
|
8726
8817
|
let fsProvider = null;
|
|
8727
8818
|
if (transient) {
|
|
@@ -8827,7 +8918,7 @@ function DocBlocksShell({
|
|
|
8827
8918
|
if (opened) closeWelcomeGateway();
|
|
8828
8919
|
return opened;
|
|
8829
8920
|
} finally {
|
|
8830
|
-
if (!opened &&
|
|
8921
|
+
if (!opened && getTransientWorkspace2(options.id)?.provider === options.provider) {
|
|
8831
8922
|
await unregisterTransientWorkspace(options.id);
|
|
8832
8923
|
}
|
|
8833
8924
|
}
|
|
@@ -8928,11 +9019,11 @@ function DocBlocksShell({
|
|
|
8928
9019
|
showBrowserStorageWarning
|
|
8929
9020
|
]
|
|
8930
9021
|
);
|
|
8931
|
-
const startupOpenFromIdsRef =
|
|
9022
|
+
const startupOpenFromIdsRef = useRef21(openFromIds);
|
|
8932
9023
|
startupOpenFromIdsRef.current = openFromIds;
|
|
8933
|
-
const startupOpenSharedDocumentRef =
|
|
9024
|
+
const startupOpenSharedDocumentRef = useRef21(openSharedDocument);
|
|
8934
9025
|
startupOpenSharedDocumentRef.current = openSharedDocument;
|
|
8935
|
-
const startupSeedWelcomeFileRef =
|
|
9026
|
+
const startupSeedWelcomeFileRef = useRef21(seedWelcomeFile);
|
|
8936
9027
|
startupSeedWelcomeFileRef.current = seedWelcomeFile;
|
|
8937
9028
|
const [focusAfterWelcome, setFocusAfterWelcome] = useState24(false);
|
|
8938
9029
|
const handleTourWelcome = useCallback19(() => {
|
|
@@ -8949,7 +9040,7 @@ function DocBlocksShell({
|
|
|
8949
9040
|
let cancelled = false;
|
|
8950
9041
|
const isCurrent = () => !cancelled && requestId === navigationRequestRef.current;
|
|
8951
9042
|
void (async () => {
|
|
8952
|
-
const electron =
|
|
9043
|
+
const electron = hostSupports3("workspaceAuthority");
|
|
8953
9044
|
let workspaceIdRemap = {};
|
|
8954
9045
|
const defaultHostWorkspaceIds = /* @__PURE__ */ new Set();
|
|
8955
9046
|
const isDefaultWorkspace = (workspaceId) => isAppDefaultWorkspace(workspaceId, electron ? defaultHostWorkspaceIds : null);
|
|
@@ -9279,7 +9370,7 @@ function DocBlocksShell({
|
|
|
9279
9370
|
};
|
|
9280
9371
|
}, []);
|
|
9281
9372
|
const [offlineReadyToast, setOfflineReadyToast] = useState24(false);
|
|
9282
|
-
const offlineReadyAnnouncedRef =
|
|
9373
|
+
const offlineReadyAnnouncedRef = useRef21(false);
|
|
9283
9374
|
useEffect30(() => {
|
|
9284
9375
|
if (!offlineReady || offlineReadyAnnouncedRef.current) return;
|
|
9285
9376
|
offlineReadyAnnouncedRef.current = true;
|
|
@@ -9295,7 +9386,7 @@ function DocBlocksShell({
|
|
|
9295
9386
|
setStorageFull(false);
|
|
9296
9387
|
}
|
|
9297
9388
|
}, [documentSnapshot.error, documentSnapshot.status]);
|
|
9298
|
-
const autoPersistRequestedRef =
|
|
9389
|
+
const autoPersistRequestedRef = useRef21(false);
|
|
9299
9390
|
useEffect30(() => {
|
|
9300
9391
|
if (!showBrowserStorageWarning || browserStoragePersistent) return;
|
|
9301
9392
|
if (autoPersistRequestedRef.current) return;
|
|
@@ -9330,12 +9421,18 @@ function DocBlocksShell({
|
|
|
9330
9421
|
const parentDir = dirnameOf(selectedFile);
|
|
9331
9422
|
const base = basenameOf(selectedFile);
|
|
9332
9423
|
const baseNoExt = base.replace(/\.[^.]+$/, "");
|
|
9333
|
-
const
|
|
9424
|
+
const readBeside = looseFileMediaReader(provider.id);
|
|
9425
|
+
const container = createMediaContainer(provider, parentDir, readBeside);
|
|
9334
9426
|
const vPrefix = parentDir ? `${parentDir}/${baseNoExt}_files` : `${baseNoExt}_files`;
|
|
9335
|
-
const vContainer = new
|
|
9427
|
+
const vContainer = new FileSystemContentContainer3(provider, vPrefix, {
|
|
9336
9428
|
documentMediaPrefix: `${baseNoExt}_files`
|
|
9337
9429
|
});
|
|
9338
|
-
const mp = createFileMediaProvider(container, base
|
|
9430
|
+
const mp = createFileMediaProvider(container, base, {
|
|
9431
|
+
readDocumentRelative: createDocumentRelativeMediaReader(
|
|
9432
|
+
createMediaContainer(provider, "", readBeside),
|
|
9433
|
+
parentDir
|
|
9434
|
+
)
|
|
9435
|
+
});
|
|
9339
9436
|
mediaContainerRef.current = container;
|
|
9340
9437
|
versionsContainerRef.current = vContainer;
|
|
9341
9438
|
setMediaProvider(mp);
|
|
@@ -9396,7 +9493,7 @@ function DocBlocksShell({
|
|
|
9396
9493
|
useEffect30(() => {
|
|
9397
9494
|
if (!provider) return;
|
|
9398
9495
|
const providerV2 = getFileSystemProviderV211(provider);
|
|
9399
|
-
const lifecycle =
|
|
9496
|
+
const lifecycle = maybeGetDocBlocksHost5()?.lifecycle;
|
|
9400
9497
|
if (!providerV2 || !providerV2.capabilities.watch && !lifecycle?.onResume && !managedOutputRefreshToken)
|
|
9401
9498
|
return;
|
|
9402
9499
|
const watchedFile = selectedSourceFile ?? selectedFile;
|
|
@@ -9496,7 +9593,7 @@ function DocBlocksShell({
|
|
|
9496
9593
|
const [showConflictComparison, setShowConflictComparison] = useState24(false);
|
|
9497
9594
|
const readConflictFile = useCallback19(async () => {
|
|
9498
9595
|
const path = selectedSourceFile ?? selectedFile;
|
|
9499
|
-
if (!provider || !path || activeWorkspaceId &&
|
|
9596
|
+
if (!provider || !path || activeWorkspaceId && getTransientWorkspace2(activeWorkspaceId)) {
|
|
9500
9597
|
return null;
|
|
9501
9598
|
}
|
|
9502
9599
|
return readStableFileSnapshot(provider, path);
|
|
@@ -9567,8 +9664,8 @@ function DocBlocksShell({
|
|
|
9567
9664
|
};
|
|
9568
9665
|
}, [documentSession, documentSnapshot.status, documentSnapshot.targetKey]);
|
|
9569
9666
|
useEffect30(() => {
|
|
9570
|
-
const lifecycle =
|
|
9571
|
-
if (!
|
|
9667
|
+
const lifecycle = maybeGetDocBlocksHost5()?.lifecycle;
|
|
9668
|
+
if (!hostSupports3("guardedClose") || !lifecycle) return;
|
|
9572
9669
|
const stopPrepare = lifecycle.onPrepareClose(async (request) => {
|
|
9573
9670
|
preparedCloseRequestRef.current = request.requestId;
|
|
9574
9671
|
try {
|
|
@@ -9598,7 +9695,7 @@ function DocBlocksShell({
|
|
|
9598
9695
|
await touchWorkspace2(ws.id);
|
|
9599
9696
|
if (requestId !== navigationRequestRef.current) return;
|
|
9600
9697
|
let nextProvider = null;
|
|
9601
|
-
const transient =
|
|
9698
|
+
const transient = getTransientWorkspace2(ws.id);
|
|
9602
9699
|
if (transient) {
|
|
9603
9700
|
nextProvider = transient.provider;
|
|
9604
9701
|
} else if (ws.type === "host-native") {
|
|
@@ -9699,11 +9796,11 @@ function DocBlocksShell({
|
|
|
9699
9796
|
let adoptedNextProvider = nextProvider !== null;
|
|
9700
9797
|
try {
|
|
9701
9798
|
if (!nextProvider) {
|
|
9702
|
-
const transient =
|
|
9799
|
+
const transient = getTransientWorkspace2(workspace.id);
|
|
9703
9800
|
if (transient) {
|
|
9704
9801
|
nextProvider = transient.provider;
|
|
9705
9802
|
} else if (workspace.type === "host-native") {
|
|
9706
|
-
nextProvider =
|
|
9803
|
+
nextProvider = hostSupports3("nativeWorkspaces") ? await createHostProviderFromWorkspace(workspace) : null;
|
|
9707
9804
|
ownsNextProvider = nextProvider !== null;
|
|
9708
9805
|
} else if (workspace.type === "native") {
|
|
9709
9806
|
nextProvider = await (await loadNativeFileSystem()).restoreNativeFolder(workspace.id);
|
|
@@ -9818,7 +9915,7 @@ function DocBlocksShell({
|
|
|
9818
9915
|
if (!activeWorkspaceId || !provider || !selectedFile) {
|
|
9819
9916
|
throw new Error("Select the temporary document before moving it.");
|
|
9820
9917
|
}
|
|
9821
|
-
const transient =
|
|
9918
|
+
const transient = getTransientWorkspace2(activeWorkspaceId);
|
|
9822
9919
|
if (!transient || transient.provider !== provider) {
|
|
9823
9920
|
throw new Error("This workspace is no longer temporary.");
|
|
9824
9921
|
}
|
|
@@ -9891,7 +9988,7 @@ function DocBlocksShell({
|
|
|
9891
9988
|
void touchWorkspace2(destination.id).catch(() => void 0);
|
|
9892
9989
|
if (sourceTargetKey) pendingDbkConflictsRef.current.delete(sourceTargetKey);
|
|
9893
9990
|
const origin = transient.descriptor.origin;
|
|
9894
|
-
const externalApi =
|
|
9991
|
+
const externalApi = maybeGetDocBlocksHost5()?.external;
|
|
9895
9992
|
if (externalApi && origin && (origin.kind === "loose-file" || origin.kind === "dbk")) {
|
|
9896
9993
|
try {
|
|
9897
9994
|
await externalApi.revoke(origin.resourceId);
|
|
@@ -9930,7 +10027,7 @@ function DocBlocksShell({
|
|
|
9930
10027
|
const handleOpenFolder = useCallback19(async () => {
|
|
9931
10028
|
const requestId = ++navigationRequestRef.current;
|
|
9932
10029
|
try {
|
|
9933
|
-
if (
|
|
10030
|
+
if (hostSupports3("workspaceFolderPicker")) {
|
|
9934
10031
|
const info = await getDocBlocksHost().workspaces.pickFolder?.();
|
|
9935
10032
|
if (!info) return;
|
|
9936
10033
|
if (requestId !== navigationRequestRef.current) return;
|
|
@@ -10148,7 +10245,7 @@ function DocBlocksShell({
|
|
|
10148
10245
|
singlePane
|
|
10149
10246
|
]);
|
|
10150
10247
|
const canFind = selectedFile !== null && mediaProvider !== null && selectedManagedOutput !== "catalog-html" && selectedImage === void 0;
|
|
10151
|
-
const canFindRef =
|
|
10248
|
+
const canFindRef = useRef21(canFind);
|
|
10152
10249
|
canFindRef.current = canFind;
|
|
10153
10250
|
const { ensure: ensureWorkspaceIndex } = workspaceIndex;
|
|
10154
10251
|
const openQuickOpen = useCallback19(() => {
|
|
@@ -10225,7 +10322,7 @@ function DocBlocksShell({
|
|
|
10225
10322
|
);
|
|
10226
10323
|
useShellShortcuts(shortcutHandlers, layoutMode);
|
|
10227
10324
|
useEffect30(
|
|
10228
|
-
() =>
|
|
10325
|
+
() => maybeGetDocBlocksHost5()?.lifecycle?.onBack?.(() => {
|
|
10229
10326
|
if (dismissTopmostDialog()) return true;
|
|
10230
10327
|
const escape = new KeyboardEvent("keydown", {
|
|
10231
10328
|
key: "Escape",
|
|
@@ -10246,7 +10343,7 @@ function DocBlocksShell({
|
|
|
10246
10343
|
}),
|
|
10247
10344
|
[singlePane, mobileShowEditor]
|
|
10248
10345
|
);
|
|
10249
|
-
const actionNewHandledRef =
|
|
10346
|
+
const actionNewHandledRef = useRef21(false);
|
|
10250
10347
|
useEffect30(() => {
|
|
10251
10348
|
if (!provider || actionNewHandledRef.current) return;
|
|
10252
10349
|
if (typeof window === "undefined") return;
|
|
@@ -10263,8 +10360,8 @@ function DocBlocksShell({
|
|
|
10263
10360
|
void handleNewFile();
|
|
10264
10361
|
}, [provider, handleNewFile]);
|
|
10265
10362
|
const handleRevealWorkspace = useCallback19(async () => {
|
|
10266
|
-
const shell =
|
|
10267
|
-
if (!
|
|
10363
|
+
const shell = maybeGetDocBlocksHost5()?.shell;
|
|
10364
|
+
if (!hostSupports3("revealInFileManager") || !shell?.revealInFolder || !activeWorkspaceId) {
|
|
10268
10365
|
return;
|
|
10269
10366
|
}
|
|
10270
10367
|
const ws = await getWorkspace(activeWorkspaceId);
|
|
@@ -10273,8 +10370,8 @@ function DocBlocksShell({
|
|
|
10273
10370
|
}
|
|
10274
10371
|
}, [activeWorkspaceId]);
|
|
10275
10372
|
const handleOpenWorkspaceFolder = useCallback19(() => {
|
|
10276
|
-
const shell =
|
|
10277
|
-
if (!
|
|
10373
|
+
const shell = maybeGetDocBlocksHost5()?.shell;
|
|
10374
|
+
if (!hostSupports3("openWorkspaceFolder") || !shell?.openWorkspaceFolder || !nativeWorkspaceId) {
|
|
10278
10375
|
return;
|
|
10279
10376
|
}
|
|
10280
10377
|
void shell.openWorkspaceFolder(nativeWorkspaceId).catch((error) => {
|
|
@@ -10285,8 +10382,8 @@ function DocBlocksShell({
|
|
|
10285
10382
|
});
|
|
10286
10383
|
}, [nativeWorkspaceId, showToast]);
|
|
10287
10384
|
useEffect30(() => {
|
|
10288
|
-
const host =
|
|
10289
|
-
if (!
|
|
10385
|
+
const host = maybeGetDocBlocksHost5();
|
|
10386
|
+
if (!hostSupports3("menuCommands") || !host?.onMenuCommand) return;
|
|
10290
10387
|
return host.onMenuCommand((cmd) => {
|
|
10291
10388
|
switch (cmd) {
|
|
10292
10389
|
case "file:new":
|
|
@@ -10435,7 +10532,7 @@ function DocBlocksShell({
|
|
|
10435
10532
|
defaultNewFileFormat
|
|
10436
10533
|
]
|
|
10437
10534
|
);
|
|
10438
|
-
const wikiNavigationRef =
|
|
10535
|
+
const wikiNavigationRef = useRef21(handleSelect);
|
|
10439
10536
|
wikiNavigationRef.current = handleSelect;
|
|
10440
10537
|
const wikiLinks = useMemo6(() => {
|
|
10441
10538
|
if (!provider || !selectedFile || !activeWorkspaceId) return null;
|
|
@@ -10580,7 +10677,7 @@ function DocBlocksShell({
|
|
|
10580
10677
|
const nativeActions = createNativeFileActions(
|
|
10581
10678
|
entry,
|
|
10582
10679
|
nativeWorkspaceId,
|
|
10583
|
-
|
|
10680
|
+
maybeGetDocBlocksHost5()
|
|
10584
10681
|
);
|
|
10585
10682
|
return [...nativeActions, ...outsideInActionsForEntry(entry)];
|
|
10586
10683
|
},
|
|
@@ -10819,13 +10916,13 @@ function DocBlocksShell({
|
|
|
10819
10916
|
if (activeWorkspaceId === workspace.id && provider) {
|
|
10820
10917
|
return { kind: "ready", workspace, provider, owned: false };
|
|
10821
10918
|
}
|
|
10822
|
-
const transient =
|
|
10919
|
+
const transient = getTransientWorkspace2(workspace.id);
|
|
10823
10920
|
if (transient) {
|
|
10824
10921
|
return { kind: "ready", workspace, provider: transient.provider, owned: false };
|
|
10825
10922
|
}
|
|
10826
10923
|
let pinnedProvider = null;
|
|
10827
10924
|
if (workspace.type === "host-native") {
|
|
10828
|
-
pinnedProvider =
|
|
10925
|
+
pinnedProvider = hostSupports3("nativeWorkspaces") ? await createHostProviderFromWorkspace(workspace) : null;
|
|
10829
10926
|
} else if (workspace.type === "native") {
|
|
10830
10927
|
pinnedProvider = await (await loadNativeFileSystem()).restoreNativeFolder(workspace.id);
|
|
10831
10928
|
} else {
|
|
@@ -11010,8 +11107,8 @@ function DocBlocksShell({
|
|
|
11010
11107
|
showToast
|
|
11011
11108
|
]
|
|
11012
11109
|
);
|
|
11013
|
-
const restoreInputRef =
|
|
11014
|
-
const restoreInProgress =
|
|
11110
|
+
const restoreInputRef = useRef21(null);
|
|
11111
|
+
const restoreInProgress = useRef21(false);
|
|
11015
11112
|
const handleRestoreBackup = useCallback19(
|
|
11016
11113
|
async (file) => {
|
|
11017
11114
|
if (restoreInProgress.current) {
|
|
@@ -11041,7 +11138,7 @@ function DocBlocksShell({
|
|
|
11041
11138
|
);
|
|
11042
11139
|
const importOrRestore = useCallback19(
|
|
11043
11140
|
async (files) => {
|
|
11044
|
-
const backups =
|
|
11141
|
+
const backups = hostSupports3("nativeWorkspaces") ? [] : files.filter((file) => /\.zip$/i.test(file.name));
|
|
11045
11142
|
const documents = files.filter((file) => !backups.includes(file));
|
|
11046
11143
|
const result = provider ? await importDroppedFiles(documents, provider) : null;
|
|
11047
11144
|
for (const file of backups) await handleRestoreBackup(file);
|
|
@@ -11188,8 +11285,8 @@ function DocBlocksShell({
|
|
|
11188
11285
|
[adoptTransientWorkspace]
|
|
11189
11286
|
);
|
|
11190
11287
|
useEffect30(() => {
|
|
11191
|
-
const host =
|
|
11192
|
-
if (!
|
|
11288
|
+
const host = maybeGetDocBlocksHost5();
|
|
11289
|
+
if (!hostSupports3("openRequests") || !host) return;
|
|
11193
11290
|
return host.onOpenRequest((req) => {
|
|
11194
11291
|
const requestId = ++navigationRequestRef.current;
|
|
11195
11292
|
void (req.kind === "workspace-file" ? workspaceAuthorityBarrier.wait().then(() => {
|
|
@@ -11255,7 +11352,7 @@ function DocBlocksShell({
|
|
|
11255
11352
|
[adoptTransientWorkspace]
|
|
11256
11353
|
);
|
|
11257
11354
|
useEffect30(() => {
|
|
11258
|
-
if (
|
|
11355
|
+
if (hostSupports3("openRequests") || typeof window === "undefined") return;
|
|
11259
11356
|
const launchQueue = window.launchQueue;
|
|
11260
11357
|
if (!launchQueue) return;
|
|
11261
11358
|
launchQueue.setConsumer((params) => {
|
|
@@ -11302,7 +11399,7 @@ function DocBlocksShell({
|
|
|
11302
11399
|
import("@bendyline/squisq/storage"),
|
|
11303
11400
|
import("@bendyline/squisq-formats/container")
|
|
11304
11401
|
]);
|
|
11305
|
-
const electron =
|
|
11402
|
+
const electron = hostSupports3("nativeWorkspaces");
|
|
11306
11403
|
const all = await listWorkspaces2();
|
|
11307
11404
|
const candidates = all.filter(
|
|
11308
11405
|
(w) => electron ? w.type === "host-native" || w.type === "transient" : w.type !== "host-native"
|
|
@@ -11318,7 +11415,7 @@ function DocBlocksShell({
|
|
|
11318
11415
|
let p = null;
|
|
11319
11416
|
let ownsProvider = false;
|
|
11320
11417
|
try {
|
|
11321
|
-
const transient =
|
|
11418
|
+
const transient = getTransientWorkspace2(ws.id);
|
|
11322
11419
|
if (transient) {
|
|
11323
11420
|
p = transient.provider;
|
|
11324
11421
|
} else if (ws.type === "host-native") {
|
|
@@ -11444,7 +11541,7 @@ function DocBlocksShell({
|
|
|
11444
11541
|
}
|
|
11445
11542
|
} else if (ws?.type === "transient") {
|
|
11446
11543
|
const origin = ws.origin;
|
|
11447
|
-
const externalApi =
|
|
11544
|
+
const externalApi = maybeGetDocBlocksHost5()?.external;
|
|
11448
11545
|
if (externalApi && origin && (origin.kind === "loose-file" || origin.kind === "dbk")) {
|
|
11449
11546
|
try {
|
|
11450
11547
|
await externalApi.revoke(origin.resourceId);
|
|
@@ -11468,7 +11565,7 @@ function DocBlocksShell({
|
|
|
11468
11565
|
return;
|
|
11469
11566
|
}
|
|
11470
11567
|
if (requestId !== navigationRequestRef.current) return;
|
|
11471
|
-
const electron =
|
|
11568
|
+
const electron = hostSupports3("nativeWorkspaces");
|
|
11472
11569
|
const remaining = (await listWorkspaces2()).filter(
|
|
11473
11570
|
(w) => electron ? w.type === "host-native" : w.type !== "host-native"
|
|
11474
11571
|
);
|
|
@@ -11625,7 +11722,7 @@ function DocBlocksShell({
|
|
|
11625
11722
|
onVersioningPreferenceChange: handleVersioningPreferenceChange,
|
|
11626
11723
|
onOpenWorkspaceSettings: activeWorkspaceDescriptor ? handleOpenWorkspaceSettings : void 0,
|
|
11627
11724
|
onDownloadAllWorkspaces: handleDownloadAllWorkspaces,
|
|
11628
|
-
onRestoreBackup:
|
|
11725
|
+
onRestoreBackup: hostSupports3("nativeWorkspaces") ? void 0 : () => restoreInputRef.current?.click(),
|
|
11629
11726
|
onShowKeyboardShortcuts: singlePane ? void 0 : openKeyboardShortcuts,
|
|
11630
11727
|
onKeepBrowserData: showBrowserStorageWarning && !browserStoragePersistent ? handleKeepBrowserData : void 0,
|
|
11631
11728
|
onInstallApp: installPromptEvent ? handleInstallApp : void 0,
|
|
@@ -11720,7 +11817,7 @@ function DocBlocksShell({
|
|
|
11720
11817
|
onPinnedDocumentDelete: handlePinnedDocumentDelete,
|
|
11721
11818
|
onTogglePin: handleTogglePin,
|
|
11722
11819
|
onSelect: handleSelect,
|
|
11723
|
-
onOpenWorkspaceFolder:
|
|
11820
|
+
onOpenWorkspaceFolder: hostSupports3("openWorkspaceFolder") && nativeWorkspaceId ? handleOpenWorkspaceFolder : void 0,
|
|
11724
11821
|
actionsForEntry,
|
|
11725
11822
|
onTreeMutation: handleTreeMutation,
|
|
11726
11823
|
onTreeChange: handleTreeChange,
|
|
@@ -11934,7 +12031,7 @@ function DocBlocksShell({
|
|
|
11934
12031
|
onOpenSettings: openSettings
|
|
11935
12032
|
}
|
|
11936
12033
|
),
|
|
11937
|
-
|
|
12034
|
+
hostSupports3("speechOutput") ? /* @__PURE__ */ jsx19(
|
|
11938
12035
|
SpeechToolbarControl,
|
|
11939
12036
|
{
|
|
11940
12037
|
speech,
|
|
@@ -12019,7 +12116,7 @@ function DocBlocksShell({
|
|
|
12019
12116
|
children: "New folder"
|
|
12020
12117
|
}
|
|
12021
12118
|
),
|
|
12022
|
-
(
|
|
12119
|
+
(hostSupports3("workspaceFolderPicker") || typeof globalThis.showDirectoryPicker === "function") && /* @__PURE__ */ jsx19(
|
|
12023
12120
|
"button",
|
|
12024
12121
|
{
|
|
12025
12122
|
type: "button",
|