Files
Tom Moor bf45e97641 chore: Enforce type import consistency (#10968)
* Update types

* fix circular dep

* type imports

* lint type imports and --fix
2025-12-19 23:07:02 -05:00

21 lines
562 B
TypeScript

import { wrapIn, lift } from "prosemirror-commands";
import type { NodeType } from "prosemirror-model";
import type { Command } from "prosemirror-state";
import type { Primitive } from "utility-types";
import { isNodeActive } from "../queries/isNodeActive";
export default function toggleWrap(
type: NodeType,
attrs?: Record<string, Primitive>
): Command {
return (state, dispatch) => {
const isActive = isNodeActive(type)(state);
if (isActive) {
return lift(state, dispatch);
}
return wrapIn(type, attrs)(state, dispatch);
};
}