// @ts-check

/**
 * @see https://www.tiny.cloud/docs/api/tinymce/tinymce.editor
 * ===============================================================================================
 */

/**
 * @typedef {object} TINYMCE_Editor
 * @property {function():void} addCommand - Adds a custom command to the editor, you can also
 * override existing commands with this method. The command that you add can be executed with
 * execCommand.
 * @property {function():void} addQueryStateHandler - Adds a custom query state command to the
 * editor, you can also override existing commands with this method. The command that you add
 * can be executed with queryCommandState function.
 * @property {function():void} addQueryValueHandler - Adds a custom query value command to the
 * editor, you can also override existing commands with this method. The command that you add
 * can be executed with queryCommandValue function.
 * @property {function():void} addShortcut - Adds a keyboard shortcut for some command or function.
 * @property {function():void} addVisual - Adds visual aid for tables, anchors etc so they can be
 * more easily edited inside the editor.
 * @property {function():void} convertURL - URL converter function this gets executed each time
 * a user adds an img, a or any other element that has a URL in it. This will be called both by
 * the DOM and HTML manipulation functions.
 * @property {function():void} destroy - Destroys the editor instance by removing all events,
 * element references or other resources that could leak memory. This method will be called
 * automatically when the page is unloaded but you can also call it directly if you know what you
 * are doing.
 * @property {function():void} execCallback - Executes a legacy callback. This method is useful
 * to call old 2.x option callbacks. There new event model is a better way to add callback so this
 * method might be removed in the future. Deprecated in TinyMCE 5.10 and has been marked for removal in
 * TinyMCE 6.0.
 * @property {function():void} execCommand - Executes a command on the current instance. These commands
 * can be TinyMCE internal commands prefixed with "mce" or they can be build in browser commands such
 * as "Bold". A compleate list of browser commands is available on MSDN or Mozilla.org. This function
 * will dispatch the execCommand function on each plugin, theme or the execcommand_callback option if
 * none of these return true it will handle the command as a internal browser command.
 * @property {function():void} fire - Fires the specified event by name. Consult the event reference for
 * more details on each event.
 * @property {(skipFocus:boolean) => void} focus - Focuses/activates the editor. This will set this editor as the
 * activeEditor in the tinymce collection it will also place DOM focus inside the editor.
 * @property {function():HTMLElement} getBody - Returns the root element of the editable area. For a
 * non-inline iframe-based editor, returns the iframe's body element.
 * @property {function():HTMLElement} getContainer - Returns the container element of the editor.
 * The container element includes all the elements added to the page for the editor. Such as UI, iframe,
 * etc.
 * @property {() => string} getContent - Gets the content from the editor instance, this will
 * cleanup the content before it gets returned using the different cleanup rules options.
 * @property {function():HTMLElement} getContentAreaContainer - Returns the content area container element
 * of the editor. This element holds the iframe or the editable element.
 * @property {function():Document} getDoc - Returns the iframes document object.
 * @property {function():HTMLElement} getElement - Returns the target element/textarea that got replaced
 * with a TinyMCE editor instance.
 * @property {(name:string) => *} getParam - Returns a configuration parameter by name.
 * @property {() => Window} getWin - Returns the iframes window object.
 * @property {() => boolean} hasEventListeners - Returns true/false if the object has a event of the
 * specified name.
 * @property {() => boolean} hasFocus - Returns true/false if the editor has real keyboard focus.
 * @property {(pluginName:string) => boolean} hasPlugin - Checks that the plugin is in the editor
 * configuration and can optionally check if the plugin has been loaded. Added in TinyMCE 5.5
 * @property {() => void} hide - Hides the editor and shows any textarea/div that the editor is supposed
 * to replace.
 * @property {(content:string, args: {}) => void} insertContent - Inserts content at caret position.
 * @property {() => boolean} isDirty - Returns true/false if the editor is dirty or not.
 * It will get dirty if the user has made modifications to the contents. The dirty state is automatically
 * set to `true` when the user modifies editor content after initialization or the last `editor.save()` call.
 * This includes changes made using undo or redo.
 * @property {() => void} load - Loads contents from the textarea, input or other element that got converted
 *  into an editor instance. This method will move the contents from that textarea, input or other element
 * into the editor by using setContent so all events etc that method has will get dispatched as well.
 * @property {() => void} nodeChanged - Dispatches out a onNodeChange event to all observers. This method
 * should be called when you need to update the UI states or element path etc.
 * @property {(name:string?, callback:()=>void?) => void} off - Unbinds an event listener to a specific event
 * by name. Consult the event reference for more details on each event.
 * @property {(name:string, callback:(e:Event)=>void, prepend:boolean?) => object} on - Binds an event listener
 * to a specific event by name. Consult the event reference for more details on each event.
 * @property {(name:string, callback:(e:Event)=>void) => object} once - Bind the event callback and once it
 * fires the callback is removed. Consult the event reference for more details on each event.
 * @property {(cmd:string) => boolean} queryCommandState - Returns a command specific state, for example if
 * bold is enabled or not.
 * @property {(cmd:string) => boolean} queryCommandSupported - Returns true/false if the command is supported
 * or not.
 * @property {(cmd:string) => object} queryCommandValue - Returns a command specific value, for example the
 * current font size.
 * @property {() => void} remove - Removes the editor from the dom and tinymce collection.
 * @property {() => void} render - Renders the editor/adds it to the page.
 * @property {() => void} resetContent - Resets the editors content, undo/redo history and dirty state.
 * If `initialContent` isn't specified, then the editor is reset back to the initial start content.
 * @property {(args: object) => void} save - Saves the contents from an editor out to the textarea or div element that
 * got converted into an editor instance. This method will move the HTML contents from the editor into that
 * textarea or div by getContent so all events etc that method has will get dispatched as well.
 * @property {(content: string) => void} setContent - Sets the specified content to the editor instance, this
 * will cleanup the content before it gets set using the different cleanup rules options.
 * @property {(state: boolean) => void} setDirty - Explicitly sets the dirty state. This will fire the dirty event if
 * the editor dirty state is changed from false to true by invoking this method.
 * @property {(mode: string) => void} setMode - Sets the editor mode. For example: "design", "code" or "readonly".
 * Deprecated in TinyMCE 5.0.4 and has been marked for removal in TinyMCE 6.0 - Use editor.mode.set(mode) instead.
 * @property {(state: boolean, time: number) => boolean} setProgressState - Sets the progress state, this will display
 * a throbber/progess for the editor. This is ideal for asynchronous operations like an AJAX save call.
 * @property {() => void} show - Shows the editor and hides any textarea/div that the editor is supposed to replace.
 * @property {(text: string) => string} translate - Translates the specified string by replacing variables with
 * language pack items it will also check if there is a key matching the input.
 * @property {(callback:function():void) => Promise<object>} uploadImages - Uploads all data uri/blob uri images in
 * the editor contents to server.
 */