@atlaskit/editor-core 187.34.2 → 187.35.1

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 (96) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/index.js +10 -42
  3. package/dist/cjs/plugins/block-type/commands/block-type.js +19 -211
  4. package/dist/cjs/plugins/block-type/commands/index.js +2 -28
  5. package/dist/cjs/plugins/block-type/index.js +21 -4
  6. package/dist/cjs/plugins/block-type/pm-plugins/input-rule.js +9 -64
  7. package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +1 -1
  8. package/dist/cjs/plugins/code-block/actions.js +83 -6
  9. package/dist/cjs/plugins/code-block/index.js +27 -12
  10. package/dist/cjs/plugins/code-block/pm-plugins/input-rule.js +68 -0
  11. package/dist/cjs/plugins/date/ui/DatePicker/index.js +3 -2
  12. package/dist/cjs/plugins/expand/commands.js +3 -3
  13. package/dist/cjs/plugins/expand/index.js +2 -2
  14. package/dist/cjs/plugins/index.js +1 -7
  15. package/dist/cjs/plugins/insert-block/index.js +34 -29
  16. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +36 -26
  17. package/dist/cjs/plugins/panel/actions.js +26 -2
  18. package/dist/cjs/plugins/panel/index.js +9 -5
  19. package/dist/cjs/version-wrapper.js +1 -1
  20. package/dist/es2019/index.js +16 -2
  21. package/dist/es2019/plugins/block-type/commands/block-type.js +15 -217
  22. package/dist/es2019/plugins/block-type/commands/index.js +1 -3
  23. package/dist/es2019/plugins/block-type/index.js +21 -4
  24. package/dist/es2019/plugins/block-type/pm-plugins/input-rule.js +3 -56
  25. package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +2 -2
  26. package/dist/es2019/plugins/code-block/actions.js +84 -3
  27. package/dist/es2019/plugins/code-block/index.js +22 -7
  28. package/dist/es2019/plugins/code-block/pm-plugins/input-rule.js +60 -0
  29. package/dist/es2019/plugins/date/ui/DatePicker/index.js +3 -2
  30. package/dist/es2019/plugins/expand/commands.js +1 -1
  31. package/dist/es2019/plugins/expand/index.js +1 -1
  32. package/dist/es2019/plugins/index.js +0 -1
  33. package/dist/es2019/plugins/insert-block/index.js +47 -42
  34. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +35 -26
  35. package/dist/es2019/plugins/panel/actions.js +26 -2
  36. package/dist/es2019/plugins/panel/index.js +8 -4
  37. package/dist/es2019/version-wrapper.js +1 -1
  38. package/dist/esm/index.js +16 -2
  39. package/dist/esm/plugins/block-type/commands/block-type.js +17 -205
  40. package/dist/esm/plugins/block-type/commands/index.js +1 -3
  41. package/dist/esm/plugins/block-type/index.js +21 -4
  42. package/dist/esm/plugins/block-type/pm-plugins/input-rule.js +3 -58
  43. package/dist/esm/plugins/block-type/pm-plugins/keymap.js +2 -2
  44. package/dist/esm/plugins/code-block/actions.js +76 -3
  45. package/dist/esm/plugins/code-block/index.js +25 -11
  46. package/dist/esm/plugins/code-block/pm-plugins/input-rule.js +62 -0
  47. package/dist/esm/plugins/date/ui/DatePicker/index.js +3 -2
  48. package/dist/esm/plugins/expand/commands.js +1 -1
  49. package/dist/esm/plugins/expand/index.js +1 -1
  50. package/dist/esm/plugins/index.js +0 -1
  51. package/dist/esm/plugins/insert-block/index.js +27 -22
  52. package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +37 -27
  53. package/dist/esm/plugins/panel/actions.js +24 -2
  54. package/dist/esm/plugins/panel/index.js +8 -4
  55. package/dist/esm/version-wrapper.js +1 -1
  56. package/dist/types/index.d.ts +16 -3
  57. package/dist/types/labs/next/presets/default.d.ts +6 -0
  58. package/dist/types/plugins/block-type/commands/block-type.d.ts +1 -25
  59. package/dist/types/plugins/block-type/commands/index.d.ts +1 -3
  60. package/dist/types/plugins/block-type/index.d.ts +10 -2
  61. package/dist/types/plugins/code-block/actions.d.ts +11 -0
  62. package/dist/types/plugins/code-block/index.d.ts +6 -1
  63. package/dist/types/plugins/code-block/pm-plugins/input-rule.d.ts +3 -0
  64. package/dist/types/plugins/date/ui/DatePicker/index.d.ts +2 -2
  65. package/dist/types/plugins/index.d.ts +0 -2
  66. package/dist/types/plugins/insert-block/types.d.ts +7 -1
  67. package/dist/types/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +1 -3
  68. package/dist/types/plugins/panel/actions.d.ts +4 -1
  69. package/dist/types/plugins/panel/index.d.ts +11 -2
  70. package/dist/types-ts4.5/index.d.ts +16 -3
  71. package/dist/types-ts4.5/labs/next/presets/default.d.ts +6 -0
  72. package/dist/types-ts4.5/plugins/block-type/commands/block-type.d.ts +1 -25
  73. package/dist/types-ts4.5/plugins/block-type/commands/index.d.ts +1 -3
  74. package/dist/types-ts4.5/plugins/block-type/index.d.ts +10 -2
  75. package/dist/types-ts4.5/plugins/code-block/actions.d.ts +11 -0
  76. package/dist/types-ts4.5/plugins/code-block/index.d.ts +6 -1
  77. package/dist/types-ts4.5/plugins/code-block/pm-plugins/input-rule.d.ts +3 -0
  78. package/dist/types-ts4.5/plugins/date/ui/DatePicker/index.d.ts +2 -2
  79. package/dist/types-ts4.5/plugins/index.d.ts +0 -2
  80. package/dist/types-ts4.5/plugins/insert-block/types.d.ts +7 -1
  81. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +1 -3
  82. package/dist/types-ts4.5/plugins/panel/actions.d.ts +4 -1
  83. package/dist/types-ts4.5/plugins/panel/index.d.ts +9 -2
  84. package/package.json +3 -3
  85. package/report.api.md +62 -23
  86. package/tmp/api-report-tmp.d.ts +49 -15
  87. package/dist/cjs/plugins/block-type/commands/insert-block.js +0 -60
  88. package/dist/es2019/plugins/block-type/commands/insert-block.js +0 -55
  89. package/dist/esm/plugins/block-type/commands/insert-block.js +0 -53
  90. package/dist/types/plugins/block-type/commands/insert-block.d.ts +0 -5
  91. package/dist/types-ts4.5/plugins/block-type/commands/insert-block.d.ts +0 -5
  92. /package/dist/cjs/plugins/{block-type/commands → code-block}/transform-to-code-block.js +0 -0
  93. /package/dist/es2019/plugins/{block-type/commands → code-block}/transform-to-code-block.js +0 -0
  94. /package/dist/esm/plugins/{block-type/commands → code-block}/transform-to-code-block.js +0 -0
  95. /package/dist/types/plugins/{block-type/commands → code-block}/transform-to-code-block.d.ts +0 -0
  96. /package/dist/types-ts4.5/plugins/{block-type/commands → code-block}/transform-to-code-block.d.ts +0 -0
