import { getNodeType, isNodeActive } from "./../../tiptap/index.js";
const toggleTextNode = (typeOrName, toggleTypeOrName, attributes = {}) => ({ chain }) => {
  return chain().command(({ state, commands }) => {
    const type = getNodeType(typeOrName, state.schema);
    const toggleType = getNodeType(toggleTypeOrName, state.schema);
    const isActive = isNodeActive(state, type, attributes);
    if (isActive) {
      return commands.updateTextNode(toggleType);
    }
    return commands.updateTextNode(type, attributes);
  }).run();
};
export {
  toggleTextNode
};
//# sourceMappingURL=toggle-text-node.js.map
