aglinxinyuan opened a new pull request, #8055: URL: https://github.com/apache/texera/pull/8055
### What changes were proposed in this PR? The operator and port title editors bind Enter to "commit and close" so that a display name stays a single-line value. Since the move to Quill 2 (#6418) that suppression has been dead: Enter inserted a literal newline into the shared `Y.Text`, which is published to every co-editor and persisted with the workflow. Root cause — Quill 2 resolves a keydown against two buckets, `event.key` first: ``` bindings[evt.key] ++ bindings[evt.which] // "Enter" bucket, then 13 bucket matches.some(handler) // first non-`true` return wins, loop stops ``` Quill's own `handleEnter` is registered under `"Enter"`; the editors registered theirs under the legacy `13` keycode. So Quill's handler ran first, inserted the newline, and short-circuited the loop before the editors' handler was reached. The template's separate `(keyup.enter)` still closed the editor on key *release*, so the rename looked like it worked. ``` Before: Enter -> Quill handleEnter -> "\n" into shared text -> keyup closes editor After: Enter -> editor handler -> commit and close, text untouched ``` Keying both bindings `"Enter"` puts them in the same bucket, registered ahead of `handleEnter` (user options are added before Quill's built-ins). | Rename typed | Enter pressed at | Stored name before | Stored name after | | --- | --- | --- | --- | | `Sentiment Analysis` | end | `"Sentiment Analysis\n"` | `"Sentiment Analysis"` | | `Sentiment Analysis` | mid-word | `"Sen\ntiment Analysis"` | `"Sentiment Analysis"` | | *(untouched)* | start | `"\n"` | `""` | No visual change: the editor renders identically before and after, which is why this went unnoticed — the defect is only in the value that gets stored. `CollabWrapperComponent` carries the same `key: 13`, but it is unreachable (its call site is commented out) and #7351 deletes it, so it is left alone here. ### Any related issues, documentation, discussions? Closes #8053. Regression from #6418 (Quill 1 -> 2). Related: #7351. ### How was this PR tested? New regression tests in both title editors' specs mount the real Quill instance and the real y-quill binding, open the editor through the template's edit button, and press Enter as a **keydown only** — the template's `(keyup.enter)` fallback is never dispatched, so it cannot mask a broken binding. Each asserts the shared `Y.Text` and `editingTitle`. Coverage: caret at the end, mid-word, an empty name, Shift+Enter, and an ordinary keystroke that must still reach the editor (`defaultPrevented === false`, editor stays open). The four positive tests fail on `main` and pass here; the negative one passes both ways, as a control: ``` AssertionError: expected 'renamed\n' to be 'renamed' AssertionError: expected 'ren\named' to be 'renamed' AssertionError: expected '\n' to be '' ``` ```bash cd frontend && yarn install --frozen-lockfile ``` ```bash cd frontend && npx ng test --include "src/app/workspace/component/property-editor/**/*.spec.ts" --watch=false ``` `316 passed | 1 skipped (317)`. Full frontend suite: `204 files, 5213 passed`. `yarn build` (production) succeeds. `npx prettier --check` and `npx eslint` clean. jsdom has no layout engine, so `Range#getBoundingClientRect` is stubbed next to the existing test-env polyfills — Quill calls it to place the caret and quill-cursors calls it per remote cursor. Manually verified in Chromium against Quill 2.0.3 with both binding forms side by side and a real Enter keystroke: `key: 13` stored `"Sentiment Analysis\n"` and left the editor open; `key: "Enter"` stored `"Sentiment Analysis"` and closed it. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code, Opus 5 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
