Update Umbraco to 7.12.2
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
// Exports the "autoresize" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/autoresize')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/autoresize'
|
||||
require('./plugin.js');
|
||||
@@ -1,162 +1,169 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
(function () {
|
||||
var autoresize = (function () {
|
||||
'use strict';
|
||||
|
||||
/*global tinymce:true */
|
||||
/*eslint no-nested-ternary:0 */
|
||||
var Cell = function (initial) {
|
||||
var value = initial;
|
||||
var get = function () {
|
||||
return value;
|
||||
};
|
||||
var set = function (v) {
|
||||
value = v;
|
||||
};
|
||||
var clone = function () {
|
||||
return Cell(get());
|
||||
};
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
clone: clone
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Auto Resize
|
||||
*
|
||||
* This plugin automatically resizes the content area to fit its content height.
|
||||
* It will retain a minimum height, which is the height of the content area when
|
||||
* it's initialized.
|
||||
*/
|
||||
tinymce.PluginManager.add('autoresize', function(editor) {
|
||||
var settings = editor.settings, oldSize = 0;
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
function isFullscreen() {
|
||||
return editor.plugins.fullscreen && editor.plugins.fullscreen.isFullscreen();
|
||||
}
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
|
||||
|
||||
if (editor.settings.inline) {
|
||||
return;
|
||||
}
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay');
|
||||
|
||||
/**
|
||||
* This method gets executed each time the editor needs to resize.
|
||||
*/
|
||||
function resize(e) {
|
||||
var deltaSize, doc, body, docElm, DOM = tinymce.DOM, resizeHeight, myHeight,
|
||||
marginTop, marginBottom, paddingTop, paddingBottom, borderTop, borderBottom;
|
||||
var getAutoResizeMinHeight = function (editor) {
|
||||
return parseInt(editor.getParam('autoresize_min_height', editor.getElement().offsetHeight), 10);
|
||||
};
|
||||
var getAutoResizeMaxHeight = function (editor) {
|
||||
return parseInt(editor.getParam('autoresize_max_height', 0), 10);
|
||||
};
|
||||
var getAutoResizeOverflowPadding = function (editor) {
|
||||
return editor.getParam('autoresize_overflow_padding', 1);
|
||||
};
|
||||
var getAutoResizeBottomMargin = function (editor) {
|
||||
return editor.getParam('autoresize_bottom_margin', 50);
|
||||
};
|
||||
var shouldAutoResizeOnInit = function (editor) {
|
||||
return editor.getParam('autoresize_on_init', true);
|
||||
};
|
||||
var $_azyemt8qjh8lpue0 = {
|
||||
getAutoResizeMinHeight: getAutoResizeMinHeight,
|
||||
getAutoResizeMaxHeight: getAutoResizeMaxHeight,
|
||||
getAutoResizeOverflowPadding: getAutoResizeOverflowPadding,
|
||||
getAutoResizeBottomMargin: getAutoResizeBottomMargin,
|
||||
shouldAutoResizeOnInit: shouldAutoResizeOnInit
|
||||
};
|
||||
|
||||
doc = editor.getDoc();
|
||||
if (!doc) {
|
||||
return;
|
||||
}
|
||||
var isFullscreen = function (editor) {
|
||||
return editor.plugins.fullscreen && editor.plugins.fullscreen.isFullscreen();
|
||||
};
|
||||
var wait = function (editor, oldSize, times, interval, callback) {
|
||||
global$2.setEditorTimeout(editor, function () {
|
||||
resize(editor, oldSize);
|
||||
if (times--) {
|
||||
wait(editor, oldSize, times, interval, callback);
|
||||
} else if (callback) {
|
||||
callback();
|
||||
}
|
||||
}, interval);
|
||||
};
|
||||
var toggleScrolling = function (editor, state) {
|
||||
var body = editor.getBody();
|
||||
if (body) {
|
||||
body.style.overflowY = state ? '' : 'hidden';
|
||||
if (!state) {
|
||||
body.scrollTop = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
var resize = function (editor, oldSize) {
|
||||
var deltaSize, doc, body, resizeHeight, myHeight;
|
||||
var marginTop, marginBottom, paddingTop, paddingBottom, borderTop, borderBottom;
|
||||
var dom = editor.dom;
|
||||
doc = editor.getDoc();
|
||||
if (!doc) {
|
||||
return;
|
||||
}
|
||||
if (isFullscreen(editor)) {
|
||||
toggleScrolling(editor, true);
|
||||
return;
|
||||
}
|
||||
body = doc.body;
|
||||
resizeHeight = $_azyemt8qjh8lpue0.getAutoResizeMinHeight(editor);
|
||||
marginTop = dom.getStyle(body, 'margin-top', true);
|
||||
marginBottom = dom.getStyle(body, 'margin-bottom', true);
|
||||
paddingTop = dom.getStyle(body, 'padding-top', true);
|
||||
paddingBottom = dom.getStyle(body, 'padding-bottom', true);
|
||||
borderTop = dom.getStyle(body, 'border-top-width', true);
|
||||
borderBottom = dom.getStyle(body, 'border-bottom-width', true);
|
||||
myHeight = body.offsetHeight + parseInt(marginTop, 10) + parseInt(marginBottom, 10) + parseInt(paddingTop, 10) + parseInt(paddingBottom, 10) + parseInt(borderTop, 10) + parseInt(borderBottom, 10);
|
||||
if (isNaN(myHeight) || myHeight <= 0) {
|
||||
myHeight = global$1.ie ? body.scrollHeight : global$1.webkit && body.clientHeight === 0 ? 0 : body.offsetHeight;
|
||||
}
|
||||
if (myHeight > $_azyemt8qjh8lpue0.getAutoResizeMinHeight(editor)) {
|
||||
resizeHeight = myHeight;
|
||||
}
|
||||
var maxHeight = $_azyemt8qjh8lpue0.getAutoResizeMaxHeight(editor);
|
||||
if (maxHeight && myHeight > maxHeight) {
|
||||
resizeHeight = maxHeight;
|
||||
toggleScrolling(editor, true);
|
||||
} else {
|
||||
toggleScrolling(editor, false);
|
||||
}
|
||||
if (resizeHeight !== oldSize.get()) {
|
||||
deltaSize = resizeHeight - oldSize.get();
|
||||
dom.setStyle(editor.iframeElement, 'height', resizeHeight + 'px');
|
||||
oldSize.set(resizeHeight);
|
||||
if (global$1.webkit && deltaSize < 0) {
|
||||
resize(editor, oldSize);
|
||||
}
|
||||
}
|
||||
};
|
||||
var setup = function (editor, oldSize) {
|
||||
editor.on('init', function () {
|
||||
var overflowPadding, bottomMargin;
|
||||
var dom = editor.dom;
|
||||
overflowPadding = $_azyemt8qjh8lpue0.getAutoResizeOverflowPadding(editor);
|
||||
bottomMargin = $_azyemt8qjh8lpue0.getAutoResizeBottomMargin(editor);
|
||||
if (overflowPadding !== false) {
|
||||
dom.setStyles(editor.getBody(), {
|
||||
paddingLeft: overflowPadding,
|
||||
paddingRight: overflowPadding
|
||||
});
|
||||
}
|
||||
if (bottomMargin !== false) {
|
||||
dom.setStyles(editor.getBody(), { paddingBottom: bottomMargin });
|
||||
}
|
||||
});
|
||||
editor.on('nodechange setcontent keyup FullscreenStateChanged', function (e) {
|
||||
resize(editor, oldSize);
|
||||
});
|
||||
if ($_azyemt8qjh8lpue0.shouldAutoResizeOnInit(editor)) {
|
||||
editor.on('init', function () {
|
||||
wait(editor, oldSize, 20, 100, function () {
|
||||
wait(editor, oldSize, 5, 1000);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
var $_rs2t18njh8lpudw = {
|
||||
setup: setup,
|
||||
resize: resize
|
||||
};
|
||||
|
||||
body = doc.body;
|
||||
docElm = doc.documentElement;
|
||||
resizeHeight = settings.autoresize_min_height;
|
||||
var register = function (editor, oldSize) {
|
||||
editor.addCommand('mceAutoResize', function () {
|
||||
$_rs2t18njh8lpudw.resize(editor, oldSize);
|
||||
});
|
||||
};
|
||||
var $_b0t1u48mjh8lpudv = { register: register };
|
||||
|
||||
if (!body || (e && e.type === "setcontent" && e.initial) || isFullscreen()) {
|
||||
if (body && docElm) {
|
||||
body.style.overflowY = "auto";
|
||||
docElm.style.overflowY = "auto"; // Old IE
|
||||
}
|
||||
global.add('autoresize', function (editor) {
|
||||
if (!editor.inline) {
|
||||
var oldSize = Cell(0);
|
||||
$_b0t1u48mjh8lpudv.register(editor, oldSize);
|
||||
$_rs2t18njh8lpudw.setup(editor, oldSize);
|
||||
}
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
return Plugin;
|
||||
|
||||
// Calculate outer height of the body element using CSS styles
|
||||
marginTop = editor.dom.getStyle(body, 'margin-top', true);
|
||||
marginBottom = editor.dom.getStyle(body, 'margin-bottom', true);
|
||||
paddingTop = editor.dom.getStyle(body, 'padding-top', true);
|
||||
paddingBottom = editor.dom.getStyle(body, 'padding-bottom', true);
|
||||
borderTop = editor.dom.getStyle(body, 'border-top-width', true);
|
||||
borderBottom = editor.dom.getStyle(body, 'border-bottom-width', true);
|
||||
myHeight = body.offsetHeight + parseInt(marginTop, 10) + parseInt(marginBottom, 10) +
|
||||
parseInt(paddingTop, 10) + parseInt(paddingBottom, 10) +
|
||||
parseInt(borderTop, 10) + parseInt(borderBottom, 10);
|
||||
|
||||
// Make sure we have a valid height
|
||||
if (isNaN(myHeight) || myHeight <= 0) {
|
||||
// Get height differently depending on the browser used
|
||||
myHeight = tinymce.Env.ie ? body.scrollHeight : (tinymce.Env.webkit && body.clientHeight === 0 ? 0 : body.offsetHeight);
|
||||
}
|
||||
|
||||
// Don't make it smaller than the minimum height
|
||||
if (myHeight > settings.autoresize_min_height) {
|
||||
resizeHeight = myHeight;
|
||||
}
|
||||
|
||||
// If a maximum height has been defined don't exceed this height
|
||||
if (settings.autoresize_max_height && myHeight > settings.autoresize_max_height) {
|
||||
resizeHeight = settings.autoresize_max_height;
|
||||
body.style.overflowY = "auto";
|
||||
docElm.style.overflowY = "auto"; // Old IE
|
||||
} else {
|
||||
body.style.overflowY = "hidden";
|
||||
docElm.style.overflowY = "hidden"; // Old IE
|
||||
body.scrollTop = 0;
|
||||
}
|
||||
|
||||
// Resize content element
|
||||
if (resizeHeight !== oldSize) {
|
||||
deltaSize = resizeHeight - oldSize;
|
||||
DOM.setStyle(editor.iframeElement, 'height', resizeHeight + 'px');
|
||||
oldSize = resizeHeight;
|
||||
|
||||
// WebKit doesn't decrease the size of the body element until the iframe gets resized
|
||||
// So we need to continue to resize the iframe down until the size gets fixed
|
||||
if (tinymce.isWebKit && deltaSize < 0) {
|
||||
resize(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the resize x times in 100ms intervals. We can't wait for load events since
|
||||
* the CSS files might load async.
|
||||
*/
|
||||
function wait(times, interval, callback) {
|
||||
setTimeout(function() {
|
||||
resize({});
|
||||
|
||||
if (times--) {
|
||||
wait(times, interval, callback);
|
||||
} else if (callback) {
|
||||
callback();
|
||||
}
|
||||
}, interval);
|
||||
}
|
||||
|
||||
// Define minimum height
|
||||
settings.autoresize_min_height = parseInt(editor.getParam('autoresize_min_height', editor.getElement().offsetHeight), 10);
|
||||
|
||||
// Define maximum height
|
||||
settings.autoresize_max_height = parseInt(editor.getParam('autoresize_max_height', 0), 10);
|
||||
|
||||
// Add padding at the bottom for better UX
|
||||
editor.on("init", function() {
|
||||
var overflowPadding, bottomMargin;
|
||||
|
||||
overflowPadding = editor.getParam('autoresize_overflow_padding', 1);
|
||||
bottomMargin = editor.getParam('autoresize_bottom_margin', 50);
|
||||
|
||||
if (overflowPadding !== false) {
|
||||
editor.dom.setStyles(editor.getBody(), {
|
||||
paddingLeft: overflowPadding,
|
||||
paddingRight: overflowPadding
|
||||
});
|
||||
}
|
||||
|
||||
if (bottomMargin !== false) {
|
||||
editor.dom.setStyles(editor.getBody(), {
|
||||
paddingBottom: bottomMargin
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Add appropriate listeners for resizing content area
|
||||
editor.on("nodechange setcontent keyup FullscreenStateChanged", resize);
|
||||
|
||||
if (editor.getParam('autoresize_on_init', true)) {
|
||||
editor.on('init', function() {
|
||||
// Hit it 20 times in 100 ms intervals
|
||||
wait(20, 100, function() {
|
||||
// Hit it 5 times in 1 sec intervals
|
||||
wait(5, 1000);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
||||
editor.addCommand('mceAutoResize', resize);
|
||||
});
|
||||
}());
|
||||
})();
|
||||
|
||||
@@ -1 +1 @@
|
||||
tinymce.PluginManager.add("autoresize",function(a){function b(){return a.plugins.fullscreen&&a.plugins.fullscreen.isFullscreen()}function c(d){var g,h,i,j,k,l,m,n,o,p,q,r,s=tinymce.DOM;if(h=a.getDoc()){if(i=h.body,j=h.documentElement,k=e.autoresize_min_height,!i||d&&"setcontent"===d.type&&d.initial||b())return void(i&&j&&(i.style.overflowY="auto",j.style.overflowY="auto"));m=a.dom.getStyle(i,"margin-top",!0),n=a.dom.getStyle(i,"margin-bottom",!0),o=a.dom.getStyle(i,"padding-top",!0),p=a.dom.getStyle(i,"padding-bottom",!0),q=a.dom.getStyle(i,"border-top-width",!0),r=a.dom.getStyle(i,"border-bottom-width",!0),l=i.offsetHeight+parseInt(m,10)+parseInt(n,10)+parseInt(o,10)+parseInt(p,10)+parseInt(q,10)+parseInt(r,10),(isNaN(l)||0>=l)&&(l=tinymce.Env.ie?i.scrollHeight:tinymce.Env.webkit&&0===i.clientHeight?0:i.offsetHeight),l>e.autoresize_min_height&&(k=l),e.autoresize_max_height&&l>e.autoresize_max_height?(k=e.autoresize_max_height,i.style.overflowY="auto",j.style.overflowY="auto"):(i.style.overflowY="hidden",j.style.overflowY="hidden",i.scrollTop=0),k!==f&&(g=k-f,s.setStyle(a.iframeElement,"height",k+"px"),f=k,tinymce.isWebKit&&0>g&&c(d))}}function d(a,b,e){setTimeout(function(){c({}),a--?d(a,b,e):e&&e()},b)}var e=a.settings,f=0;a.settings.inline||(e.autoresize_min_height=parseInt(a.getParam("autoresize_min_height",a.getElement().offsetHeight),10),e.autoresize_max_height=parseInt(a.getParam("autoresize_max_height",0),10),a.on("init",function(){var b,c;b=a.getParam("autoresize_overflow_padding",1),c=a.getParam("autoresize_bottom_margin",50),b!==!1&&a.dom.setStyles(a.getBody(),{paddingLeft:b,paddingRight:b}),c!==!1&&a.dom.setStyles(a.getBody(),{paddingBottom:c})}),a.on("nodechange setcontent keyup FullscreenStateChanged",c),a.getParam("autoresize_on_init",!0)&&a.on("init",function(){d(20,100,function(){d(5,1e3)})}),a.addCommand("mceAutoResize",c))});
|
||||
!function(){"use strict";var i=function(t){var e=t,n=function(){return e};return{get:n,set:function(t){e=t},clone:function(){return i(n())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),y=tinymce.util.Tools.resolve("tinymce.Env"),r=tinymce.util.Tools.resolve("tinymce.util.Delay"),h=function(t){return parseInt(t.getParam("autoresize_min_height",t.getElement().offsetHeight),10)},v=function(t){return parseInt(t.getParam("autoresize_max_height",0),10)},o=function(t){return t.getParam("autoresize_overflow_padding",1)},a=function(t){return t.getParam("autoresize_bottom_margin",50)},n=function(t){return t.getParam("autoresize_on_init",!0)},u=function(t,e,n,i,o){r.setEditorTimeout(t,function(){_(t,e),n--?u(t,e,n,i,o):o&&o()},i)},S=function(t,e){var n=t.getBody();n&&(n.style.overflowY=e?"":"hidden",e||(n.scrollTop=0))},_=function(t,e){var n,i,o,r,a,u,s,l,g,c,f,d=t.dom;if(i=t.getDoc())if((m=t).plugins.fullscreen&&m.plugins.fullscreen.isFullscreen())S(t,!0);else{var m;o=i.body,r=h(t),u=d.getStyle(o,"margin-top",!0),s=d.getStyle(o,"margin-bottom",!0),l=d.getStyle(o,"padding-top",!0),g=d.getStyle(o,"padding-bottom",!0),c=d.getStyle(o,"border-top-width",!0),f=d.getStyle(o,"border-bottom-width",!0),a=o.offsetHeight+parseInt(u,10)+parseInt(s,10)+parseInt(l,10)+parseInt(g,10)+parseInt(c,10)+parseInt(f,10),(isNaN(a)||a<=0)&&(a=y.ie?o.scrollHeight:y.webkit&&0===o.clientHeight?0:o.offsetHeight),a>h(t)&&(r=a);var p=v(t);p&&p<a?(r=p,S(t,!0)):S(t,!1),r!==e.get()&&(n=r-e.get(),d.setStyle(t.iframeElement,"height",r+"px"),e.set(r),y.webkit&&n<0&&_(t,e))}},s={setup:function(i,e){i.on("init",function(){var t,e,n=i.dom;t=o(i),e=a(i),!1!==t&&n.setStyles(i.getBody(),{paddingLeft:t,paddingRight:t}),!1!==e&&n.setStyles(i.getBody(),{paddingBottom:e})}),i.on("nodechange setcontent keyup FullscreenStateChanged",function(t){_(i,e)}),n(i)&&i.on("init",function(){u(i,e,20,100,function(){u(i,e,5,1e3)})})},resize:_},l=function(t,e){t.addCommand("mceAutoResize",function(){s.resize(t,e)})};t.add("autoresize",function(t){if(!t.inline){var e=i(0);l(t,e),s.setup(t,e)}})}();
|
||||
Reference in New Issue
Block a user