integarting admin dashboard
This commit is contained in:
7
public/Dashboard/vendors/tinymce/plugins/save/index.js
vendored
Normal file
7
public/Dashboard/vendors/tinymce/plugins/save/index.js
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
// Exports the "save" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/save')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/save'
|
||||
require('./plugin.js');
|
119
public/Dashboard/vendors/tinymce/plugins/save/plugin.js
vendored
Normal file
119
public/Dashboard/vendors/tinymce/plugins/save/plugin.js
vendored
Normal file
@ -0,0 +1,119 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.7.0 (2021-02-10)
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
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');
|
||||
};
|
||||
|
||||
var displayErrorMessage = function (editor, message) {
|
||||
editor.notificationManager.open({
|
||||
text: message,
|
||||
type: 'error'
|
||||
});
|
||||
};
|
||||
var save = function (editor) {
|
||||
var formObj = global$1.DOM.getParent(editor.id, 'form');
|
||||
if (enableWhenDirty(editor) && !editor.isDirty()) {
|
||||
return;
|
||||
}
|
||||
editor.save();
|
||||
if (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 = global$2.trim(editor.startContent);
|
||||
if (hasOnCancelCallback(editor)) {
|
||||
editor.execCallback('save_oncancelcallback', editor);
|
||||
return;
|
||||
}
|
||||
editor.resetContent(h);
|
||||
};
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mceSave', function () {
|
||||
save(editor);
|
||||
});
|
||||
editor.addCommand('mceCancel', function () {
|
||||
cancel(editor);
|
||||
});
|
||||
};
|
||||
|
||||
var stateToggle = function (editor) {
|
||||
return function (api) {
|
||||
var handler = function () {
|
||||
api.setDisabled(enableWhenDirty(editor) && !editor.isDirty());
|
||||
};
|
||||
editor.on('NodeChange dirty', handler);
|
||||
return function () {
|
||||
return editor.off('NodeChange dirty', handler);
|
||||
};
|
||||
};
|
||||
};
|
||||
var register$1 = function (editor) {
|
||||
editor.ui.registry.addButton('save', {
|
||||
icon: 'save',
|
||||
tooltip: 'Save',
|
||||
disabled: true,
|
||||
onAction: function () {
|
||||
return editor.execCommand('mceSave');
|
||||
},
|
||||
onSetup: stateToggle(editor)
|
||||
});
|
||||
editor.ui.registry.addButton('cancel', {
|
||||
icon: 'cancel',
|
||||
tooltip: 'Cancel',
|
||||
disabled: true,
|
||||
onAction: function () {
|
||||
return editor.execCommand('mceCancel');
|
||||
},
|
||||
onSetup: stateToggle(editor)
|
||||
});
|
||||
editor.addShortcut('Meta+S', '', 'mceSave');
|
||||
};
|
||||
|
||||
function Plugin () {
|
||||
global.add('save', function (editor) {
|
||||
register$1(editor);
|
||||
register(editor);
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}());
|
9
public/Dashboard/vendors/tinymce/plugins/save/plugin.min.js
vendored
Normal file
9
public/Dashboard/vendors/tinymce/plugins/save/plugin.min.js
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.7.0 (2021-02-10)
|
||||
*/
|
||||
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),o=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),a=tinymce.util.Tools.resolve("tinymce.util.Tools"),i=function(e){return e.getParam("save_enablewhendirty",!0)},c=function(e,n){e.notificationManager.open({text:n,type:"error"})},t=function(t){t.addCommand("mceSave",function(){!function(e){var n=o.DOM.getParent(e.id,"form");if(!i(e)||e.isDirty()){if(e.save(),e.getParam("save_onsavecallback"))return e.execCallback("save_onsavecallback",e),e.nodeChanged();n?(e.setDirty(!1),n.onsubmit&&!n.onsubmit()||("function"==typeof n.submit?n.submit():c(e,"Error: Form submit field collision.")),e.nodeChanged()):c(e,"Error: No form element found.")}}(t)}),t.addCommand("mceCancel",function(){var e,n;e=t,n=a.trim(e.startContent),e.getParam("save_oncancelcallback")?e.execCallback("save_oncancelcallback",e):e.resetContent(n)})},r=function(t){return function(e){var n=function(){e.setDisabled(i(t)&&!t.isDirty())};return t.on("NodeChange dirty",n),function(){return t.off("NodeChange dirty",n)}}};e.add("save",function(e){var n;(n=e).ui.registry.addButton("save",{icon:"save",tooltip:"Save",disabled:!0,onAction:function(){return n.execCommand("mceSave")},onSetup:r(n)}),n.ui.registry.addButton("cancel",{icon:"cancel",tooltip:"Cancel",disabled:!0,onAction:function(){return n.execCommand("mceCancel")},onSetup:r(n)}),n.addShortcut("Meta+S","","mceSave"),t(e)})}();
|
Reference in New Issue
Block a user