codex-team/editor.js

API: improve block.insert() interface to allow passing parameters as an object instead of set

Open

#1817 aperta il 24 nov 2021

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)TypeScript (1985 fork)batch import
good first issue

Metriche repository

Star
 (26.602 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

  1. Describe a problem.

The current interface of the api.blocks.insert accepts parameters as a list:

this.api.blocks.insert(
      toolName,
      undefined,
      undefined,
      index,
      undefined,
      currentBlock.isEmpty
);    
  1. Describe the solution you'd like. Mockups are welcome.

It would better to pass parameters as an object:

this.api.blocks.insert({
  type: toolName,
  index,
  replace: currentBlock.isEmpty
});    

Important. We need to save the backward capability.

Guida contributor