@atlaskit/editor-core 189.1.15 → 189.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/composable-editor/editor-internal.js +24 -2
  3. package/dist/cjs/create-editor/feature-flags-from-props.js +4 -5
  4. package/dist/cjs/plugins/index.js +0 -7
  5. package/dist/cjs/presets/universal.js +11 -6
  6. package/dist/cjs/ui/Appearance/FullPage/FullPage.js +2 -1
  7. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +19 -12
  8. package/dist/cjs/version-wrapper.js +1 -1
  9. package/dist/es2019/composable-editor/editor-internal.js +27 -3
  10. package/dist/es2019/create-editor/feature-flags-from-props.js +4 -5
  11. package/dist/es2019/plugins/index.js +0 -1
  12. package/dist/es2019/presets/universal.js +11 -6
  13. package/dist/es2019/ui/Appearance/FullPage/FullPage.js +2 -1
  14. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +35 -30
  15. package/dist/es2019/version-wrapper.js +1 -1
  16. package/dist/esm/composable-editor/editor-internal.js +25 -3
  17. package/dist/esm/create-editor/feature-flags-from-props.js +4 -5
  18. package/dist/esm/plugins/index.js +0 -1
  19. package/dist/esm/presets/universal.js +11 -6
  20. package/dist/esm/ui/Appearance/FullPage/FullPage.js +2 -1
  21. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +19 -12
  22. package/dist/esm/version-wrapper.js +1 -1
  23. package/dist/types/create-editor/get-ui-component.d.ts +1 -1
  24. package/dist/types/plugins/index.d.ts +0 -1
  25. package/dist/types/plugins/insert-block/types.d.ts +1 -1
  26. package/dist/types/types/editor-appearance-component.d.ts +1 -0
  27. package/dist/types/types/editor-props.d.ts +2 -1
  28. package/dist/types/ui/Appearance/FullPage/FullPageToolbar.d.ts +2 -1
  29. package/dist/types-ts4.5/create-editor/get-ui-component.d.ts +1 -1
  30. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  31. package/dist/types-ts4.5/plugins/insert-block/types.d.ts +1 -1
  32. package/dist/types-ts4.5/types/editor-appearance-component.d.ts +1 -0
  33. package/dist/types-ts4.5/types/editor-props.d.ts +2 -1
  34. package/dist/types-ts4.5/ui/Appearance/FullPage/FullPageToolbar.d.ts +2 -1
  35. package/package.json +5 -7
  36. package/report.api.md +3 -8
  37. package/tmp/api-report-tmp.d.ts +3 -8
  38. package/dist/cjs/plugins/panel/actions.js +0 -125
  39. package/dist/cjs/plugins/panel/index.js +0 -215
  40. package/dist/cjs/plugins/panel/message.js +0 -44
  41. package/dist/cjs/plugins/panel/nodeviews/panel.js +0 -94
  42. package/dist/cjs/plugins/panel/pm-plugins/keymaps.js +0 -81
  43. package/dist/cjs/plugins/panel/pm-plugins/main.js +0 -28
  44. package/dist/cjs/plugins/panel/toolbar.js +0 -293
  45. package/dist/cjs/plugins/panel/types.js +0 -8
  46. package/dist/cjs/plugins/panel/utils.js +0 -53
  47. package/dist/es2019/plugins/panel/actions.js +0 -116
  48. package/dist/es2019/plugins/panel/index.js +0 -192
  49. package/dist/es2019/plugins/panel/message.js +0 -38
  50. package/dist/es2019/plugins/panel/nodeviews/panel.js +0 -82
  51. package/dist/es2019/plugins/panel/pm-plugins/keymaps.js +0 -82
  52. package/dist/es2019/plugins/panel/pm-plugins/main.js +0 -21
  53. package/dist/es2019/plugins/panel/toolbar.js +0 -279
  54. package/dist/es2019/plugins/panel/types.js +0 -2
  55. package/dist/es2019/plugins/panel/utils.js +0 -48
  56. package/dist/esm/plugins/panel/actions.js +0 -116
  57. package/dist/esm/plugins/panel/index.js +0 -209
  58. package/dist/esm/plugins/panel/message.js +0 -38
  59. package/dist/esm/plugins/panel/nodeviews/panel.js +0 -87
  60. package/dist/esm/plugins/panel/pm-plugins/keymaps.js +0 -74
  61. package/dist/esm/plugins/panel/pm-plugins/main.js +0 -22
  62. package/dist/esm/plugins/panel/toolbar.js +0 -286
  63. package/dist/esm/plugins/panel/types.js +0 -2
  64. package/dist/esm/plugins/panel/utils.js +0 -46
  65. package/dist/types/plugins/panel/actions.d.ts +0 -12
  66. package/dist/types/plugins/panel/index.d.ts +0 -17
  67. package/dist/types/plugins/panel/message.d.ts +0 -37
  68. package/dist/types/plugins/panel/nodeviews/panel.d.ts +0 -36
  69. package/dist/types/plugins/panel/pm-plugins/keymaps.d.ts +0 -3
  70. package/dist/types/plugins/panel/pm-plugins/main.d.ts +0 -11
  71. package/dist/types/plugins/panel/toolbar.d.ts +0 -15
  72. package/dist/types/plugins/panel/types.d.ts +0 -21
  73. package/dist/types/plugins/panel/utils.d.ts +0 -5
  74. package/dist/types-ts4.5/plugins/panel/actions.d.ts +0 -12
  75. package/dist/types-ts4.5/plugins/panel/index.d.ts +0 -17
  76. package/dist/types-ts4.5/plugins/panel/message.d.ts +0 -37
  77. package/dist/types-ts4.5/plugins/panel/nodeviews/panel.d.ts +0 -36
  78. package/dist/types-ts4.5/plugins/panel/pm-plugins/keymaps.d.ts +0 -3
  79. package/dist/types-ts4.5/plugins/panel/pm-plugins/main.d.ts +0 -11
  80. package/dist/types-ts4.5/plugins/panel/toolbar.d.ts +0 -15
  81. package/dist/types-ts4.5/plugins/panel/types.d.ts +0 -21
  82. package/dist/types-ts4.5/plugins/panel/utils.d.ts +0 -5
