Page tree
Skip to end of metadata
Go to start of metadata

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

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.

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.

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.

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

empty()

Remove all child elements.

IF ALL CHILD ELEMENTS ARE REMOVED, AN ERROR MAY OCCUR IN SUBSEQUENT OPERATIONS.

var element = editor.getAPIModelById('id');
element.empty();


  • No labels