editor.closeCurrentPopup()
Closes an open editor popup — a dropdown, menu, or dialog panel — and returns focus to the editing area. It is most useful from inside custom toolbar dropdowns, where a button in the panel should dismiss that panel after it does its work.
Syntax
editor.closeCurrentPopup()
Parameters
None in typical use. Called with no arguments it closes the currently open popup. (A specific panel object can be passed to target it, but custom dropdown code normally just calls it with no arguments.)
Returns
Nothing (undefined).
Behavior notes
- Submenu chains are handled.When the open panel belongs to a parent popup, it is unlinked from that parent’s submenu list and its dispose/close handlers run — so closing a nested menu does not leave a dangling reference.
- Focus returns to the editor. After the panel closes, keyboard focus is handed back to the editing area, so the user can keep typing without an extra click.
- It closes the popup, not the editor. Only the transient dropdown/menu/dialog is dismissed; the document and selection are untouched.
Example usage
Inside a custom dropdown, close the panel after the user clicks a button in it:
option.fillpanel = function (panel) {
var btn = document.createElement("button");
btn.textContent = "Insert signature";
btn.onclick = function () {
editor.closeCurrentPopup(); // dismiss the dropdown
editor.insertHTML("<p>-- <br/>Sent from RichTextEditor</p>");
return false;
};
panel.appendChild(btn);
};
var btn = editor.createToolbarDropDown(option, cmd, suffix);Related
- editor.createToolbarDropDown(option, cmd, suffix) — build a custom dropdown whose panel this closes.
- editor.createDialog(...)— build a custom dialog.
- editor.focus()— return focus to the editor explicitly.