@@ -1,215 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _adfSchema = require("@atlaskit/adf-schema");
10
- var _analytics = require("@atlaskit/editor-common/analytics");
11
- var _messages = require("@atlaskit/editor-common/messages");
12
- var _quickInsert = require("@atlaskit/editor-common/quick-insert");
13
- var _utils = require("@atlaskit/editor-common/utils");
14
- var _colors = require("@atlaskit/theme/colors");
15
- var _actions = require("./actions");
16
- var _keymaps = _interopRequireDefault(require("./pm-plugins/keymaps"));
17
- var _main = require("./pm-plugins/main");
18
- var _toolbar = require("./toolbar");
19
- var panelPlugin = function panelPlugin(_ref) {
20
- var _ref$config = _ref.config,
21
- options = _ref$config === void 0 ? {} : _ref$config,
22
- api = _ref.api;
23
- return {
24
- name: 'panel',
25
- nodes: function nodes() {
26
- var panelNode = (0, _adfSchema.panel)(!!options.allowCustomPanel);
27
- return [{
28
- name: 'panel',
29
- node: panelNode
30
- }];
31
- },
32
- pmPlugins: function pmPlugins() {
33
- return [{
34
- name: 'panel',
35
- plugin: function plugin(_ref2) {
36
- var providerFactory = _ref2.providerFactory,
37
- dispatch = _ref2.dispatch;
38
- return (0, _main.createPlugin)(dispatch, providerFactory, options);
39
- }
40
- }, {
41
- name: 'panelKeyMap',
42
- plugin: function plugin() {
43
- return (0, _keymaps.default)();
44
- }
45
- }];
46
- },
47
- actions: {
48
- insertPanel: function insertPanel(inputMethod) {
49
- var _api$analytics;
50
- return (0, _actions.insertPanelWithAnalytics)(inputMethod, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
51
- }
52
- },
53
- pluginsOptions: {
54
- quickInsert: function quickInsert(_ref3) {
55
- var formatMessage = _ref3.formatMessage;
56
- var quickInsertOptions = [{
57
- id: 'infopanel',
58
- title: formatMessage(_messages.blockTypeMessages.infoPanel),
59
- keywords: ['panel'],
60
- description: formatMessage(_messages.blockTypeMessages.infoPanelDescription),
61
- priority: 800,
62
- icon: function icon() {
63
- return /*#__PURE__*/_react.default.createElement(_quickInsert.IconPanel, null);
64
- },
65
- action: function action(insert, state) {
66
- return createPanelAction({
67
- state: state,
68
- attributes: {
69
- panelType: _adfSchema.PanelType.INFO
70
- },
71
- api: api
72
- });
73
- }
74
- }, {
75
- id: 'notepanel',
76
- title: formatMessage(_messages.blockTypeMessages.notePanel),
77
- description: formatMessage(_messages.blockTypeMessages.notePanelDescription),
78
- priority: 1000,
79
- icon: function icon() {
80
- return /*#__PURE__*/_react.default.createElement(_quickInsert.IconPanelNote, null);
81
- },
82
- action: function action(insert, state) {
83
- return createPanelAction({
84
- state: state,
85
- attributes: {
86
- panelType: _adfSchema.PanelType.NOTE
87
- },
88
- api: api
89
- });
90
- }
91
- }, {
92
- id: 'successpanel',
93
- title: formatMessage(_messages.blockTypeMessages.successPanel),
94
- description: formatMessage(_messages.blockTypeMessages.successPanelDescription),
95
- keywords: ['tip'],
96
- priority: 1000,
97
- icon: function icon() {
98
- return /*#__PURE__*/_react.default.createElement(_quickInsert.IconPanelSuccess, null);
99
- },
100
- action: function action(insert, state) {
101
- return createPanelAction({
102
- state: state,
103
- attributes: {
104
- panelType: _adfSchema.PanelType.SUCCESS
105
- },
106
- api: api
107
- });
108
- }
109
- }, {
110
- id: 'warningpanel',
111
- title: formatMessage(_messages.blockTypeMessages.warningPanel),
112
- description: formatMessage(_messages.blockTypeMessages.warningPanelDescription),
113
- priority: 1000,
114
- icon: function icon() {
115
- return /*#__PURE__*/_react.default.createElement(_quickInsert.IconPanelWarning, null);
116
- },
117
- action: function action(insert, state) {
118
- return createPanelAction({
119
- state: state,
120
- attributes: {
121
- panelType: _adfSchema.PanelType.WARNING
122
- },
123
- api: api
124
- });
125
- }
126
- }, {
127
- id: 'errorpanel',
128
- title: formatMessage(_messages.blockTypeMessages.errorPanel),
129
- description: formatMessage(_messages.blockTypeMessages.errorPanelDescription),
130
- priority: 1000,
131
- icon: function icon() {
132
- return /*#__PURE__*/_react.default.createElement(_quickInsert.IconPanelError, null);
133
- },
134
- action: function action(insert, state) {
135
- return createPanelAction({
136
- state: state,
137
- attributes: {
138
- panelType: _adfSchema.PanelType.ERROR
139
- },
140
- api: api
141
- });
142
- }
143
- }];
144
- if (options.allowCustomPanel && options.allowCustomPanelEdit) {
145
- quickInsertOptions.push({
146
- id: 'custompanel',
147
- title: formatMessage(_messages.blockTypeMessages.customPanel),
148
- description: formatMessage(_messages.blockTypeMessages.customPanelDescription),
149
- priority: 1000,
150
- icon: function icon() {
151
- return /*#__PURE__*/_react.default.createElement(_quickInsert.IconCustomPanel, null);
152
- },
153
- action: function action(insert, state) {
154
- return createPanelAction({
155
- state: state,
156
- attributes: {
157
- panelType: _adfSchema.PanelType.CUSTOM,
158
- panelIcon: ':rainbow:',
159
- panelIconId: '1f308',
160
- panelIconText: '🌈',
161
- // TODO: https://product-fabric.atlassian.net/browse/DSP-7268
162
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
163
- panelColor: _colors.T50
164
- },
165
- api: api
166
- });
167
- }
168
- });
169
- }
170
- return quickInsertOptions;
171
- },
172
- floatingToolbar: function floatingToolbar(state, intl, providerFactory) {
173
- return (0, _toolbar.getToolbarConfig)(state, intl, options, providerFactory, api);
174
- }
175
- }
176
- };
177
- };
178
-
179
- /**
180
- * Creates panel action and wrap selection transaction with analytics for the panel insertion.
181
- *
182
- * @example
183
- * const tr = createPanelAction({
184
- * state: editorState,
185
- * attributes: { panelType: 'info' },
186
- * });
187
- * if (tr) {
188
- * applyTransaction(tr);
189
- * }
190
- */
191
- function createPanelAction(_ref4) {
192
- var state = _ref4.state,
193
- attributes = _ref4.attributes,
194
- api = _ref4.api;
195
- var tr = (0, _utils.createWrapSelectionTransaction)({
196
- state: state,
197
- type: state.schema.nodes.panel,
198
- nodeAttributes: attributes
199
- });
200
- if (tr) {
201
- var _api$analytics2;
202
- api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
203
- action: _analytics.ACTION.INSERTED,
204
- actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
205
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.PANEL,
206
- attributes: {
207
- inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT,
208
- panelType: attributes.panelType
209
- },
210
- eventType: _analytics.EVENT_TYPE.TRACK
211
- })(tr);
212
- }
213
- return tr;
214
- }
215
- var _default = exports.default = panelPlugin;
@@ -1,44 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.messages = void 0;
7
- var _reactIntlNext = require("react-intl-next");
8
- var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
9
- info: {
10
- id: 'fabric.editor.info',
11
- defaultMessage: 'Info',
12
- description: 'Panels provide a way to highlight text. The info panel has a blue background.'
13
- },
14
- note: {
15
- id: 'fabric.editor.note',
16
- defaultMessage: 'Note',
17
- description: 'Panels provide a way to highlight text. The note panel has a purple background.'
18
- },
19
- success: {
20
- id: 'fabric.editor.success',
21
- defaultMessage: 'Success',
22
- description: 'Panels provide a way to highlight text. The success panel has a green background.'
23
- },
24
- warning: {
25
- id: 'fabric.editor.warning',
26
- defaultMessage: 'Warning',
27
- description: 'Panels provide a way to highlight text. The warning panel has a yellow background.'
28
- },
29
- error: {
30
- id: 'fabric.editor.error',
31
- defaultMessage: 'Error',
32
- description: 'Panels provide a way to highlight text. The error panel has a red background.'
33
- },
34
- emoji: {
35
- id: 'fabric.editor.panel.emoji',
36
- defaultMessage: 'Add emoji',
37
- description: 'Select the panel icon'
38
- },
39
- backgroundColor: {
40
- id: 'fabric.editor.panel.backgroundColor',
41
- defaultMessage: 'Background color',
42
- description: 'Select the panel background color.'
43
- }
44
- });
@@ -1,94 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.panelIcons = exports.getPanelNodeView = exports.PanelIcon = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _react = _interopRequireDefault(require("react"));
11
- var _reactDom = _interopRequireDefault(require("react-dom"));
12
- var _adfSchema = require("@atlaskit/adf-schema");
13
- var _emoji = require("@atlaskit/editor-common/emoji");
14
- var _icons = require("@atlaskit/editor-common/icons");
15
- var _panel = require("@atlaskit/editor-common/panel");
16
- var _model = require("@atlaskit/editor-prosemirror/model");
17
- var _consts = require("@atlaskit/editor-shared-styles/consts");
18
- var _hint = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/hint"));
19
- var _utils = require("../utils");
20
- var panelIcons = exports.panelIcons = {
21
- info: _icons.PanelInfoIcon,
22
- success: _icons.PanelSuccessIcon,
23
- note: _icons.PanelNoteIcon,
24
- tip: _hint.default,
25
- warning: _icons.PanelWarningIcon,
26
- error: _icons.PanelErrorIcon,
27
- custom: _icons.PanelInfoIcon
28
- };
29
- var PanelIcon = exports.PanelIcon = function PanelIcon(props) {
30
- var allowCustomPanel = props.allowCustomPanel,
31
- providerFactory = props.providerFactory,
32
- _props$panelAttribute = props.panelAttributes,
33
- panelType = _props$panelAttribute.panelType,
34
- panelIcon = _props$panelAttribute.panelIcon,
35
- panelIconId = _props$panelAttribute.panelIconId,
36
- panelIconText = _props$panelAttribute.panelIconText;
37
- if (allowCustomPanel && panelIcon && panelType === _adfSchema.PanelType.CUSTOM) {
38
- return /*#__PURE__*/_react.default.createElement(_emoji.Emoji, {
39
- providers: providerFactory,
40
- shortName: panelIcon,
41
- id: panelIconId,
42
- fallback: panelIconText,
43
- showTooltip: false,
44
- allowTextFallback: false,
45
- fitToHeight: _consts.akEditorCustomIconSize
46
- });
47
- }
48
- var Icon = panelIcons[panelType];
49
- return /*#__PURE__*/_react.default.createElement(Icon, {
50
- label: "Panel ".concat(panelType)
51
- });
52
- };
53
- var PanelNodeView = /*#__PURE__*/function () {
54
- function PanelNodeView(node, view, getPos, pluginOptions, providerFactory) {
55
- (0, _classCallCheck2.default)(this, PanelNodeView);
56
- this.providerFactory = providerFactory;
57
- this.pluginOptions = pluginOptions;
58
- this.view = view;
59
- this.node = node;
60
- var _DOMSerializer$render = _model.DOMSerializer.renderSpec(document, (0, _utils.panelAttrsToDom)(node.attrs, pluginOptions.allowCustomPanel || false)),
61
- dom = _DOMSerializer$render.dom,
62
- contentDOM = _DOMSerializer$render.contentDOM;
63
- this.getPos = getPos;
64
- this.dom = dom;
65
- this.contentDOM = contentDOM;
66
- this.icon = this.dom.querySelector(".".concat(_panel.PanelSharedCssClassName.icon));
67
- if (!this.icon) {
68
- return;
69
- }
70
- // set contentEditable as false to be able to select the custom panels with keyboard
71
- this.icon.contentEditable = 'false';
72
- _reactDom.default.render( /*#__PURE__*/_react.default.createElement(PanelIcon, {
73
- allowCustomPanel: pluginOptions.allowCustomPanel,
74
- panelAttributes: node.attrs,
75
- providerFactory: this.providerFactory
76
- }), this.icon);
77
- }
78
- (0, _createClass2.default)(PanelNodeView, [{
79
- key: "ignoreMutation",
80
- value: function ignoreMutation(mutation) {
81
- // ignore mutation if it caused by the icon.
82
- var isIcon = mutation.target === this.icon || mutation.target.parentNode === this.icon;
83
- // ignore mutation if it caused by the lazy load emoji inside icon.
84
- var isInsideIcon = this.icon.contains(mutation.target);
85
- return isIcon || isInsideIcon;
86
- }
87
- }]);
88
- return PanelNodeView;
89
- }();
90
- var getPanelNodeView = exports.getPanelNodeView = function getPanelNodeView(pluginOptions, providerFactory) {
91
- return function (node, view, getPos) {
92
- return new PanelNodeView(node, view, getPos, pluginOptions, providerFactory);
93
- };
94
- };
@@ -1,81 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- exports.keymapPlugin = keymapPlugin;
8
- var _utils = require("@atlaskit/editor-common/utils");
9
- var _keymap = require("@atlaskit/editor-prosemirror/keymap");
10
- var _utils2 = require("@atlaskit/editor-prosemirror/utils");
11
- function findParentNode(selection, nodeType) {
12
- var parentPosition = (0, _utils2.findParentNodeOfType)(nodeType)(selection);
13
- if (parentPosition) {
14
- return parentPosition.node;
15
- }
16
- return null;
17
- }
18
- function isInsideAnEmptyNode(selection, nodeType, schema) {
19
- var parentNode = findParentNode(selection, nodeType);
20
- return parentNode && (0, _utils.isEmptyNode)(schema)(parentNode);
21
- }
22
-
23
- // Somewhat broken and subverted: https://product-fabric.atlassian.net/browse/ED-6504
24
- function keymapPlugin() {
25
- var deleteCurrentItem = function deleteCurrentItem($from, tr) {
26
- return tr.delete($from.before($from.depth) - 1, $from.end($from.depth) + 1);
27
- };
28
- var keymaps = {
29
- Backspace: function Backspace(state, dispatch) {
30
- var _nodeBeforePanel$type;
31
- var selection = state.selection,
32
- nodes = state.schema.nodes,
33
- tr = state.tr;
34
- var panel = nodes.panel,
35
- blockquote = nodes.blockquote;
36
- var $from = selection.$from,
37
- $to = selection.$to;
38
- // Don't do anything if selection is a range
39
- if ($from.pos !== $to.pos) {
40
- return false;
41
- }
42
-
43
- // If not at the start of a panel, no joining will happen so allow default behaviour (backspacing characters etc..)
44
- if ($from.parentOffset !== 0) {
45
- return false;
46
- }
47
- var $previousPos = tr.doc.resolve(Math.max(0, $from.before($from.depth) - 1));
48
- var previousNodeType = $previousPos.pos > 0 && $previousPos.parent && $previousPos.parent.type;
49
- var parentNodeType = $from.parent.type;
50
- var isPreviousNodeAPanel = previousNodeType === panel;
51
- var isParentNodeAPanel = parentNodeType === panel;
52
- var nodeBeforePanel = $previousPos === null || $previousPos === void 0 ? void 0 : $previousPos.nodeBefore;
53
-
54
- // Stops merging panels when deleting empty paragraph in between
55
- // Stops merging blockquotes with panels when deleting from start of blockquote
56
-
57
- if (isPreviousNodeAPanel && !isParentNodeAPanel || isInsideAnEmptyNode(selection, panel, state.schema) || (0, _utils2.hasParentNodeOfType)(blockquote)(selection) ||
58
- // Lift line of panel content up and out of the panel, when backspacing
59
- // at the start of a panel, if the node before the panel is an 'isolating' node
60
- // (for e.g. a table, or an expand), otherwise the default prosemirror backspace
61
- // behaviour will fallback to 'select node backward' logic because the node
62
- // before is an isolating node.
63
- nodeBeforePanel !== null && nodeBeforePanel !== void 0 && (_nodeBeforePanel$type = nodeBeforePanel.type) !== null && _nodeBeforePanel$type !== void 0 && (_nodeBeforePanel$type = _nodeBeforePanel$type.spec) !== null && _nodeBeforePanel$type !== void 0 && _nodeBeforePanel$type.isolating && (0, _utils2.hasParentNodeOfType)(panel)(selection)) {
64
- var content = $from.node($from.depth).content;
65
- var insertPos = $previousPos.pos;
66
- deleteCurrentItem($from, tr).insert(insertPos, content);
67
- if (dispatch) {
68
- dispatch((0, _utils2.setTextSelection)(insertPos)(tr).scrollIntoView());
69
- }
70
- return true;
71
- }
72
- var nodeType = $from.node().type;
73
- if (nodeType !== panel) {
74
- return false;
75
- }
76
- return true;
77
- }
78
- };
79
- return (0, _keymap.keymap)(keymaps);
80
- }
81
- var _default = exports.default = keymapPlugin;
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createPlugin = void 0;
7
- var _panel = require("@atlaskit/editor-common/panel");
8
- var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
9
- var _selection = require("@atlaskit/editor-common/selection");
10
- var _panel2 = require("../nodeviews/panel");
11
- var _types = require("../types");
12
- var createPlugin = exports.createPlugin = function createPlugin(dispatch, providerFactory, pluginOptions) {
13
- var _pluginOptions$useLon = pluginOptions.useLongPressSelection,
14
- useLongPressSelection = _pluginOptions$useLon === void 0 ? false : _pluginOptions$useLon;
15
- return new _safePlugin.SafePlugin({
16
- key: _types.pluginKey,
17
- props: {
18
- nodeViews: {
19
- panel: (0, _panel2.getPanelNodeView)(pluginOptions, providerFactory)
20
- },
21
- handleClickOn: (0, _selection.createSelectionClickHandler)(['panel'], function (target) {
22
- return !!target.closest(".".concat(_panel.PanelSharedCssClassName.prefix));
23
- }, {
24
- useLongPressSelection: useLongPressSelection
25
- })
26
- }
27
- });
28
- };