跳到主要内容

JsonEditor

Defined in: packages/rxdb-model/dist/entity-table/editors/json-editor.d.ts:11

JSON / KeyValue 编辑器

浮层显示带语法提示的 textarea,适合编辑 json 和 keyValue 类型。

  • Ctrl+Enter:验证并提交
  • Escape:取消(恢复原始值)
  • 点击外部:best-effort 提交(JSON 合法则提交,否则保持原始值)
  • 实时显示 JSON 格式错误

Implements​

  • IEditor<unknown>

Constructors​

Constructor​

new JsonEditor(): JsonEditor;

Returns​

JsonEditor

Properties​

editorType​

readonly editorType: "json-editor" = "json-editor";

Defined in: packages/rxdb-model/dist/entity-table/editors/json-editor.d.ts:14

VTable 编辑器类型标识(注册到 VTable 的编辑器名)

Methods​

getValue()​

getValue(): unknown;

Defined in: packages/rxdb-model/dist/entity-table/editors/json-editor.d.ts:18

返回当前编辑值

Returns​

unknown

Implementation of​

IEditor.getValue

isEditorElement()​

isEditorElement(el): boolean;

Defined in: packages/rxdb-model/dist/entity-table/editors/json-editor.d.ts:22

判断目标元素是否属于编辑器浮层

Parameters​

ParameterType
elEventTarget | HTMLElement

Returns​

boolean

Implementation of​

IEditor.isEditorElement

onEnd()​

onEnd(): void;

Defined in: packages/rxdb-model/dist/entity-table/editors/json-editor.d.ts:20

结束编辑:清理浮层面板与事件监听

Returns​

void

Implementation of​

IEditor.onEnd

onStart()​

onStart(ctx): void;

Defined in: packages/rxdb-model/dist/entity-table/editors/json-editor.d.ts:16

打开编辑器:构建浮层 textarea 面板并初始化原始值

Parameters​

ParameterType
ctxEditContext<unknown>

Returns​

void

Implementation of​

IEditor.onStart