fix: prevent unstyled lines and theme corruption in inline edit mode#68
Open
MageByte-Zero wants to merge 1 commit into
Open
fix: prevent unstyled lines and theme corruption in inline edit mode#68MageByte-Zero wants to merge 1 commit into
MageByte-Zero wants to merge 1 commit into
Conversation
Pressing Enter in contenteditable inserts a <div> (Chrome default) that inherits no theme styles — new line renders plain. Pasting rich text injects foreign fonts/colors that break the presentation theme. Add three guards: defaultParagraphSeparator='br', Enter intercept that calls insertLineBreak, and paste handler that strips to plain text. Closes zarazhangrui#49.
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.
Problem
Two bugs affect the inline editing mode (issue #49):
Enter key inserts unstyled
<div>— Chrome's defaultcontenteditablebehavior on Enter is to insert a<div>. This div inherits none of the element's CSS (font, color, line-height). The new line renders plain, looking completely different from the rest of the slide.Paste injects foreign styles — Pasting from a browser, doc editor, or another tab injects inline
styleattributes with foreign fonts and colors. The pasted text permanently overrides the theme until the user manually removes the styles.Both issues reproduce every time a user edits text in the generated presentation.
Closes #49.
Fix
Three guards added to the inline editing section:
document.execCommand('defaultParagraphSeparator', false, 'br')— changes the default separatorkeydownhandler that interceptsEnterand callsinsertLineBreakinsteadpastehandler that strips to plain text viaclipboardData.getData('text/plain')Existing PRs
No open PR addresses this. Issue #49 has been open since 2026-04-11 with no fix submitted.