[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 /** 2 * Copyright (c) Tiny Technologies, Inc. All rights reserved. 3 * Licensed under the LGPL or a commercial license. 4 * For LGPL see License.txt in the project root for license information. 5 * For commercial licenses see https://www.tiny.cloud/ 6 * 7 * Version: 5.10.5 (2022-05-25) 8 */ 9 (function () { 10 'use strict'; 11 12 var global$2 = tinymce.util.Tools.resolve('tinymce.PluginManager'); 13 14 var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils'); 15 16 var global = tinymce.util.Tools.resolve('tinymce.util.Tools'); 17 18 var enableWhenDirty = function (editor) { 19 return editor.getParam('save_enablewhendirty', true); 20 }; 21 var hasOnSaveCallback = function (editor) { 22 return !!editor.getParam('save_onsavecallback'); 23 }; 24 var hasOnCancelCallback = function (editor) { 25 return !!editor.getParam('save_oncancelcallback'); 26 }; 27 28 var displayErrorMessage = function (editor, message) { 29 editor.notificationManager.open({ 30 text: message, 31 type: 'error' 32 }); 33 }; 34 var save = function (editor) { 35 var formObj = global$1.DOM.getParent(editor.id, 'form'); 36 if (enableWhenDirty(editor) && !editor.isDirty()) { 37 return; 38 } 39 editor.save(); 40 if (hasOnSaveCallback(editor)) { 41 editor.execCallback('save_onsavecallback', editor); 42 editor.nodeChanged(); 43 return; 44 } 45 if (formObj) { 46 editor.setDirty(false); 47 if (!formObj.onsubmit || formObj.onsubmit()) { 48 if (typeof formObj.submit === 'function') { 49 formObj.submit(); 50 } else { 51 displayErrorMessage(editor, 'Error: Form submit field collision.'); 52 } 53 } 54 editor.nodeChanged(); 55 } else { 56 displayErrorMessage(editor, 'Error: No form element found.'); 57 } 58 }; 59 var cancel = function (editor) { 60 var h = global.trim(editor.startContent); 61 if (hasOnCancelCallback(editor)) { 62 editor.execCallback('save_oncancelcallback', editor); 63 return; 64 } 65 editor.resetContent(h); 66 }; 67 68 var register$1 = function (editor) { 69 editor.addCommand('mceSave', function () { 70 save(editor); 71 }); 72 editor.addCommand('mceCancel', function () { 73 cancel(editor); 74 }); 75 }; 76 77 var stateToggle = function (editor) { 78 return function (api) { 79 var handler = function () { 80 api.setDisabled(enableWhenDirty(editor) && !editor.isDirty()); 81 }; 82 handler(); 83 editor.on('NodeChange dirty', handler); 84 return function () { 85 return editor.off('NodeChange dirty', handler); 86 }; 87 }; 88 }; 89 var register = function (editor) { 90 editor.ui.registry.addButton('save', { 91 icon: 'save', 92 tooltip: 'Save', 93 disabled: true, 94 onAction: function () { 95 return editor.execCommand('mceSave'); 96 }, 97 onSetup: stateToggle(editor) 98 }); 99 editor.ui.registry.addButton('cancel', { 100 icon: 'cancel', 101 tooltip: 'Cancel', 102 disabled: true, 103 onAction: function () { 104 return editor.execCommand('mceCancel'); 105 }, 106 onSetup: stateToggle(editor) 107 }); 108 editor.addShortcut('Meta+S', '', 'mceSave'); 109 }; 110 111 function Plugin () { 112 global$2.add('save', function (editor) { 113 register(editor); 114 register$1(editor); 115 }); 116 } 117 118 Plugin(); 119 120 }());
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |