fix(editor): stop markdown auto-format from firing inside code blocks #837
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
Reviewed/Confirmed
Reviewed/Duplicate
Reviewed/Invalid
Reviewed/Won't Fix
Status/Abandoned
Status/Blocked
Status/Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
project-halkyon/halkyon-learn!837
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/837/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Typing a Go generic signature into a code block lost text. The moment the
closing paren landed on
func PlusOneHundred[T Integer](in T, AppFlowy'smarkdown-link shortcut matched
\[(...)\]\((...)\)and rewrote the run asa hyperlink reading
T Integer— brackets, parens and the parameter namedeleted, the remainder silently carrying an href of
in T.AppFlowy gates its slash menu on the cursor's block type but gives the
markdown shortcuts no such check, so every one of them fires anywhere
there is a delta. A code listing is verbatim text:
`,*,_,~and their doubled forms,
--(sogit log --onelinebecomes an em dash)and
=>all reinterpret code as markup, and the block-level conversionsare worse still — a listing whose first line opens
#,-,>or1.is retyped whole as a heading, bullet or quote.halkyonCodeBlockAwarewraps a shortcut so its handler stands down whenthe caret is in a code block, returning false to hand the keystroke back
to the IME, which types the literal character. Outside code blocks the
wrapped handler runs untouched.
_codeBlockSaferoutes every stock eventthrough it, keeping the existing
halkyonCodeAwareNewLineswap for Enterand passing the other newline handlers through — those already gate on
their own block type. Applying it in
halkyonCharacterShortcutscoversevery surface at once: flashcard faces, notes, path steps, PDF page notes.
The wrapper forwards
regExpandhandlerWithCharacteras well. Nothingin appflowy_editor 6.2.0 sets either, but its own
copyWithdrops thelatter, and building the event explicitly avoids inheriting that on a
version bump.
Cards authored before this fix may already hold mangled text; repairing
those is a separate pass.
Signed-off-by: Tizian 「ティツィアーン」 raisondetredev@pm.me