UNPKG

@atlaskit/editor-plugin-date

Version:

Date plugin for @atlaskit/editor-core

39 lines (38 loc) 1.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getPluginState = exports.default = void 0; var _safePlugin = require("@atlaskit/editor-common/safe-plugin"); var _utils = require("@atlaskit/editor-common/utils"); var _DateNodeView = require("../nodeviews/DateNodeView"); var _pluginKey = require("./plugin-key"); var _utils2 = require("./utils"); var dest = (0, _utils.pluginFactory)(_pluginKey.pluginKey, _utils2.reducer, { mapping: _utils2.mapping, onSelectionChanged: _utils2.onSelectionChanged }); var createPluginState = dest.createPluginState; var getPluginState = exports.getPluginState = dest.getPluginState; var createPlugin = function createPlugin(pmPluginFactoryParams) { var dispatch = pmPluginFactoryParams.dispatch; var newPluginState = { showDatePickerAt: null, isNew: false, isDateEmpty: false, focusDateInput: false, isInitialised: true }; return new _safePlugin.SafePlugin({ state: createPluginState(dispatch, newPluginState), key: _pluginKey.pluginKey, props: { nodeViews: { date: function date(node, view, getPos, decorations) { return new _DateNodeView.DateNodeView(node, view, getPos, pmPluginFactoryParams.getIntl(), decorations); } } } }); }; var _default = exports.default = createPlugin;