SD-2678 - Cannot delete contentlocked inline sdt with normal#3129
Conversation
* fix: footer tcs in replacement generating one per character
…annot-delete-contentlocked-inline-sdt-with-normal # Conflicts: # pnpm-lock.yaml
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
caio-pizzol
left a comment
There was a problem hiding this comment.
hey @chittolinag! the original bug is fixed in the dev app :)
one thing to flag: Cmd+X breaks for unlocked fields. select the text inside, press Cmd+X, nothing gets cut and the whole field gets selected instead. fix is one line.
approve once that's in.
| // NodeSelection on the wrapper so the user sees the whole field | ||
| // highlighted and the next destructive press deletes it (matches | ||
| // Word's "click to select, key to delete"). | ||
| if (from !== to && !(selection instanceof NodeSelection)) { |
There was a problem hiding this comment.
repro: open any unlocked inline field, triple-click to highlight the text inside, press Cmd+X. clipboard stays unchanged, the field's text is still there, and the highlight jumps to the whole field. paste anywhere to confirm "controlled text" is not on the clipboard. only Backspace and Delete should go through this branch:
| if (from !== to && !(selection instanceof NodeSelection)) { | |
| if ((isBackspace || isDelete) && from !== to && !(selection instanceof NodeSelection)) { |
There was a problem hiding this comment.
hey @caio-pizzol ! I could not reproduce this one, at least not manually. seems to work fine here. maybe let's get on a call to figure it out whether we're doing something different?
There was a problem hiding this comment.
hey @chittolinag! I was able to reproduce this issue using the document attached
If you click the UNLOCKED_FIELD_VALUE sdt and then press Cmd+X, it doesn't do anything. Loading the same document in the main branch actually does cut the text.
There was a problem hiding this comment.
ah I think I get it. if you single click the field, cmd + x won't work. if you double click it, it works. at least that's the behavior from my side.
…ked-inline-sdt-with-normal
|
🎉 This PR is included in superdoc v1.30.0-next.71 The release is available on GitHub release |
|
🎉 This PR is included in @superdoc-dev/react v1.2.0-next.116 The release is available on GitHub release |
|
🎉 This PR is included in @superdoc-dev/mcp v0.3.0-next.74 The release is available on GitHub release |
|
🎉 This PR is included in vscode-ext v2.3.0-next.118 |
|
🎉 This PR is included in superdoc-cli v0.8.0-next.90 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-sdk v1.8.0-next.72 |
Issue
Structured content blocks (SDTs) configured with
contentLockedcould not be deleted as a whole. Users could neither remove them with backspace/delete at the wrapper boundary, nor select-and-delete the field — the lock plugin treated wrapper-level actions as in-content edits and blocked them.Proposed solution
Refined the structured-content lock plugin so it distinguishes wrapper-level actions from content edits:
NodeSelection, so the next destructive keypress removes the whole field (matching Word's "click to select, key to delete" behavior).contentLockedno longer blocks deletion of the field itself.Lock modes that protect the wrapper (
sdtLocked,sdtContentLocked) still prevent removal. Added unit tests covering the new paths.