Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Parent Class of all APIModel Elements. It provides the necessary properties and methods to manipulate the model.

Table of Contents
maxLevel3
minLevel2
exclude.*\(.*\).*|Methods

Table of Contents
maxLevel3
minLevel2
include.*\(.*\).*|Methods

Properties

id 

  • <String>

Element ID

type

  • <String>

Element Type

index

  • <Number>

Current index

parent

  • <Element>

Parent APIModel

nextSibling

  • <Element>

Next Sibling APIModel

previousSibling

  • <Element>

Previous Sibling APIModel

firstChild

  • <Element>

First child APIModel

lastChild

  • <Element>

Last child APIModel

children

  • <Element[]>

Child APIModels (array)

siblings

  • <Element[]>

Sibling APIModels (array)

nextSiblings

  • <Element[]>

Next sibling APIModels (array)

previousSiblings

  • <Element[]>

Previous sibling APIModels (array)

options

  • <Object>
    • skipUndoRedo<Boolean>
    • skipRendering<Boolean>

Options object

skipUndoRedo

  • <Boolean>

편집시 undo, redo를 생략할지 여부

skipRendering

  • <Boolean>

Whether to omit undo and redo when editing

Methods

closest(condition)

  • condition <Function> function to test each element
    • The first argument of the condition function: Current API model Element
    • return of condition function: <Boolean>
  • Returns: <Element> API model Element

Returns the API model that meets the criteria among the parent API models.

Code Block
languagejs
themeEmacs
var run = editor.getAPIModelById('id');
var body = run.closest(function(apiModel){
	return apiModel.type === 'Body';
});


setId(id)

  • id <String> ID value to set in the model

Set ID.

Code Block
languagejs
themeEmacs
var element = editor.getAPIModelById('id');
element.setId('test_setId');

setStyle(cssText)

  • cssText <String> A string in the style attribute in the HTML DOM

Set style.

Code Block
languagejs
themeEmacs
var element = editor.getAPIModelById('id');
element.setStyle('background-color: red;')

empty()

Remove all child elements.

Status
subtletrue
colourRed
titleIf all child elements are removed, an error may occur in subsequent operations.

Code Block
languagejs
themeEmacs
var element = editor.getAPIModelById('id');
element.empty();