@atlaskit/editor-plugin-block-controls 3.15.5 → 3.15.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 +10 -0
- package/dist/cjs/ui/quick-insert-button.js +7 -1
- package/dist/cjs/ui/utils/document-checks.js +2 -1
- package/dist/es2019/ui/quick-insert-button.js +12 -2
- package/dist/es2019/ui/utils/document-checks.js +2 -1
- package/dist/esm/ui/quick-insert-button.js +8 -2
- package/dist/esm/ui/utils/document-checks.js +2 -1
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 3.15.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#161993](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/161993)
|
|
8
|
+
[`bd93cafe79061`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bd93cafe79061) -
|
|
9
|
+
[ED-27277] When quick insert is triggered by quick insert button and the selection is in code
|
|
10
|
+
block node, place slash in a new line after the node
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 3.15.5
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -207,7 +207,13 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
|
|
|
207
207
|
if (!isSelectionInsideNode || (0, _documentChecks.isNonEditableBlock)(start, view)) {
|
|
208
208
|
api.core.actions.execute((0, _editorCommands.createNewLine)(start));
|
|
209
209
|
}
|
|
210
|
-
|
|
210
|
+
var codeBlock = view.state.schema.nodes.codeBlock;
|
|
211
|
+
var selection = view.state.selection;
|
|
212
|
+
var codeBlockParentNode = (0, _utils.findParentNodeOfType)(codeBlock)(selection);
|
|
213
|
+
if (codeBlockParentNode && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_11')) {
|
|
214
|
+
// Slash command is not meant to be triggered inside code block, hence always insert slash in a new line following
|
|
215
|
+
api.core.actions.execute((0, _editorCommands.createNewLine)(codeBlockParentNode.pos));
|
|
216
|
+
} else if (isSelectionInsideNode) {
|
|
211
217
|
// text or element with be deselected and the / added immediately after the paragraph
|
|
212
218
|
// unless the selection is empty
|
|
213
219
|
var currentSelection = view.state.selection;
|
|
@@ -5,9 +5,10 @@ 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");
|
|
8
9
|
var isNestedNodeSelected = exports.isNestedNodeSelected = function isNestedNodeSelected(view) {
|
|
9
10
|
var selection = view.state.selection;
|
|
10
|
-
return selection instanceof _state.NodeSelection && selection.$from.depth > 1;
|
|
11
|
+
return selection instanceof _state.NodeSelection && selection.$from.depth > ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_11') ? 0 : 1);
|
|
11
12
|
};
|
|
12
13
|
var isSelectionInNode = exports.isSelectionInNode = function isSelectionInNode(start, view) {
|
|
13
14
|
var node = view.state.doc.nodeAt(start);
|
|
@@ -13,7 +13,7 @@ import { blockControlsMessages as messages } from '@atlaskit/editor-common/messa
|
|
|
13
13
|
import { tableControlsSpacing } from '@atlaskit/editor-common/styles';
|
|
14
14
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
15
15
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
16
|
-
import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
16
|
+
import { findParentNode, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
17
17
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
18
18
|
import AddIcon from '@atlaskit/icon/utility/add';
|
|
19
19
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -197,7 +197,17 @@ export const TypeAheadControl = ({
|
|
|
197
197
|
if (!isSelectionInsideNode || isNonEditableBlock(start, view)) {
|
|
198
198
|
api.core.actions.execute(createNewLine(start));
|
|
199
199
|
}
|
|
200
|
-
|
|
200
|
+
const {
|
|
201
|
+
codeBlock
|
|
202
|
+
} = view.state.schema.nodes;
|
|
203
|
+
const {
|
|
204
|
+
selection
|
|
205
|
+
} = view.state;
|
|
206
|
+
const codeBlockParentNode = findParentNodeOfType(codeBlock)(selection);
|
|
207
|
+
if (codeBlockParentNode && fg('platform_editor_controls_patch_11')) {
|
|
208
|
+
// Slash command is not meant to be triggered inside code block, hence always insert slash in a new line following
|
|
209
|
+
api.core.actions.execute(createNewLine(codeBlockParentNode.pos));
|
|
210
|
+
} else if (isSelectionInsideNode) {
|
|
201
211
|
// text or element with be deselected and the / added immediately after the paragraph
|
|
202
212
|
// unless the selection is empty
|
|
203
213
|
const currentSelection = view.state.selection;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
export const isNestedNodeSelected = view => {
|
|
3
4
|
const selection = view.state.selection;
|
|
4
|
-
return selection instanceof NodeSelection && selection.$from.depth > 1;
|
|
5
|
+
return selection instanceof NodeSelection && selection.$from.depth > (fg('platform_editor_controls_patch_11') ? 0 : 1);
|
|
5
6
|
};
|
|
6
7
|
export const isSelectionInNode = (start, view) => {
|
|
7
8
|
const node = view.state.doc.nodeAt(start);
|
|
@@ -17,7 +17,7 @@ import { blockControlsMessages as messages } from '@atlaskit/editor-common/messa
|
|
|
17
17
|
import { tableControlsSpacing } from '@atlaskit/editor-common/styles';
|
|
18
18
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
19
19
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
20
|
-
import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
20
|
+
import { findParentNode, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
21
21
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
22
22
|
import AddIcon from '@atlaskit/icon/utility/add';
|
|
23
23
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -201,7 +201,13 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
201
201
|
if (!isSelectionInsideNode || isNonEditableBlock(start, view)) {
|
|
202
202
|
api.core.actions.execute(createNewLine(start));
|
|
203
203
|
}
|
|
204
|
-
|
|
204
|
+
var codeBlock = view.state.schema.nodes.codeBlock;
|
|
205
|
+
var selection = view.state.selection;
|
|
206
|
+
var codeBlockParentNode = findParentNodeOfType(codeBlock)(selection);
|
|
207
|
+
if (codeBlockParentNode && fg('platform_editor_controls_patch_11')) {
|
|
208
|
+
// Slash command is not meant to be triggered inside code block, hence always insert slash in a new line following
|
|
209
|
+
api.core.actions.execute(createNewLine(codeBlockParentNode.pos));
|
|
210
|
+
} else if (isSelectionInsideNode) {
|
|
205
211
|
// text or element with be deselected and the / added immediately after the paragraph
|
|
206
212
|
// unless the selection is empty
|
|
207
213
|
var currentSelection = view.state.selection;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
export var isNestedNodeSelected = function isNestedNodeSelected(view) {
|
|
3
4
|
var selection = view.state.selection;
|
|
4
|
-
return selection instanceof NodeSelection && selection.$from.depth > 1;
|
|
5
|
+
return selection instanceof NodeSelection && selection.$from.depth > (fg('platform_editor_controls_patch_11') ? 0 : 1);
|
|
5
6
|
};
|
|
6
7
|
export var isSelectionInNode = function isSelectionInNode(start, view) {
|
|
7
8
|
var node = view.state.doc.nodeAt(start);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "3.15.
|
|
3
|
+
"version": "3.15.6",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
36
|
-
"@atlaskit/editor-common": "^106.
|
|
36
|
+
"@atlaskit/editor-common": "^106.1.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.0.0",
|
|
@@ -196,6 +196,9 @@
|
|
|
196
196
|
},
|
|
197
197
|
"dst-a11y__replace-anchor-with-link__editor-jenga": {
|
|
198
198
|
"type": "boolean"
|
|
199
|
+
},
|
|
200
|
+
"platform_editor_controls_patch_11": {
|
|
201
|
+
"type": "boolean"
|
|
199
202
|
}
|
|
200
203
|
}
|
|
201
204
|
}
|