getAPIModelById

2.11.0 버전부터 지원합니다.

ID로 요소를 찾아, API로 편집할 수 있는 API 모델(APIModel)을 반환합니다.

매개변수

이름타입설명
idstring요소 id
[options]object{ skipUndoRedo: false, skipRendering: false }

options

이름타입기본값설명
skipUndoRedobooleanfalsetrue일 때, 이 모델을 통한 편집은 실행 취소/다시 실행 스택에 추가되지 않습니다. 기존 실행 취소/다시 실행 스택도 초기화됩니다.
skipRenderingbooleanfalsetrue일 때, 편집은 모델에만 적용되고 렌더링되지 않습니다. 모든 편집 후, 별도로 editor.render()를 호출해야 합니다.

반환값

타입설명
Element편집을 위한 API 모델

예시

var table = editor.getAPIModelById('ID');
table.insertCol(1);
table.insertRow(1);
table.setWidth(400);

// skipUndoRedo: true
var table = editor.getAPIModelById('ID', { skipUndoRedo: true });
table.insertCol(1);
table.insertRow(1);
table.setWidth(400);

// skipRendering: true
var table = editor.getAPIModelById('ID', { skipRendering: true });
table.insertCol(1);
table.insertRow(1);
table.setWidth(400);

editor.render();