!function(){"use strict";varn=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),o=tinymce.util.Tools.resolve("tinymce.util.Tools"),a=function(n){returnn.getParam("save_enablewhendirty",!0)},i=function(n){return!!n.getParam("save_onsavecallback")},c=function(n){return!!n.getParam("save_oncancelcallback")},r=function(n,e){n.notificationManager.open({text:e,type:"error"})},e=function(n){vare;if(e=t.DOM.getParent(n.id,"form"),!a(n)||n.isDirty()){if(n.save(),i(n))returnn.execCallback("save_onsavecallback",n),voidn.nodeChanged();e?(n.setDirty(!1),e.onsubmit&&!e.onsubmit()||("function"==typeofe.submit?e.submit():r(n,"Error: Form submit field collision.")),n.nodeChanged()):r(n,"Error: No form element found.")}},u=function(n){vare=o.trim(n.startContent);c(n)?n.execCallback("save_oncancelcallback",n):n.resetContent(e)},l=function(n){n.addCommand("mceSave",function(){e(n)}),n.addCommand("mceCancel",function(){u(n)})},s=function(t){returnfunction(n){vare=function(){n.setDisabled(a(t)&&!t.isDirty())};returnt.on("NodeChange dirty",e),function(){returnt.off("NodeChange dirty",e)}}},d=function(n){n.ui.registry.addButton("save",{icon:"save",tooltip:"Save",disabled:!0,onAction:function(){returnn.execCommand("mceSave")},onSetup:s(n)}),n.ui.registry.addButton("cancel",{icon:"cancel",tooltip:"Cancel",disabled:!0,onAction:function(){returnn.execCommand("mceCancel")},onSetup:s(n)}),n.addShortcut("Meta+S","","mceSave")};!functionm(){n.add("save",function(n){d(n),l(n)})}()}();