@atlaskit/editor-plugin-block-controls 4.2.5 → 4.2.7
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 +13 -0
- package/dist/cjs/blockControlsPlugin.js +21 -12
- package/dist/es2019/blockControlsPlugin.js +21 -12
- package/dist/esm/blockControlsPlugin.js +21 -12
- package/package.json +7 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 4.2.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4ad85ea2ae5db`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4ad85ea2ae5db) -
|
|
8
|
+
[ux] ED-29121 Fix selection toolbar not showing after block menu item is clicked
|
|
9
|
+
|
|
10
|
+
## 4.2.6
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 4.2.5
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -74,18 +74,31 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
74
74
|
},
|
|
75
75
|
toggleBlockMenu: function toggleBlockMenu(options) {
|
|
76
76
|
return function (_ref4) {
|
|
77
|
-
var _options$anchorName, _api$blockControls;
|
|
77
|
+
var _api$userIntent, _options$anchorName, _api$blockControls;
|
|
78
78
|
var tr = _ref4.tr;
|
|
79
79
|
var currMeta = tr.getMeta(_main.key);
|
|
80
|
+
var currentUserIntent = api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent;
|
|
80
81
|
if (options !== null && options !== void 0 && options.closeMenu) {
|
|
81
82
|
tr.setMeta(_main.key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
82
83
|
closeMenu: true
|
|
83
84
|
}));
|
|
85
|
+
if (currentUserIntent === 'blockMenuOpen') {
|
|
86
|
+
var _api$userIntent2;
|
|
87
|
+
api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || _api$userIntent2.commands.setCurrentUserIntent('default')({
|
|
88
|
+
tr: tr
|
|
89
|
+
});
|
|
90
|
+
}
|
|
84
91
|
return tr;
|
|
85
92
|
}
|
|
86
93
|
|
|
87
94
|
// Do not open menu on layoutColumn and close opened menu when layoutColumn drag handle is clicked
|
|
88
95
|
if (options !== null && options !== void 0 && (_options$anchorName = options.anchorName) !== null && _options$anchorName !== void 0 && _options$anchorName.includes('layoutColumn')) {
|
|
96
|
+
if (currentUserIntent === 'blockMenuOpen') {
|
|
97
|
+
var _api$userIntent3;
|
|
98
|
+
api === null || api === void 0 || (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 || _api$userIntent3.commands.setCurrentUserIntent('default')({
|
|
99
|
+
tr: tr
|
|
100
|
+
});
|
|
101
|
+
}
|
|
89
102
|
tr.setMeta(_main.key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
90
103
|
closeMenu: true
|
|
91
104
|
}));
|
|
@@ -107,23 +120,19 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
107
120
|
tr.setMeta(_main.key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
108
121
|
toggleMenu: toggleMenuMeta
|
|
109
122
|
}));
|
|
110
|
-
if (menuTriggerBy === undefined || !!menuTriggerBy && menuTriggerBy === (options === null || options === void 0 ? void 0 : options.anchorName)) {
|
|
111
|
-
var _api$
|
|
123
|
+
if ((menuTriggerBy === undefined || !!menuTriggerBy && menuTriggerBy === (options === null || options === void 0 ? void 0 : options.anchorName)) && currentUserIntent === 'blockMenuOpen') {
|
|
124
|
+
var _api$userIntent4;
|
|
112
125
|
// Toggled from drag handle
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || _api$userIntent2.commands.setCurrentUserIntent('default')({
|
|
117
|
-
tr: tr
|
|
118
|
-
});
|
|
119
|
-
}
|
|
126
|
+
api === null || api === void 0 || (_api$userIntent4 = api.userIntent) === null || _api$userIntent4 === void 0 || _api$userIntent4.commands.setCurrentUserIntent('default')({
|
|
127
|
+
tr: tr
|
|
128
|
+
});
|
|
120
129
|
}
|
|
121
130
|
return tr;
|
|
122
131
|
};
|
|
123
132
|
},
|
|
124
133
|
setNodeDragged: function setNodeDragged(getPos, anchorName, nodeType) {
|
|
125
134
|
return function (_ref5) {
|
|
126
|
-
var _api$
|
|
135
|
+
var _api$userIntent5;
|
|
127
136
|
var tr = _ref5.tr;
|
|
128
137
|
var pos = getPos();
|
|
129
138
|
if (pos === undefined) {
|
|
@@ -147,7 +156,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
147
156
|
tr: tr
|
|
148
157
|
});
|
|
149
158
|
}
|
|
150
|
-
api === null || api === void 0 || (_api$
|
|
159
|
+
api === null || api === void 0 || (_api$userIntent5 = api.userIntent) === null || _api$userIntent5 === void 0 || _api$userIntent5.commands.setCurrentUserIntent('dragging')({
|
|
151
160
|
tr: tr
|
|
152
161
|
});
|
|
153
162
|
return tr;
|
|
@@ -64,18 +64,31 @@ export const blockControlsPlugin = ({
|
|
|
64
64
|
toggleBlockMenu: options => ({
|
|
65
65
|
tr
|
|
66
66
|
}) => {
|
|
67
|
-
var _options$anchorName, _api$blockControls, _api$blockControls$sh;
|
|
67
|
+
var _api$userIntent, _api$userIntent$share, _options$anchorName, _api$blockControls, _api$blockControls$sh;
|
|
68
68
|
const currMeta = tr.getMeta(key);
|
|
69
|
+
const currentUserIntent = api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : (_api$userIntent$share = _api$userIntent.sharedState.currentState()) === null || _api$userIntent$share === void 0 ? void 0 : _api$userIntent$share.currentUserIntent;
|
|
69
70
|
if (options !== null && options !== void 0 && options.closeMenu) {
|
|
70
71
|
tr.setMeta(key, {
|
|
71
72
|
...currMeta,
|
|
72
73
|
closeMenu: true
|
|
73
74
|
});
|
|
75
|
+
if (currentUserIntent === 'blockMenuOpen') {
|
|
76
|
+
var _api$userIntent2;
|
|
77
|
+
api === null || api === void 0 ? void 0 : (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands.setCurrentUserIntent('default')({
|
|
78
|
+
tr
|
|
79
|
+
});
|
|
80
|
+
}
|
|
74
81
|
return tr;
|
|
75
82
|
}
|
|
76
83
|
|
|
77
84
|
// Do not open menu on layoutColumn and close opened menu when layoutColumn drag handle is clicked
|
|
78
85
|
if (options !== null && options !== void 0 && (_options$anchorName = options.anchorName) !== null && _options$anchorName !== void 0 && _options$anchorName.includes('layoutColumn')) {
|
|
86
|
+
if (currentUserIntent === 'blockMenuOpen') {
|
|
87
|
+
var _api$userIntent3;
|
|
88
|
+
api === null || api === void 0 ? void 0 : (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 ? void 0 : _api$userIntent3.commands.setCurrentUserIntent('default')({
|
|
89
|
+
tr
|
|
90
|
+
});
|
|
91
|
+
}
|
|
79
92
|
tr.setMeta(key, {
|
|
80
93
|
...currMeta,
|
|
81
94
|
closeMenu: true
|
|
@@ -101,23 +114,19 @@ export const blockControlsPlugin = ({
|
|
|
101
114
|
...currMeta,
|
|
102
115
|
toggleMenu: toggleMenuMeta
|
|
103
116
|
});
|
|
104
|
-
if (menuTriggerBy === undefined || !!menuTriggerBy && menuTriggerBy === (options === null || options === void 0 ? void 0 : options.anchorName)) {
|
|
105
|
-
var _api$
|
|
117
|
+
if ((menuTriggerBy === undefined || !!menuTriggerBy && menuTriggerBy === (options === null || options === void 0 ? void 0 : options.anchorName)) && currentUserIntent === 'blockMenuOpen') {
|
|
118
|
+
var _api$userIntent4;
|
|
106
119
|
// Toggled from drag handle
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
api === null || api === void 0 ? void 0 : (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands.setCurrentUserIntent('default')({
|
|
111
|
-
tr
|
|
112
|
-
});
|
|
113
|
-
}
|
|
120
|
+
api === null || api === void 0 ? void 0 : (_api$userIntent4 = api.userIntent) === null || _api$userIntent4 === void 0 ? void 0 : _api$userIntent4.commands.setCurrentUserIntent('default')({
|
|
121
|
+
tr
|
|
122
|
+
});
|
|
114
123
|
}
|
|
115
124
|
return tr;
|
|
116
125
|
},
|
|
117
126
|
setNodeDragged: (getPos, anchorName, nodeType) => ({
|
|
118
127
|
tr
|
|
119
128
|
}) => {
|
|
120
|
-
var _api$
|
|
129
|
+
var _api$userIntent5;
|
|
121
130
|
const pos = getPos();
|
|
122
131
|
if (pos === undefined) {
|
|
123
132
|
return tr;
|
|
@@ -141,7 +150,7 @@ export const blockControlsPlugin = ({
|
|
|
141
150
|
tr
|
|
142
151
|
});
|
|
143
152
|
}
|
|
144
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
153
|
+
api === null || api === void 0 ? void 0 : (_api$userIntent5 = api.userIntent) === null || _api$userIntent5 === void 0 ? void 0 : _api$userIntent5.commands.setCurrentUserIntent('dragging')({
|
|
145
154
|
tr
|
|
146
155
|
});
|
|
147
156
|
return tr;
|
|
@@ -67,18 +67,31 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
67
67
|
},
|
|
68
68
|
toggleBlockMenu: function toggleBlockMenu(options) {
|
|
69
69
|
return function (_ref4) {
|
|
70
|
-
var _options$anchorName, _api$blockControls;
|
|
70
|
+
var _api$userIntent, _options$anchorName, _api$blockControls;
|
|
71
71
|
var tr = _ref4.tr;
|
|
72
72
|
var currMeta = tr.getMeta(key);
|
|
73
|
+
var currentUserIntent = api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent;
|
|
73
74
|
if (options !== null && options !== void 0 && options.closeMenu) {
|
|
74
75
|
tr.setMeta(key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
75
76
|
closeMenu: true
|
|
76
77
|
}));
|
|
78
|
+
if (currentUserIntent === 'blockMenuOpen') {
|
|
79
|
+
var _api$userIntent2;
|
|
80
|
+
api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || _api$userIntent2.commands.setCurrentUserIntent('default')({
|
|
81
|
+
tr: tr
|
|
82
|
+
});
|
|
83
|
+
}
|
|
77
84
|
return tr;
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
// Do not open menu on layoutColumn and close opened menu when layoutColumn drag handle is clicked
|
|
81
88
|
if (options !== null && options !== void 0 && (_options$anchorName = options.anchorName) !== null && _options$anchorName !== void 0 && _options$anchorName.includes('layoutColumn')) {
|
|
89
|
+
if (currentUserIntent === 'blockMenuOpen') {
|
|
90
|
+
var _api$userIntent3;
|
|
91
|
+
api === null || api === void 0 || (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 || _api$userIntent3.commands.setCurrentUserIntent('default')({
|
|
92
|
+
tr: tr
|
|
93
|
+
});
|
|
94
|
+
}
|
|
82
95
|
tr.setMeta(key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
83
96
|
closeMenu: true
|
|
84
97
|
}));
|
|
@@ -100,23 +113,19 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
100
113
|
tr.setMeta(key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
101
114
|
toggleMenu: toggleMenuMeta
|
|
102
115
|
}));
|
|
103
|
-
if (menuTriggerBy === undefined || !!menuTriggerBy && menuTriggerBy === (options === null || options === void 0 ? void 0 : options.anchorName)) {
|
|
104
|
-
var _api$
|
|
116
|
+
if ((menuTriggerBy === undefined || !!menuTriggerBy && menuTriggerBy === (options === null || options === void 0 ? void 0 : options.anchorName)) && currentUserIntent === 'blockMenuOpen') {
|
|
117
|
+
var _api$userIntent4;
|
|
105
118
|
// Toggled from drag handle
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || _api$userIntent2.commands.setCurrentUserIntent('default')({
|
|
110
|
-
tr: tr
|
|
111
|
-
});
|
|
112
|
-
}
|
|
119
|
+
api === null || api === void 0 || (_api$userIntent4 = api.userIntent) === null || _api$userIntent4 === void 0 || _api$userIntent4.commands.setCurrentUserIntent('default')({
|
|
120
|
+
tr: tr
|
|
121
|
+
});
|
|
113
122
|
}
|
|
114
123
|
return tr;
|
|
115
124
|
};
|
|
116
125
|
},
|
|
117
126
|
setNodeDragged: function setNodeDragged(getPos, anchorName, nodeType) {
|
|
118
127
|
return function (_ref5) {
|
|
119
|
-
var _api$
|
|
128
|
+
var _api$userIntent5;
|
|
120
129
|
var tr = _ref5.tr;
|
|
121
130
|
var pos = getPos();
|
|
122
131
|
if (pos === undefined) {
|
|
@@ -140,7 +149,7 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
140
149
|
tr: tr
|
|
141
150
|
});
|
|
142
151
|
}
|
|
143
|
-
api === null || api === void 0 || (_api$
|
|
152
|
+
api === null || api === void 0 || (_api$userIntent5 = api.userIntent) === null || _api$userIntent5 === void 0 || _api$userIntent5.commands.setCurrentUserIntent('dragging')({
|
|
144
153
|
tr: tr
|
|
145
154
|
});
|
|
146
155
|
return tr;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.7",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,9 +27,6 @@
|
|
|
27
27
|
"*.compiled.css"
|
|
28
28
|
],
|
|
29
29
|
"atlaskit:src": "src/index.ts",
|
|
30
|
-
"af:exports": {
|
|
31
|
-
".": "./src/index.ts"
|
|
32
|
-
},
|
|
33
30
|
"dependencies": {
|
|
34
31
|
"@atlaskit/adf-schema": "^50.2.2",
|
|
35
32
|
"@atlaskit/editor-plugin-accessibility-utils": "^3.0.0",
|
|
@@ -47,16 +44,16 @@
|
|
|
47
44
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
48
45
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
49
46
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
50
|
-
"@atlaskit/icon": "^28.
|
|
47
|
+
"@atlaskit/icon": "^28.1.0",
|
|
51
48
|
"@atlaskit/link": "^3.2.0",
|
|
52
49
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
53
50
|
"@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
|
|
54
51
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
|
|
55
52
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
56
|
-
"@atlaskit/primitives": "^14.
|
|
57
|
-
"@atlaskit/theme": "^
|
|
58
|
-
"@atlaskit/tmp-editor-statsig": "^11.
|
|
59
|
-
"@atlaskit/tokens": "^6.
|
|
53
|
+
"@atlaskit/primitives": "^14.12.0",
|
|
54
|
+
"@atlaskit/theme": "^20.0.0",
|
|
55
|
+
"@atlaskit/tmp-editor-statsig": "^11.8.0",
|
|
56
|
+
"@atlaskit/tokens": "^6.1.0",
|
|
60
57
|
"@atlaskit/tooltip": "^20.4.0",
|
|
61
58
|
"@babel/runtime": "^7.0.0",
|
|
62
59
|
"@emotion/react": "^11.7.1",
|
|
@@ -67,7 +64,7 @@
|
|
|
67
64
|
"uuid": "^3.1.0"
|
|
68
65
|
},
|
|
69
66
|
"peerDependencies": {
|
|
70
|
-
"@atlaskit/editor-common": "^107.
|
|
67
|
+
"@atlaskit/editor-common": "^107.32.0",
|
|
71
68
|
"react": "^18.2.0",
|
|
72
69
|
"react-dom": "^18.2.0",
|
|
73
70
|
"react-intl-next": "npm:react-intl@^5.18.1"
|