@atlaskit/editor-plugin-panel 4.2.7 → 4.2.9

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-plugin-panel
2
2
 
3
+ ## 4.2.9
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 4.2.8
10
+
11
+ ### Patch Changes
12
+
13
+ - [#126653](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/126653)
14
+ [`ead76c1d57ed4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ead76c1d57ed4) -
15
+ When `platform_editor_controls` is enabled for experimental group, force panel to always insert
16
+ content when quick inserted
17
+ - Updated dependencies
18
+
3
19
  ## 4.2.7
4
20
 
5
21
  ### Patch Changes
@@ -10,6 +10,7 @@ var _adfSchema = require("@atlaskit/adf-schema");
10
10
  var _analytics = require("@atlaskit/editor-common/analytics");
11
11
  var _messages = require("@atlaskit/editor-common/messages");
12
12
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
13
+ var _utils = require("@atlaskit/editor-common/utils");
13
14
  var _colors = require("@atlaskit/theme/colors");
14
15
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
15
16
  var _actions = require("./editor-actions/actions");
@@ -226,11 +227,23 @@ function createPanelAction(_ref4) {
226
227
  api = _ref4.api,
227
228
  insert = _ref4.insert;
228
229
  var panel = state.schema.nodes.panel;
229
- var node = panel.createAndFill(attributes);
230
- if (!node) {
231
- return false;
230
+ var tr;
231
+
232
+ // Panels should wrap content by default when inserted, the quickInsert `insert` method
233
+ // will insert the node on a newline
234
+ if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
235
+ tr = state.selection.empty && (0, _utils.createWrapSelectionTransaction)({
236
+ state: state,
237
+ type: panel,
238
+ nodeAttributes: attributes
239
+ });
240
+ } else {
241
+ var node = panel.createAndFill(attributes);
242
+ if (!node) {
243
+ return false;
244
+ }
245
+ tr = state.selection.empty && insert(node);
232
246
  }
233
- var tr = state.selection.empty && insert(node);
234
247
  if (tr) {
235
248
  var _api$analytics2;
236
249
  api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
@@ -3,6 +3,7 @@ import { extendedPanel, panelWithoutNestedNonBodiedMacros, PanelType } from '@at
3
3
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { blockTypeMessages } from '@atlaskit/editor-common/messages';
5
5
  import { IconCustomPanel, IconPanel, IconPanelError, IconPanelNote, IconPanelSuccess, IconPanelWarning } from '@atlaskit/editor-common/quick-insert';
6
+ import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
6
7
  import { T50 } from '@atlaskit/theme/colors';
7
8
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
8
9
  import { insertPanelWithAnalytics } from './editor-actions/actions';
@@ -202,11 +203,23 @@ function createPanelAction({
202
203
  const {
203
204
  panel
204
205
  } = state.schema.nodes;
205
- const node = panel.createAndFill(attributes);
206
- if (!node) {
207
- return false;
206
+ let tr;
207
+
208
+ // Panels should wrap content by default when inserted, the quickInsert `insert` method
209
+ // will insert the node on a newline
210
+ if (editorExperiment('platform_editor_controls', 'variant1')) {
211
+ tr = state.selection.empty && createWrapSelectionTransaction({
212
+ state,
213
+ type: panel,
214
+ nodeAttributes: attributes
215
+ });
216
+ } else {
217
+ const node = panel.createAndFill(attributes);
218
+ if (!node) {
219
+ return false;
220
+ }
221
+ tr = state.selection.empty && insert(node);
208
222
  }
209
- const tr = state.selection.empty && insert(node);
210
223
  if (tr) {
211
224
  var _api$analytics2;
212
225
  api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent({
@@ -3,6 +3,7 @@ import { extendedPanel, panelWithoutNestedNonBodiedMacros, PanelType } from '@at
3
3
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { blockTypeMessages } from '@atlaskit/editor-common/messages';
5
5
  import { IconCustomPanel, IconPanel, IconPanelError, IconPanelNote, IconPanelSuccess, IconPanelWarning } from '@atlaskit/editor-common/quick-insert';
6
+ import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
6
7
  import { T50 } from '@atlaskit/theme/colors';
7
8
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
8
9
  import { insertPanelWithAnalytics } from './editor-actions/actions';
@@ -219,11 +220,23 @@ function createPanelAction(_ref4) {
219
220
  api = _ref4.api,
220
221
  insert = _ref4.insert;
221
222
  var panel = state.schema.nodes.panel;
222
- var node = panel.createAndFill(attributes);
223
- if (!node) {
224
- return false;
223
+ var tr;
224
+
225
+ // Panels should wrap content by default when inserted, the quickInsert `insert` method
226
+ // will insert the node on a newline
227
+ if (editorExperiment('platform_editor_controls', 'variant1')) {
228
+ tr = state.selection.empty && createWrapSelectionTransaction({
229
+ state: state,
230
+ type: panel,
231
+ nodeAttributes: attributes
232
+ });
233
+ } else {
234
+ var node = panel.createAndFill(attributes);
235
+ if (!node) {
236
+ return false;
237
+ }
238
+ tr = state.selection.empty && insert(node);
225
239
  }
226
- var tr = state.selection.empty && insert(node);
227
240
  if (tr) {
228
241
  var _api$analytics2;
229
242
  api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-panel",
3
- "version": "4.2.7",
3
+ "version": "4.2.9",
4
4
  "description": "Panel plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,9 +32,9 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^47.6.0",
35
- "@atlaskit/editor-common": "^102.4.0",
36
- "@atlaskit/editor-palette": "^2.0.0",
37
- "@atlaskit/editor-plugin-analytics": "^2.1.0",
35
+ "@atlaskit/editor-common": "^102.8.0",
36
+ "@atlaskit/editor-palette": "^2.1.0",
37
+ "@atlaskit/editor-plugin-analytics": "^2.2.0",
38
38
  "@atlaskit/editor-plugin-decorations": "^2.0.0",
39
39
  "@atlaskit/editor-plugin-emoji": "^3.2.0",
40
40
  "@atlaskit/editor-prosemirror": "7.0.0",
@@ -43,8 +43,8 @@
43
43
  "@atlaskit/icon": "^25.0.0",
44
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
45
45
  "@atlaskit/theme": "^18.0.0",
46
- "@atlaskit/tmp-editor-statsig": "^3.6.0",
47
- "@atlaskit/tokens": "^4.4.0",
46
+ "@atlaskit/tmp-editor-statsig": "^4.0.0",
47
+ "@atlaskit/tokens": "^4.5.0",
48
48
  "@babel/runtime": "^7.0.0",
49
49
  "uuid": "^3.1.0"
50
50
  },