Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ The release run heads these entries with the version and opens a fresh

## Unreleased

- **Fix**: `odr.editing.getOperations()` and `odr.generateDiff()` stated
`"version": 1` while `Document::edit` takes 2, so every save the browser
produced was refused. A check page now asserts the version.

- A `.pptx` can be edited and saved: every text operation a `.docx` takes, and
a save that writes the slide parts back into the package. Its
`FileTypeCapabilities` now states `edit` and `save`.
Expand Down
6 changes: 4 additions & 2 deletions src/odr/internal/html/frontend/editing.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,11 @@
});
},

/// The envelope a host hands to `Document::edit` before saving.
/// The envelope a host hands to `Document::edit` before saving. The
/// version is what the library takes; a check page asserts it, because
/// nothing else here would notice the two drifting apart.
getOperations: function () {
return JSON.stringify({ version: 1, ops: operations() });
return JSON.stringify({ version: 2, ops: operations() });
},

/// False where no editor has an edit to take back.
Expand Down
5 changes: 5 additions & 0 deletions test/browser/text/tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,11 @@
odr.resetSearch();
check("as does clearing it", ops().length === 1);

check(
"the envelope states the version the library takes",
JSON.parse(odr.editing.getOperations()).version === 2
);

odr.editing.committed();
check("committing clears the log", ops().length === 0);
check("and undo with it", odr.editing.undo() === false);
Expand Down
Loading