import crel from "crelt"
import {lift, joinUp, selectParentNode, wrapIn, setBlockType, toggleMark} from "prosemirror-commands"
import {undo, redo} from "prosemirror-history"
-import {setBlockAttr} from "../commands";
+import {setBlockAttr, insertBlockBefore} from "../commands";
import {getIcon, icons} from "./icons"
return new MenuItem(passedOptions)
}
+export function insertBlockBeforeItem(blockType, options) {
+ const command = insertBlockBefore(blockType);
+ const passedOptions = {
+ run: command,
+ enable(state) { return command(state) },
+ active(state) {
+ return false;
+ }
+ }
+ for (const prop in options) passedOptions[prop] = options[prop]
+ return new MenuItem(passedOptions);
+}
+
// Work around classList.toggle being broken in IE11
function setClass(dom, cls, on) {
if (on) dom.classList.add(cls)