@atlaskit/editor-plugin-text-color
Version:
Text color plugin for @atlaskit/editor-core
23 lines • 748 B
JavaScript
import { pluginKey, ACTIONS } from '../pm-plugins/main';
export var togglePalette = function togglePalette(api) {
return function (_ref) {
var tr = _ref.tr;
var pluginState = api === null || api === void 0 ? void 0 : api.textColor.sharedState.currentState();
var isPaletteOpen = pluginState === null || pluginState === void 0 ? void 0 : pluginState.isPaletteOpen;
tr.setMeta(pluginKey, {
action: ACTIONS.SET_PALETTE,
isPaletteOpen: !isPaletteOpen
});
return tr;
};
};
export var setPalette = function setPalette(isPaletteOpen) {
return function (_ref2) {
var tr = _ref2.tr;
tr.setMeta(pluginKey, {
action: ACTIONS.SET_PALETTE,
isPaletteOpen: isPaletteOpen
});
return tr;
};
};