2
* $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
5
* @copyright Copyright ďż˝ 2004-2007, Moxiecode Systems AB, All rights reserved.
8
tinyMCE.importPluginLanguagePack('devkit');
10
var TinyMCE_DevKitPlugin = {
11
_logFilter : '\\[(importCSS|execCommand|execInstanceCommand|debug)\\]',
16
_isDebugEvents : false,
18
getInfo : function() {
20
longname : 'Development Kit',
21
author : 'Moxiecode Systems AB',
22
authorurl : 'http://tinymce.moxiecode.com',
23
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/devkit',
24
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
28
initInstance : function(inst) {
38
// Register a document reference for more easy access in the FF DOM inspector
39
document.___TinyMCE = tinyMCE;
41
// Setup devkit by settings
42
this._logFilter = tinyMCE.getParam('devkit_log_filter', this._logFilter);
43
this._benchMark = tinyMCE.getParam('devkit_bench_mark', false);
45
var ifr = document.createElement('iframe');
47
ifr.setAttribute("id", "devkit");
48
ifr.setAttribute("frameBorder", "0");
49
ifr.setAttribute("src", tinyMCE.baseURL + '/plugins/devkit/devkit.htm');
51
document.body.appendChild(ifr);
53
// Workaround for strange IE reload bug
54
//if (tinyMCE.isRealIE)
55
// document.getElementById('devkit').outerHTML = document.getElementById('devkit').outerHTML;
57
tinyMCE.importCSS(document, tinyMCE.baseURL + '/plugins/devkit/css/devkit_ui.css');
61
this._logPadding += '\u00a0';
63
return new Date().getTime();
67
if (this._logPadding.length > 0)
68
this._logPadding = this._logPadding.substring(0, this._logPadding.length - 1);
71
this._log("benchmark", "Execution time: " + (new Date().getTime() - st));
75
var m, a, i, e = document.getElementById('devkit'), now = new Date().getTime();
78
this._startTime = now;
80
m = (this._logPadding.length > 1 ? this._logPadding : '') + '[' + (now - this._startTime) + '] [' + t + '] ';
82
a = this._log.arguments;
83
for (i=1; i<a.length; i++) {
84
if (typeof(a[i]) == 'undefined')
93
if (!new RegExp(this._logFilter, 'gi').test(m)) {
94
if (this._logPadding.length > 0)
95
this._logPadding = this._logPadding.substring(0, this._logPadding.length - 1);
100
if (!this._winLoaded)
101
tinyMCE.log[tinyMCE.log.length] = m;
103
e.contentWindow.debug(m);
106
_debugEvents : function(s) {
107
var i, ld, inst, n, ev = ['CheckboxStateChange','DOMAttrModified','DOMMenuItemActive',
108
'DOMMenuItemInactive','DOMMouseScroll','DOMNodeInserted','DOMNodeRemoved',
109
'RadioStateChange','blur','broadcast','change','click','close','command',
110
'commandupdate','contextmenu','dblclick','dragdrop','dragenter','dragexit',
111
'draggesture','dragover','focus','input','keydown','keypress','keyup','load',
112
'mousedown','mouseout','mouseover','mouseup','overflow','overflowchanged','popuphidden',
113
'popuphiding','popupshowing','popupshown','select','syncfrompreference','synctopreference',
114
'underflow','unload','abort','activate','afterprint','afterupdate','beforeactivate',
115
'beforecopy','beforecut','beforedeactivate','beforeeditfocus','beforepaste','beforeprint',
116
'beforeunload','beforeupdate','bounce','cellchange','controlselect','copy','cut',
117
'dataavailable','datasetchanged','datasetcomplete','deactivate','dragend','dragleave',
118
'dragstart','drop','error','errorupdate','filterchange','finish','focusin','focusout',
119
'help','layoutcomplete','losecapture','mouseenter','mouseleave','mousewheel',
120
'move','moveend','movestart','paste','propertychange','readystatechange','reset','resize',
121
'resizeend','resizestart','rowenter','rowexit','rowsdelete','rowsinserted','scroll',
122
'selectionchange','selectstart','start','stop','submit'];
125
if (TinyMCE_DevKitPlugin._isDebugEvents == s)
128
TinyMCE_DevKitPlugin._isDebugEvents = s;
130
for (n in tinyMCE.instances) {
131
inst = tinyMCE.instances[n];
133
if (!tinyMCE.isInstance(inst) || inst.getDoc() == ld)
138
for (i=0; i<ev.length; i++) {
140
tinyMCE.addEvent(ld, ev[i], TinyMCE_DevKitPlugin._debugEvent);
142
tinyMCE.removeEvent(ld, ev[i], TinyMCE_DevKitPlugin._debugEvent);
147
_debugEvent : function(e) {
150
e = e ? e : tinyMCE.selectedInstance.getWin().event;
151
t = e.srcElement ? e.srcElement : e.target;
153
tinyMCE.debug(e.type, t ? t.nodeName : '');
156
_serialize : function(o) {
157
var i, v, s = TinyMCE_DevKitPlugin._serialize;
164
v = '\bb\tt\nn\ff\rr\""\'\'\\\\';
166
return '"' + o.replace(new RegExp('([\u0080-\uFFFF\\x00-\\x1f\\"])', 'g'), function(a, b) {
170
return '\\' + v.charAt(i + 1);
172
a = b.charCodeAt().toString(16);
174
return '\\u' + '0000'.substring(a.length) + a;
178
if (o instanceof Array) {
179
for (i=0, v = '['; i<o.length; i++)
180
v += (i > 0 ? ',' : '') + s(o[i]);
188
v += typeof o[i] != 'function' ? (v.length > 1 ? ',"' : '"') + i + '":' + s(o[i]) : '';
197
// Patch and piggy back functions
198
tinyMCE.__debug = tinyMCE.debug;
199
tinyMCE.debug = function() {
200
var a, i, m = '', now = new Date().getTime(), start = TinyMCE_DevKitPlugin._startTime;
203
TinyMCE_DevKitPlugin._startTime = start = now;
205
a = this.debug.arguments;
206
for (i=0; i<a.length; i++) {
207
if (typeof(a[i]) == 'undefined')
216
TinyMCE_DevKitPlugin._log('debug', m);
219
tinyMCE.dump = function(o) {
220
tinyMCE.debug(TinyMCE_DevKitPlugin._serialize(o));
223
tinyMCE.sleep = function(t) {
224
var s = new Date().getTime(), b;
226
while (new Date().getTime() - s < t) b=1;
229
tinyMCE.__execCommand = tinyMCE.execCommand;
230
tinyMCE.execCommand = function(command, user_interface, value) {
231
var r, st, dk = TinyMCE_DevKitPlugin;
234
dk._log('execCommand', command, user_interface, value);
235
r = tinyMCE.__execCommand(command, user_interface, value);
241
tinyMCE.__execInstanceCommand = tinyMCE.execInstanceCommand;
242
tinyMCE.execInstanceCommand = function(editor_id, command, user_interface, value, focus) {
243
var r, st, dk = TinyMCE_DevKitPlugin;
246
dk._log('execInstanceCommand', editor_id, command, user_interface, value);
247
r = tinyMCE.__execInstanceCommand(editor_id, command, user_interface, value);
253
TinyMCE_Engine.prototype.__handleEvent = TinyMCE_Engine.prototype.handleEvent;
254
TinyMCE_Engine.prototype.handleEvent = function(e) {
255
var r, st, dk = TinyMCE_DevKitPlugin;
258
dk._log('handleEvent', e.type);
259
r = tinyMCE.__handleEvent(e);
265
tinyMCE.__importCSS = tinyMCE.importCSS;
266
tinyMCE.importCSS = function(doc, css) {
267
var r, st, dk = TinyMCE_DevKitPlugin;
270
dk._log('importCSS', doc, css);
271
r = tinyMCE.__importCSS(doc, css);
277
tinyMCE.__triggerNodeChange = tinyMCE.triggerNodeChange;
278
tinyMCE.triggerNodeChange = function(focus, setup_content) {
279
var r, st, dk = TinyMCE_DevKitPlugin;
282
dk._log('triggerNodeChange', focus, setup_content);
283
r = tinyMCE.__triggerNodeChange(focus, setup_content);
289
tinyMCE.__dispatchCallback = tinyMCE.dispatchCallback;
290
tinyMCE.dispatchCallback = function(i, p, n) {
291
var r, st, dk = TinyMCE_DevKitPlugin;
294
dk._log('dispatchCallback', i, p, n);
295
r = tinyMCE.__dispatchCallback(i, p, n);
301
tinyMCE.__executeCallback = tinyMCE.executeCallback;
302
tinyMCE.executeCallback = function(i, p, n) {
303
var r, st, dk = TinyMCE_DevKitPlugin;
306
dk._log('executeCallback', i, p, n);
307
r = tinyMCE.__executeCallback(i, p, n);
313
tinyMCE.__execCommandCallback = tinyMCE.execCommandCallback;
314
tinyMCE.execCommandCallback = function(i, p, n) {
315
var r, st, dk = TinyMCE_DevKitPlugin;
318
dk._log('execCommandCallback', i, p, n);
319
r = tinyMCE.__execCommandCallback(i, p, n);
325
tinyMCE.addPlugin("devkit", TinyMCE_DevKitPlugin);