Repository navigation
PT-2609: Add hasBuiltInContextMenu editor option - #58
Draft
rolfheij-sil wants to merge 2 commits into
Draft
rolfheij-sil wants to merge 2 commits into
rolfheij-sil wants to merge 2 commits into
Conversation
… right-click menu The new experimental editor option hasBuiltInContextMenu (default true) controls whether the editor mounts its own right-click menu. A host that shows its own menu sets it to false. It is independent of hasExternalUI, which other consumers pass while still relying on the built-in menu. The clipboard plugin stays mounted, so EditorRef.copy() keeps working. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012P3p4beP5twfPwL6U3xjTX
…menu off Add the option to the package README options table, note on contextMenu that its items are ignored when the built-in menu is off, and spell out in the TSDoc that the host must then prevent the browser's own menu itself. Mark the changelog entry experimental. Drop a test that duplicated another and add one proving a collapsed-selection copy() still writes nothing with the menu off. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012P3p4beP5twfPwL6U3xjTX
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds an editor option,
hasBuiltInContextMenu(defaulttrue), that lets a host stop the editor from mounting its own right-click menu.Platform.Bible is moving the Scripture editors' right-click menu to the platform's own context menu (PT-2609: localized, shadcn look, items declared in
menus.json, Copy disabled without a selection). For that the host needs to switch the built-inContextMenuPluginoff. The core PR that uses the option follows; nothing opts in yet, so no editor changes behaviour with this PR alone.What changes
EditorOptions.hasBuiltInContextMenu?: boolean, marked@experimental.falseskips mountingContextMenuPlugin; unset ortrueis today's behaviour.hasExternalUI: Enhanced Resources, the footnote editor, the Storybook stories and this repo's own demos all passhasExternalUI: trueand still rely on the built-in menu.ClipboardPluginstays mounted either way, soEditorRef.cut()/copy()/paste()/pastePlainText()and the empty-copy guard are unaffected.distandetcrebuilt withpnpm rebuild-committed-output.Later, once no host uses the built-in menu,
ContextMenuPlugin,EditorOptions.contextMenuand this option can be removed together (a breaking change, not part of this PR).Verification
Editor.test.tsx(options.hasBuiltInContextMenu, 7 tests): red before the change (the 3falsecases failed, the 4 controls passed), green after; with the mount made unconditional again the same 3 failnx test @eten-tech-foundation/platform-editornx run-many -t typechecknx run-many -t lintpnpm rebuild-committed-output, run lastpackages/platform/distandetcchanged;platform-editor.api.mdlists the new memberNot run:
nx test shared-react(not touched); a live run in Platform.Bible (it happens in the core PR, against this branch staged locally; this description will be updated with the result); the/process-pr-feedback --verify-onlypass and the full/pr-reviewpipeline (the source change is one option and one conditional mount). Instead, an independent reviewer with no prior context read the commit against the surrounding code: no important findings; its four minor ones (README options table, TSDoc on what the host must do, a duplicate test, a copy test that could not fail) are fixed in the second commit, where the new empty-copy test was shown to fail with the guard removed.AI-assisted — session
🤖 Generated with Claude Code
https://claude.ai/code/session_012P3p4beP5twfPwL6U3xjTX
This change is