app/assets/source/tinymce/tinymce.jquery.js in tinymce-rails-4.0.6 vs app/assets/source/tinymce/tinymce.jquery.js in tinymce-rails-4.0.7
- old
+ new
@@ -1,6 +1,6 @@
-// 4.0.6 (2013-09-12)
+// 4.0.7 (2013-10-02)
/**
* Compiled inline version. (Library mode)
*/
@@ -820,11 +820,10 @@
// Clone callbackList since unbind inside a callback would otherwise break the handlers loop
callbackList = callbackList.slice(0, ci).concat(callbackList.slice(ci + 1));
callbackList.nativeHandler = nativeHandler;
eventMap[name] = callbackList;
- callbackList.splice(ci, 1);
}
}
}
// Remove all callbacks if there isn't a specified callback or there is no callbacks left
@@ -19989,10 +19988,17 @@
while (i--) {
if (visiblePanels[i] === panel) {
visiblePanels.splice(i, 1);
}
}
+
+ i = zOrder.length;
+ while (i--) {
+ if (zOrder[i] === panel) {
+ zOrder.splice(i, 1);
+ }
+ }
}
return FloatPanel;
});
@@ -20651,11 +20657,11 @@
// TODO: Figure out a better way
if (ctrl.type == 'filepicker') {
items.push(ctrl.getEl('inp'));
if (ctrl.getEl('open')) {
- items.push(ctrl.getEl('open').firstChild);
+ items.push(ctrl.getEl('open'));
}
} else {
items.push(ctrl.getEl());
}
}
@@ -20706,16 +20712,10 @@
*
* @method submit
* @return {Object} Event arguments object.
*/
submit: function() {
- // Blur current control so a onchange is fired before submit
- var ctrl = this.getParentCtrl(document.activeElement);
- if (ctrl) {
- ctrl.blur();
- }
-
return this.fire('submit', {data: this.toJSON()});
},
/**
* Removes the current control from DOM and from UI collections.
@@ -20870,10 +20870,11 @@
default:
buttons = [
{type: "button", text: "Ok", subtype: "primary", onClick: function(e) {
e.control.parents()[1].close();
+ callback(true);
}}
];
break;
}
@@ -21091,11 +21092,13 @@
* // Displays an alert box using the active editors window manager instance
* tinymce.activeEditor.windowManager.alert('Hello world!');
*/
self.alert = function(message, callback, scope) {
MessageBox.alert(message, function() {
- callback.call(scope || this);
+ if (callback) {
+ callback.call(scope || this);
+ }
});
};
/**
* Creates a confirm dialog. Please don't use the blocking behavior of this
@@ -22391,10 +22394,18 @@
self[bindingsName] = [];
}
}
return self;
+ },
+
+ hasEventListeners: function(name) {
+ var bindings = this[bindingsName];
+
+ name = name.toLowerCase();
+
+ return !(!bindings || !bindings[name] || bindings[name].length === 0);
}
};
});
// Included from: js/tinymce/classes/Shortcuts.js
@@ -22587,11 +22598,11 @@
// Shorten these names
var DOM = DOMUtils.DOM, ThemeManager = AddOnManager.ThemeManager, PluginManager = AddOnManager.PluginManager;
var extend = Tools.extend, each = Tools.each, explode = Tools.explode;
var inArray = Tools.inArray, trim = Tools.trim, resolve = Tools.resolve;
var Event = EventUtils.Event;
- var isGecko = Env.gecko, ie = Env.ie, isOpera = Env.opera;
+ var isGecko = Env.gecko, ie = Env.ie;
function getEventTarget(editor, eventName) {
if (eventName == 'selectionchange' || eventName == 'drop') {
return editor.getDoc();
}
@@ -22824,10 +22835,11 @@
self.formElement = form;
// Add hidden input for non input elements inside form elements
if (settings.hidden_input && !/TEXTAREA|INPUT/i.test(self.getElement().nodeName)) {
DOM.insertAfter(DOM.create('input', {type: 'hidden', name: id}), id);
+ self.hasHiddenInput = true;
}
// Pass submit/reset from form to editor instance
self.formEventDelegate = function(e) {
self.fire(e.type, e);
@@ -23113,15 +23125,10 @@
if (settings.content_editable) {
elm = n = o = null; // Fix IE leak
return self.initContentBody();
}
- // User specified a document.domain value
- if (document.domain && location.hostname != document.domain) {
- self.editorManager.relaxedDomain = document.domain;
- }
-
self.iframeHTML = settings.doctype + '<html><head>';
// We only need to override paths if we have to
// IE has a bug where it remove site absolute urls to relative ones if this is specified
if (settings.document_base_url != self.documentBaseUrl) {
@@ -23155,17 +23162,18 @@
}
self.iframeHTML += '</head><body id="' + bodyId + '" class="mce-content-body ' + bodyClass + '" ' +
'onload="window.parent.tinymce.get(\'' + self.id + '\').fire(\'load\');"><br></body></html>';
- // Domain relaxing enabled, then set document domain
- // TODO: Fix this old stuff
- if (self.editorManager.relaxedDomain && (ie || (isOpera && parseFloat(window.opera.version()) < 11))) {
- // We need to write the contents here in IE since multiple writes messes up refresh button and back button
- url = 'javascript:(function(){document.open();document.domain="' + document.domain + '";' +
- 'var ed = window.parent.tinymce.get("' + self.id + '");document.write(ed.iframeHTML);' +
- 'document.close();ed.initContentBody();})()';
+ var domainRelaxUrl = 'javascript:(function(){'+
+ 'document.open();document.domain="' + document.domain + '";' +
+ 'var ed = window.parent.tinymce.get("' + self.id + '");document.write(ed.iframeHTML);' +
+ 'document.close();ed.initContentBody(true);})()';
+
+ // Domain relaxing is required since the user has messed around with document.domain
+ if (document.domain != location.hostname) {
+ url = domainRelaxUrl;
}
// Create iframe
// TODO: ACC add the appropriate description on this.
n = DOM.add(o.iframeContainer, 'iframe', {
@@ -23182,20 +23190,30 @@
height: h,
display: 'block' // Important for Gecko to render the iframe correctly
}
});
+ // Try accessing the document this will fail on IE when document.domain is set to the same as location.hostname
+ // Then we have to force domain relaxing using the domainRelaxUrl approach very ugly!!
+ if (ie) {
+ try {
+ self.getDoc();
+ } catch (e) {
+ n.src = url = domainRelaxUrl;
+ }
+ }
+
self.contentAreaContainer = o.iframeContainer;
if (o.editorContainer) {
DOM.get(o.editorContainer).style.display = self.orgDisplay;
}
DOM.get(self.id).style.display = 'none';
DOM.setAttrib(self.id, 'aria-hidden', true);
- if (!self.editorManager.relaxedDomain || !url) {
+ if (!url) {
self.initContentBody();
}
elm = n = o = null; // Cleanup
},
@@ -23205,27 +23223,23 @@
* It will fill the iframe with contents, setups DOM and selection objects for the iframe.
*
* @method initContentBody
* @private
*/
- initContentBody: function() {
+ initContentBody: function(skipWrite) {
var self = this, settings = self.settings, targetElm = DOM.get(self.id), doc = self.getDoc(), body, contentCssText;
// Restore visibility on target element
if (!settings.inline) {
self.getElement().style.visibility = self.orgVisibility;
}
// Setup iframe body
- if ((!ie || !self.editorManager.relaxedDomain) && !settings.content_editable) {
+ if (!skipWrite && !settings.content_editable) {
doc.open();
doc.write(self.iframeHTML);
doc.close();
-
- if (self.editorManager.relaxedDomain) {
- doc.domain = self.editorManager.relaxedDomain;
- }
}
if (settings.content_editable) {
self.on('remove', function() {
var body = this.getBody();
@@ -24522,16 +24536,22 @@
* Removes the editor from the dom and tinymce collection.
*
* @method remove
*/
remove: function() {
- var self = this, elm = self.getContainer(), doc = self.getDoc();
+ var self = this;
if (!self.removed) {
self.removed = 1; // Cancels post remove event execution
+ // Remove any hidden input
+ if (self.hasHiddenInput) {
+ DOM.remove(self.getElement().nextSibling);
+ }
+
// Fixed bug where IE has a blinking cursor left from the editor
+ var doc = self.getDoc();
if (ie && doc) {
doc.execCommand('SelectAll');
}
// We must save before we hide so Safari doesn't crash
@@ -24544,10 +24564,11 @@
if (!self.settings.content_editable) {
Event.unbind(self.getWin());
Event.unbind(self.getDoc());
}
+ var elm = self.getContainer();
Event.unbind(self.getBody());
Event.unbind(elm);
self.fire('remove');
@@ -24595,10 +24616,17 @@
// One time is enough
if (self.destroyed) {
return;
}
+ // If user manually calls destroy and not remove
+ // Users seems to have logic that calls destroy instead of remove
+ if (!automatic && !self.removed) {
+ self.remove();
+ return;
+ }
+
// We must unbind on Gecko since it would otherwise produce the pesky "attempt
// to run compile-and-go script on a cleared scope" message
if (automatic && isGecko) {
Event.unbind(self.getDoc());
Event.unbind(self.getWin());
@@ -24997,19 +25025,19 @@
* Minor version of TinyMCE build.
*
* @property minorVersion
* @type String
*/
- minorVersion : '0.6',
+ minorVersion : '0.7',
/**
* Release date of TinyMCE build.
*
* @property releaseDate
* @type String
*/
- releaseDate: '2013-09-12',
+ releaseDate: '2013-10-02',
/**
* Collection of editor instances.
*
* @property editors
@@ -26990,25 +27018,37 @@
* @method showPanel
*/
showPanel: function() {
var self = this, settings = self.settings;
- settings.panel.popover = true;
- settings.panel.autohide = true;
self.active(true);
if (!self.panel) {
- self.panel = new FloatPanel(settings.panel).on('hide', function() {
+ var panelSettings = settings.panel;
+
+ // Wrap panel in grid layout if type if specified
+ // This makes it possible to add forms or other containers directly in the panel option
+ if (panelSettings.type) {
+ panelSettings = {
+ layout: 'grid',
+ items: panelSettings
+ };
+ }
+
+ panelSettings.popover = true;
+ panelSettings.autohide = true;
+
+ self.panel = new FloatPanel(panelSettings).on('hide', function() {
self.active(false);
}).parent(self).renderTo(self.getContainerElm());
self.panel.fire('show');
self.panel.reflow();
} else {
self.panel.show();
}
- self.panel.moveRel(self.getEl(), settings.popoverAlign || 'bc-tc');
+ self.panel.moveRel(self.getEl(), settings.popoverAlign || ['bc-tl', 'bc-tc']);
},
/**
* Hides the panel for the button.
*
@@ -27287,15 +27327,15 @@
* @return {Boolean|tinymce.ui.ComboBox} True/false or self if it's a set operation.
*/
disabled: function(state) {
var self = this;
- self._super(state);
-
- if (self._rendered) {
+ if (self._rendered && typeof(state) != 'undefined') {
self.getEl('inp').disabled = state;
}
+
+ return self._super(state);
},
/**
* Focuses the input area of the control.
*
@@ -27385,11 +27425,11 @@
}
return (
'<div id="' + id + '" class="' + self.classes() + '">' +
'<input id="' + id + '-inp" class="' + prefix + 'textbox ' + prefix + 'placeholder" value="' +
- value + '" hidefocus="true">' +
+ value + '" hidefocus="true"' + (self.disabled() ? ' disabled="disabled"' : '') + '>' +
openBtnHtml +
'</div>'
);
}
});
@@ -27809,16 +27849,10 @@
*
* @method submit
* @return {Object} Event arguments object.
*/
submit: function() {
- // Blur current control so a onchange is fired before submit
- var ctrl = this.getParentCtrl(document.activeElement);
- if (ctrl) {
- ctrl.blur();
- }
-
return this.fire('submit', {data: this.toJSON()});
},
/**
* Post render method. Called after the control has been rendered to the target.
@@ -29935,10 +29969,14 @@
self.aria('checked', true);
self.addClass('menu-item-checkbox');
settings.icon = 'selected';
}
+ if (!settings.preview && !settings.selectable) {
+ self.addClass('menu-item-normal');
+ }
+
self.on('mousedown', function(e) {
e.preventDefault();
});
self.on('mouseenter click', function(e) {
@@ -30614,11 +30652,11 @@
*/
define("tinymce/ui/TabPanel", [
"tinymce/ui/Panel",
"tinymce/ui/DomUtils"
], function(Panel, DomUtils) {
- "use stict";
+ "use strict";
return Panel.extend({
lastIdx: 0,
Defaults: {
@@ -30721,11 +30759,13 @@
* @return {Object} Layout rect instance.
*/
initLayoutRect: function() {
var self = this, rect, minW, minH;
- minW = minH = 0;
+ minW = self.getEl('head').offsetWidth;
+ minW = minW < 0 ? 0 : minW;
+ minH = 0;
self.items().each(function(item, i) {
minW = Math.max(minW, item.layoutRect().minW);
minH = Math.max(minH, item.layoutRect().minH);
if (self.settings.activeTab != i) {
item.hide();
@@ -30821,10 +30861,27 @@
});
}
},
/**
+ * Getter/setter function for the disabled state.
+ *
+ * @method value
+ * @param {Boolean} [state] State to be set.
+ * @return {Boolean|tinymce.ui.ComboBox} True/false or self if it's a set operation.
+ */
+ disabled: function(state) {
+ var self = this;
+
+ if (self._rendered && typeof(state) != 'undefined') {
+ self.getEl().disabled = state;
+ }
+
+ return self._super(state);
+ },
+
+ /**
* Getter/setter function for the control value.
*
* @method value
* @param {String} [value] Value to be set.
* @return {String|tinymce.ui.ComboBox} Value or self if it's a set operation.
@@ -30918,9 +30975,13 @@
extraAttrs += ' size="' + settings.size + '"';
}
if (settings.subtype) {
extraAttrs += ' type="' + settings.subtype + '"';
+ }
+
+ if (self.disabled()) {
+ extraAttrs += ' disabled="disabled"';
}
if (settings.multiline) {
return (
'<textarea id="' + id + '" class="' + self.classes() + '" ' +
\ No newline at end of file