Registry
K

editor-has-block

No description available

krishn4040 executions

  • Legacy
  • slatejs
  • typescript
Connect a repo
npx codemod editor-has-block

Transform Editor.hasBlock to Editor.nodes

This codemod replaces occurrences of Editor.hasBlock with the equivalent Editor.nodes structure. The transformation updates the code to use a more modern API, ensuring compatibility and improved functionality.

// Before (v0.88) - Editor.hasBlock usage

ts
if (Editor.hasBlock(editor, 'paragraph')) {
  // do something

}

After (v0.104) - Alternative approach using Editor.nodes

ts
if (Editor.nodes(editor, {
  match: n => Element.isElement(n) && n.type === 'paragraph'
}).next().done === false) {
  // do something
}

Ready to evolve your codebase?

Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.