@atlaskit/editor-plugin-block-controls 3.19.8 → 3.19.10

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,22 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 3.19.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#175523](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/175523)
8
+ [`0623f8fb2b5ee`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0623f8fb2b5ee) -
9
+ Fix a bug where slash command via quick insert button is not inserted at the correct location
10
+
11
+ ## 3.19.9
12
+
13
+ ### Patch Changes
14
+
15
+ - [#173895](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/173895)
16
+ [`6e123631d7c26`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6e123631d7c26) -
17
+ Clean up platform_editor_interaction_api_refactor
18
+ - Updated dependencies
19
+
3
20
  ## 3.19.8
4
21
 
5
22
  ### Patch Changes
@@ -299,7 +299,6 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
299
299
  macroInteractionUpdates = _useDragHandlePluginS.macroInteractionUpdates;
300
300
  var selection = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection');
301
301
  var isShiftDown = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'blockControls.isShiftDown');
302
- var _hasHadInteraction = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'interaction.hasHadInteraction') !== false;
303
302
  var interactionState = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'interaction.interactionState');
304
303
  var start = getPos();
305
304
  var isLayoutColumn = nodeType === 'layoutColumn';
@@ -846,7 +845,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
846
845
  var handleOnDrop = function handleOnDrop(event) {
847
846
  (0, _experiments.editorExperiment)('platform_editor_element_drag_and_drop_multiselect', true) && event.stopPropagation();
848
847
  };
