@stll/folio-core 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -61,12 +61,11 @@ type HiddenEditorManagerDeps = {
|
|
|
61
61
|
getPrecomputedInitialState: () => EditorState | null | undefined;
|
|
62
62
|
getReadOnly: () => boolean;
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
65
|
-
* internal edits (so typing does not trigger an external
|
|
66
|
-
* distinct
|
|
67
|
-
* signature is used as a fallback when undefined.
|
|
64
|
+
* Identity of the loaded document as tracked by the adapter's loader: the
|
|
65
|
+
* same value across internal edits (so typing does not trigger an external
|
|
66
|
+
* re-sync) and a distinct value per load.
|
|
68
67
|
*/
|
|
69
|
-
|
|
68
|
+
getDocumentIdentity: () => string;
|
|
70
69
|
/** Document context for the API's `getDocument` (PM state -> Document). */
|
|
71
70
|
getDocumentContext: () => document_d_exports.Document | null;
|
|
72
71
|
onTransaction: (transaction: Transaction, newState: EditorState) => void;
|
|
@@ -152,11 +152,6 @@ function createHiddenEditorState(options) {
|
|
|
152
152
|
recordHiddenEditorPhase(reason, "editor-state", performance.now() - startedAt);
|
|
153
153
|
return state;
|
|
154
154
|
}
|
|
155
|
-
function getDocumentIdentity(doc) {
|
|
156
|
-
if (!doc) return "empty";
|
|
157
|
-
const meta = doc.package.properties;
|
|
158
|
-
return `${meta?.created ? String(meta.created) : ""}-${meta?.modified ? String(meta.modified) : ""}-${meta?.title ?? ""}`;
|
|
159
|
-
}
|
|
160
155
|
function syncHiddenEditorAccessibility(view, readOnly) {
|
|
161
156
|
const { dom } = view;
|
|
162
157
|
if (!dom.hasAttribute("tabindex")) dom.tabIndex = 0;
|
|
@@ -193,7 +188,6 @@ const createHiddenEditorManager = (deps) => {
|
|
|
193
188
|
let isInitialized = false;
|
|
194
189
|
let lastDocumentId = null;
|
|
195
190
|
let lastCollaborationFragment = null;
|
|
196
|
-
const currentDocumentIdentity = () => deps.getDocumentKey() ?? getDocumentIdentity(deps.getDocument());
|
|
197
191
|
const tryCreate = () => {
|
|
198
192
|
if (!requested || view !== null || isDestroying) return;
|
|
199
193
|
const host = deps.getHost();
|
|
@@ -264,7 +258,7 @@ const createHiddenEditorManager = (deps) => {
|
|
|
264
258
|
recordHiddenEditorPhase("mount", "editor-view", performance.now() - viewStartedAt);
|
|
265
259
|
syncHiddenEditorAccessibility(view, deps.getReadOnly());
|
|
266
260
|
isInitialized = true;
|
|
267
|
-
lastDocumentId =
|
|
261
|
+
lastDocumentId = deps.getDocumentIdentity();
|
|
268
262
|
lastCollaborationFragment = collaboration?.yXmlFragment ?? null;
|
|
269
263
|
deps.onEditorViewReady(view);
|
|
270
264
|
};
|
|
@@ -291,7 +285,7 @@ const createHiddenEditorManager = (deps) => {
|
|
|
291
285
|
const collaborationModules = deps.getCollaborationModules();
|
|
292
286
|
if (collaboration && !collaborationModules) return;
|
|
293
287
|
const document = deps.getDocument();
|
|
294
|
-
const currentDocId =
|
|
288
|
+
const currentDocId = deps.getDocumentIdentity();
|
|
295
289
|
const currentCollaborationFragment = collaboration?.yXmlFragment ?? null;
|
|
296
290
|
const collaborationSourceChanged = currentCollaborationFragment !== lastCollaborationFragment;
|
|
297
291
|
if (collaboration && !collaborationSourceChanged) return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/folio-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Headless, framework-neutral core of folio: the OOXML (.docx) parser, document model, ProseMirror integration, and page-layout engine. No React.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"document-model",
|