@@ -24,7 +24,7 @@ var PopupWithListeners = withOuterListeners(Popup);
24
24
  import { INPUT_METHOD } from '../../../analytics/types/enums';
25
25
  import { injectIntl } from 'react-intl-next';
26
26
  import DatePickerInput from './date-picker-input';
27
- var popupContentWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 2px;\n border-radius: ", "px;\n box-shadow: ", ";\n background-color: ", ";\n"])), borderRadius(), "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N60A, ", 0 0 1px ").concat(N60A), ")"), "var(--ds-surface-overlay, ".concat(N0, ")"));
27
+ var popupContentWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: ", ";\n border-radius: ", "px;\n box-shadow: ", ";\n background-color: ", ";\n"])), "var(--ds-space-025, 2px)", borderRadius(), "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N60A, ", 0 0 1px ").concat(N60A), ")"), "var(--ds-surface-overlay, ".concat(N0, ")"));
28
28
  var DatePicker = /*#__PURE__*/function (_React$Component) {
29
29
  _inherits(DatePicker, _React$Component);
30
30
  var _super = _createSuper(DatePicker);
@@ -151,7 +151,8 @@ var DatePicker = /*#__PURE__*/function (_React$Component) {
151
151
  year: year,
152
152
  selected: selected,
153
153
  ref: this.handleRef,
154
- weekStartDay: weekStartDay
154
+ weekStartDay: weekStartDay,
155
+ testId: 'datepicker'
155
156
  })));
156
157
  }
157
158
  }]);
