@atlaskit/editor-plugin-breakout 6.2.4 → 6.2.6

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-breakout
2
2
 
3
+ ## 6.2.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`0c0f8207e7294`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0c0f8207e7294) -
8
+ Added sync block resizing
9
+ - Updated dependencies
10
+
11
+ ## 6.2.5
12
+
13
+ ### Patch Changes
14
+
15
+ - [`a774d02e0633f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a774d02e0633f) -
16
+ Remove platform_editor_breakout_resizing_patch_1 FG
17
+ - Updated dependencies
18
+
3
19
  ## 6.2.4
4
20
 
5
21
  ### Patch Changes
@@ -11,7 +11,7 @@ var _utils = require("@atlaskit/editor-common/utils");
11
11
  var _document = require("@atlaskit/editor-common/utils/document");
12
12
  var _state = require("@atlaskit/editor-prosemirror/state");
13
13
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
14
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
15
15
  var _handleKeyDown = require("./handle-key-down");
16
16
  var _resizingMarkView = require("./resizing-mark-view");
17
17
  var _singlePlayerExpand = require("./utils/single-player-expand");
@@ -51,9 +51,9 @@ var addBreakoutToResizableNode = function addBreakoutToResizableNode(_ref) {
51
51
  updatedDocChanged = true;
52
52
  } else if ((breakoutMark === null || breakoutMark === void 0 ? void 0 : breakoutMark.attrs.width) === null || (breakoutMark === null || breakoutMark === void 0 ? void 0 : breakoutMark.attrs.width) === undefined) {
53
53
  var mode = breakoutMark.attrs.mode;
54
- var newWidth = (0, _platformFeatureFlags.fg)('platform_editor_breakout_resizing_patch_1') ?
54
+
55
55
  // if breakout is present on node, but page appearance is 'full width' force width to full width to maintain backwards compatibility
56
- isFullWidthEnabled || mode === 'full-width' ? _editorSharedStyles.akEditorFullWidthLayoutWidth : _editorSharedStyles.akEditorCalculatedWideLayoutWidth : mode === 'wide' ? _editorSharedStyles.akEditorCalculatedWideLayoutWidth : _editorSharedStyles.akEditorFullWidthLayoutWidth;
56
+ var newWidth = isFullWidthEnabled || mode === 'full-width' ? _editorSharedStyles.akEditorFullWidthLayoutWidth : _editorSharedStyles.akEditorCalculatedWideLayoutWidth;
57
57
  updatedTr = newTr.setNodeMarkup(pos, node.type, node.attrs, [breakout.create({
58
58
  width: newWidth,
59
59
  mode: mode
@@ -121,25 +121,23 @@ var createResizingPlugin = exports.createResizingPlugin = function createResizin
121
121
  handleKeyDown: (0, _handleKeyDown.handleKeyDown)(api)
122
122
  },
123
123
  appendTransaction: function appendTransaction(transactions, oldState, newState) {
124
- if ((0, _platformFeatureFlags.fg)('platform_editor_breakout_resizing_patch_1')) {
125
- var _api$editorViewMode;
126
- if ((api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view') {
127
- return;
128
- }
129
- } else {
130
- var _api$editorViewMode2;
131
- // if editor is in live-view mode don't send transactions
132
- if ((api === null || api === void 0 || (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 || (_api$editorViewMode2 = _api$editorViewMode2.sharedState.currentState()) === null || _api$editorViewMode2 === void 0 ? void 0 : _api$editorViewMode2.mode) !== 'edit') {
133
- return;
134
- }
124
+ var _api$editorViewMode;
125
+ if ((api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view') {
126
+ return;
135
127
  }
136
128
  var newTr = newState.tr;
137
129
  var hasDocChanged = false;
138
130
  var _newState$schema$node = newState.schema.nodes,
139
131
  expand = _newState$schema$node.expand,
140
132
  codeBlock = _newState$schema$node.codeBlock,
141
- layoutSection = _newState$schema$node.layoutSection;
133
+ layoutSection = _newState$schema$node.layoutSection,
134
+ syncBlock = _newState$schema$node.syncBlock,
135
+ bodiedSyncBlock = _newState$schema$node.bodiedSyncBlock;
142
136
  var breakoutResizableNodes = new Set([expand, codeBlock, layoutSection]);
137
+ if ((0, _experiments.editorExperiment)('platform_synced_block', true)) {
138
+ breakoutResizableNodes.add(syncBlock);
139
+ breakoutResizableNodes.add(bodiedSyncBlock);
140
+ }
143
141
  var isFullWidthEnabled = !((options === null || options === void 0 ? void 0 : options.allowBreakoutButton) === true);
144
142
  if ((0, _document.isReplaceDocOperation)(transactions, oldState)) {
145
143
  newState.doc.forEach(function (node, pos) {
@@ -3,7 +3,7 @@ import { stepAddsOneOf } from '@atlaskit/editor-common/utils';
3
3
  import { getChangedNodes, isReplaceDocOperation } from '@atlaskit/editor-common/utils/document';
4
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
5
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorCalculatedWideLayoutWidth } from '@atlaskit/editor-shared-styles';
6
- import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
7
  import { handleKeyDown } from './handle-key-down';
8
8
  import { ResizingMarkView } from './resizing-mark-view';
9
9
  import { updateExpandedStateNew } from './utils/single-player-expand';
@@ -44,9 +44,9 @@ const addBreakoutToResizableNode = ({
44
44
  updatedDocChanged = true;
45
45
  } else if ((breakoutMark === null || breakoutMark === void 0 ? void 0 : breakoutMark.attrs.width) === null || (breakoutMark === null || breakoutMark === void 0 ? void 0 : breakoutMark.attrs.width) === undefined) {
46
46
  const mode = breakoutMark.attrs.mode;
47
- const newWidth = fg('platform_editor_breakout_resizing_patch_1') ?
47
+
48
48
  // if breakout is present on node, but page appearance is 'full width' force width to full width to maintain backwards compatibility
49
- isFullWidthEnabled || mode === 'full-width' ? akEditorFullWidthLayoutWidth : akEditorCalculatedWideLayoutWidth : mode === 'wide' ? akEditorCalculatedWideLayoutWidth : akEditorFullWidthLayoutWidth;
49
+ const newWidth = isFullWidthEnabled || mode === 'full-width' ? akEditorFullWidthLayoutWidth : akEditorCalculatedWideLayoutWidth;
50
50
  updatedTr = newTr.setNodeMarkup(pos, node.type, node.attrs, [breakout.create({
51
51
  width: newWidth,
52
52
  mode: mode
@@ -117,26 +117,24 @@ export const createResizingPlugin = (api, getIntl, nodeViewPortalProviderAPI, op
117
117
  handleKeyDown: handleKeyDown(api)
118
118
  },
119
119
  appendTransaction(transactions, oldState, newState) {
120
- if (fg('platform_editor_breakout_resizing_patch_1')) {
121
- var _api$editorViewMode, _api$editorViewMode$s;
122
- if ((api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode) === 'view') {
123
- return;
124
- }
125
- } else {
126
- var _api$editorViewMode2, _api$editorViewMode2$;
127
- // if editor is in live-view mode don't send transactions
128
- if ((api === null || api === void 0 ? void 0 : (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 ? void 0 : (_api$editorViewMode2$ = _api$editorViewMode2.sharedState.currentState()) === null || _api$editorViewMode2$ === void 0 ? void 0 : _api$editorViewMode2$.mode) !== 'edit') {
129
- return;
130
- }
120
+ var _api$editorViewMode, _api$editorViewMode$s;
121
+ if ((api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode) === 'view') {
122
+ return;
131
123
  }
132
124
  let newTr = newState.tr;
133
125
  let hasDocChanged = false;
134
126
  const {
135
127
  expand,
136
128
  codeBlock,
137
- layoutSection
129
+ layoutSection,
130
+ syncBlock,
131
+ bodiedSyncBlock
138
132
  } = newState.schema.nodes;
139
133
  const breakoutResizableNodes = new Set([expand, codeBlock, layoutSection]);
134
+ if (editorExperiment('platform_synced_block', true)) {
135
+ breakoutResizableNodes.add(syncBlock);
136
+ breakoutResizableNodes.add(bodiedSyncBlock);
137
+ }
140
138
  const isFullWidthEnabled = !((options === null || options === void 0 ? void 0 : options.allowBreakoutButton) === true);
141
139
  if (isReplaceDocOperation(transactions, oldState)) {
142
140
  newState.doc.forEach((node, pos) => {
@@ -6,7 +6,7 @@ import { stepAddsOneOf } from '@atlaskit/editor-common/utils';
6
6
  import { getChangedNodes, isReplaceDocOperation } from '@atlaskit/editor-common/utils/document';
7
7
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
8
8
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorCalculatedWideLayoutWidth } from '@atlaskit/editor-shared-styles';
9
- import { fg } from '@atlaskit/platform-feature-flags';
9
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
10
10
  import { handleKeyDown } from './handle-key-down';
11
11
  import { ResizingMarkView } from './resizing-mark-view';
12
12
  import { updateExpandedStateNew } from './utils/single-player-expand';
@@ -44,9 +44,9 @@ var addBreakoutToResizableNode = function addBreakoutToResizableNode(_ref) {
44
44
  updatedDocChanged = true;
45
45
  } else if ((breakoutMark === null || breakoutMark === void 0 ? void 0 : breakoutMark.attrs.width) === null || (breakoutMark === null || breakoutMark === void 0 ? void 0 : breakoutMark.attrs.width) === undefined) {
46
46
  var mode = breakoutMark.attrs.mode;
47
- var newWidth = fg('platform_editor_breakout_resizing_patch_1') ?
47
+
48
48
  // if breakout is present on node, but page appearance is 'full width' force width to full width to maintain backwards compatibility
49
- isFullWidthEnabled || mode === 'full-width' ? akEditorFullWidthLayoutWidth : akEditorCalculatedWideLayoutWidth : mode === 'wide' ? akEditorCalculatedWideLayoutWidth : akEditorFullWidthLayoutWidth;
49
+ var newWidth = isFullWidthEnabled || mode === 'full-width' ? akEditorFullWidthLayoutWidth : akEditorCalculatedWideLayoutWidth;
50
50
  updatedTr = newTr.setNodeMarkup(pos, node.type, node.attrs, [breakout.create({
51
51
  width: newWidth,
52
52
  mode: mode
@@ -114,25 +114,23 @@ export var createResizingPlugin = function createResizingPlugin(api, getIntl, no
114
114
  handleKeyDown: handleKeyDown(api)
115
115
  },
116
116
  appendTransaction: function appendTransaction(transactions, oldState, newState) {
117
- if (fg('platform_editor_breakout_resizing_patch_1')) {
118
- var _api$editorViewMode;
119
- if ((api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view') {
120
- return;
121
- }
122
- } else {
123
- var _api$editorViewMode2;
124
- // if editor is in live-view mode don't send transactions
125
- if ((api === null || api === void 0 || (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 || (_api$editorViewMode2 = _api$editorViewMode2.sharedState.currentState()) === null || _api$editorViewMode2 === void 0 ? void 0 : _api$editorViewMode2.mode) !== 'edit') {
126
- return;
127
- }
117
+ var _api$editorViewMode;
118
+ if ((api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view') {
119
+ return;
128
120
  }
129
121
  var newTr = newState.tr;
130
122
  var hasDocChanged = false;
131
123
  var _newState$schema$node = newState.schema.nodes,
132
124
  expand = _newState$schema$node.expand,
133
125
  codeBlock = _newState$schema$node.codeBlock,
134
- layoutSection = _newState$schema$node.layoutSection;
126
+ layoutSection = _newState$schema$node.layoutSection,
127
+ syncBlock = _newState$schema$node.syncBlock,
128
+ bodiedSyncBlock = _newState$schema$node.bodiedSyncBlock;
135
129
  var breakoutResizableNodes = new Set([expand, codeBlock, layoutSection]);
130
+ if (editorExperiment('platform_synced_block', true)) {
131
+ breakoutResizableNodes.add(syncBlock);
132
+ breakoutResizableNodes.add(bodiedSyncBlock);
133
+ }
136
134
  var isFullWidthEnabled = !((options === null || options === void 0 ? void 0 : options.allowBreakoutButton) === true);
137
135
  if (isReplaceDocOperation(transactions, oldState)) {
138
136
  newState.doc.forEach(function (node, pos) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-breakout",
3
- "version": "6.2.4",
3
+ "version": "6.2.6",
4
4
  "description": "Breakout plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -43,7 +43,7 @@
43
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
44
  "@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
45
45
  "@atlaskit/theme": "^21.0.0",
46
- "@atlaskit/tmp-editor-statsig": "^15.0.0",
46
+ "@atlaskit/tmp-editor-statsig": "^15.7.0",
47
47
  "@atlaskit/tokens": "^8.4.0",
48
48
  "@atlaskit/tooltip": "^20.11.0",
49
49
  "@babel/runtime": "^7.0.0",
@@ -53,13 +53,13 @@
53
53
  "uuid": "^3.1.0"
54
54
  },
55
55
  "peerDependencies": {
56
- "@atlaskit/editor-common": "^110.40.0",
56
+ "@atlaskit/editor-common": "^110.41.0",
57
57
  "react": "^18.2.0",
58
58
  "react-dom": "^18.2.0",
59
59
  "react-intl-next": "npm:react-intl@^5.18.1"
60
60
  },
61
61
  "devDependencies": {
62
- "@testing-library/react": "^13.4.0",
62
+ "@testing-library/react": "^16.3.0",
63
63
  "wait-for-expect": "^1.2.0"
64
64
  },
65
65
  "techstack": {
@@ -102,9 +102,6 @@
102
102
  "platform-editor-single-player-expand": {
103
103
  "type": "boolean"
104
104
  },
105
- "platform_editor_breakout_resizing_patch_1": {
106
- "type": "boolean"
107
- },
108
105
  "platform_editor_breakout_resizing_width_changes": {
109
106
  "type": "boolean"
110
107
  }