Behavior of insert* commands for contenteditable=plaintext-only
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 202
- Forks
- 43
- PR merge metrics
- No merged PRs in 30d
Description
See https://bugzilla.mozilla.org/show_bug.cgi?id=1291467#c17 by @masayuki-nakano
I checked the behavior in Chrome roughly now, then, I see only the following commands work, so their definitions are required:
- Handling steps of
Document.execCommand("insertParagraph")(Chrome/Safari handle this command differently from pressing Enter)- Handling steps of
Document.execCommand("insertLineBreak")(LF vs<br>(Chrome vs. Safari)- Handling steps of the commands when caret is in special elements such as
<li>- Handling steps of
Document.execCommand("insertText")(including line breaks causes insertParagraph in both, but I'm not sure it's intended since the behavior looks odd)- Handling steps of
Document.execCommand("insertHTML")(especially which elements need to be handled as line breaks)And the other commands (except
undo,redoand clipboard commands) should be defined as NOOP (including not deletingSelection).
cc @howard-e
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Bugzilla discussion and compare the listed execCommand cases for plaintext-only editing. The work is complete when the handling steps are defined for insertParagraph, insertLineBreak, insertText, insertHTML, and special elements, while the other commands are explicitly treated as no-ops as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html
- Domain
- documentation, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100