-
-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prosemirror-suggest example out of day, using keyBindings
, etc.
#2187
Labels
type: bug 🪲
Something isn't working
Comments
It's because the prosemirror-suggest API has been refactored here. The import { keymap } from 'prosemirror-keymap';
import { undo, redo } from 'prosemirror-history';
import { schema } from 'prosemirror-schema-basic';
import { EditorState } from 'prosemirror-state';
import { EditorView } from 'prosemirror-view';
import { baseKeymap, toggleMark } from 'prosemirror-commands';
// First, define the commands you want to bind to
const myKeymap = {
"Mod-z": undo,
"Mod-y": redo,
"Mod-b": toggleMark(schema.marks.strong), // Toggle bold mark
"Mod-i": toggleMark(schema.marks.em) // Toggle italic mark
"ArrowUp": () => console.log("Your ArrowUp here"),
"ArrowDown": () => console.log("Your ArrowDown here"),
"Enter": () => console.log("Your Enter here"),
"Esc": () => console.log("Your Esc here")
}
// You might have multiple keymaps, and just in case they conflict, you'll want to decide what priority they have:
const keymapPlugin = keymap(myKeymap)
const defaultKeymapPlugin = keymap(baseKeymap)
// Now add the created plugins to your PM instance
let state = EditorState.create({
schema,
plugins: [keymapPlugin, defaultKeymapPlugin, /* other plugins */]
})
const view = new EditorView(document.body, { state }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
The prosemirror-suggest example / readme is out of date, as it references interfaces have have since changed, like
keyBindings
. It would be great to have an up-to-date example for newcomers.The text was updated successfully, but these errors were encountered: