@atlaskit/editor-plugin-hyperlink
Version:
Hyperlink plugin for @atlaskit/editor-core
26 lines (25 loc) • 808 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.toolbarKey = exports.toolbarButtonsPlugin = void 0;
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
var _state = require("@atlaskit/editor-prosemirror/state");
var toolbarKey = exports.toolbarKey = new _state.PluginKey('hyperlinkToolbarItems');
var toolbarButtonsPlugin = exports.toolbarButtonsPlugin = function toolbarButtonsPlugin(initialState) {
return new _safePlugin.SafePlugin({
key: toolbarKey,
state: {
init: function init(_, __) {
return initialState;
},
apply: function apply(tr, pluginState) {
var metaState = tr.getMeta(toolbarKey);
if (metaState) {
return metaState;
}
return pluginState;
}
}
});
};