UNPKG

@atlaskit/editor-plugin-toolbar

Version:

Toolbar plugin for @atlaskit/editor-core

37 lines (36 loc) • 932 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createConfirmDialogStore = void 0; /** * Holds the open confirm dialog for a toolbar action. Create one per editor, call `show` from the * action, and render `ConfirmDialog` with the same store. */ var createConfirmDialogStore = exports.createConfirmDialogStore = function createConfirmDialogStore() { var options; var listeners = new Set(); var set = function set(next) { options = next; listeners.forEach(function (listener) { return listener(); }); }; return { getOptions: function getOptions() { return options; }, show: function show(next) { return set(next); }, hide: function hide() { return set(); }, subscribe: function subscribe(listener) { listeners.add(listener); return function () { listeners.delete(listener); }; } }; };