Repository navigation
fix(model): keep inline tool data when modifyData re-applies formatting #194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b1480c9
docs(openspec): keep bug-fix proposals to the bug and the fix
gohabereg 9f284e1
docs(openspec): propose fix-modify-data-inline-data
gohabereg 3c60e39
fix(model): keep inline tool data when modifyData re-applies formatting
gohabereg e608c67
chore(openspec): archive fix-modify-data-inline-data
github-actions[bot] b5fc653
Merge branch 'main' into fix/modify-op-inline-data
gohabereg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
openspec/changes/archive/2026-11-08-fix-modify-data-inline-data/proposal.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| ## Bug | ||
|
|
||
| `EditorDocument.modifyData()` calls `format()` with the tool but drops `data`. Since #169, re-applying a tool with `data: undefined` replaces the fragment's data, so a redo or a remote Modify op on a link wipes its `href` (and over a partial range splits the link into an href-less head and an href-bearing tail). | ||
|
|
||
| ## Fix | ||
|
|
||
| Pass `(data.value as TextFormattedEventData).data` through to `format()`. |
24 changes: 24 additions & 0 deletions
24
...spec/changes/archive/2026-11-08-fix-modify-data-inline-data/specs/model/spec.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| ## MODIFIED Requirements | ||
|
|
||
| ### Requirement: EditorDocument block container | ||
| The system SHALL provide `EditorDocument` as the root container of `BlockNode`s, supporting add/remove/get by index or id (with an O(1) id lookup map), document-level properties, and generic index-based `insertData`/`removeData`/`modifyData` dispatch, bubbling child events with the block index injected. | ||
|
|
||
| #### Scenario: Adding a block at an out-of-bounds index | ||
| - **GIVEN** a document with N blocks | ||
| - **WHEN** `addBlock` is called with an index less than 0 or greater than N | ||
| - **THEN** it throws an "Index out of bounds" error | ||
|
|
||
| #### Scenario: Adding a block with a duplicate id | ||
| - **GIVEN** a block id that already exists in the document | ||
| - **WHEN** `addBlock` is called reusing that id | ||
| - **THEN** it throws `BlockAlreadyExistsError` | ||
|
|
||
| #### Scenario: Appending a block with no index | ||
| - **GIVEN** an existing document | ||
| - **WHEN** `addBlock` is called without an index | ||
| - **THEN** the block is appended at the end and a `BlockAddedEvent` fires carrying the serialized block data and its index | ||
|
|
||
| #### Scenario: Modifying text with a formatting value | ||
| - **GIVEN** a `TextIndex` and a modified value `{ tool, data }` | ||
| - **WHEN** `modifyData` is called | ||
| - **THEN** the range is formatted with that `tool` and its `data`, so re-applying a data-carrying tool (e.g. redo or a remote op) keeps the fragment's data |
5 changes: 5 additions & 0 deletions
5
openspec/changes/archive/2026-11-08-fix-modify-data-inline-data/tasks.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| ## 1. Fix | ||
|
|
||
| - [x] 1.1 Add a failing `EditorDocument.modifyData()` test asserting `format()` receives the modified value's `data` | ||
| - [x] 1.2 Pass `data.value.data` through to `format()` in `EditorDocument.modifyData()` | ||
| - [x] 1.3 Run model tests and lint; `openspec validate fix-modify-data-inline-data --type change` passes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.