| | |
| | | var ua;
|
| | |
|
| | | this.majorVersion = "2";
|
| | | this.minorVersion = "1.1.1";
|
| | | this.releaseDate = "2007-05-14";
|
| | | this.minorVersion = "1.3";
|
| | | this.releaseDate = "2007-11-27";
|
| | |
|
| | | this.instances = [];
|
| | | this.switchClassCache = [];
|
| | |
| | | this._def("hide_selects_on_submit", true);
|
| | | this._def("forced_root_block", false);
|
| | | this._def("remove_trailing_nbsp", false);
|
| | | this._def("save_on_tinymce_forms", false);
|
| | |
|
| | | // Force strict loading mode to false on non Gecko browsers
|
| | | if (this.isMSIE && !this.isOpera)
|
| | |
| | | },
|
| | |
|
| | | removeMCEControl : function(editor_id) {
|
| | | var inst = tinyMCE.getInstanceById(editor_id), h, re, ot, tn;
|
| | | var inst = tinyMCE.getInstanceById(editor_id), h, re, ot, tn, n;
|
| | |
|
| | | if (inst) {
|
| | | inst.switchSettings();
|
| | |
| | |
|
| | | tinyMCE.selectedElement = null;
|
| | | tinyMCE.selectedInstance = null;
|
| | |
|
| | | tinyMCE.selectedElement = null;
|
| | | tinyMCE.selectedInstance = null;
|
| | |
|
| | | // Try finding an instance
|
| | | for (n in tinyMCE.instances) {
|
| | | if (!tinyMCE.isInstance(tinyMCE.instances[n]))
|
| | | continue;
|
| | |
|
| | | tinyMCE.selectedInstance = tinyMCE.instances[n];
|
| | | break;
|
| | | }
|
| | |
|
| | | // Remove element
|
| | | re = document.getElementById(editor_id + "_parent");
|
| | |
| | | // s = s.replace(new RegExp('mce_href\\s*=\\s*\"[^ >\"]*\"', 'gi'), '');
|
| | |
|
| | | if (!s.match(/(mce_src|mce_href)/gi, s)) {
|
| | | s = s.replace(new RegExp('src\\s*=\\s*\"([^ >\"]*)\"', 'gi'), 'src="$1" mce_src="$1"');
|
| | | s = s.replace(new RegExp('href\\s*=\\s*\"([^ >\"]*)\"', 'gi'), 'href="$1" mce_href="$1"');
|
| | | s = s.replace(new RegExp('src\\s*=\\s*[\"\']([^ >\"]*)[\"\']', 'gi'), 'src="$1" mce_src="$1"');
|
| | | s = s.replace(new RegExp('href\\s*=\\s*[\"\']([^ >\"]*)[\"\']', 'gi'), 'href="$1" mce_href="$1"');
|
| | | }
|
| | |
|
| | | return s;
|
| | |
| | | // Workaround for drag drop/copy paste base href bug
|
| | | case "drop":
|
| | | case "beforepaste":
|
| | | if (tinyMCE.selectedInstance)
|
| | | /* if (tinyMCE.selectedInstance)
|
| | | tinyMCE.selectedInstance.setBaseHREF(null);
|
| | |
|
| | | // Fixes odd MSIE bug where drag/droping elements in a iframe with height 100% breaks
|
| | | // This logic forces the width/height to be in pixels while the user is drag/dropping
|
| | | // NOTE: This has been disabled for now since it messes up copy/paste that is far more important than image drag
|
| | | if (tinyMCE.isRealIE) {
|
| | | var ife = tinyMCE.selectedInstance.iframeElement;
|
| | |
|
| | | /*if (ife.style.width.indexOf('%') != -1) {
|
| | | ife._oldWidth = ife.width.height;
|
| | | ife.style.width = ife.clientWidth;
|
| | | }*/
|
| | |
|
| | | if (ife.style.height.indexOf('%') != -1) {
|
| | | ife._oldHeight = ife.style.height;
|
| | |
| | | }
|
| | |
|
| | | window.setTimeout("tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings.base_href);tinyMCE._resetIframeHeight();", 1);
|
| | | */
|
| | | return;
|
| | |
|
| | | case "submit":
|
| | |
| | | f = f.form;
|
| | |
|
| | | // Is it a form that has a TinyMCE instance
|
| | | if (tinyMCE.getParam('save_on_tinymce_forms')) {
|
| | | for (n in tinyMCE.instances) {
|
| | | inst = tinyMCE.instances[n];
|
| | |
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | } else
|
| | | found = true;
|
| | |
|
| | | // Is valid
|
| | | if (found) {
|
| | |
| | | },
|
| | |
|
| | | triggerNodeChange : function(focus, setup_content) {
|
| | | var elm, inst, editorId, undoIndex = -1, undoLevels = -1, doc, anySelection = false, st;
|
| | | var elm, inst, editorId, undoIndex = -1, undoLevels = -1, doc, anySelection, st;
|
| | |
|
| | | if (tinyMCE.selectedInstance) {
|
| | | inst = tinyMCE.selectedInstance;
|
| | |
| | | elm = inst.getBody();
|
| | |
|
| | | inst.switchSettings();
|
| | |
|
| | | if (tinyMCE.selectedElement)
|
| | | anySelection = (tinyMCE.selectedElement.nodeName.toLowerCase() == "img") || (st && st.length > 0);
|
| | | anySelection = !inst.selection.isCollapsed();
|
| | |
|
| | | if (tinyMCE.settings.custom_undo_redo) {
|
| | | undoIndex = inst.undoRedo.undoIndex;
|
| | |
| | | }
|
| | |
|
| | | // Make it bigger if statusbar is forced
|
| | | if (tinyMCE.isGecko) {
|
| | | if (tinyMCE.isGecko && win.document) {
|
| | | if (win.document.defaultView.statusbar.visible)
|
| | | win.resizeBy(0, tinyMCE.isMac ? 10 : 24);
|
| | | }
|
| | |
| | | add : function(c, m) {
|
| | | var n;
|
| | |
|
| | | for (n in m)
|
| | | for (n in m) {
|
| | | if (m.hasOwnProperty(n))
|
| | | c.prototype[n] = m[n];
|
| | | }
|
| | | },
|
| | |
|
| | | extend : function(p, np) {
|
| | |
| | |
|
| | | o.parent = p;
|
| | |
|
| | | for (n in p)
|
| | | for (n in p) {
|
| | | if (p.hasOwnProperty(n))
|
| | | o[n] = p[n];
|
| | | }
|
| | |
|
| | | for (n in np)
|
| | | for (n in np) {
|
| | | if (np.hasOwnProperty(n))
|
| | | o[n] = np[n];
|
| | | }
|
| | |
|
| | | return o;
|
| | | },
|
| | |
| | | nx = ne.nextSibling;
|
| | |
|
| | | // If text node or inline element wrap it in a block element
|
| | | if (ne.nodeType == 3 || !tinyMCE.blockRegExp.test(ne.nodeName)) {
|
| | | if ((ne.nodeType == 3 && ne.nodeValue.replace(/\s+/g, '') != '') || (ne.nodeType == 1 && !tinyMCE.blockRegExp.test(ne.nodeName))) {
|
| | | if (!bm)
|
| | | bm = this.selection.getBookmark();
|
| | |
|
| | |
| | |
|
| | | switch (command) {
|
| | | case "JustifyLeft":
|
| | | if (align == 'left')
|
| | | if (align == 'left') {
|
| | | img.setAttribute('align', ''); // Needed for IE
|
| | | img.removeAttribute('align');
|
| | | else
|
| | | } else
|
| | | img.setAttribute('align', 'left');
|
| | |
|
| | | // Remove the div
|
| | |
| | | return;
|
| | |
|
| | | case "JustifyCenter":
|
| | | img.setAttribute('align', ''); // Needed for IE
|
| | | img.removeAttribute('align');
|
| | |
|
| | | // Is centered
|
| | |
| | | return;
|
| | |
|
| | | case "JustifyRight":
|
| | | if (align == 'right')
|
| | | if (align == 'right') {
|
| | | img.setAttribute('align', ''); // Needed for IE
|
| | | img.removeAttribute('align');
|
| | | else
|
| | | } else
|
| | | img.setAttribute('align', 'right');
|
| | |
|
| | | // Remove the div
|
| | |
| | | switch (command) {
|
| | | case "mceRepaint":
|
| | | this.repaint();
|
| | | return true;
|
| | |
|
| | | case "JustifyLeft":
|
| | | case "JustifyCenter":
|
| | | case "JustifyFull":
|
| | | case "JustifyRight":
|
| | | var el = tinyMCE.getParentNode(focusElm, function(n) {return tinyMCE.getAttrib(n, 'align');});
|
| | |
|
| | | if (el) {
|
| | | el.setAttribute('align', ''); // Needed for IE
|
| | | el.removeAttribute('align');
|
| | | } else
|
| | | this.getDoc().execCommand(command, user_interface, value);
|
| | |
|
| | | tinyMCE.triggerNodeChange();
|
| | |
|
| | | return true;
|
| | |
|
| | | case "unlink":
|
| | |
| | | value = value.charAt(0) != '#' ? (isNaN('0x' + value) ? value : '#' + value) : value;
|
| | | this.backColor = value;
|
| | |
|
| | | if (tinyMCE.isGecko) {
|
| | | if (tinyMCE.isGecko || tinyMCE.isOpera) {
|
| | | this._setUseCSS(true);
|
| | | this.getDoc().execCommand('hilitecolor', false, value);
|
| | | this._setUseCSS(false);
|
| | |
| | | if (box[i] == null)
|
| | | return;
|
| | |
|
| | | for (a=0; a<box.length; a++) {
|
| | | if (box[a] != box[i])
|
| | | if (i && box[i] != box[i-1])
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | // They are all the same
|
| | |
| | | c.settings.on_save = on_save;
|
| | |
|
| | | c.idCount = 0;
|
| | | c.serializationId = new Date().getTime().toString(32); // Unique ID needed for the content duplication bug
|
| | | c.serializationId++; // Unique ID needed for the content duplication bug
|
| | | c.serializedNodes = [];
|
| | | c.sourceIndex = -1;
|
| | |
|
| | |
| | | this.nlAfterRe = this._arrayToRe(s.newline_after_elements.split(','), 'gi', '<(', ')([^>]*)>');
|
| | | this.nlBeforeAfterRe = this._arrayToRe(s.newline_before_after_elements.split(','), 'gi', '<(\\/?)(', ')([^>]*)>');
|
| | | this.serializedNodes = [];
|
| | | this.serializationId = 0;
|
| | |
|
| | | if (s.invalid_elements !== '')
|
| | | this.iveRe = this._arrayToRe(s.invalid_elements.toUpperCase().split(','), 'g', '^(', ')$');
|
| | |
| | | e = document.createElement("body");
|
| | |
|
| | | if (r.cloneContents)
|
| | | e.appendChild(r.cloneContents());
|
| | | e.appendChild(document.importNode(r.cloneContents(), true));
|
| | | else if (typeof(r.item) != 'undefined' || typeof(r.htmlText) != 'undefined')
|
| | | e.innerHTML = r.item ? r.item(0).outerHTML : r.htmlText;
|
| | | else
|
| | |
| | | endNode = direct ? sel.focusNode : sel.anchorNode;
|
| | | endOffset = direct ? sel.focusOffset : sel.anchorOffset;
|
| | |
|
| | | startNode = startNode.nodeName == "HTML" ? doc.body : startNode; // Fix for Opera bug: https://bugs.opera.com/show_bug.cgi?id=273224&comments=yes
|
| | | startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode;
|
| | | endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode;
|
| | |
|