feat: add guillemet auto-formatting (<< and >>) to the document editor#8783
Open
kyo5uke wants to merge 1 commit into
Open
feat: add guillemet auto-formatting (<< and >>) to the document editor#8783kyo5uke wants to merge 1 commit into
kyo5uke wants to merge 1 commit into
Conversation
Contributor
Reviewer's GuideAdds new document editor character shortcuts that auto-convert double angle brackets ( Sequence diagram for new guillemet auto-formatting shortcutssequenceDiagram
actor User
participant Editor as DocumentEditor
participant Shortcuts as CharacterShortcutEvent
participant Handler as _handleDoubleCharacterReplacement
User->>Editor: type "<"
Editor->>Shortcuts: customFormatDoubleAngleLeftGuillemet
Shortcuts->>Handler: _handleDoubleCharacterReplacement(editorState, character: _leftAngle, replacement: _leftGuillemet)
Handler-->>Editor: replace "<<" with "«" (undoable)
User->>Editor: type ">"
Editor->>Shortcuts: customFormatDoubleAngleRightGuillemet
Shortcuts->>Handler: _handleDoubleCharacterReplacement(editorState, character: _greater, replacement: _rightGuillemet)
Handler-->>Editor: replace ">>" with "»" (undoable)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Feature Preview
This adds two unambiguous auto-typography conversions to the document editor, building on the existing
--→—,->→→and=>→⇒shortcuts:<<→«>>→»Both reuse the existing
_handleDoubleCharacterReplacementhelper (so the conversion is undoable) and are registered inbuildCharacterShortcutEvents. The>>handler keys off a preceding>, so it does not conflict with the existing=>/->shortcuts (which look for=/-) or the>+ space block-quote toggle.This is a small first step toward #3322. The other requests in that issue (three-character conversions such as
(c)→©, the ambiguous quote conversions, and an on/off "Advanced settings" toggle) are intentionally left out of this PR and can be handled separately.Partially addresses #3322
PR Checklist
Summary by Sourcery
Add new auto-typography shortcuts in the document editor to convert double angle brackets into guillemets and wire them into the existing character shortcut system.
New Features:
<<into the left guillemet character«via a character shortcut event in the document editor.>>into the right guillemet character»via a character shortcut event in the document editor.Tests:
<<and>>are converted to«and»respectively and that the operations are undoable.