import { Node_Type } from "./../../ricos-schema/legacy/wix/rich_content/v1/index.js";
import { findParentNodeClosestToPos } from "./../../tiptap/index.js";
const toggleNodeTextWrap = () => ({ commands, tr, dispatch }) => {
  if (!dispatch) {
    return !findParentNodeClosestToPos(
      tr.selection.$from,
      (node) => node?.type?.name === Node_Type.LAYOUT_CELL || node?.type?.name === Node_Type.LIST_ITEM
    );
  }
  const $from = tr.selection.$from;
  const selectedNode = $from.nodeAfter;
  const nodeType = selectedNode?.type.name || "";
  const nodeContainerData = selectedNode?.attrs.containerData;
  const currentTextWrap = nodeContainerData?.textWrap ?? true;
  return commands.updateAttributes(nodeType, {
    containerData: { ...nodeContainerData, textWrap: !currentTextWrap }
  });
};
export {
  toggleNodeTextWrap
};
//# sourceMappingURL=toggle-node-text-wrap.js.map
