bgneal@45: /** bgneal@45: * $Id: editor_plugin_src.js 264 2007-04-26 20:53:09Z spocke $ bgneal@45: * bgneal@45: * @author Moxiecode bgneal@45: * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. bgneal@45: */ bgneal@45: bgneal@45: (function() { bgneal@45: var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is; bgneal@45: bgneal@45: tinymce.create('tinymce.plugins.Compat2x', { bgneal@45: getInfo : function() { bgneal@45: return { bgneal@45: longname : 'Compat2x', bgneal@45: author : 'Moxiecode Systems AB', bgneal@45: authorurl : 'http://tinymce.moxiecode.com', bgneal@45: infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/compat2x', bgneal@45: version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion bgneal@45: }; bgneal@45: } bgneal@45: }); bgneal@45: bgneal@45: (function() { bgneal@45: // Extend tinyMCE/EditorManager bgneal@45: tinymce.extend(tinyMCE, { bgneal@45: addToLang : function(p, l) { bgneal@45: each(l, function(v, k) { bgneal@45: tinyMCE.i18n[(tinyMCE.settings.language || 'en') + '.' + (p ? p + '_' : '') + k] = v; bgneal@45: }); bgneal@45: }, bgneal@45: bgneal@45: getInstanceById : function(n) { bgneal@45: return this.get(n); bgneal@45: } bgneal@45: }); bgneal@45: })(); bgneal@45: bgneal@45: (function() { bgneal@45: var EditorManager = tinymce.EditorManager; bgneal@45: bgneal@45: tinyMCE.instances = {}; bgneal@45: tinyMCE.plugins = {}; bgneal@45: tinymce.PluginManager.onAdd.add(function(pm, n, p) { bgneal@45: tinyMCE.plugins[n] = p; bgneal@45: }); bgneal@45: bgneal@45: tinyMCE.majorVersion = tinymce.majorVersion; bgneal@45: tinyMCE.minorVersion = tinymce.minorVersion; bgneal@45: tinyMCE.releaseDate = tinymce.releaseDate; bgneal@45: tinyMCE.baseURL = tinymce.baseURL; bgneal@45: tinyMCE.isIE = tinyMCE.isMSIE = tinymce.isIE || tinymce.isOpera; bgneal@45: tinyMCE.isMSIE5 = tinymce.isIE; bgneal@45: tinyMCE.isMSIE5_0 = tinymce.isIE; bgneal@45: tinyMCE.isMSIE7 = tinymce.isIE; bgneal@45: tinyMCE.isGecko = tinymce.isGecko; bgneal@45: tinyMCE.isSafari = tinymce.isWebKit; bgneal@45: tinyMCE.isOpera = tinymce.isOpera; bgneal@45: tinyMCE.isMac = false; bgneal@45: tinyMCE.isNS7 = false; bgneal@45: tinyMCE.isNS71 = false; bgneal@45: tinyMCE.compat = true; bgneal@45: bgneal@45: // Extend tinyMCE class bgneal@45: TinyMCE_Engine = tinyMCE; bgneal@45: tinymce.extend(tinyMCE, { bgneal@45: getParam : function(n, dv) { bgneal@45: return this.activeEditor.getParam(n, dv); bgneal@45: }, bgneal@45: bgneal@45: addEvent : function(e, na, f, sc) { bgneal@45: tinymce.dom.Event.add(e, na, f, sc || this); bgneal@45: }, bgneal@45: bgneal@45: getControlHTML : function(n) { bgneal@45: return EditorManager.activeEditor.controlManager.createControl(n); bgneal@45: }, bgneal@45: bgneal@45: loadCSS : function(u) { bgneal@45: tinymce.DOM.loadCSS(u); bgneal@45: }, bgneal@45: bgneal@45: importCSS : function(doc, u) { bgneal@45: if (doc == document) bgneal@45: this.loadCSS(u); bgneal@45: else bgneal@45: new tinymce.dom.DOMUtils(doc).loadCSS(u); bgneal@45: }, bgneal@45: bgneal@45: log : function() { bgneal@45: console.debug.apply(console, arguments); bgneal@45: }, bgneal@45: bgneal@45: getLang : function(n, dv) { bgneal@45: var v = EditorManager.activeEditor.getLang(n.replace(/^lang_/g, ''), dv); bgneal@45: bgneal@45: // Is number bgneal@45: if (/^[0-9\-.]+$/g.test(v)) bgneal@45: return parseInt(v); bgneal@45: bgneal@45: return v; bgneal@45: }, bgneal@45: bgneal@45: isInstance : function(o) { bgneal@45: return o != null && typeof(o) == "object" && o.execCommand; bgneal@45: }, bgneal@45: bgneal@45: triggerNodeChange : function() { bgneal@45: EditorManager.activeEditor.nodeChanged(); bgneal@45: }, bgneal@45: bgneal@45: regexpReplace : function(in_str, reg_exp, replace_str, opts) { bgneal@45: var re; bgneal@45: bgneal@45: if (in_str == null) bgneal@45: return in_str; bgneal@45: bgneal@45: if (typeof(opts) == "undefined") bgneal@45: opts = 'g'; bgneal@45: bgneal@45: re = new RegExp(reg_exp, opts); bgneal@45: bgneal@45: return in_str.replace(re, replace_str); bgneal@45: }, bgneal@45: bgneal@45: trim : function(s) { bgneal@45: return tinymce.trim(s); bgneal@45: }, bgneal@45: bgneal@45: xmlEncode : function(s) { bgneal@45: return tinymce.DOM.encode(s); bgneal@45: }, bgneal@45: bgneal@45: explode : function(s, d) { bgneal@45: var o = []; bgneal@45: bgneal@45: tinymce.each(s.split(d), function(v) { bgneal@45: if (v != '') bgneal@45: o.push(v); bgneal@45: }); bgneal@45: bgneal@45: return o; bgneal@45: }, bgneal@45: bgneal@45: switchClass : function(id, cls) { bgneal@45: var b; bgneal@45: bgneal@45: if (/^mceButton/.test(cls)) { bgneal@45: b = EditorManager.activeEditor.controlManager.get(id); bgneal@45: bgneal@45: if (!b) bgneal@45: return; bgneal@45: bgneal@45: switch (cls) { bgneal@45: case "mceButtonNormal": bgneal@45: b.setDisabled(false); bgneal@45: b.setActive(false); bgneal@45: return; bgneal@45: bgneal@45: case "mceButtonDisabled": bgneal@45: b.setDisabled(true); bgneal@45: return; bgneal@45: bgneal@45: case "mceButtonSelected": bgneal@45: b.setActive(true); bgneal@45: b.setDisabled(false); bgneal@45: return; bgneal@45: } bgneal@45: } bgneal@45: }, bgneal@45: bgneal@45: addCSSClass : function(e, n, b) { bgneal@45: return tinymce.DOM.addClass(e, n, b); bgneal@45: }, bgneal@45: bgneal@45: hasCSSClass : function(e, n) { bgneal@45: return tinymce.DOM.hasClass(e, n); bgneal@45: }, bgneal@45: bgneal@45: removeCSSClass : function(e, n) { bgneal@45: return tinymce.DOM.removeClass(e, n); bgneal@45: }, bgneal@45: bgneal@45: getCSSClasses : function() { bgneal@45: var cl = EditorManager.activeEditor.dom.getClasses(), o = []; bgneal@45: bgneal@45: each(cl, function(c) { bgneal@45: o.push(c['class']); bgneal@45: }); bgneal@45: bgneal@45: return o; bgneal@45: }, bgneal@45: bgneal@45: setWindowArg : function(n, v) { bgneal@45: EditorManager.activeEditor.windowManager.params[n] = v; bgneal@45: }, bgneal@45: bgneal@45: getWindowArg : function(n, dv) { bgneal@45: var wm = EditorManager.activeEditor.windowManager, v; bgneal@45: bgneal@45: v = wm.getParam(n); bgneal@45: if (v === '') bgneal@45: return ''; bgneal@45: bgneal@45: return v || wm.getFeature(n) || dv; bgneal@45: }, bgneal@45: bgneal@45: getParentNode : function(n, f) { bgneal@45: return this._getDOM().getParent(n, f); bgneal@45: }, bgneal@45: bgneal@45: selectElements : function(n, na, f) { bgneal@45: var i, a = [], nl, x; bgneal@45: bgneal@45: for (x=0, na = na.split(','); x