Add checklist and better bullet and ordered list support to editor#107
Open
hendriebeats wants to merge 9 commits into
Open
Add checklist and better bullet and ordered list support to editor#107hendriebeats wants to merge 9 commits into
hendriebeats wants to merge 9 commits into
Conversation
dad9b32 to
617847b
Compare
…s' into Added-checklist-items
- Add `- [ ]` (and `-[ ]`) as a markdown shorthand for creating checklist items, both from plain paragraphs and inside existing list items - Import and prepend `undoInputRule` to the backspace chain so pressing backspace immediately after any input rule fires reverts the conversion and restores the original typed text, rather than lifting the list item - Mark `joinAdjacentLists` appended transactions with `addToHistory: false` so auto-joining adjacent same-type lists is grouped with its triggering transaction, making Ctrl+Z fully undo an input rule conversion in one step
Registers Mod+Shift+8 (bullet), Mod+Shift+7 (ordered), and
Mod+Shift+9 (checklist) in the ProseMirror keymap, matching the
Google Docs convention. Toolbar tooltips use the existing {{modkey}}
template variable so they display ⌘ on macOS and Ctrl elsewhere.
Contributor
Author
|
@boxyoman I made the changes you suggested to this.
|
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 bullet, ordered, and checklist support to the ProseMirror editor, including a full list plugin, toolbar buttons, keyboard shortcuts, and interactive checkbox rendering.
List plugin (
listPlugin.ts)-,1.,-[]).sinkCurrentItemkeeps sibling children at their visual indentation level rather than moving them with the sunk parent — standardpmSinkListItemmoves children, which felt wrong here.joinAdjacentListsplugin auto-merges two lists of the same type when they become adjacent after edits.Indent/outdent (
editorUtils.tsx)indent/outdentexports try range-aware list operations first, then single-item list ops, then fall back to chunk-level indentation — this replaces the previousincreaseLevel/decreaseLevelcalls on the toolbar buttons, which didn't understand list context.Checklist item rendering (
Editor.tsx—CheckListItemView)contenteditable=false; a plain<li>with a CSS checkbox isn't clickable without this NodeView.listPluginsis also added to the question popup's plugin list so list keyboard handling (Enter, Backspace, Tab) works there too.baseKeymapBackspace override removedbaseKeymap["Backspace"]globally, which could affect other editors.listPluginsnow accepts custom pre-backspace commands as a parameter and chains them internally.Placeholder decoration
stopEvent{ stopEvent: () => true }so click events on the bible-text placeholder don't propagate into ProseMirror and accidentally move the cursor.Accessibility polish
StudyBlockEditPencilchanged from<img>to<button>so it is keyboard-reachable and has a proper role.closer(question popup close) changed from a custom<closer>element to<button>.Delete Studymenu item changed from<a>to<button>(no href, purely an action).aria-labelattributes.contenteditable="false"added tonoQuestionsTextandaddAnswerto prevent the cursor from entering non-editable UI chrome.Keyboard shortcuts & toolbar
Mod+Shift+8/Mod+Shift+7/Mod+Shift+9for bullet / ordered / checklist, matching Google Docs convention. Numbers without Shift conflict with browser tab switching.{{modkey}}template variable so they show ⌘ on macOS and Ctrl elsewhere.