모든 APIModel Element의 부모 Class입니다. 기본적으로 모델을 다루는데 필요한 속성과 메소드를 제공합니다Parent Class of all APIModel Elements. It provides the necessary properties and methods to manipulate the model.
Table of Contents | ||||||
---|---|---|---|---|---|---|
|
Table of Contents | ||||||
---|---|---|---|---|---|---|
|
Properties
id
- <String>
Element의 Element ID
type
- <String>
Element의 Element Type
index
- <Number>
현재 Current index
parent
- <Element>
부모 API 모델Parent APIModel
nextSibling
- <Element>
다음 형제 API 모델Next Sibling APIModel
previousSibling
- <Element>
이전 형제 API 모델Previous Sibling APIModel
firstChild
- <Element>
첫번째 자식 API 모델First child APIModel
lastChild
- <Element>
마지막 자식 API 모델Last child APIModel
children
- <Element[]>
자식 API 모델들 (배열Child APIModels (array)
siblings
- <Element[]>
형제 API 모델들 (배열Sibling APIModels (array)
nextSiblings
- <Element[]>
다음 형제 API 모델들 (배열Next sibling APIModels (array)
previousSiblings
- <Element[]>
이전 형제 API 모델들 (배열Previous sibling APIModels (array)
options
- <Object>
- skipUndoRedo<Boolean>
- skipRendering<Boolean>
Options객체Options object
skipUndoRedo
- <Boolean>
편집시 undo, redo를 생략할지 여부
skipRendering
- <Boolean>
편집시 rendering을 생략할지 여부Whether to omit undo and redo when editing
Methods
closest(condition)
- condition <Function> 각 요소를 시험할 함수
- condition 함수의 첫번째 인자 : 현재 API 모델 Element condition 함수의 return <Function> function to test each element
- The first argument of the condition function: Current API model Element
- return of condition function: <Boolean>
- Returns: <Element> <Element> API 모델 model Element
상위 API 모델 중 조건에 맞는 API 모델을 반환합니다Returns the API model that meets the criteria among the parent API models.
Code Block | ||||
---|---|---|---|---|
| ||||
var run = editor.getAPIModelById('id'); var body = run.closest(function(apiModel){ return apiModel.type === 'Body'; }); |
setId(id)
- id <String> 모델에 설정할 ID 값
...
- <String> ID value to set in the model
Set ID.
Code Block | ||||
---|---|---|---|---|
| ||||
var element = editor.getAPIModelById('id'); element.setId('test_setId'); |
setStyle(cssText)
- cssText <String> HTML DOM상에서 style 속성에 들어간 문자열
...
- <String> A string in the style attribute in the HTML DOM
Set style.
Code Block | ||||
---|---|---|---|---|
| ||||
var element = editor.getAPIModelById('id'); element.setStyle('background-color: red;') |
empty()
자식 요소들을 모두 제거합니다Remove all child elements.
Status | ||||||
---|---|---|---|---|---|---|
|
Code Block | ||||
---|---|---|---|---|
| ||||
var element = editor.getAPIModelById('id'); element.empty(); |
...