superdoc 2.0.0-next.46 → 2.0.0-next.48
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/chunks/{create-super-doc-ui-6FUZ9d-y.cjs → create-super-doc-ui-BNo2DvD1.cjs} +85 -22
- package/dist/chunks/{create-super-doc-ui-DCFTmVRK.es.js → create-super-doc-ui-BmtUtDDR.es.js} +85 -22
- package/dist/collaboration-upgrade-engine.cjs +1 -1
- package/dist/collaboration-upgrade-engine.es.js +1 -1
- package/dist/public/ui-react.cjs +1 -1
- package/dist/public/ui-react.es.js +1 -1
- package/dist/public/ui.cjs +1 -1
- package/dist/public/ui.es.js +1 -1
- package/dist/superdoc/src/composables/replace-continuation.d.ts +37 -0
- package/dist/superdoc/src/internal/toolbar/built-in/default-items.d.ts +11 -0
- package/dist/superdoc.cjs +33 -18
- package/dist/superdoc.es.js +33 -18
- package/dist-cdn/superdoc.min.js +35 -35
- package/package.json +2 -2
|
@@ -4814,7 +4814,11 @@ function createSuperDocUI(options) {
|
|
|
4814
4814
|
if (mirroredEditCommandState) {
|
|
4815
4815
|
const shippedStatus = mirroredEditCommandState.shippedStatus;
|
|
4816
4816
|
const supported = shippedStatus !== "not-shipped" && shippedStatus !== "disabled";
|
|
4817
|
-
const
|
|
4817
|
+
const mirroredEnabled = typeof mirroredEditCommandState.enabled === "boolean" ? mirroredEditCommandState.enabled : true;
|
|
4818
|
+
const isHistoryCommand = id === "undo" || id === "redo";
|
|
4819
|
+
const historyUnread = isHistoryCommand && mirroredEditCommandState.historyResolved === false;
|
|
4820
|
+
const isEmptyHistoryStack = isHistoryCommand && supported && mirroredEnabled === false && mirroredEditCommandState.reason === null && !historyUnread;
|
|
4821
|
+
const reason = mirroredEditCommandState.reason === void 0 ? void 0 : isEmptyHistoryStack ? SUPERDOC_UI_REASONS.historyEmpty : historyUnread ? SUPERDOC_UI_REASONS.notReady : coerceSuperDocUIReason(mirroredEditCommandState.reason, SUPERDOC_UI_REASONS.commandUnsupported);
|
|
4818
4822
|
if (descriptor.mutates && readonly) return normalizeCommandState({
|
|
4819
4823
|
enabled: false,
|
|
4820
4824
|
active: false,
|
|
@@ -4822,7 +4826,7 @@ function createSuperDocUI(options) {
|
|
|
4822
4826
|
reason: SUPERDOC_UI_REASONS.documentReadonly
|
|
4823
4827
|
}, "builtin");
|
|
4824
4828
|
return normalizeCommandState({
|
|
4825
|
-
enabled: supported &&
|
|
4829
|
+
enabled: supported && mirroredEnabled,
|
|
4826
4830
|
active: false,
|
|
4827
4831
|
supported,
|
|
4828
4832
|
reason
|
|
@@ -5747,6 +5751,37 @@ function createSuperDocUI(options) {
|
|
|
5747
5751
|
};
|
|
5748
5752
|
let currentHostSelectionSource = null;
|
|
5749
5753
|
let detachHostSelection = null;
|
|
5754
|
+
let currentEditCommandsSource = null;
|
|
5755
|
+
let detachEditCommands = null;
|
|
5756
|
+
let editCommandsRecomputeQueued = false;
|
|
5757
|
+
const requestEditCommandsRecompute = () => {
|
|
5758
|
+
if (disposed || editCommandsRecomputeQueued) return;
|
|
5759
|
+
editCommandsRecomputeQueued = true;
|
|
5760
|
+
const run = () => {
|
|
5761
|
+
if (!editCommandsRecomputeQueued) return;
|
|
5762
|
+
editCommandsRecomputeQueued = false;
|
|
5763
|
+
if (disposed) return;
|
|
5764
|
+
recompute();
|
|
5765
|
+
};
|
|
5766
|
+
if (typeof queueMicrotask === "function") queueMicrotask(run);
|
|
5767
|
+
else Promise.resolve().then(run);
|
|
5768
|
+
};
|
|
5769
|
+
const syncEditCommandsSubscription = () => {
|
|
5770
|
+
const next = getEditCommands();
|
|
5771
|
+
if (next === currentEditCommandsSource) return;
|
|
5772
|
+
if (detachEditCommands) {
|
|
5773
|
+
detachEditCommands();
|
|
5774
|
+
detachEditCommands = null;
|
|
5775
|
+
}
|
|
5776
|
+
currentEditCommandsSource = next;
|
|
5777
|
+
if (!next || typeof next.subscribe !== "function") return;
|
|
5778
|
+
try {
|
|
5779
|
+
const unsubscribe = next.subscribe(() => requestEditCommandsRecompute());
|
|
5780
|
+
if (typeof unsubscribe === "function") detachEditCommands = unsubscribe;
|
|
5781
|
+
} catch {
|
|
5782
|
+
currentEditCommandsSource = null;
|
|
5783
|
+
}
|
|
5784
|
+
};
|
|
5750
5785
|
let currentHostReviewSource = null;
|
|
5751
5786
|
let detachHostReview = null;
|
|
5752
5787
|
let currentHostEventsSource = null;
|
|
@@ -5941,8 +5976,10 @@ function createSuperDocUI(options) {
|
|
|
5941
5976
|
};
|
|
5942
5977
|
const recompute = () => {
|
|
5943
5978
|
if (disposed) return;
|
|
5979
|
+
editCommandsRecomputeQueued = false;
|
|
5944
5980
|
syncCoordinatorEditor();
|
|
5945
5981
|
syncHostSelectionSubscription();
|
|
5982
|
+
syncEditCommandsSubscription();
|
|
5946
5983
|
syncHostReviewSubscription();
|
|
5947
5984
|
syncDocumentSelectionFallbackSubscription();
|
|
5948
5985
|
syncHostEventsSubscription();
|
|
@@ -5977,6 +6014,7 @@ function createSuperDocUI(options) {
|
|
|
5977
6014
|
};
|
|
5978
6015
|
attach(superdoc, HOST_EVENTS);
|
|
5979
6016
|
syncHostSelectionSubscription();
|
|
6017
|
+
syncEditCommandsSubscription();
|
|
5980
6018
|
syncHostReviewSubscription();
|
|
5981
6019
|
syncDocumentSelectionFallbackSubscription();
|
|
5982
6020
|
syncHostEventsSubscription();
|
|
@@ -8810,13 +8848,19 @@ function createSuperDocUI(options) {
|
|
|
8810
8848
|
reason: SUPERDOC_UI_REASONS.operationUnavailable
|
|
8811
8849
|
};
|
|
8812
8850
|
const result = safeCall(() => editSearch.next(), null);
|
|
8813
|
-
if (isPromiseLike(result))
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8851
|
+
if (isPromiseLike(result)) {
|
|
8852
|
+
const generation = searchRequestGeneration;
|
|
8853
|
+
Promise.resolve(result).then((resolved) => {
|
|
8854
|
+
if (generation !== searchRequestGeneration) return;
|
|
8855
|
+
applyHostSearchResult(resolved, readEditCommandCanReplace());
|
|
8856
|
+
}).catch(() => {
|
|
8857
|
+
if (generation !== searchRequestGeneration) return;
|
|
8858
|
+
setSearchState({
|
|
8859
|
+
available: false,
|
|
8860
|
+
reason: SUPERDOC_UI_REASONS.searchUnavailable
|
|
8861
|
+
});
|
|
8817
8862
|
});
|
|
8818
|
-
});
|
|
8819
|
-
else applyHostSearchResult(result, readEditCommandCanReplace());
|
|
8863
|
+
} else applyHostSearchResult(result, readEditCommandCanReplace());
|
|
8820
8864
|
applyHostSearchResult(safeCall(() => editSearch.getState(), null), readEditCommandCanReplace());
|
|
8821
8865
|
return { ok: true };
|
|
8822
8866
|
}
|
|
@@ -8840,13 +8884,19 @@ function createSuperDocUI(options) {
|
|
|
8840
8884
|
reason: SUPERDOC_UI_REASONS.operationUnavailable
|
|
8841
8885
|
};
|
|
8842
8886
|
const result = safeCall(() => editSearch.previous(), null);
|
|
8843
|
-
if (isPromiseLike(result))
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8887
|
+
if (isPromiseLike(result)) {
|
|
8888
|
+
const generation = searchRequestGeneration;
|
|
8889
|
+
Promise.resolve(result).then((resolved) => {
|
|
8890
|
+
if (generation !== searchRequestGeneration) return;
|
|
8891
|
+
applyHostSearchResult(resolved, readEditCommandCanReplace());
|
|
8892
|
+
}).catch(() => {
|
|
8893
|
+
if (generation !== searchRequestGeneration) return;
|
|
8894
|
+
setSearchState({
|
|
8895
|
+
available: false,
|
|
8896
|
+
reason: SUPERDOC_UI_REASONS.searchUnavailable
|
|
8897
|
+
});
|
|
8847
8898
|
});
|
|
8848
|
-
});
|
|
8849
|
-
else applyHostSearchResult(result, readEditCommandCanReplace());
|
|
8899
|
+
} else applyHostSearchResult(result, readEditCommandCanReplace());
|
|
8850
8900
|
applyHostSearchResult(safeCall(() => editSearch.getState(), null), readEditCommandCanReplace());
|
|
8851
8901
|
return { ok: true };
|
|
8852
8902
|
}
|
|
@@ -8858,6 +8908,7 @@ function createSuperDocUI(options) {
|
|
|
8858
8908
|
return { ok: true };
|
|
8859
8909
|
},
|
|
8860
8910
|
clear: () => {
|
|
8911
|
+
searchRequestGeneration += 1;
|
|
8861
8912
|
const host = getHostSearch();
|
|
8862
8913
|
if (host && typeof host.clear === "function") safeCall(() => host.clear(), null);
|
|
8863
8914
|
if (!host || typeof host.clear !== "function") {
|
|
@@ -8885,15 +8936,19 @@ function createSuperDocUI(options) {
|
|
|
8885
8936
|
};
|
|
8886
8937
|
const result$1 = safeCall(() => editSearch.replace({ replacement: typeof replacement === "string" ? replacement : "" }), null);
|
|
8887
8938
|
if (isPromiseLike(result$1)) {
|
|
8939
|
+
const generation = searchRequestGeneration;
|
|
8888
8940
|
syncSearchStateFromHost();
|
|
8889
8941
|
emitSearch();
|
|
8942
|
+
const isCurrent = () => generation === searchRequestGeneration;
|
|
8890
8943
|
return Promise.resolve(result$1).then((resolved) => {
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8944
|
+
if (isCurrent()) {
|
|
8945
|
+
applyHostSearchResult(resolved, readEditCommandCanReplace());
|
|
8946
|
+
syncSearchStateFromHost();
|
|
8947
|
+
emitSearch();
|
|
8948
|
+
}
|
|
8894
8949
|
return mapHostReplaceResult(resolved);
|
|
8895
8950
|
}, () => {
|
|
8896
|
-
setSearchState({
|
|
8951
|
+
if (isCurrent()) setSearchState({
|
|
8897
8952
|
available: false,
|
|
8898
8953
|
reason: SUPERDOC_UI_REASONS.searchUnavailable
|
|
8899
8954
|
});
|
|
@@ -8930,15 +8985,19 @@ function createSuperDocUI(options) {
|
|
|
8930
8985
|
};
|
|
8931
8986
|
const result$1 = safeCall(() => editSearch.replaceAll({ replacement: typeof replacement === "string" ? replacement : "" }), null);
|
|
8932
8987
|
if (isPromiseLike(result$1)) {
|
|
8988
|
+
const generation = searchRequestGeneration;
|
|
8933
8989
|
syncSearchStateFromHost();
|
|
8934
8990
|
emitSearch();
|
|
8991
|
+
const isCurrent = () => generation === searchRequestGeneration;
|
|
8935
8992
|
return Promise.resolve(result$1).then((resolved) => {
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
|
|
8993
|
+
if (isCurrent()) {
|
|
8994
|
+
applyHostSearchResult(resolved, readEditCommandCanReplace());
|
|
8995
|
+
syncSearchStateFromHost();
|
|
8996
|
+
emitSearch();
|
|
8997
|
+
}
|
|
8939
8998
|
return mapHostReplaceResult(resolved);
|
|
8940
8999
|
}, () => {
|
|
8941
|
-
setSearchState({
|
|
9000
|
+
if (isCurrent()) setSearchState({
|
|
8942
9001
|
available: false,
|
|
8943
9002
|
reason: SUPERDOC_UI_REASONS.searchUnavailable
|
|
8944
9003
|
});
|
|
@@ -9028,6 +9087,9 @@ function createSuperDocUI(options) {
|
|
|
9028
9087
|
if (detachHostSelection) detachHostSelection();
|
|
9029
9088
|
detachHostSelection = null;
|
|
9030
9089
|
currentHostSelectionSource = null;
|
|
9090
|
+
if (detachEditCommands) detachEditCommands();
|
|
9091
|
+
detachEditCommands = null;
|
|
9092
|
+
currentEditCommandsSource = null;
|
|
9031
9093
|
if (detachHostReview) detachHostReview();
|
|
9032
9094
|
detachHostReview = null;
|
|
9033
9095
|
currentHostReviewSource = null;
|
|
@@ -9041,6 +9103,7 @@ function createSuperDocUI(options) {
|
|
|
9041
9103
|
searchListeners.clear();
|
|
9042
9104
|
painterCaptureEpoch += 1;
|
|
9043
9105
|
painterModeListeners.clear();
|
|
9106
|
+
searchRequestGeneration += 1;
|
|
9044
9107
|
customCommands.clear();
|
|
9045
9108
|
};
|
|
9046
9109
|
const controller = {
|
package/dist/chunks/{create-super-doc-ui-DCFTmVRK.es.js → create-super-doc-ui-BmtUtDDR.es.js}
RENAMED
|
@@ -4592,7 +4592,11 @@ function createSuperDocUI(options) {
|
|
|
4592
4592
|
if (mirroredEditCommandState) {
|
|
4593
4593
|
const shippedStatus = mirroredEditCommandState.shippedStatus;
|
|
4594
4594
|
const supported = shippedStatus !== "not-shipped" && shippedStatus !== "disabled";
|
|
4595
|
-
const
|
|
4595
|
+
const mirroredEnabled = typeof mirroredEditCommandState.enabled === "boolean" ? mirroredEditCommandState.enabled : true;
|
|
4596
|
+
const isHistoryCommand = id === "undo" || id === "redo";
|
|
4597
|
+
const historyUnread = isHistoryCommand && mirroredEditCommandState.historyResolved === false;
|
|
4598
|
+
const isEmptyHistoryStack = isHistoryCommand && supported && mirroredEnabled === false && mirroredEditCommandState.reason === null && !historyUnread;
|
|
4599
|
+
const reason = mirroredEditCommandState.reason === void 0 ? void 0 : isEmptyHistoryStack ? SUPERDOC_UI_REASONS.historyEmpty : historyUnread ? SUPERDOC_UI_REASONS.notReady : coerceSuperDocUIReason(mirroredEditCommandState.reason, SUPERDOC_UI_REASONS.commandUnsupported);
|
|
4596
4600
|
if (descriptor.mutates && readonly) return normalizeCommandState({
|
|
4597
4601
|
enabled: false,
|
|
4598
4602
|
active: false,
|
|
@@ -4600,7 +4604,7 @@ function createSuperDocUI(options) {
|
|
|
4600
4604
|
reason: SUPERDOC_UI_REASONS.documentReadonly
|
|
4601
4605
|
}, "builtin");
|
|
4602
4606
|
return normalizeCommandState({
|
|
4603
|
-
enabled: supported &&
|
|
4607
|
+
enabled: supported && mirroredEnabled,
|
|
4604
4608
|
active: false,
|
|
4605
4609
|
supported,
|
|
4606
4610
|
reason
|
|
@@ -5525,6 +5529,37 @@ function createSuperDocUI(options) {
|
|
|
5525
5529
|
};
|
|
5526
5530
|
let currentHostSelectionSource = null;
|
|
5527
5531
|
let detachHostSelection = null;
|
|
5532
|
+
let currentEditCommandsSource = null;
|
|
5533
|
+
let detachEditCommands = null;
|
|
5534
|
+
let editCommandsRecomputeQueued = false;
|
|
5535
|
+
const requestEditCommandsRecompute = () => {
|
|
5536
|
+
if (disposed || editCommandsRecomputeQueued) return;
|
|
5537
|
+
editCommandsRecomputeQueued = true;
|
|
5538
|
+
const run = () => {
|
|
5539
|
+
if (!editCommandsRecomputeQueued) return;
|
|
5540
|
+
editCommandsRecomputeQueued = false;
|
|
5541
|
+
if (disposed) return;
|
|
5542
|
+
recompute();
|
|
5543
|
+
};
|
|
5544
|
+
if (typeof queueMicrotask === "function") queueMicrotask(run);
|
|
5545
|
+
else Promise.resolve().then(run);
|
|
5546
|
+
};
|
|
5547
|
+
const syncEditCommandsSubscription = () => {
|
|
5548
|
+
const next = getEditCommands();
|
|
5549
|
+
if (next === currentEditCommandsSource) return;
|
|
5550
|
+
if (detachEditCommands) {
|
|
5551
|
+
detachEditCommands();
|
|
5552
|
+
detachEditCommands = null;
|
|
5553
|
+
}
|
|
5554
|
+
currentEditCommandsSource = next;
|
|
5555
|
+
if (!next || typeof next.subscribe !== "function") return;
|
|
5556
|
+
try {
|
|
5557
|
+
const unsubscribe = next.subscribe(() => requestEditCommandsRecompute());
|
|
5558
|
+
if (typeof unsubscribe === "function") detachEditCommands = unsubscribe;
|
|
5559
|
+
} catch {
|
|
5560
|
+
currentEditCommandsSource = null;
|
|
5561
|
+
}
|
|
5562
|
+
};
|
|
5528
5563
|
let currentHostReviewSource = null;
|
|
5529
5564
|
let detachHostReview = null;
|
|
5530
5565
|
let currentHostEventsSource = null;
|
|
@@ -5719,8 +5754,10 @@ function createSuperDocUI(options) {
|
|
|
5719
5754
|
};
|
|
5720
5755
|
const recompute = () => {
|
|
5721
5756
|
if (disposed) return;
|
|
5757
|
+
editCommandsRecomputeQueued = false;
|
|
5722
5758
|
syncCoordinatorEditor();
|
|
5723
5759
|
syncHostSelectionSubscription();
|
|
5760
|
+
syncEditCommandsSubscription();
|
|
5724
5761
|
syncHostReviewSubscription();
|
|
5725
5762
|
syncDocumentSelectionFallbackSubscription();
|
|
5726
5763
|
syncHostEventsSubscription();
|
|
@@ -5755,6 +5792,7 @@ function createSuperDocUI(options) {
|
|
|
5755
5792
|
};
|
|
5756
5793
|
attach(superdoc, HOST_EVENTS);
|
|
5757
5794
|
syncHostSelectionSubscription();
|
|
5795
|
+
syncEditCommandsSubscription();
|
|
5758
5796
|
syncHostReviewSubscription();
|
|
5759
5797
|
syncDocumentSelectionFallbackSubscription();
|
|
5760
5798
|
syncHostEventsSubscription();
|
|
@@ -8588,13 +8626,19 @@ function createSuperDocUI(options) {
|
|
|
8588
8626
|
reason: SUPERDOC_UI_REASONS.operationUnavailable
|
|
8589
8627
|
};
|
|
8590
8628
|
const result = safeCall(() => editSearch.next(), null);
|
|
8591
|
-
if (isPromiseLike(result))
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
|
|
8629
|
+
if (isPromiseLike(result)) {
|
|
8630
|
+
const generation = searchRequestGeneration;
|
|
8631
|
+
Promise.resolve(result).then((resolved) => {
|
|
8632
|
+
if (generation !== searchRequestGeneration) return;
|
|
8633
|
+
applyHostSearchResult(resolved, readEditCommandCanReplace());
|
|
8634
|
+
}).catch(() => {
|
|
8635
|
+
if (generation !== searchRequestGeneration) return;
|
|
8636
|
+
setSearchState({
|
|
8637
|
+
available: false,
|
|
8638
|
+
reason: SUPERDOC_UI_REASONS.searchUnavailable
|
|
8639
|
+
});
|
|
8595
8640
|
});
|
|
8596
|
-
});
|
|
8597
|
-
else applyHostSearchResult(result, readEditCommandCanReplace());
|
|
8641
|
+
} else applyHostSearchResult(result, readEditCommandCanReplace());
|
|
8598
8642
|
applyHostSearchResult(safeCall(() => editSearch.getState(), null), readEditCommandCanReplace());
|
|
8599
8643
|
return { ok: true };
|
|
8600
8644
|
}
|
|
@@ -8618,13 +8662,19 @@ function createSuperDocUI(options) {
|
|
|
8618
8662
|
reason: SUPERDOC_UI_REASONS.operationUnavailable
|
|
8619
8663
|
};
|
|
8620
8664
|
const result = safeCall(() => editSearch.previous(), null);
|
|
8621
|
-
if (isPromiseLike(result))
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8665
|
+
if (isPromiseLike(result)) {
|
|
8666
|
+
const generation = searchRequestGeneration;
|
|
8667
|
+
Promise.resolve(result).then((resolved) => {
|
|
8668
|
+
if (generation !== searchRequestGeneration) return;
|
|
8669
|
+
applyHostSearchResult(resolved, readEditCommandCanReplace());
|
|
8670
|
+
}).catch(() => {
|
|
8671
|
+
if (generation !== searchRequestGeneration) return;
|
|
8672
|
+
setSearchState({
|
|
8673
|
+
available: false,
|
|
8674
|
+
reason: SUPERDOC_UI_REASONS.searchUnavailable
|
|
8675
|
+
});
|
|
8625
8676
|
});
|
|
8626
|
-
});
|
|
8627
|
-
else applyHostSearchResult(result, readEditCommandCanReplace());
|
|
8677
|
+
} else applyHostSearchResult(result, readEditCommandCanReplace());
|
|
8628
8678
|
applyHostSearchResult(safeCall(() => editSearch.getState(), null), readEditCommandCanReplace());
|
|
8629
8679
|
return { ok: true };
|
|
8630
8680
|
}
|
|
@@ -8636,6 +8686,7 @@ function createSuperDocUI(options) {
|
|
|
8636
8686
|
return { ok: true };
|
|
8637
8687
|
},
|
|
8638
8688
|
clear: () => {
|
|
8689
|
+
searchRequestGeneration += 1;
|
|
8639
8690
|
const host = getHostSearch();
|
|
8640
8691
|
if (host && typeof host.clear === "function") safeCall(() => host.clear(), null);
|
|
8641
8692
|
if (!host || typeof host.clear !== "function") {
|
|
@@ -8663,15 +8714,19 @@ function createSuperDocUI(options) {
|
|
|
8663
8714
|
};
|
|
8664
8715
|
const result$1 = safeCall(() => editSearch.replace({ replacement: typeof replacement === "string" ? replacement : "" }), null);
|
|
8665
8716
|
if (isPromiseLike(result$1)) {
|
|
8717
|
+
const generation = searchRequestGeneration;
|
|
8666
8718
|
syncSearchStateFromHost();
|
|
8667
8719
|
emitSearch();
|
|
8720
|
+
const isCurrent = () => generation === searchRequestGeneration;
|
|
8668
8721
|
return Promise.resolve(result$1).then((resolved) => {
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8722
|
+
if (isCurrent()) {
|
|
8723
|
+
applyHostSearchResult(resolved, readEditCommandCanReplace());
|
|
8724
|
+
syncSearchStateFromHost();
|
|
8725
|
+
emitSearch();
|
|
8726
|
+
}
|
|
8672
8727
|
return mapHostReplaceResult(resolved);
|
|
8673
8728
|
}, () => {
|
|
8674
|
-
setSearchState({
|
|
8729
|
+
if (isCurrent()) setSearchState({
|
|
8675
8730
|
available: false,
|
|
8676
8731
|
reason: SUPERDOC_UI_REASONS.searchUnavailable
|
|
8677
8732
|
});
|
|
@@ -8708,15 +8763,19 @@ function createSuperDocUI(options) {
|
|
|
8708
8763
|
};
|
|
8709
8764
|
const result$1 = safeCall(() => editSearch.replaceAll({ replacement: typeof replacement === "string" ? replacement : "" }), null);
|
|
8710
8765
|
if (isPromiseLike(result$1)) {
|
|
8766
|
+
const generation = searchRequestGeneration;
|
|
8711
8767
|
syncSearchStateFromHost();
|
|
8712
8768
|
emitSearch();
|
|
8769
|
+
const isCurrent = () => generation === searchRequestGeneration;
|
|
8713
8770
|
return Promise.resolve(result$1).then((resolved) => {
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8771
|
+
if (isCurrent()) {
|
|
8772
|
+
applyHostSearchResult(resolved, readEditCommandCanReplace());
|
|
8773
|
+
syncSearchStateFromHost();
|
|
8774
|
+
emitSearch();
|
|
8775
|
+
}
|
|
8717
8776
|
return mapHostReplaceResult(resolved);
|
|
8718
8777
|
}, () => {
|
|
8719
|
-
setSearchState({
|
|
8778
|
+
if (isCurrent()) setSearchState({
|
|
8720
8779
|
available: false,
|
|
8721
8780
|
reason: SUPERDOC_UI_REASONS.searchUnavailable
|
|
8722
8781
|
});
|
|
@@ -8806,6 +8865,9 @@ function createSuperDocUI(options) {
|
|
|
8806
8865
|
if (detachHostSelection) detachHostSelection();
|
|
8807
8866
|
detachHostSelection = null;
|
|
8808
8867
|
currentHostSelectionSource = null;
|
|
8868
|
+
if (detachEditCommands) detachEditCommands();
|
|
8869
|
+
detachEditCommands = null;
|
|
8870
|
+
currentEditCommandsSource = null;
|
|
8809
8871
|
if (detachHostReview) detachHostReview();
|
|
8810
8872
|
detachHostReview = null;
|
|
8811
8873
|
currentHostReviewSource = null;
|
|
@@ -8819,6 +8881,7 @@ function createSuperDocUI(options) {
|
|
|
8819
8881
|
searchListeners.clear();
|
|
8820
8882
|
painterCaptureEpoch += 1;
|
|
8821
8883
|
painterModeListeners.clear();
|
|
8884
|
+
searchRequestGeneration += 1;
|
|
8822
8885
|
customCommands.clear();
|
|
8823
8886
|
};
|
|
8824
8887
|
const controller = {
|
|
@@ -7,7 +7,7 @@ const COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
|
|
|
7
7
|
var PRIVATE_ENGINE_INFO = (0, __superdoc_docx_engine_collaboration_upgrade_engine.getCollaborationUpgradeEngineInfo)();
|
|
8
8
|
var ENGINE_INFO = Object.freeze({
|
|
9
9
|
...PRIVATE_ENGINE_INFO,
|
|
10
|
-
superdocVersion: "2.0.0-next.
|
|
10
|
+
superdocVersion: "2.0.0-next.48",
|
|
11
11
|
roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
|
|
12
12
|
supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
|
|
13
13
|
supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
|
|
@@ -6,7 +6,7 @@ const COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
|
|
|
6
6
|
var PRIVATE_ENGINE_INFO = getCollaborationUpgradeEngineInfo$1();
|
|
7
7
|
var ENGINE_INFO = Object.freeze({
|
|
8
8
|
...PRIVATE_ENGINE_INFO,
|
|
9
|
-
superdocVersion: "2.0.0-next.
|
|
9
|
+
superdocVersion: "2.0.0-next.48",
|
|
10
10
|
roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
|
|
11
11
|
supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
|
|
12
12
|
supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
|
package/dist/public/ui-react.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rolldown_runtime = require("../chunks/rolldown-runtime-_dR15c8t.cjs");
|
|
3
|
-
const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-
|
|
3
|
+
const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-BNo2DvD1.cjs");
|
|
4
4
|
let react = require("react");
|
|
5
5
|
var SuperDocUIContext = (0, react.createContext)(null);
|
|
6
6
|
function disposeOwnedUi(ref) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-
|
|
1
|
+
import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-BmtUtDDR.es.js";
|
|
2
2
|
import { createContext, createElement, useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
3
3
|
var SuperDocUIContext = createContext(null);
|
|
4
4
|
function disposeOwnedUi(ref) {
|
package/dist/public/ui.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-
|
|
2
|
+
const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-BNo2DvD1.cjs");
|
|
3
3
|
exports.BUILT_IN_COMMAND_IDS = require_create_super_doc_ui.BUILT_IN_COMMAND_IDS;
|
|
4
4
|
exports.createSuperDocUI = require_create_super_doc_ui.createSuperDocUI;
|
|
5
5
|
exports.shallowEqual = require_create_super_doc_ui.shallowEqual;
|
package/dist/public/ui.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as shallowEqual, r as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-
|
|
1
|
+
import { n as shallowEqual, r as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-BmtUtDDR.es.js";
|
|
2
2
|
export { BUILT_IN_COMMAND_IDS, createSuperDocUI, shallowEqual };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The find/replace panel's settled-replace continuation.
|
|
3
|
+
*
|
|
4
|
+
* A worker-backed replace resolves asynchronously, and the session it belongs to
|
|
5
|
+
* can be gone by the time it does: the search handle is reassigned when the
|
|
6
|
+
* active editor changes and nulled on teardown. Publishing the resolved snapshot
|
|
7
|
+
* anyway would repopulate the panel with matches from a document the user is no
|
|
8
|
+
* longer looking at.
|
|
9
|
+
*
|
|
10
|
+
* A leaf module rather than a closure inside `useFindReplace`, following
|
|
11
|
+
* `find-shortcut-owner.js`. The guard previously lived in two byte-identical
|
|
12
|
+
* inline closures, each of which needed a full composable driving a
|
|
13
|
+
* worker-backed host caught mid-swap to reach one branch. Nothing could, so it
|
|
14
|
+
* shipped with a comment admitting it was verified by inspection only. The
|
|
15
|
+
* duplication was the tell: logic worth stating twice is worth naming once.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Build the continuation that publishes a settled replace back into the panel.
|
|
19
|
+
*
|
|
20
|
+
* The session handle itself is the identity. `onSettled` always runs, including
|
|
21
|
+
* when the write is skipped: it clears the pending flag that gates the replace
|
|
22
|
+
* controls, and leaving it set would disable them with nothing left to settle.
|
|
23
|
+
*
|
|
24
|
+
* @param {{ getSnapshot: () => unknown }} session The handle captured when the replace was issued.
|
|
25
|
+
* @param {object} deps
|
|
26
|
+
* @param {() => unknown} deps.getCurrentSession Reads the live session identity.
|
|
27
|
+
* @param {(snapshot: unknown) => void} deps.applySlice Publishes a snapshot into the panel.
|
|
28
|
+
* @param {() => void} deps.onSettled Runs whether or not the write was skipped.
|
|
29
|
+
* @returns {() => void}
|
|
30
|
+
*/
|
|
31
|
+
export function createReplaceContinuation(session: {
|
|
32
|
+
getSnapshot: () => unknown;
|
|
33
|
+
}, { getCurrentSession, applySlice, onSettled }: {
|
|
34
|
+
getCurrentSession: () => unknown;
|
|
35
|
+
applySlice: (snapshot: unknown) => void;
|
|
36
|
+
onSettled: () => void;
|
|
37
|
+
}): () => void;
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Set or clear the link item's `href` without disturbing the rest of its
|
|
3
|
+
* attributes. The static configuration (`ariaLabel`, and anything added later)
|
|
4
|
+
* lives in the same object as the transient href, so rebuilding that object
|
|
5
|
+
* from the keys a caller knows about silently drops the others.
|
|
6
|
+
*
|
|
7
|
+
* Exported because the built-in toolbar's `updateToolbarState()` writes the
|
|
8
|
+
* href on its own path, without going through this item's handlers. Both
|
|
9
|
+
* callers share this one rule so the two cannot drift apart.
|
|
10
|
+
*/
|
|
11
|
+
export function withLinkHref(attributes: any, href: any): any;
|
|
1
12
|
export function makeDefaultItems({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts, hideButtons, availableWidth, role, isDev, }?: {
|
|
2
13
|
isDev?: boolean | undefined;
|
|
3
14
|
}): {
|
package/dist/superdoc.cjs
CHANGED
|
@@ -6,7 +6,7 @@ const require_uuid = require("./chunks/uuid-CFp0WGVU.cjs");
|
|
|
6
6
|
const require_jszip = require("./chunks/jszip-BdUBlUeG.cjs");
|
|
7
7
|
const require__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-BTwbGDKw.cjs");
|
|
8
8
|
const require_constants = require("./chunks/constants-sbCZ2O_A.cjs");
|
|
9
|
-
const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-
|
|
9
|
+
const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-BNo2DvD1.cjs");
|
|
10
10
|
let vue = require("vue");
|
|
11
11
|
vue = require_rolldown_runtime.__toESM(vue);
|
|
12
12
|
require("y-websocket");
|
|
@@ -10554,6 +10554,14 @@ function usePasswordPrompt({ getSurfaceManager, getPasswordPromptConfig, onUnhan
|
|
|
10554
10554
|
destroy
|
|
10555
10555
|
};
|
|
10556
10556
|
}
|
|
10557
|
+
function createReplaceContinuation(session, { getCurrentSession, applySlice, onSettled }) {
|
|
10558
|
+
return () => {
|
|
10559
|
+
if (session === getCurrentSession()) try {
|
|
10560
|
+
applySlice(session.getSnapshot());
|
|
10561
|
+
} catch {}
|
|
10562
|
+
onSettled();
|
|
10563
|
+
};
|
|
10564
|
+
}
|
|
10557
10565
|
var DEFAULT_TEXTS = {
|
|
10558
10566
|
findPlaceholder: "Find",
|
|
10559
10567
|
findAriaLabel: "Find text",
|
|
@@ -10738,12 +10746,13 @@ function useFindReplace({ getSurfaceManager, getActiveEditor, activeEditorRef, g
|
|
|
10738
10746
|
if (!canReplaceState.value) return;
|
|
10739
10747
|
const search = currentV2Search;
|
|
10740
10748
|
replacePending.value = true;
|
|
10741
|
-
const finish = (
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10746
|
-
|
|
10749
|
+
const finish = createReplaceContinuation(search, {
|
|
10750
|
+
getCurrentSession: () => currentV2Search,
|
|
10751
|
+
applySlice: applyV2Slice,
|
|
10752
|
+
onSettled: () => {
|
|
10753
|
+
replacePending.value = false;
|
|
10754
|
+
}
|
|
10755
|
+
});
|
|
10747
10756
|
let result = null;
|
|
10748
10757
|
try {
|
|
10749
10758
|
result = search.replace(replaceText.value);
|
|
@@ -10767,12 +10776,13 @@ function useFindReplace({ getSurfaceManager, getActiveEditor, activeEditorRef, g
|
|
|
10767
10776
|
if (!canReplaceState.value) return;
|
|
10768
10777
|
const search = currentV2Search;
|
|
10769
10778
|
replacePending.value = true;
|
|
10770
|
-
const finish = (
|
|
10771
|
-
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
|
|
10779
|
+
const finish = createReplaceContinuation(search, {
|
|
10780
|
+
getCurrentSession: () => currentV2Search,
|
|
10781
|
+
applySlice: applyV2Slice,
|
|
10782
|
+
onSettled: () => {
|
|
10783
|
+
replacePending.value = false;
|
|
10784
|
+
}
|
|
10785
|
+
});
|
|
10776
10786
|
let result = null;
|
|
10777
10787
|
try {
|
|
10778
10788
|
result = search.replaceAll(replaceText.value);
|
|
@@ -32628,6 +32638,12 @@ var check_default = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448
|
|
|
32628
32638
|
var closeDropdown = (dropdown) => {
|
|
32629
32639
|
dropdown.expand.value = false;
|
|
32630
32640
|
};
|
|
32641
|
+
function withLinkHref(attributes, href) {
|
|
32642
|
+
const next = { ...attributes ?? {} };
|
|
32643
|
+
if (href) next.href = href;
|
|
32644
|
+
else delete next.href;
|
|
32645
|
+
return next;
|
|
32646
|
+
}
|
|
32631
32647
|
function selectionTargetFromTextTarget(target) {
|
|
32632
32648
|
const segments = Array.isArray(target?.segments) ? target.segments : [];
|
|
32633
32649
|
if (target?.kind !== "text" || !segments.length) return null;
|
|
@@ -32905,11 +32921,10 @@ const makeDefaultItems = ({ superToolbar, toolbarIcons: toolbarIcons$1, toolbarT
|
|
|
32905
32921
|
render: () => renderLinkDropdown(link)
|
|
32906
32922
|
}],
|
|
32907
32923
|
onActivate: ({ href }) => {
|
|
32908
|
-
|
|
32909
|
-
else link.attributes.value = {};
|
|
32924
|
+
link.attributes.value = withLinkHref(link.attributes.value, href);
|
|
32910
32925
|
},
|
|
32911
32926
|
onDeactivate: () => {
|
|
32912
|
-
link.attributes.value =
|
|
32927
|
+
link.attributes.value = withLinkHref(link.attributes.value, null);
|
|
32913
32928
|
link.expand.value = false;
|
|
32914
32929
|
}
|
|
32915
32930
|
});
|
|
@@ -34192,7 +34207,7 @@ var BuiltInToolbar = class extends require_eventemitter3.import_eventemitter3.de
|
|
|
34192
34207
|
},
|
|
34193
34208
|
link: () => {
|
|
34194
34209
|
item.active.value = Boolean(commandState?.active);
|
|
34195
|
-
item.attributes.value =
|
|
34210
|
+
item.attributes.value = withLinkHref(item.attributes.value, commandState?.value ?? null);
|
|
34196
34211
|
},
|
|
34197
34212
|
fontFamily: () => {
|
|
34198
34213
|
if (commandState?.value != null) {
|
|
@@ -34695,7 +34710,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
34695
34710
|
this.config.colors = shuffleArray(this.config.colors);
|
|
34696
34711
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
34697
34712
|
this.colorIndex = 0;
|
|
34698
|
-
this.version = "2.0.0-next.
|
|
34713
|
+
this.version = "2.0.0-next.48";
|
|
34699
34714
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
34700
34715
|
this.superdocId = config.superdocId || require_uuid.v4_default();
|
|
34701
34716
|
this.colors = this.config.colors ?? [];
|