- 본클래스는 AshAPI 라이브러리를 필요로한다.
- 인스턴스 생성시 어플리케이션으로 동작한다.
- Body embeded로 AshHtmlEditor 클래스를 내장하고 있다.
그외 추가적인 규칙에 준한 embeded될 컨테이너와 각 자식 element들에 대한 구성요소들이 필요하다.
container의 div 내 자식요소에는 dragbar(div) / toolbar(div) / body(div) 가 name attribute 로 정의되어야 한다.
각 툴바들에 대한 추가지정은 toolbar div안에 inline태그로 지정하면 된다.
resizeable를 위한 gap 값과 toolbar 값을 별도로 지정할 수 있다.
원할한 drag 수행을 위해 container의 position은 absolute / relative 가 지정되어야 한다.
본 클래스는 정해진 템플릿을 기본으로 채택했기때문에 다른 스타일 형식의 커스텀 에디터 제작을 위해서는
AshHtmlEditor 클래스를 이용하여 직접 제작해야만 한다.
등록된 client가 존재하고 client에 onEditorPanelCallback이라는 메소드가 정의되어 있을경우 리턴값으로
event타입이 발생된다. 이 이벤트를 타입을 이용하여 개별 client별로 각 모드별 액션수행이 가능하다.
this.client.onEditorPanelCallback(eventType). 이것은 editorPanel에 정의하는 addEventListener와는 좀 다르다.
왜냐면 client는 그때그때 한 에디터에따라 의뢰자가 달라질수 있기때문에 addEventListener로 등록한경우
현재 client가 자신이 아닌경우에도 이벤트가 수신되기때문이다.
이러한 애로점을 막기위해 만들어진 리턴콜백개념으로 이해하면 되겠다.
[standard coding]
------------------------------------------------------------------------------------------------------------
<div id='Editor1' style='position:relative; display:none; width:500px; height:500px; border:1px solid #000000;' >
<div name='dragbar'>
</div>
<div name='toolbar'>
<!-- 이곳에 툴바 버튼들을 삽입한다 -->
</div>
<div name='body'>
<textarea>내용입력</textarea>
</div>
<div name='submitbar'>
<!-- 확인 및 취소 버튼들을 삽입한다 -->
</div>
</div>
------------------------------------------------------------------------------------------------------------
<script>
var editPanel = new AshEditorPanel(AshUtil.obj('Editor1'), 'sample.html' ); // sample.html 페이지가 정의되지 않으면
textarea에 정의된 내용이 기본 에디터로 표시된다.
editPanel.showHide(true); // container 의 style:display 가 'none' 일경우에만 적용(보통 초기에 에디터는 보이지 않고
버튼을 눌러서 에디터를 실행하고자 할때 버튼에 이 스크립터가 정의되어 있으면된다.)
</script>
- 본 클래스는 AshMotionAgent를 확장했기때문에 container를 위한 x,y,width,height,alpha 등의 기본 모셔닝 처리를
runtime에 바로 수행할 수 있다. resize / drag 기능이 기본 내장 구현되어 있다.
setClient // set the request client. // Set the client. | client is requested element to edit to AshEditor object.
에디터패널을 수행할 클라이언트를 등록한다.
show(client, defaultWidth, defaultHeight) // show the editor's panel.
* parameters |
client:Element // the html value to be display to the editor. [optional]
defaultWidth:String // change the default width to be display.
defaultHeight:String // change the default height to be display.
에디터를 실행한다. defaultWidth, height값을 통해 실행과 동시에 에디터의 디폴트 사이즈를 변경할수 있다.
hide() // hide the editor's panel.
에디터를 종료한다.
redraw() // update the lastest situration.
에디터의 최신상황을 업데이트 한다.
ok() // apply the edited content to the client.
이명령이 실행되면 의뢰한 클라이언트에 변경된 에디트상태를 즉각 반영한다.
cancel() // cancel the request.
요청 및 수행을 취소한다.
setResizeGap(value, skipDraw) // set the resizer object's gap value.
패널의 리사이즈영역의 간격을 직접 설정한다.
skipDraw는 간격을 설정하면서 redraw 수행을 스킵한다.
setDragbarHeight(value, skipDraw) // set the dragbar's height value.
패널의 드래그바 높이값을 설정한다.
setSubmitbarHeight(value, skipDraw) // set the submitbar's height value.
패널의 submitbar 높이값을 설정한다.
setToolbarSize(value, skipDraw) // set the toolbar's size.
패널의 툴바 사이즈를 지정한다.
setToolbarDirection(direction, skipDraw) // change the toolbar's direction.
패널에서 툴바 방향을 설정한다 skipDraw값이 true 이면 redraw상태를 스킵한다.
setMinSize(width, height) // set the minsize value of the editor panel.
패널의 최소사이즈를 등록한다.
setMinimum(duration, engin) // set minimum.
에디트를 최소모드로 실행한다. duration, engin을 통해 모션처리시간, 모션엔진을 지정할 수 있다.
setNormal(duration, engin) // set the normal.
에디트를 노멀모드로 실행한다. duration, engin을 통해 모션처리시간, 모션엔진을 지정할 수 있다.
setMaximum(duration, engin) // set the maximum.
에디트를 최대모드로 실행한다. duration, engin을 통해 모션처리시간, 모션엔진을 지정할 수 있다.
setToggle() // set the toggle.
에디터의 최대 노멀모드를 토글한다.
All Articles




1