エディターのイベントで JavaScript を実行する
実行されるイベントハンドラーをアタッチします。
構文
editor.attachEvent(eventName,eventHandler)
eventName
Type: String
Specifies the name of the event to be called.(呼び出すイベントの名前を指定します。)
eventHandler
Type: function
A function to execute when the event is triggered.(イベントが発生したときに実行する関数です。)
使用例
editor1.attachEvent("exec_command_newdoc", function (state, cmd, value) {
state.returnValue = true;//handled, don't execute default action
this.setHTMLCode("<p>New Doc...</p>");
});editor.detachEvent()
attachEvent メソッドで以前に登録した、指定のイベントハンドラーを削除します。
構文
editor.detachEvent(eventName,eventHandler)
eventName
Type: String
specifies the name of the event that is listened by the event handler.(イベントハンドラーが待ち受けているイベントの名前を指定します。)
eventHandler
Type: function
Reference to the event handler function to remove.(削除するイベントハンドラー関数への参照です。)