@@ -7,7 +7,7 @@ import { addAnalytics, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD,
7
7
  import { GapCursorSelection, Side } from '../selection/gap-cursor-selection';
8
8
  import { findExpand } from './utils';
9
9
  import { createCommand } from './pm-plugins/plugin-factory';
10
- import { createWrapSelectionTransaction } from '../block-type/commands/block-type';
10
+ import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
11
11
  import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
12
12
  export var setExpandRef = function setExpandRef(ref) {
13
13
  return createCommand({
@@ -8,7 +8,7 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, IN
8
8
  import { getToolbarConfig } from './toolbar';
9
9
  import { createExpandNode } from './commands';
10
10
  import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
11
- import { createWrapSelectionTransaction } from '../block-type/commands/block-type';
11
+ import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
12
12
  var expandPlugin = function expandPlugin(_ref) {
13
13
  var _api$featureFlags;
14
14
  var _ref$config = _ref.config,
@@ -1,6 +1,5 @@
1
1
  export { basePlugin } from './base';
2
2
  export { default as blockTypePlugin } from './block-type';
3
- export { pluginKey as blockPluginStateKey } from './block-type';
4
3
  export { default as betterTypeHistoryPlugin } from './better-type-history';
5
4
  export { default as clearMarksOnChangeToEmptyDocumentPlugin } from './clear-marks-on-change-to-empty-document';
6
5
  export { default as codeBlockPlugin } from './code-block';
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
3
- import { pluginKey as blockTypeStateKey } from '../block-type/pm-plugins/main';
4
3
  import { stateKey as mediaStateKey } from '../media/pm-plugins/plugin-key';
5
4
  import { isTypeAheadAllowed } from '../type-ahead/utils';
6
5
  import { pluginKey as layoutStateKey } from '../layout';
@@ -8,7 +7,7 @@ import { insertMacroFromMacroBrowser } from '../macro';
8
7
  import WithPluginState from '../../ui/WithPluginState';
9
8
  import ToolbarInsertBlock from './ui/ToolbarInsertBlock';
10
9
  import { pluginKey as typeAheadPluginKey } from '../type-ahead/pm-plugins/key';
11
- import { insertBlockTypesWithAnalytics } from '../block-type/commands';
10
+ import { BLOCK_QUOTE, CODE_BLOCK, PANEL } from '../block-type/types';
12
11
  import { INPUT_METHOD } from '../analytics';
13
12
  import { pluginKey as placeholderTextStateKey } from '../placeholder-text/plugin-key';
14
13
  import { pluginKey as macroStateKey } from '../macro/plugin-key';
@@ -27,6 +26,26 @@ var toolbarSizeToButtons = function toolbarSizeToButtons(toolbarSize) {
27
26
  return 0;
28
27
  }
29
28
  };
29
+ /**
30
+ * Wrapper over insertBlockTypeWithAnalytics to autobind toolbar input method
31
+ * @param name Block name
32
+ */
33
+ function handleInsertBlockType(insertCodeBlock, insertPanel, insertBlockQuote) {
34
+ return function (name) {
35
+ if (name === CODE_BLOCK.name && insertCodeBlock) {
36
+ return insertCodeBlock(INPUT_METHOD.TOOLBAR);
37
+ }
38
+ if (name === PANEL.name && insertPanel) {
39
+ return insertPanel(INPUT_METHOD.TOOLBAR);
40
+ }
41
+ if (name === BLOCK_QUOTE.name && insertBlockQuote) {
42
+ return insertBlockQuote(INPUT_METHOD.TOOLBAR);
43
+ }
44
+ return function () {
45
+ return false;
46
+ };
47
+ };
48
+ }
30
49
  var insertBlockPlugin = function insertBlockPlugin(_ref) {
31
50
  var _api$featureFlags;
32
51
  var _ref$config = _ref.config,
@@ -53,16 +72,13 @@ var insertBlockPlugin = function insertBlockPlugin(_ref) {
53
72
  return /*#__PURE__*/React.createElement(WithPluginState, {
54
73
  plugins: {
55
74
  typeAheadState: typeAheadPluginKey,
56
- // needed to check isTypeAheadAllowed in ToolbarInsertBlock
57
- blockTypeState: blockTypeStateKey,
58
75
  mediaState: mediaStateKey,
59
76
  macroState: macroStateKey,
60
77
  placeholderTextState: placeholderTextStateKey,
61
78
  layoutState: layoutStateKey
62
79
  },
63
80
  render: function render(_ref3) {
64
- var blockTypeState = _ref3.blockTypeState,
65
- mediaState = _ref3.mediaState,
81
+ var mediaState = _ref3.mediaState,
66
82
  _ref3$macroState = _ref3.macroState,
67
83
  macroState = _ref3$macroState === void 0 ? {} : _ref3$macroState,
68
84
  placeholderTextState = _ref3.placeholderTextState,
@@ -81,7 +97,6 @@ var insertBlockPlugin = function insertBlockPlugin(_ref) {
81
97
  isToolbarReducedSpacing: isToolbarReducedSpacing,
82
98
  isLastItem: isLastItem,
83
99
  featureFlags: featureFlags,
84
- blockTypeState: blockTypeState,
85
100
  mediaState: mediaState,
86
101
  macroState: macroState,
87
102
  placeholderTextState: placeholderTextState,
@@ -101,11 +116,10 @@ var insertBlockPlugin = function insertBlockPlugin(_ref) {
101
116
  };
102
117
  };
103
118
  function ToolbarInsertBlockWithInjectionApi(_ref4) {
104
- var _pluginInjectionApi$a2, _pluginInjectionApi$i;
119
+ var _pluginInjectionApi$i, _pluginInjectionApi$c, _pluginInjectionApi$p, _pluginInjectionApi$b;
105
120
  var editorView = _ref4.editorView,
106
121
  editorActions = _ref4.editorActions,
107
122
  dispatchAnalyticsEvent = _ref4.dispatchAnalyticsEvent,
108
- providerFactory = _ref4.providerFactory,
109
123
  popupsMountPoint = _ref4.popupsMountPoint,
110
124
  popupsBoundariesElement = _ref4.popupsBoundariesElement,
111
125
  popupsScrollableElement = _ref4.popupsScrollableElement,
@@ -116,28 +130,19 @@ function ToolbarInsertBlockWithInjectionApi(_ref4) {
116
130
  providers = _ref4.providers,
117
131
  pluginInjectionApi = _ref4.pluginInjectionApi,
118
132
  options = _ref4.options,
119
- blockTypeState = _ref4.blockTypeState,
120
133
  mediaState = _ref4.mediaState,
121
134
  macroState = _ref4.macroState,
122
135
  placeholderTextState = _ref4.placeholderTextState,
123
136
  layoutState = _ref4.layoutState,
124
137
  featureFlags = _ref4.featureFlags;
125
138
  var buttons = toolbarSizeToButtons(toolbarSize);
126
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji']),
139
+ var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType']),
127
140
  dateState = _useSharedPluginState.dateState,
128
141
  hyperlinkState = _useSharedPluginState.hyperlinkState,
129
142
  imageUploadState = _useSharedPluginState.imageUploadState,
130
143
  mentionState = _useSharedPluginState.mentionState,
131
- emojiState = _useSharedPluginState.emojiState;
132
-
133
- /**
134
- * Wrapper over insertBlockTypeWithAnalytics to autobind toolbar input method
135
- * @param name Block name
136
- */
137
- var handleInsertBlockType = React.useCallback(function (name) {
138
- var _pluginInjectionApi$a;
139
- return insertBlockTypesWithAnalytics(name, INPUT_METHOD.TOOLBAR, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions);
140
- }, [pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions]);
144
+ emojiState = _useSharedPluginState.emojiState,
145
+ blockTypeState = _useSharedPluginState.blockTypeState;
141
146
  return /*#__PURE__*/React.createElement(ToolbarInsertBlock, {
142
147
  pluginInjectionApi: pluginInjectionApi,
143
148
  buttons: buttons,
@@ -167,7 +172,7 @@ function ToolbarInsertBlockWithInjectionApi(_ref4) {
167
172
  emojiProvider: providers.emojiProvider,
168
173
  nativeStatusSupported: options.nativeStatusSupported,
169
174
  horizontalRuleEnabled: options.horizontalRuleEnabled,
170
- onInsertBlockType: handleInsertBlockType,
175
+ onInsertBlockType: handleInsertBlockType(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.codeBlock) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.insertCodeBlock, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$p = pluginInjectionApi.panel) === null || _pluginInjectionApi$p === void 0 ? void 0 : _pluginInjectionApi$p.actions.insertPanel, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$b = pluginInjectionApi.blockType) === null || _pluginInjectionApi$b === void 0 ? void 0 : _pluginInjectionApi$b.actions.insertBlockQuote),
171
176
  onInsertMacroFromMacroBrowser: insertMacroFromMacroBrowser,
172
177
  macroProvider: macroState.macroProvider,
173
178
  popupsMountPoint: popupsMountPoint,
@@ -13,7 +13,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
13
13
  /** @jsx jsx */
14
14
  import React from 'react';
15
15
  import { jsx } from '@emotion/react';
16
- import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
16
+ import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
17
17
  import { getMediaClient } from '@atlaskit/media-client';
18
18
  import { calcPctFromPx, wrappedLayouts, handleSides, imageAlignmentMap } from '@atlaskit/editor-common/ui';
19
19
  import { nonWrappedLayouts, setNodeSelection } from '@atlaskit/editor-common/utils';
@@ -71,7 +71,6 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
71
71
  _defineProperty(_assertThisInitialized(_this), "calcNewSize", function (newWidth, stop) {
72
72
  var _this$props2 = _this.props,
73
73
  layout = _this$props2.layout,
74
- state = _this$props2.view.state,
75
74
  containerWidth = _this$props2.containerWidth,
76
75
  lineLength = _this$props2.lineLength,
77
76
  fullWidthMode = _this$props2.fullWidthMode;
@@ -79,29 +78,32 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
79
78
  _this.setState({
80
79
  resizedPctWidth: newPct
81
80
  });
82
- var newLayout = hasParentNodeOfType(state.schema.nodes.table)(state.selection) ? layout : _this.calcUnwrappedLayout(newWidth, containerWidth, lineLength, fullWidthMode);
81
+ var newLayout = _this.calcUnwrappedLayout(newWidth, containerWidth, lineLength, fullWidthMode, _this.isNestedNode());
83
82
  if (newPct <= 100) {
84
83
  if (_this.wrappedLayout && (stop ? newPct !== 100 : true)) {
85
84
  newLayout = layout;
86
85
  }
87
86
  return {
88
- width: newPct,
89
87
  layout: newLayout
90
88
  };
91
89
  } else {
92
90
  return {
93
- width: _this.props.pctWidth || null,
94
91
  layout: newLayout
95
92
  };
96
93
  }
97
94
  });
98
- _defineProperty(_assertThisInitialized(_this), "calcUnwrappedLayout", function (width, containerWidth, contentWidth, fullWidthMode) {
95
+ _defineProperty(_assertThisInitialized(_this), "calcUnwrappedLayout", function (width, containerWidth, contentWidth, fullWidthMode, isNestedNode) {
96
+ if (isNestedNode) {
97
+ return 'center';
98
+ }
99
99
  if (fullWidthMode) {
100
100
  if (width < contentWidth) {
101
101
  return 'center';
102
102
  }
103
103
  return 'full-width';
104
104
  }
105
+
106
+ // handle top-level node in fixed-width editor
105
107
  if (width <= contentWidth) {
106
108
  return 'center';
107
109
  }
@@ -147,7 +149,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
147
149
  return dispatch(tr);
148
150
  }, MEDIA_SINGLE_RESIZE_THROTTLE_TIME));
149
151
  _defineProperty(_assertThisInitialized(_this), "calcMaxWidth", memoizeOne(function (contentWidth, containerWidth, fullWidthMode) {
150
- if (fullWidthMode) {
152
+ if (_this.isNestedNode() || fullWidthMode) {
151
153
  return contentWidth;
152
154
  }
153
155
  return calcMediaSingleMaxWidth(containerWidth);
@@ -262,14 +264,20 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
262
264
  }
263
265
  _this.setIsResizing(false);
264
266
  _this.displayGuideline([]);
267
+ var newWidth = width;
268
+ if (calculatedWidthWithLayout.layout === 'full-width') {
269
+ // When a node reaches full width in current viewport,
270
+ // update its width with 1800 to align with pixel entry
271
+ newWidth = akEditorFullWidthLayoutWidth;
272
+ }
265
273
  _this.setState({
266
274
  isResizing: false,
267
275
  size: {
268
- width: width,
276
+ width: newWidth,
269
277
  height: height
270
278
  }
271
279
  }, function () {
272
- updateSize(width, calculatedWidthWithLayout.layout);
280
+ updateSize(newWidth, calculatedWidthWithLayout.layout);
273
281
  });
274
282
  });
275
283
  var initialWidth = props.mediaSingleWidth || DEFAULT_IMAGE_WIDTH;
@@ -291,7 +299,6 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
291
299
  _createClass(ResizableMediaSingleNext, [{
292
300
  key: "componentDidUpdate",
293
301
  value: function componentDidUpdate(prevProps) {
294
- var _this2 = this;
295
302
  var offsetLeft = calculateOffsetLeft(this.insideInlineLike, this.insideLayout, this.props.view.dom, this.wrapper);
296
303
  if (offsetLeft !== this.state.offsetLeft && offsetLeft >= 0) {
297
304
  this.setState({
@@ -317,18 +324,6 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
317
324
  }
318
325
  });
319
326
  }
320
- if (this.props.layout === 'full-width' && !this.isNestedNode() && prevProps.containerWidth !== this.props.containerWidth) {
321
- // To achieve edge-to-edge for full-width, we need to update its width according to containerWidth
322
- // Update state to allow resizer to get most up-to-date width to avoid jumping when start resizing
323
- this.setState(function (prevState) {
324
- return {
325
- size: {
326
- width: calcMediaSingleMaxWidth(_this2.props.containerWidth),
327
- height: prevState.size.height
328
- }
329
- };
330
- });
331
- }
332
327
  return true;
333
328
  }
334
329
  }, {
@@ -496,7 +491,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
496
491
  }, {
497
492
  key: "render",
498
493
  value: function render() {
499
- var _this3 = this;
494
+ var _this2 = this;
500
495
  var _this$props8 = this.props,
501
496
  origWidth = _this$props8.width,
502
497
  layout = _this$props8.layout,
@@ -514,7 +509,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
514
509
  handleSides.forEach(function (side) {
515
510
  var oppositeSide = side === 'left' ? 'right' : 'left';
516
511
  enable[side] = nonWrappedLayouts.concat("wrap-".concat(oppositeSide)).concat("align-".concat(imageAlignmentMap[oppositeSide])).indexOf(layout) > -1;
517
- if (side === 'left' && _this3.insideInlineLike) {
512
+ if (side === 'left' && _this2.insideInlineLike) {
518
513
  enable[side] = false;
519
514
  }
520
515
  });
@@ -526,9 +521,23 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
526
521
  'rich-media-wrapped': layout === 'wrap-left' || layout === 'wrap-right'
527
522
  });
528
523
  var resizerNextClassName = classnames(className, resizerStyles);
529
- var maxWidth = this.isNestedNode() ? undefined // fall back to 'max-width: 100%'
530
- : this.calcMaxWidth(lineLength, containerWidth, fullWidthMode);
524
+ var maxWidth = !isResizing && this.isNestedNode() ?
525
+ // set undefined to fall back to 100%
526
+ undefined : this.calcMaxWidth(lineLength, containerWidth, fullWidthMode);
531
527
  var minWidth = this.calcMinWidth(isVideoFile, lineLength);
528
+ var nestedHandleStyles = function nestedHandleStyles(isNestedNode) {
529
+ if (!isNestedNode) {
530
+ return;
531
+ }
532
+ return {
533
+ left: {
534
+ left: "calc(".concat("var(--ds-space-075, 0.375em)", " * -1)")
535
+ },
536
+ right: {
537
+ right: "calc(".concat("var(--ds-space-075, 0.375em)", " * -1)")
538
+ }
539
+ };
540
+ };
532
541
  return jsx("div", {
533
542
  ref: this.saveWrapper,
534
543
  css: wrapperStyle({
@@ -554,7 +563,8 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
554
563
  resizeRatio: nonWrappedLayouts.includes(layout) ? 2 : 1,
555
564
  handleComponent: handleComponent,
556
565
  "data-testid": resizerNextTestId,
557
- isHandleVisible: selected
566
+ isHandleVisible: selected,
567
+ handleStyles: nestedHandleStyles(this.isNestedNode())
558
568
  }, children));
559
569
  }
560
570
  }]);
@@ -3,9 +3,12 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import { removeParentNodeOfType, findSelectedNodeOfType, removeSelectedNode, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
5
5
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
6
- import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, addAnalytics } from '../analytics';
6
+ import { PanelType } from '@atlaskit/adf-schema';
7
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD, EVENT_TYPE, addAnalytics } from '../analytics';
7
8
  import { findPanel } from './utils';
8
9
  import { getPanelTypeBackgroundNoTokens } from '@atlaskit/editor-common/panel';
10
+ import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
11
+ import { wrapSelectionIn } from '@atlaskit/editor-common/utils';
9
12
  export var removePanel = function removePanel() {
10
13
  return function (state, dispatch) {
11
14
  var nodes = state.schema.nodes,
@@ -88,4 +91,23 @@ export var changePanelType = function changePanelType(panelType) {
88
91
  }
89
92
  return true;
90
93
  };
91
- };
94
+ };
95
+ export function insertPanelWithAnalytics(inputMethod, analyticsAPI) {
96
+ return withAnalytics(analyticsAPI, {
97
+ action: ACTION.INSERTED,
98
+ actionSubject: ACTION_SUBJECT.DOCUMENT,
99
+ actionSubjectId: ACTION_SUBJECT_ID.PANEL,
100
+ attributes: {
101
+ inputMethod: inputMethod,
102
+ panelType: PanelType.INFO // only info panels can be inserted via this action
103
+ },
104
+
105
+ eventType: EVENT_TYPE.TRACK
106
+ })(function (state, dispatch) {
107
+ var nodes = state.schema.nodes;
108
+ if (nodes.panel && nodes.paragraph) {
109
+ return wrapSelectionIn(nodes.panel)(state, dispatch);
110
+ }
111
+ return false;
112
+ });
113
+ }
@@ -5,13 +5,11 @@ import { getToolbarConfig } from './toolbar';
5
5
  import keymap from './pm-plugins/keymaps';
6
6
  import { addAnalytics, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD, EVENT_TYPE } from '../analytics';
7
7
  import { IconPanel, IconPanelNote, IconPanelSuccess, IconPanelWarning, IconPanelError } from '@atlaskit/editor-common/quick-insert';
8
+ import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
8
9
  import { messages } from '../block-type/messages';
9
10
  import { IconCustomPanel } from '@atlaskit/editor-common/quick-insert';
10
11
  import { T50 } from '@atlaskit/theme/colors';
11
- // Theres an existing interelationship between these files, where the imported function is being called for panel
12
- // Insertions via the drop down menu
13
- // tslint-ignore-next-line
14
- import { createWrapSelectionTransaction } from '../block-type/commands/block-type';
12
+ import { insertPanelWithAnalytics } from './actions';
15
13
  var panelPlugin = function panelPlugin(_ref) {
16
14
  var _ref$config = _ref.config,
17
15
  options = _ref$config === void 0 ? {} : _ref$config,
@@ -40,6 +38,12 @@ var panelPlugin = function panelPlugin(_ref) {
40
38
  }
41
39
  }];
42
40
  },
41
+ actions: {
42
+ insertPanel: function insertPanel(inputMethod) {
43
+ var _api$analytics;
44
+ return insertPanelWithAnalytics(inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
45
+ }
46
+ },
43
47
  pluginsOptions: {
44
48
  quickInsert: function quickInsert(_ref3) {
45
49
  var formatMessage = _ref3.formatMessage;
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.34.2";
2
+ export var version = "187.35.1";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -24,12 +24,25 @@ export { textColorPluginKey } from './plugins/text-color';
24
24
  export type { TextColorPluginState } from './plugins/text-color';
25
25
  export { changeColor } from './plugins/text-color/commands/change-color';
26
26
  export { insertHorizontalRule } from './plugins/rule/commands';
27
- export { blockPluginStateKey } from './plugins';
28
- export type { BlockTypeState } from './plugins';
27
+ export type { BlockTypeState } from './plugins/block-type/pm-plugins/main';
28
+ /**
29
+ * @private
30
+ * @deprecated DO NOT USE, temporary solution while decoupling plugins from editor-core
31
+ */
32
+ export type { BlockTypePlugin } from './plugins/block-type';
33
+ /**
34
+ * @private
35
+ * @deprecated DO NOT USE, temporary solution while decoupling plugins from editor-core
36
+ */
37
+ export type { CodeBlockPlugin } from './plugins/code-block';
38
+ /**
39
+ * @private
40
+ * @deprecated DO NOT USE, temporary solution while decoupling plugins from editor-core
41
+ */
42
+ export type { PanelPlugin } from './plugins/panel';
29
43
  export { subscribeToToolbarAndPickerUpdates } from './plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates';
30
44
  export { subscribeTypeAheadUpdates } from './plugins/view-update-subscription/subscribe/type-ahead-updates';
31
45
  export type { InputMethodToolbar as TextFormattingInputMethodToolbar, InputMethodBasic as TextFormattingInputMethodBasic, } from '@atlaskit/editor-common/types';
32
- export { insertBlockType, insertBlockTypesWithAnalytics, setBlockType, setBlockTypeWithAnalytics, } from './plugins/block-type/commands';
33
46
  export type { InputMethod as BlockTypeInputMethod } from './plugins/block-type/commands';
34
47
  export { createTable } from '@atlaskit/editor-plugin-table/commands';
35
48
  export { insertTaskDecisionCommand } from './plugins/tasks-and-decisions/commands';
@@ -56,6 +56,9 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
56
56
  }, import("@atlaskit/editor-common/types").FeatureFlags>];
57
57
  actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
58
58
  }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>];
59
+ actions: {
60
+ insertCodeBlock: (inputMethod: import("@atlaskit/editor-common/analytics").INPUT_METHOD) => import("@atlaskit/editor-common/types").Command;
61
+ };
59
62
  }, CodeBlockOptions>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"selection", {
60
63
  pluginConfiguration: SelectionPluginOptions | undefined;
61
64
  }, SelectionPluginOptions | undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"floatingToolbar", {
@@ -181,6 +184,9 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
181
184
  }, import("@atlaskit/editor-common/types").FeatureFlags>];
182
185
  actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
183
186
  }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>];
187
+ actions: {
188
+ insertCodeBlock: (inputMethod: import("@atlaskit/editor-common/analytics").INPUT_METHOD) => import("@atlaskit/editor-common/types").Command;
189
+ };
184
190
  }, CodeBlockOptions>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"selection", {
185
191
  pluginConfiguration: SelectionPluginOptions | undefined;
186
192
  }, SelectionPluginOptions | undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"floatingToolbar", {
@@ -1,5 +1,3 @@
1
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
- import type { NodeType } from '@atlaskit/editor-prosemirror/model';
3
1
  import type { HeadingLevelsAndNormalText, Command } from '@atlaskit/editor-common/types';
4
2
  import type { INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
5
3
  export type InputMethod = INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FORMATTING | INPUT_METHOD.KEYBOARD;
@@ -9,7 +7,6 @@ export declare function setNormalText(): Command;
9
7
  export declare function setNormalTextWithAnalytics(inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined): Command;
10
8
  export declare function setHeading(level: HeadingLevelsAndNormalText): Command;
11
9
  export declare const setHeadingWithAnalytics: (newHeadingLevel: HeadingLevelsAndNormalText, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
12
- export declare function insertBlockType(name: string): Command;
13
10
  /**
14
11
  *
15
12
  * @param name - block type name
@@ -18,26 +15,5 @@ export declare function insertBlockType(name: string): Command;
18
15
  * otherwise Editor becomes very sad and crashes
19
16
  * @returns - command that inserts block type
20
17
  */
21
- export declare const insertBlockTypesWithAnalytics: (name: string, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
22
- /**
23
- * This function creates a new transaction that wraps the current selection
24
- * in the specified node type if it results in a valid transaction.
25
- * If not valid, it performs a safe insert operation.
26
- *
27
- * Example of when wrapping might not be valid is when attempting to wrap
28
- * content that is already inside a panel with another panel
29
- */
30
- export declare function createWrapSelectionTransaction({ state, type, nodeAttributes, }: {
31
- state: EditorState;
32
- type: NodeType;
33
- nodeAttributes?: Record<string, any>;
34
- }): import("prosemirror-state").Transaction;
35
- /**
36
- * This function creates a new transaction that inserts a code block,
37
- * if there is text selected it will wrap the current selection if not it will
38
- * append the codeblock to the end of the document.
39
- */
40
- export declare function createInsertCodeBlockTransaction({ state, }: {
41
- state: EditorState;
42
- }): import("prosemirror-state").Transaction;
18
+ export declare const insertBlockQuoteWithAnalytics: (inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
43
19
  export declare const cleanUpAtTheStartOfDocument: Command;
@@ -1,6 +1,4 @@
1
- export { cleanUpAtTheStartOfDocument, insertBlockType, insertBlockTypesWithAnalytics, setBlockType, setBlockTypeWithAnalytics, setHeading, setHeadingWithAnalytics, setNormalText, setNormalTextWithAnalytics, } from './block-type';
1
+ export { cleanUpAtTheStartOfDocument, insertBlockQuoteWithAnalytics, setBlockType, setBlockTypeWithAnalytics, setHeading, setHeadingWithAnalytics, setNormalText, setNormalTextWithAnalytics, } from './block-type';
2
2
  export type { InputMethod } from './block-type';
3
- export { insertBlock } from './insert-block';
4
- export { isConvertableToCodeBlock, transformToCodeBlockAction, } from './transform-to-code-block';
5
3
  export { deleteAndMoveCursor } from './delete-and-move-cursor';
6
4
  export { deleteBlockContent } from './delete-block-content';
@@ -1,10 +1,18 @@
1
- import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
1
+ import type { NextEditorPlugin, OptionalPlugin, Command } from '@atlaskit/editor-common/types';
2
2
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
+ import type { BlockTypeState } from './pm-plugins/main';
3
4
  import type { BlockTypePluginOptions } from './types';
4
- declare const blockTypePlugin: NextEditorPlugin<'blockType', {
5
+ import type { InputMethod } from './commands/block-type';
6
+ export type BlockTypePlugin = NextEditorPlugin<'blockType', {
5
7
  pluginConfiguration: BlockTypePluginOptions | undefined;
6
8
  dependencies: [OptionalPlugin<typeof analyticsPlugin>];
9
+ sharedState: BlockTypeState | undefined;
10
+ actions: {
11
+ insertBlockQuote: (inputMethod: InputMethod) => Command;
12
+ setBlockType: (name: string, inputMethod: InputMethod) => Command;
13
+ };
7
14
  }>;
15
+ declare const blockTypePlugin: BlockTypePlugin;
8
16
  export default blockTypePlugin;
9
17
  export { pluginKey } from './pm-plugins/main';
10
18
  export type { BlockTypeState } from './pm-plugins/main';
@@ -1,7 +1,18 @@
1
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
1
2
  import type { Command } from '../../types';
3
+ import type { INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
4
  export declare const removeCodeBlock: Command;
3
5
  export declare const changeLanguage: (language: string) => Command;
4
6
  export declare const copyContentToClipboard: Command;
5
7
  export declare const resetCopiedState: Command;
6
8
  export declare const ignoreFollowingMutations: Command;
7
9
  export declare const resetShouldIgnoreFollowingMutations: Command;
10
+ /**
11
+ * This function creates a new transaction that inserts a code block,
12
+ * if there is text selected it will wrap the current selection if not it will
13
+ * append the codeblock to the end of the document.
14
+ */
15
+ export declare function createInsertCodeBlockTransaction({ state, }: {
16
+ state: EditorState;
17
+ }): import("prosemirror-state").Transaction;
18
+ export declare function insertCodeBlockWithAnalytics(inputMethod: INPUT_METHOD, analyticsAPI?: EditorAnalyticsAPI): Command;
@@ -1,4 +1,5 @@
1
- import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
1
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
+ import type { NextEditorPlugin, OptionalPlugin, Command } from '@atlaskit/editor-common/types';
2
3
  import type { CodeBlockOptions } from './types';
3
4
  import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
4
5
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
@@ -10,5 +11,9 @@ declare const codeBlockPlugin: NextEditorPlugin<'codeBlock', {
10
11
  typeof compositionPlugin,
11
12
  OptionalPlugin<typeof analyticsPlugin>
12
13
  ];
14
+ actions: {
15
+ insertCodeBlock: (inputMethod: INPUT_METHOD) => Command;
16
+ };
13
17
  }>;
14
18
  export default codeBlockPlugin;
19
+ export type CodeBlockPlugin = typeof codeBlockPlugin;
@@ -0,0 +1,3 @@
1
+ import type { Schema } from '@atlaskit/editor-prosemirror/model';
2
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
+ export declare function createCodeBlockInputRule(schema: Schema, editorAnalyticsAPI?: EditorAnalyticsAPI): import("@atlaskit/editor-common/safe-plugin").SafePlugin<any>;
@@ -1,10 +1,10 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import type { WeekDay } from '@atlaskit/calendar/types';
4
- import { DateType } from '../../types';
4
+ import type { DateType } from '../../types';
5
5
  import { INPUT_METHOD } from '../../../analytics/types/enums';
6
6
  import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
7
- import { WrappedComponentProps } from 'react-intl-next';
7
+ import type { WrappedComponentProps } from 'react-intl-next';
8
8
  export interface Props {
9
9
  element: HTMLElement | null;
10
10
  closeDatePicker: () => void;
@@ -1,7 +1,5 @@
1
1
  export { basePlugin } from './base';
2
2
  export { default as blockTypePlugin } from './block-type';
3
- export { pluginKey as blockPluginStateKey } from './block-type';
4
- export type { BlockTypeState } from './block-type';
5
3
  export { default as betterTypeHistoryPlugin } from './better-type-history';
6
4
  export { default as clearMarksOnChangeToEmptyDocumentPlugin } from './clear-marks-on-change-to-empty-document';
7
5
  export { default as codeBlockPlugin } from './code-block';
@@ -8,14 +8,20 @@ import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
8
8
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
9
9
  import type mentionsPlugin from '../mentions';
10
10
  import type quickInsertPlugin from '../quick-insert';
11
+ import type blockTypePlugin from '../block-type';
12
+ import type codeBlockPlugin from '../code-block';
13
+ import type panelPlugin from '../panel';
11
14
  export type InsertBlockPluginDependencies = [
12
15
  typeof featureFlagsPlugin,
13
16
  OptionalPlugin<typeof tablesPlugin>,
14
17
  OptionalPlugin<typeof hyperlinkPlugin>,
15
18
  OptionalPlugin<typeof datePlugin>,
19
+ OptionalPlugin<typeof blockTypePlugin>,
16
20
  OptionalPlugin<typeof analyticsPlugin>,
17
21
  OptionalPlugin<ImageUploadPlugin>,
18
22
  OptionalPlugin<typeof mentionsPlugin>,
19
23
  OptionalPlugin<EmojiPlugin>,
20
- OptionalPlugin<typeof quickInsertPlugin>
24
+ OptionalPlugin<typeof quickInsertPlugin>,
25
+ OptionalPlugin<typeof codeBlockPlugin>,
26
+ OptionalPlugin<typeof panelPlugin>
21
27
  ];