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

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

모든 APIModel Element의 부모 Class입니다. 기본적으로 모델을 다루는데 필요한 속성과 메소드를 제공합니다.

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>

현재 index

parent

  • <Element>

부모 API 모델

nextSibling

  • <Element>

다음 형제 API 모델

previousSibling

  • <Element>

이전 형제 API 모델

firstChild

  • <Element>

첫번째 자식 API 모델

lastChild

  • <Element>

마지막 자식 API 모델

children

  • <Element[]>

자식 API 모델들 (배열)

siblings

  • <Element[]>

형제 API 모델들 (배열)

nextSiblings

  • <Element[]>

다음 형제 API 모델들 (배열)

previousSiblings

  • <Element[]>

이전 형제 API 모델들 (배열)

options

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

Options객체

skipUndoRedo

  • <Boolean>

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

skipRendering

  • <Boolean>

편집시 rendering을 생략할지 여부

Methods

closest(condition)

  • condition <Function> 각 요소를 시험할 함수
    • condition 함수의 첫번째 인자 : 현재 API 모델 Element
    • condition 함수의 return : <Boolean>
  • Returns: <Element> API 모델 Element

상위 API 모델 중 조건에 맞는 API 모델을 반환합니다.

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


setId(id)

  • id <String> 모델에 설정할 ID 값

ID를 설정합니다.

var element = editor.getAPIModelById('id');
element.setId('test_setId');

setStyle(cssText)

  • cssText <String> HTML DOM상에서 style 속성에 들어간 문자열

스타일을 설정합니다.

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

empty()

자식 요소들을 모두 제거합니다.

자식 요소들을 모두 제거할 경우 이후의 작업에서 오류가 발생할 수 있습니다.

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


  • No labels