mirror of
https://github.com/documize/community.git
synced 2025-08-04 13:05:23 +02:00
inymce upgrade 4.7.4
This commit is contained in:
parent
9dcaf697a8
commit
2da0089c1c
119 changed files with 113279 additions and 183 deletions
370
gui/public/tinymce/plugins/save/plugin.js
Executable file
370
gui/public/tinymce/plugins/save/plugin.js
Executable file
|
@ -0,0 +1,370 @@
|
|||
(function () {
|
||||
|
||||
var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
|
||||
|
||||
// Used when there is no 'main' module.
|
||||
// The name is probably (hopefully) unique so minification removes for releases.
|
||||
var register_3795 = function (id) {
|
||||
var module = dem(id);
|
||||
var fragments = id.split('.');
|
||||
var target = Function('return this;')();
|
||||
for (var i = 0; i < fragments.length - 1; ++i) {
|
||||
if (target[fragments[i]] === undefined)
|
||||
target[fragments[i]] = {};
|
||||
target = target[fragments[i]];
|
||||
}
|
||||
target[fragments[fragments.length - 1]] = module;
|
||||
};
|
||||
|
||||
var instantiate = function (id) {
|
||||
var actual = defs[id];
|
||||
var dependencies = actual.deps;
|
||||
var definition = actual.defn;
|
||||
var len = dependencies.length;
|
||||
var instances = new Array(len);
|
||||
for (var i = 0; i < len; ++i)
|
||||
instances[i] = dem(dependencies[i]);
|
||||
var defResult = definition.apply(null, instances);
|
||||
if (defResult === undefined)
|
||||
throw 'module [' + id + '] returned undefined';
|
||||
actual.instance = defResult;
|
||||
};
|
||||
|
||||
var def = function (id, dependencies, definition) {
|
||||
if (typeof id !== 'string')
|
||||
throw 'module id must be a string';
|
||||
else if (dependencies === undefined)
|
||||
throw 'no dependencies for ' + id;
|
||||
else if (definition === undefined)
|
||||
throw 'no definition function for ' + id;
|
||||
defs[id] = {
|
||||
deps: dependencies,
|
||||
defn: definition,
|
||||
instance: undefined
|
||||
};
|
||||
};
|
||||
|
||||
var dem = function (id) {
|
||||
var actual = defs[id];
|
||||
if (actual === undefined)
|
||||
throw 'module [' + id + '] was undefined';
|
||||
else if (actual.instance === undefined)
|
||||
instantiate(id);
|
||||
return actual.instance;
|
||||
};
|
||||
|
||||
var req = function (ids, callback) {
|
||||
var len = ids.length;
|
||||
var instances = new Array(len);
|
||||
for (var i = 0; i < len; ++i)
|
||||
instances[i] = dem(ids[i]);
|
||||
callback.apply(null, instances);
|
||||
};
|
||||
|
||||
var ephox = {};
|
||||
|
||||
ephox.bolt = {
|
||||
module: {
|
||||
api: {
|
||||
define: def,
|
||||
require: req,
|
||||
demand: dem
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var define = def;
|
||||
var require = req;
|
||||
var demand = dem;
|
||||
// this helps with minification when using a lot of global references
|
||||
var defineGlobal = function (id, ref) {
|
||||
define(id, [], function () { return ref; });
|
||||
};
|
||||
/*jsc
|
||||
["tinymce.plugins.save.Plugin","tinymce.core.PluginManager","tinymce.plugins.save.api.Commands","tinymce.plugins.save.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.save.core.Actions","tinymce.plugins.save.api.Settings","tinymce.core.dom.DOMUtils","tinymce.core.util.Tools"]
|
||||
jsc*/
|
||||
defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
|
||||
/**
|
||||
* ResolveGlobal.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
define(
|
||||
'tinymce.core.PluginManager',
|
||||
[
|
||||
'global!tinymce.util.Tools.resolve'
|
||||
],
|
||||
function (resolve) {
|
||||
return resolve('tinymce.PluginManager');
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* ResolveGlobal.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
define(
|
||||
'tinymce.core.dom.DOMUtils',
|
||||
[
|
||||
'global!tinymce.util.Tools.resolve'
|
||||
],
|
||||
function (resolve) {
|
||||
return resolve('tinymce.dom.DOMUtils');
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* ResolveGlobal.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
define(
|
||||
'tinymce.core.util.Tools',
|
||||
[
|
||||
'global!tinymce.util.Tools.resolve'
|
||||
],
|
||||
function (resolve) {
|
||||
return resolve('tinymce.util.Tools');
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
define(
|
||||
'tinymce.plugins.save.api.Settings',
|
||||
[
|
||||
],
|
||||
function () {
|
||||
var enableWhenDirty = function (editor) {
|
||||
return editor.getParam('save_enablewhendirty', true);
|
||||
};
|
||||
|
||||
var hasOnSaveCallback = function (editor) {
|
||||
return !!editor.getParam('save_onsavecallback');
|
||||
};
|
||||
|
||||
var hasOnCancelCallback = function (editor) {
|
||||
return !!editor.getParam('save_oncancelcallback');
|
||||
};
|
||||
|
||||
return {
|
||||
enableWhenDirty: enableWhenDirty,
|
||||
hasOnSaveCallback: hasOnSaveCallback,
|
||||
hasOnCancelCallback: hasOnCancelCallback
|
||||
};
|
||||
}
|
||||
);
|
||||
/**
|
||||
* Actions.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
define(
|
||||
'tinymce.plugins.save.core.Actions',
|
||||
[
|
||||
'tinymce.core.dom.DOMUtils',
|
||||
'tinymce.core.util.Tools',
|
||||
'tinymce.plugins.save.api.Settings'
|
||||
],
|
||||
function (DOMUtils, Tools, Settings) {
|
||||
var displayErrorMessage = function (editor, message) {
|
||||
editor.notificationManager.open({
|
||||
text: editor.translate(message),
|
||||
type: 'error'
|
||||
});
|
||||
};
|
||||
|
||||
var save = function (editor) {
|
||||
var formObj;
|
||||
|
||||
formObj = DOMUtils.DOM.getParent(editor.id, 'form');
|
||||
|
||||
if (Settings.enableWhenDirty(editor) && !editor.isDirty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
editor.save();
|
||||
|
||||
// Use callback instead
|
||||
if (Settings.hasOnSaveCallback(editor)) {
|
||||
editor.execCallback('save_onsavecallback', editor);
|
||||
editor.nodeChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
if (formObj) {
|
||||
editor.setDirty(false);
|
||||
|
||||
if (!formObj.onsubmit || formObj.onsubmit()) {
|
||||
if (typeof formObj.submit === 'function') {
|
||||
formObj.submit();
|
||||
} else {
|
||||
displayErrorMessage(editor, 'Error: Form submit field collision.');
|
||||
}
|
||||
}
|
||||
|
||||
editor.nodeChanged();
|
||||
} else {
|
||||
displayErrorMessage(editor, 'Error: No form element found.');
|
||||
}
|
||||
};
|
||||
|
||||
var cancel = function (editor) {
|
||||
var h = Tools.trim(editor.startContent);
|
||||
|
||||
// Use callback instead
|
||||
if (Settings.hasOnCancelCallback(editor)) {
|
||||
editor.execCallback('save_oncancelcallback', editor);
|
||||
return;
|
||||
}
|
||||
|
||||
editor.setContent(h);
|
||||
editor.undoManager.clear();
|
||||
editor.nodeChanged();
|
||||
};
|
||||
|
||||
return {
|
||||
save: save,
|
||||
cancel: cancel
|
||||
};
|
||||
}
|
||||
);
|
||||
/**
|
||||
* Commands.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
define(
|
||||
'tinymce.plugins.save.api.Commands',
|
||||
[
|
||||
'tinymce.plugins.save.core.Actions'
|
||||
],
|
||||
function (Actions) {
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mceSave', function () {
|
||||
Actions.save(editor);
|
||||
});
|
||||
|
||||
editor.addCommand('mceCancel', function () {
|
||||
Actions.cancel(editor);
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
register: register
|
||||
};
|
||||
}
|
||||
);
|
||||
/**
|
||||
* Buttons.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
define(
|
||||
'tinymce.plugins.save.ui.Buttons',
|
||||
[
|
||||
'tinymce.plugins.save.api.Settings'
|
||||
],
|
||||
function (Settings) {
|
||||
var stateToggle = function (editor) {
|
||||
return function (e) {
|
||||
var ctrl = e.control;
|
||||
|
||||
editor.on('nodeChange dirty', function () {
|
||||
ctrl.disabled(Settings.enableWhenDirty(editor) && !editor.isDirty());
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addButton('save', {
|
||||
icon: 'save',
|
||||
text: 'Save',
|
||||
cmd: 'mceSave',
|
||||
disabled: true,
|
||||
onPostRender: stateToggle(editor)
|
||||
});
|
||||
|
||||
editor.addButton('cancel', {
|
||||
text: 'Cancel',
|
||||
icon: false,
|
||||
cmd: 'mceCancel',
|
||||
disabled: true,
|
||||
onPostRender: stateToggle(editor)
|
||||
});
|
||||
|
||||
editor.addShortcut('Meta+S', '', 'mceSave');
|
||||
};
|
||||
|
||||
return {
|
||||
register: register
|
||||
};
|
||||
}
|
||||
);
|
||||
/**
|
||||
* Plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
define(
|
||||
'tinymce.plugins.save.Plugin',
|
||||
[
|
||||
'tinymce.core.PluginManager',
|
||||
'tinymce.plugins.save.api.Commands',
|
||||
'tinymce.plugins.save.ui.Buttons'
|
||||
],
|
||||
function (PluginManager, Commands, Buttons) {
|
||||
PluginManager.add('save', function (editor) {
|
||||
Buttons.register(editor);
|
||||
Commands.register(editor);
|
||||
});
|
||||
|
||||
return function () { };
|
||||
}
|
||||
);
|
||||
dem('tinymce.plugins.save.Plugin')();
|
||||
})();
|
|
@ -1 +1 @@
|
|||
tinymce.PluginManager.add("save",function(e){function t(){var t;if(t=tinymce.DOM.getParent(e.id,"form"),!e.getParam("save_enablewhendirty",!0)||e.isDirty())return tinymce.triggerSave(),e.getParam("save_onsavecallback")?(e.execCallback("save_onsavecallback",e),void e.nodeChanged()):void(t?(e.setDirty(!1),t.onsubmit&&!t.onsubmit()||("function"==typeof t.submit?t.submit():n(e.translate("Error: Form submit field collision."))),e.nodeChanged()):n(e.translate("Error: No form element found.")))}function n(t){e.notificationManager.open({text:t,type:"error"})}function r(){var t=tinymce.trim(e.startContent);return e.getParam("save_oncancelcallback")?void e.execCallback("save_oncancelcallback",e):(e.setContent(t),e.undoManager.clear(),void e.nodeChanged())}function i(){var t=this;e.on("nodeChange dirty",function(){t.disabled(e.getParam("save_enablewhendirty",!0)&&!e.isDirty())})}e.addCommand("mceSave",t),e.addCommand("mceCancel",r),e.addButton("save",{icon:"save",text:"Save",cmd:"mceSave",disabled:!0,onPostRender:i}),e.addButton("cancel",{text:"Cancel",icon:!1,cmd:"mceCancel",disabled:!0,onPostRender:i}),e.addShortcut("Meta+S","","mceSave")});
|
||||
!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e[f]=d(a[f]);b.apply(null,e)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("4",tinymce.util.Tools.resolve),g("1",["4"],function(a){return a("tinymce.PluginManager")}),g("7",["4"],function(a){return a("tinymce.dom.DOMUtils")}),g("8",["4"],function(a){return a("tinymce.util.Tools")}),g("6",[],function(){var a=function(a){return a.getParam("save_enablewhendirty",!0)},b=function(a){return!!a.getParam("save_onsavecallback")},c=function(a){return!!a.getParam("save_oncancelcallback")};return{enableWhenDirty:a,hasOnSaveCallback:b,hasOnCancelCallback:c}}),g("5",["7","8","6"],function(a,b,c){var d=function(a,b){a.notificationManager.open({text:a.translate(b),type:"error"})},e=function(b){var e;if(e=a.DOM.getParent(b.id,"form"),!c.enableWhenDirty(b)||b.isDirty())return b.save(),c.hasOnSaveCallback(b)?(b.execCallback("save_onsavecallback",b),void b.nodeChanged()):void(e?(b.setDirty(!1),e.onsubmit&&!e.onsubmit()||("function"==typeof e.submit?e.submit():d(b,"Error: Form submit field collision.")),b.nodeChanged()):d(b,"Error: No form element found."))},f=function(a){var d=b.trim(a.startContent);return c.hasOnCancelCallback(a)?void a.execCallback("save_oncancelcallback",a):(a.setContent(d),a.undoManager.clear(),void a.nodeChanged())};return{save:e,cancel:f}}),g("2",["5"],function(a){var b=function(b){b.addCommand("mceSave",function(){a.save(b)}),b.addCommand("mceCancel",function(){a.cancel(b)})};return{register:b}}),g("3",["6"],function(a){var b=function(b){return function(c){var d=c.control;b.on("nodeChange dirty",function(){d.disabled(a.enableWhenDirty(b)&&!b.isDirty())})}},c=function(a){a.addButton("save",{icon:"save",text:"Save",cmd:"mceSave",disabled:!0,onPostRender:b(a)}),a.addButton("cancel",{text:"Cancel",icon:!1,cmd:"mceCancel",disabled:!0,onPostRender:b(a)}),a.addShortcut("Meta+S","","mceSave")};return{register:c}}),g("0",["1","2","3"],function(a,b,c){return a.add("save",function(a){c.register(a),b.register(a)}),function(){}}),d("0")()}();
|
Loading…
Add table
Add a link
Reference in a new issue