codex-team/editor.js

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

Ouverte

#1 817 ouverte le 24 nov. 2021

 (0 commentaire) (0 réaction) (0 personne assignée)TypeScript (1 985 forks)batch import
good first issue

Métriques du dépôt

Stars
 (26 602 étoiles)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

  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.

Guide contributeur