123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- import {
- __commonJS,
- init_define_APP_INFO
- } from "./chunk-XY75H3MP.js";
- // node_modules/tinymce/plugins/save/plugin.js
- var require_plugin = __commonJS({
- "node_modules/tinymce/plugins/save/plugin.js"() {
- init_define_APP_INFO();
- (function() {
- "use strict";
- var global$2 = tinymce.util.Tools.resolve("tinymce.PluginManager");
- var global$1 = tinymce.util.Tools.resolve("tinymce.dom.DOMUtils");
- var global = 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.trim(editor.startContent);
- if (hasOnCancelCallback(editor)) {
- editor.execCallback("save_oncancelcallback", editor);
- return;
- }
- editor.resetContent(h);
- };
- var register$1 = 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());
- };
- handler();
- editor.on("NodeChange dirty", handler);
- return function() {
- return editor.off("NodeChange dirty", handler);
- };
- };
- };
- var register = 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$2.add("save", function(editor) {
- register(editor);
- register$1(editor);
- });
- }
- Plugin();
- })();
- }
- });
- // node_modules/tinymce/plugins/save/index.js
- var require_save = __commonJS({
- "node_modules/tinymce/plugins/save/index.js"() {
- init_define_APP_INFO();
- require_plugin();
- }
- });
- // dep:tinymce_plugins_save
- init_define_APP_INFO();
- var tinymce_plugins_save_default = require_save();
- export {
- tinymce_plugins_save_default as default
- };
- //# sourceMappingURL=tinymce_plugins_save.js.map
|