@atlaskit/editor-plugin-block-type 4.0.8 → 4.0.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 +18 -0
- package/dist/cjs/blockTypePlugin.js +5 -2
- package/dist/cjs/pm-plugins/ui/FloatingToolbarComponent.js +0 -6
- package/dist/cjs/pm-plugins/utils.js +7 -1
- package/dist/es2019/blockTypePlugin.js +5 -2
- package/dist/es2019/pm-plugins/ui/FloatingToolbarComponent.js +1 -7
- package/dist/es2019/pm-plugins/utils.js +7 -1
- package/dist/esm/blockTypePlugin.js +5 -2
- package/dist/esm/pm-plugins/ui/FloatingToolbarComponent.js +1 -7
- package/dist/esm/pm-plugins/utils.js +7 -1
- package/package.json +8 -5
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# @atlaskit/editor-plugin-block-type
|
2
2
|
|
3
|
+
## 4.0.10
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#176005](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/176005)
|
8
|
+
[`d4348ed45eed7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d4348ed45eed7) -
|
9
|
+
[ux] When text selection is inside media caption or decision nodes, Main and Floating toolbars
|
10
|
+
should have Lists and Text styles options disabled.
|
11
|
+
|
12
|
+
## 4.0.9
|
13
|
+
|
14
|
+
### Patch Changes
|
15
|
+
|
16
|
+
- [#172933](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/172933)
|
17
|
+
[`8323af2381d00`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8323af2381d00) -
|
18
|
+
[ux] Arranges items in the Selection toolbar under the Contextual toolbar experiment flag
|
19
|
+
- Updated dependencies
|
20
|
+
|
3
21
|
## 4.0.8
|
4
22
|
|
5
23
|
### Patch Changes
|
@@ -204,7 +204,9 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
|
|
204
204
|
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
|
205
205
|
pluginsOptions: {
|
206
206
|
selectionToolbar: function selectionToolbar() {
|
207
|
-
if ((0, _experiments.editorExperiment)('contextual_formatting_toolbar', true
|
207
|
+
if ((0, _experiments.editorExperiment)('contextual_formatting_toolbar', true, {
|
208
|
+
exposure: true
|
209
|
+
})) {
|
208
210
|
var toolbarCustom = {
|
209
211
|
type: 'custom',
|
210
212
|
render: function render(view, _idx, _dispatchAnalyticsEvent) {
|
@@ -219,7 +221,8 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
|
|
219
221
|
};
|
220
222
|
return {
|
221
223
|
isToolbarAbove: true,
|
222
|
-
items: [toolbarCustom]
|
224
|
+
items: [toolbarCustom],
|
225
|
+
rank: 8
|
223
226
|
};
|
224
227
|
} else {
|
225
228
|
return undefined;
|
@@ -9,7 +9,6 @@ exports.FloatingToolbarComponent = FloatingToolbarComponent;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
11
11
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
12
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
13
12
|
var _ToolbarBlockType = _interopRequireDefault(require("./ToolbarBlockType"));
|
14
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
15
14
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
@@ -23,11 +22,6 @@ function FloatingToolbarComponent(_ref) {
|
|
23
22
|
var api = _ref.api;
|
24
23
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['blockType']),
|
25
24
|
blockTypeState = _useSharedPluginState.blockTypeState;
|
26
|
-
(0, _react.useEffect)(function () {
|
27
|
-
(0, _experiments.editorExperiment)('contextual_formatting_toolbar', true, {
|
28
|
-
exposure: true
|
29
|
-
});
|
30
|
-
}, []);
|
31
25
|
var boundSetBlockType = (0, _react.useCallback)(function (name) {
|
32
26
|
var _api$core, _api$blockType;
|
33
27
|
return api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 || (_api$blockType = api.blockType) === null || _api$blockType === void 0 || (_api$blockType = _api$blockType.commands) === null || _api$blockType === void 0 ? void 0 : _api$blockType.setTextLevel(name, _analytics.INPUT_METHOD.FLOATING_TB));
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.areBlockTypesDisabled = areBlockTypesDisabled;
|
7
7
|
exports.isNodeAWrappingBlockNode = exports.createWrappingTextBlockRule = exports.createJoinNodesRule = void 0;
|
8
8
|
var _utils = require("@atlaskit/editor-common/utils");
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
9
10
|
var _blockTypes = require("./block-types");
|
10
11
|
var isNodeAWrappingBlockNode = exports.isNodeAWrappingBlockNode = function isNodeAWrappingBlockNode(node) {
|
11
12
|
if (!node) {
|
@@ -57,13 +58,18 @@ function getSelectedWrapperNodes(state) {
|
|
57
58
|
orderedList = _state$schema$nodes.orderedList,
|
58
59
|
bulletList = _state$schema$nodes.bulletList,
|
59
60
|
listItem = _state$schema$nodes.listItem,
|
61
|
+
caption = _state$schema$nodes.caption,
|
60
62
|
codeBlock = _state$schema$nodes.codeBlock,
|
61
63
|
decisionItem = _state$schema$nodes.decisionItem,
|
62
64
|
decisionList = _state$schema$nodes.decisionList,
|
63
65
|
taskItem = _state$schema$nodes.taskItem,
|
64
66
|
taskList = _state$schema$nodes.taskList;
|
67
|
+
var wrapperNodes = [blockquote, panel, orderedList, bulletList, listItem, codeBlock, decisionItem, decisionList, taskItem, taskList];
|
68
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_toolbar_fix_for_disabled_options')) {
|
69
|
+
wrapperNodes.push(caption);
|
70
|
+
}
|
65
71
|
state.doc.nodesBetween($from.pos, $to.pos, function (node) {
|
66
|
-
if (node.isBlock &&
|
72
|
+
if (node.isBlock && wrapperNodes.indexOf(node.type) >= 0) {
|
67
73
|
nodes.push(node.type);
|
68
74
|
}
|
69
75
|
});
|
@@ -189,7 +189,9 @@ const blockTypePlugin = ({
|
|
189
189
|
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
|
190
190
|
pluginsOptions: {
|
191
191
|
selectionToolbar: () => {
|
192
|
-
if (editorExperiment('contextual_formatting_toolbar', true
|
192
|
+
if (editorExperiment('contextual_formatting_toolbar', true, {
|
193
|
+
exposure: true
|
194
|
+
})) {
|
193
195
|
const toolbarCustom = {
|
194
196
|
type: 'custom',
|
195
197
|
render: (view, _idx, _dispatchAnalyticsEvent) => {
|
@@ -204,7 +206,8 @@ const blockTypePlugin = ({
|
|
204
206
|
};
|
205
207
|
return {
|
206
208
|
isToolbarAbove: true,
|
207
|
-
items: [toolbarCustom]
|
209
|
+
items: [toolbarCustom],
|
210
|
+
rank: 8
|
208
211
|
};
|
209
212
|
} else {
|
210
213
|
return undefined;
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import React, { useCallback
|
1
|
+
import React, { useCallback } from 'react';
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
3
3
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
4
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
5
4
|
import ToolbarBlockType from './ToolbarBlockType';
|
6
5
|
const FloatingToolbarSettings = {
|
7
6
|
isSmall: true,
|
@@ -15,11 +14,6 @@ export function FloatingToolbarComponent({
|
|
15
14
|
const {
|
16
15
|
blockTypeState
|
17
16
|
} = useSharedPluginState(api, ['blockType']);
|
18
|
-
useEffect(() => {
|
19
|
-
editorExperiment('contextual_formatting_toolbar', true, {
|
20
|
-
exposure: true
|
21
|
-
});
|
22
|
-
}, []);
|
23
17
|
const boundSetBlockType = useCallback(name => {
|
24
18
|
var _api$core, _api$blockType, _api$blockType$comman;
|
25
19
|
return api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockType = api.blockType) === null || _api$blockType === void 0 ? void 0 : (_api$blockType$comman = _api$blockType.commands) === null || _api$blockType$comman === void 0 ? void 0 : _api$blockType$comman.setTextLevel(name, INPUT_METHOD.FLOATING_TB));
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { createRule, createWrappingJoinRule } from '@atlaskit/editor-common/utils';
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
2
3
|
import { WRAPPER_BLOCK_TYPES } from './block-types';
|
3
4
|
export const isNodeAWrappingBlockNode = node => {
|
4
5
|
if (!node) {
|
@@ -48,14 +49,19 @@ function getSelectedWrapperNodes(state) {
|
|
48
49
|
orderedList,
|
49
50
|
bulletList,
|
50
51
|
listItem,
|
52
|
+
caption,
|
51
53
|
codeBlock,
|
52
54
|
decisionItem,
|
53
55
|
decisionList,
|
54
56
|
taskItem,
|
55
57
|
taskList
|
56
58
|
} = state.schema.nodes;
|
59
|
+
const wrapperNodes = [blockquote, panel, orderedList, bulletList, listItem, codeBlock, decisionItem, decisionList, taskItem, taskList];
|
60
|
+
if (fg('platform_editor_toolbar_fix_for_disabled_options')) {
|
61
|
+
wrapperNodes.push(caption);
|
62
|
+
}
|
57
63
|
state.doc.nodesBetween($from.pos, $to.pos, node => {
|
58
|
-
if (node.isBlock &&
|
64
|
+
if (node.isBlock && wrapperNodes.indexOf(node.type) >= 0) {
|
59
65
|
nodes.push(node.type);
|
60
66
|
}
|
61
67
|
});
|
@@ -191,7 +191,9 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
191
191
|
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
|
192
192
|
pluginsOptions: {
|
193
193
|
selectionToolbar: function selectionToolbar() {
|
194
|
-
if (editorExperiment('contextual_formatting_toolbar', true
|
194
|
+
if (editorExperiment('contextual_formatting_toolbar', true, {
|
195
|
+
exposure: true
|
196
|
+
})) {
|
195
197
|
var toolbarCustom = {
|
196
198
|
type: 'custom',
|
197
199
|
render: function render(view, _idx, _dispatchAnalyticsEvent) {
|
@@ -206,7 +208,8 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
206
208
|
};
|
207
209
|
return {
|
208
210
|
isToolbarAbove: true,
|
209
|
-
items: [toolbarCustom]
|
211
|
+
items: [toolbarCustom],
|
212
|
+
rank: 8
|
210
213
|
};
|
211
214
|
} else {
|
212
215
|
return undefined;
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import React, { useCallback
|
1
|
+
import React, { useCallback } from 'react';
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
3
3
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
4
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
5
4
|
import ToolbarBlockType from './ToolbarBlockType';
|
6
5
|
var FloatingToolbarSettings = {
|
7
6
|
isSmall: true,
|
@@ -13,11 +12,6 @@ export function FloatingToolbarComponent(_ref) {
|
|
13
12
|
var api = _ref.api;
|
14
13
|
var _useSharedPluginState = useSharedPluginState(api, ['blockType']),
|
15
14
|
blockTypeState = _useSharedPluginState.blockTypeState;
|
16
|
-
useEffect(function () {
|
17
|
-
editorExperiment('contextual_formatting_toolbar', true, {
|
18
|
-
exposure: true
|
19
|
-
});
|
20
|
-
}, []);
|
21
15
|
var boundSetBlockType = useCallback(function (name) {
|
22
16
|
var _api$core, _api$blockType;
|
23
17
|
return api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 || (_api$blockType = api.blockType) === null || _api$blockType === void 0 || (_api$blockType = _api$blockType.commands) === null || _api$blockType === void 0 ? void 0 : _api$blockType.setTextLevel(name, INPUT_METHOD.FLOATING_TB));
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { createRule, createWrappingJoinRule } from '@atlaskit/editor-common/utils';
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
2
3
|
import { WRAPPER_BLOCK_TYPES } from './block-types';
|
3
4
|
export var isNodeAWrappingBlockNode = function isNodeAWrappingBlockNode(node) {
|
4
5
|
if (!node) {
|
@@ -50,13 +51,18 @@ function getSelectedWrapperNodes(state) {
|
|
50
51
|
orderedList = _state$schema$nodes.orderedList,
|
51
52
|
bulletList = _state$schema$nodes.bulletList,
|
52
53
|
listItem = _state$schema$nodes.listItem,
|
54
|
+
caption = _state$schema$nodes.caption,
|
53
55
|
codeBlock = _state$schema$nodes.codeBlock,
|
54
56
|
decisionItem = _state$schema$nodes.decisionItem,
|
55
57
|
decisionList = _state$schema$nodes.decisionList,
|
56
58
|
taskItem = _state$schema$nodes.taskItem,
|
57
59
|
taskList = _state$schema$nodes.taskList;
|
60
|
+
var wrapperNodes = [blockquote, panel, orderedList, bulletList, listItem, codeBlock, decisionItem, decisionList, taskItem, taskList];
|
61
|
+
if (fg('platform_editor_toolbar_fix_for_disabled_options')) {
|
62
|
+
wrapperNodes.push(caption);
|
63
|
+
}
|
58
64
|
state.doc.nodesBetween($from.pos, $to.pos, function (node) {
|
59
|
-
if (node.isBlock &&
|
65
|
+
if (node.isBlock && wrapperNodes.indexOf(node.type) >= 0) {
|
60
66
|
nodes.push(node.type);
|
61
67
|
}
|
62
68
|
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atlaskit/editor-plugin-block-type",
|
3
|
-
"version": "4.0.
|
3
|
+
"version": "4.0.10",
|
4
4
|
"description": "BlockType plugin for @atlaskit/editor-core",
|
5
5
|
"author": "Atlassian Pty Ltd",
|
6
6
|
"license": "Apache-2.0",
|
@@ -34,18 +34,18 @@
|
|
34
34
|
},
|
35
35
|
"dependencies": {
|
36
36
|
"@atlaskit/adf-schema": "^46.1.0",
|
37
|
-
"@atlaskit/editor-common": "^96.
|
37
|
+
"@atlaskit/editor-common": "^96.3.0",
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
39
39
|
"@atlaskit/editor-plugin-primary-toolbar": "^2.0.0",
|
40
40
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
41
41
|
"@atlaskit/editor-shared-styles": "^3.2.0",
|
42
42
|
"@atlaskit/editor-tables": "^2.8.0",
|
43
|
-
"@atlaskit/icon": "^23.
|
43
|
+
"@atlaskit/icon": "^23.1.0",
|
44
44
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
45
45
|
"@atlaskit/primitives": "^13.3.0",
|
46
46
|
"@atlaskit/prosemirror-input-rules": "^3.2.0",
|
47
47
|
"@atlaskit/theme": "^14.0.0",
|
48
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
48
|
+
"@atlaskit/tmp-editor-statsig": "^2.23.0",
|
49
49
|
"@atlaskit/tokens": "^2.4.0",
|
50
50
|
"@babel/runtime": "^7.0.0",
|
51
51
|
"@emotion/react": "^11.7.1"
|
@@ -58,7 +58,7 @@
|
|
58
58
|
"devDependencies": {
|
59
59
|
"@af/visual-regression": "*",
|
60
60
|
"@atlaskit/analytics-next": "^10.1.0",
|
61
|
-
"@atlaskit/editor-plugin-quick-insert": "^1.
|
61
|
+
"@atlaskit/editor-plugin-quick-insert": "^1.8.0",
|
62
62
|
"@atlaskit/editor-plugin-type-ahead": "^1.11.0",
|
63
63
|
"@atlaskit/ssr": "*",
|
64
64
|
"@atlaskit/visual-regression": "*",
|
@@ -112,6 +112,9 @@
|
|
112
112
|
},
|
113
113
|
"platform_editor_nest_in_quotes_adf_change": {
|
114
114
|
"type": "boolean"
|
115
|
+
},
|
116
|
+
"platform_editor_toolbar_fix_for_disabled_options": {
|
117
|
+
"type": "boolean"
|
115
118
|
}
|
116
119
|
}
|
117
120
|
}
|