codex-team/editor.js

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

开放

#1,817 创建于 2021年11月24日

 (0 条评论) (0 个反应) (0 位负责人)TypeScript (1,985 个派生)batch import
good first issue

仓库指标

星标
 (26,602 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

  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.

贡献者指南