849
- var hasHadInteraction = !(0, _platformFeatureFlags.fg)('platform_editor_no_cursor_on_live_doc_init') || ((0, _platformFeatureFlags.fg)('platform_editor_interaction_api_refactor') ? interactionState !== 'hasNotHadInteraction' : _hasHadInteraction !== false);
848
+ var hasHadInteraction = !(0, _platformFeatureFlags.fg)('platform_editor_no_cursor_on_live_doc_init') || interactionState !== 'hasNotHadInteraction';
850
849
  var renderButton = function renderButton() {
851
850
  return (
852
851
  // eslint-disable-next-line @atlaskit/design-system/no-html-button
@@ -209,7 +209,7 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
209
209
  var codeBlock = view.state.schema.nodes.codeBlock;
210
210
  var selection = view.state.selection;
211
211
  var codeBlockParentNode = (0, _utils.findParentNodeOfType)(codeBlock)(selection);
212
- if (codeBlockParentNode && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_11')) {
212
+ if (codeBlockParentNode) {
213
213
  // Slash command is not meant to be triggered inside code block, hence always insert slash in a new line following
214
214
  api.core.actions.execute((0, _editorCommands.createNewLine)(codeBlockParentNode.pos));
215
215
  } else if (isSelectionInsideNode) {
@@ -5,10 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.isSelectionInNode = exports.isNonEditableBlock = exports.isNestedNodeSelected = exports.isInTextSelection = void 0;
7
7
  var _state = require("@atlaskit/editor-prosemirror/state");
8
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
9
8
  var isNestedNodeSelected = exports.isNestedNodeSelected = function isNestedNodeSelected(view) {
10
9
  var selection = view.state.selection;
11
- return selection instanceof _state.NodeSelection && selection.$from.depth > ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_11') ? 0 : 1);
10
+ return selection instanceof _state.NodeSelection && selection.$from.depth > 0;
12
11
  };
13
12
  var isSelectionInNode = exports.isSelectionInNode = function isSelectionInNode(start, view) {
14
13
  var node = view.state.doc.nodeAt(start);
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createNewLine = void 0;
7
7
  var _state = require("@atlaskit/editor-prosemirror/state");
8
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
9
  var createNewLine = exports.createNewLine = function createNewLine(start) {
9
10
  return function (_ref) {
10
11
  var _tr$doc$nodeAt;
@@ -15,6 +16,6 @@ var createNewLine = exports.createNewLine = function createNewLine(start) {
15
16
  }
16
17
  var position = start + nodeSize;
17
18
  tr.insert(position, tr.doc.type.schema.nodes.paragraph.create());
18
- return tr.setSelection(_state.TextSelection.create(tr.doc, position));
19
+ return tr.setSelection((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_14') ? _state.TextSelection.near(tr.doc.resolve(position)) : _state.TextSelection.create(tr.doc, position));
19
20
  };
20
21
  };
@@ -278,7 +278,6 @@ export const DragHandle = ({
278
278
  } = useDragHandlePluginState(api);
279
279
  const selection = useSharedPluginStateSelector(api, 'selection.selection');
280
280
  const isShiftDown = useSharedPluginStateSelector(api, 'blockControls.isShiftDown');
281
- const _hasHadInteraction = useSharedPluginStateSelector(api, 'interaction.hasHadInteraction') !== false;
282
281
  const interactionState = useSharedPluginStateSelector(api, 'interaction.interactionState');
283
282
  const start = getPos();
284
283
  const isLayoutColumn = nodeType === 'layoutColumn';
@@ -834,7 +833,7 @@ export const DragHandle = ({
834
833
  const handleOnDrop = event => {
835
834
  editorExperiment('platform_editor_element_drag_and_drop_multiselect', true) && event.stopPropagation();
836
835
  };
837
- const hasHadInteraction = !fg('platform_editor_no_cursor_on_live_doc_init') || (fg('platform_editor_interaction_api_refactor') ? interactionState !== 'hasNotHadInteraction' : _hasHadInteraction !== false);
836
+ const hasHadInteraction = !fg('platform_editor_no_cursor_on_live_doc_init') || interactionState !== 'hasNotHadInteraction';
838
837
  const renderButton = () =>
839
838
  // eslint-disable-next-line @atlaskit/design-system/no-html-button
840
839
  jsx("button", {
@@ -204,7 +204,7 @@ export const TypeAheadControl = ({
204
204
  selection
205
205
  } = view.state;
206
206
  const codeBlockParentNode = findParentNodeOfType(codeBlock)(selection);
207
- if (codeBlockParentNode && fg('platform_editor_controls_patch_11')) {
207
+ if (codeBlockParentNode) {
208
208
  // Slash command is not meant to be triggered inside code block, hence always insert slash in a new line following
209
209
  api.core.actions.execute(createNewLine(codeBlockParentNode.pos));
210
210
  } else if (isSelectionInsideNode) {
@@ -1,8 +1,7 @@
1
1
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  export const isNestedNodeSelected = view => {
4
3
  const selection = view.state.selection;
5
- return selection instanceof NodeSelection && selection.$from.depth > (fg('platform_editor_controls_patch_11') ? 0 : 1);
4
+ return selection instanceof NodeSelection && selection.$from.depth > 0;
6
5
  };
7
6
  export const isSelectionInNode = (start, view) => {
8
7
  const node = view.state.doc.nodeAt(start);
@@ -1,4 +1,5 @@
1
1
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  export const createNewLine = start => ({
3
4
  tr
4
5
  }) => {
@@ -9,5 +10,5 @@ export const createNewLine = start => ({
9
10
  }
10
11
  const position = start + nodeSize;
11
12
  tr.insert(position, tr.doc.type.schema.nodes.paragraph.create());
12
- return tr.setSelection(TextSelection.create(tr.doc, position));
13
+ return tr.setSelection(fg('platform_editor_controls_patch_14') ? TextSelection.near(tr.doc.resolve(position)) : TextSelection.create(tr.doc, position));
13
14
  };
@@ -296,7 +296,6 @@ export var DragHandle = function DragHandle(_ref) {
296
296
  macroInteractionUpdates = _useDragHandlePluginS.macroInteractionUpdates;
297
297
  var selection = useSharedPluginStateSelector(api, 'selection.selection');
298
298
  var isShiftDown = useSharedPluginStateSelector(api, 'blockControls.isShiftDown');
299
- var _hasHadInteraction = useSharedPluginStateSelector(api, 'interaction.hasHadInteraction') !== false;
300
299
  var interactionState = useSharedPluginStateSelector(api, 'interaction.interactionState');
301
300
  var start = getPos();
302
301
  var isLayoutColumn = nodeType === 'layoutColumn';
@@ -843,7 +842,7 @@ export var DragHandle = function DragHandle(_ref) {
843
842
  var handleOnDrop = function handleOnDrop(event) {
844
843
  editorExperiment('platform_editor_element_drag_and_drop_multiselect', true) && event.stopPropagation();
845
844
  };
846
- var hasHadInteraction = !fg('platform_editor_no_cursor_on_live_doc_init') || (fg('platform_editor_interaction_api_refactor') ? interactionState !== 'hasNotHadInteraction' : _hasHadInteraction !== false);
845
+ var hasHadInteraction = !fg('platform_editor_no_cursor_on_live_doc_init') || interactionState !== 'hasNotHadInteraction';
847
846
  var renderButton = function renderButton() {
848
847
  return (
849
848
  // eslint-disable-next-line @atlaskit/design-system/no-html-button
@@ -204,7 +204,7 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
204
204
  var codeBlock = view.state.schema.nodes.codeBlock;
205
205
  var selection = view.state.selection;
206
206
  var codeBlockParentNode = findParentNodeOfType(codeBlock)(selection);
207
- if (codeBlockParentNode && fg('platform_editor_controls_patch_11')) {
207
+ if (codeBlockParentNode) {
208
208
  // Slash command is not meant to be triggered inside code block, hence always insert slash in a new line following
209
209
  api.core.actions.execute(createNewLine(codeBlockParentNode.pos));
210
210
  } else if (isSelectionInsideNode) {
@@ -1,8 +1,7 @@
1
1
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  export var isNestedNodeSelected = function isNestedNodeSelected(view) {
4
3
  var selection = view.state.selection;
5
- return selection instanceof NodeSelection && selection.$from.depth > (fg('platform_editor_controls_patch_11') ? 0 : 1);
4
+ return selection instanceof NodeSelection && selection.$from.depth > 0;
6
5
  };
7
6
  export var isSelectionInNode = function isSelectionInNode(start, view) {
8
7
  var node = view.state.doc.nodeAt(start);
@@ -1,4 +1,5 @@
1
1
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  export var createNewLine = function createNewLine(start) {
3
4
  return function (_ref) {
4
5
  var _tr$doc$nodeAt;
@@ -9,6 +10,6 @@ export var createNewLine = function createNewLine(start) {
9
10
  }
10
11
  var position = start + nodeSize;
11
12
  tr.insert(position, tr.doc.type.schema.nodes.paragraph.create());
12
- return tr.setSelection(TextSelection.create(tr.doc, position));
13
+ return tr.setSelection(fg('platform_editor_controls_patch_14') ? TextSelection.near(tr.doc.resolve(position)) : TextSelection.create(tr.doc, position));
13
14
  };
14
15
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "3.19.8",
3
+ "version": "3.19.10",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,12 +33,12 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@atlaskit/adf-schema": "^47.6.0",
36
- "@atlaskit/editor-common": "^107.1.0",
36
+ "@atlaskit/editor-common": "^107.2.0",
37
37
  "@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^2.3.0",
39
39
  "@atlaskit/editor-plugin-editor-disabled": "^2.1.0",
40
40
  "@atlaskit/editor-plugin-feature-flags": "^1.4.0",
41
- "@atlaskit/editor-plugin-interaction": "^2.0.0",
41
+ "@atlaskit/editor-plugin-interaction": "^3.0.0",
42
42
  "@atlaskit/editor-plugin-metrics": "^3.5.0",
43
43
  "@atlaskit/editor-plugin-quick-insert": "^2.6.0",
44
44
  "@atlaskit/editor-plugin-selection": "^2.2.0",
@@ -48,7 +48,7 @@
48
48
  "@atlaskit/editor-prosemirror": "7.0.0",
49
49
  "@atlaskit/editor-shared-styles": "^3.4.0",
50
50
  "@atlaskit/editor-tables": "^2.9.0",
51
- "@atlaskit/icon": "^27.0.0",
51
+ "@atlaskit/icon": "^27.1.0",
52
52
  "@atlaskit/link": "^3.2.0",
53
53
  "@atlaskit/platform-feature-flags": "^1.1.0",
54
54
  "@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
@@ -56,7 +56,7 @@
56
56
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
57
57
  "@atlaskit/primitives": "^14.9.0",
58
58
  "@atlaskit/theme": "^18.0.0",
59
- "@atlaskit/tmp-editor-statsig": "^8.0.0",
59
+ "@atlaskit/tmp-editor-statsig": "^8.1.0",
60
60
  "@atlaskit/tokens": "^5.4.0",
61
61
  "@atlaskit/tooltip": "^20.3.0",
62
62
  "@babel/runtime": "^7.0.0",
@@ -177,16 +177,13 @@
177
177
  "platform_editor_table_drag_handle_shift_fix": {
178
178
  "type": "boolean"
179
179
  },
180
- "platform_editor_interaction_api_refactor": {
181
- "type": "boolean"
182
- },
183
180
  "dst-a11y__replace-anchor-with-link__editor-jenga": {
184
181
  "type": "boolean"
185
182
  },
186
- "platform_editor_controls_patch_11": {
183
+ "platform_editor_controls_patch_13": {
187
184
  "type": "boolean"
188
185
  },
189
- "platform_editor_controls_patch_13": {
186
+ "platform_editor_controls_patch_14": {
190
187
  "type": "boolean"
191
188
  },
192
189
  "platform_editor_breakout_resizing_hello_release": {