import { findNodeById } from "../helpers/index.js";
const updateNodeAttrsById = (id, attrs = {}, options = { skipHistory: false }) => ({ tr }) => {
  const nodesWithPos = findNodeById(tr, id);
  if (nodesWithPos.length > 0) {
    const { pos, node } = nodesWithPos[0];
    if (options?.skipHistory) {
      tr.setMeta("skip", true);
      tr.setMeta("addToHistory", false);
    }
    tr.setNodeMarkup(pos, void 0, { id, ...node.attrs || {}, ...attrs });
    return true;
  } else {
    console.error("Failed to find node by id");
    return false;
  }
};
export {
  updateNodeAttrsById
};
//# sourceMappingURL=update-node-attrs-by-id.js.map
