@atlaskit/editor-plugin-toolbar 3.4.10 → 3.4.11
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 +9 -0
- package/dist/cjs/pm-plugins/experiences/selection-toolbar-open-experience.js +8 -0
- package/dist/cjs/toolbarPlugin.js +16 -0
- package/dist/es2019/pm-plugins/experiences/selection-toolbar-open-experience.js +8 -0
- package/dist/es2019/toolbarPlugin.js +20 -0
- package/dist/esm/pm-plugins/experiences/selection-toolbar-open-experience.js +8 -0
- package/dist/esm/toolbarPlugin.js +16 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-toolbar
|
|
2
2
|
|
|
3
|
+
## 3.4.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4d676bbdb3ce6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4d676bbdb3ce6) -
|
|
8
|
+
ts-ignore added temporarily to unblock local consumption for help-center, will be removed once
|
|
9
|
+
project refs are setup
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 3.4.10
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -62,6 +62,8 @@ var getSelectionToolbarOpenExperiencePlugin = exports.getSelectionToolbarOpenExp
|
|
|
62
62
|
}), new _experiences.ExperienceCheckDomMutation({
|
|
63
63
|
onDomMutation: function onDomMutation(_ref2) {
|
|
64
64
|
var mutations = _ref2.mutations;
|
|
65
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
66
|
+
|
|
65
67
|
if (mutations.some(isSelectionToolbarAddedInMutation)) {
|
|
66
68
|
return {
|
|
67
69
|
status: 'success'
|
|
@@ -84,6 +86,8 @@ var getSelectionToolbarOpenExperiencePlugin = exports.getSelectionToolbarOpenExp
|
|
|
84
86
|
init: function init() {
|
|
85
87
|
return {};
|
|
86
88
|
},
|
|
89
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
90
|
+
|
|
87
91
|
apply: function apply(_tr, pluginState, oldState, newState) {
|
|
88
92
|
if (!oldState.selection.empty && isSelectionWithoutTextContent(newState.selection)) {
|
|
89
93
|
experience.abort({
|
|
@@ -100,6 +104,8 @@ var getSelectionToolbarOpenExperiencePlugin = exports.getSelectionToolbarOpenExp
|
|
|
100
104
|
}
|
|
101
105
|
},
|
|
102
106
|
props: {
|
|
107
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
108
|
+
|
|
103
109
|
handleDOMEvents: {
|
|
104
110
|
mousedown: function mousedown(_view, e) {
|
|
105
111
|
mouseDownPos = {
|
|
@@ -150,6 +156,8 @@ var getSelectionToolbarOpenExperiencePlugin = exports.getSelectionToolbarOpenExp
|
|
|
150
156
|
var isSelectionToolbarAddedInMutation = function isSelectionToolbarAddedInMutation(_ref4) {
|
|
151
157
|
var type = _ref4.type,
|
|
152
158
|
addedNodes = _ref4.addedNodes;
|
|
159
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
160
|
+
|
|
153
161
|
return type === 'childList' && (0, _toConsumableArray2.default)(addedNodes).some(isSelectionToolbarWithinNode);
|
|
154
162
|
};
|
|
155
163
|
var isSelectionToolbarWithinNode = function isSelectionToolbarWithinNode(node) {
|
|
@@ -30,6 +30,8 @@ function getSelectedNode(editorState) {
|
|
|
30
30
|
node: selection.node,
|
|
31
31
|
pos: selection.from,
|
|
32
32
|
nodeType: selection.node.type.name,
|
|
33
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
34
|
+
|
|
33
35
|
marks: selection.node.marks.map(function (mark) {
|
|
34
36
|
return "".concat(mark.type.name, ":").concat(JSON.stringify(mark.attrs));
|
|
35
37
|
})
|
|
@@ -42,6 +44,8 @@ function getSelectedNode(editorState) {
|
|
|
42
44
|
node: selectedNode.node,
|
|
43
45
|
pos: selectedNode.pos,
|
|
44
46
|
nodeType: selectedNode.node.type.name,
|
|
47
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
48
|
+
|
|
45
49
|
marks: selectedNode.node.marks.map(function (mark) {
|
|
46
50
|
return "".concat(mark.type.name, ":").concat(JSON.stringify(mark.attrs));
|
|
47
51
|
})
|
|
@@ -53,6 +57,8 @@ function getSelectedNode(editorState) {
|
|
|
53
57
|
node: parentNode.node,
|
|
54
58
|
pos: parentNode.pos,
|
|
55
59
|
nodeType: parentNode.node.type.name,
|
|
60
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
61
|
+
|
|
56
62
|
marks: parentNode.node.marks.map(function (mark) {
|
|
57
63
|
return "".concat(mark.type.name, ":").concat(JSON.stringify(mark.attrs));
|
|
58
64
|
})
|
|
@@ -63,6 +69,8 @@ function getSelectedNode(editorState) {
|
|
|
63
69
|
node: $pos.parent,
|
|
64
70
|
pos: $pos.pos,
|
|
65
71
|
nodeType: $pos.parent.type.name,
|
|
72
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
73
|
+
|
|
66
74
|
marks: $pos.marks().map(function (mark) {
|
|
67
75
|
return "".concat(mark.type.name, ":").concat(JSON.stringify(mark.attrs));
|
|
68
76
|
})
|
|
@@ -117,12 +125,14 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
117
125
|
return new _safePlugin.SafePlugin({
|
|
118
126
|
key: _pluginKey.editorToolbarPluginKey,
|
|
119
127
|
state: {
|
|
128
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
120
129
|
init: function init(_, editorState) {
|
|
121
130
|
return {
|
|
122
131
|
shouldShowToolbar: false,
|
|
123
132
|
selectedNode: getSelectedNode(editorState)
|
|
124
133
|
};
|
|
125
134
|
},
|
|
135
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
126
136
|
apply: function apply(tr, pluginState, _, newState) {
|
|
127
137
|
var meta = tr.getMeta(_pluginKey.editorToolbarPluginKey);
|
|
128
138
|
var newPluginState = _objectSpread({}, pluginState);
|
|
@@ -143,6 +153,7 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
143
153
|
return newPluginState;
|
|
144
154
|
}
|
|
145
155
|
},
|
|
156
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
146
157
|
view: function view(_view) {
|
|
147
158
|
var unbind = (0, _bindEventListener.bind)(_view.root, {
|
|
148
159
|
type: 'mouseup',
|
|
@@ -171,6 +182,7 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
171
182
|
}
|
|
172
183
|
});
|
|
173
184
|
return {
|
|
185
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
174
186
|
destroy: function destroy() {
|
|
175
187
|
unbind();
|
|
176
188
|
unbindEditorViewFocus();
|
|
@@ -178,7 +190,11 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
178
190
|
};
|
|
179
191
|
},
|
|
180
192
|
props: {
|
|
193
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
194
|
+
|
|
181
195
|
handleDOMEvents: {
|
|
196
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
197
|
+
|
|
182
198
|
mousedown: function mousedown(view) {
|
|
183
199
|
view.dispatch(view.state.tr.setMeta(_pluginKey.editorToolbarPluginKey, {
|
|
184
200
|
shouldShowToolbar: false
|
|
@@ -56,6 +56,8 @@ export const getSelectionToolbarOpenExperiencePlugin = ({
|
|
|
56
56
|
onDomMutation: ({
|
|
57
57
|
mutations
|
|
58
58
|
}) => {
|
|
59
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
60
|
+
|
|
59
61
|
if (mutations.some(isSelectionToolbarAddedInMutation)) {
|
|
60
62
|
return {
|
|
61
63
|
status: 'success'
|
|
@@ -74,6 +76,8 @@ export const getSelectionToolbarOpenExperiencePlugin = ({
|
|
|
74
76
|
key: pluginKey,
|
|
75
77
|
state: {
|
|
76
78
|
init: () => ({}),
|
|
79
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
80
|
+
|
|
77
81
|
apply: (_tr, pluginState, oldState, newState) => {
|
|
78
82
|
if (!oldState.selection.empty && isSelectionWithoutTextContent(newState.selection)) {
|
|
79
83
|
experience.abort({
|
|
@@ -90,6 +94,8 @@ export const getSelectionToolbarOpenExperiencePlugin = ({
|
|
|
90
94
|
}
|
|
91
95
|
},
|
|
92
96
|
props: {
|
|
97
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
98
|
+
|
|
93
99
|
handleDOMEvents: {
|
|
94
100
|
mousedown: (_view, e) => {
|
|
95
101
|
mouseDownPos = {
|
|
@@ -142,6 +148,8 @@ const isSelectionToolbarAddedInMutation = ({
|
|
|
142
148
|
type,
|
|
143
149
|
addedNodes
|
|
144
150
|
}) => {
|
|
151
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
152
|
+
|
|
145
153
|
return type === 'childList' && [...addedNodes].some(isSelectionToolbarWithinNode);
|
|
146
154
|
};
|
|
147
155
|
const isSelectionToolbarWithinNode = node => {
|
|
@@ -21,6 +21,8 @@ function getSelectedNode(editorState) {
|
|
|
21
21
|
node: selection.node,
|
|
22
22
|
pos: selection.from,
|
|
23
23
|
nodeType: selection.node.type.name,
|
|
24
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
25
|
+
|
|
24
26
|
marks: selection.node.marks.map(mark => `${mark.type.name}:${JSON.stringify(mark.attrs)}`)
|
|
25
27
|
};
|
|
26
28
|
}
|
|
@@ -33,6 +35,8 @@ function getSelectedNode(editorState) {
|
|
|
33
35
|
node: selectedNode.node,
|
|
34
36
|
pos: selectedNode.pos,
|
|
35
37
|
nodeType: selectedNode.node.type.name,
|
|
38
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
39
|
+
|
|
36
40
|
marks: selectedNode.node.marks.map(mark => `${mark.type.name}:${JSON.stringify(mark.attrs)}`)
|
|
37
41
|
};
|
|
38
42
|
}
|
|
@@ -42,6 +46,8 @@ function getSelectedNode(editorState) {
|
|
|
42
46
|
node: parentNode.node,
|
|
43
47
|
pos: parentNode.pos,
|
|
44
48
|
nodeType: parentNode.node.type.name,
|
|
49
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
50
|
+
|
|
45
51
|
marks: parentNode.node.marks.map(mark => `${mark.type.name}:${JSON.stringify(mark.attrs)}`)
|
|
46
52
|
};
|
|
47
53
|
}
|
|
@@ -50,6 +56,8 @@ function getSelectedNode(editorState) {
|
|
|
50
56
|
node: $pos.parent,
|
|
51
57
|
pos: $pos.pos,
|
|
52
58
|
nodeType: $pos.parent.type.name,
|
|
59
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
60
|
+
|
|
53
61
|
marks: $pos.marks().map(mark => `${mark.type.name}:${JSON.stringify(mark.attrs)}`)
|
|
54
62
|
};
|
|
55
63
|
}
|
|
@@ -102,12 +110,16 @@ export const toolbarPlugin = ({
|
|
|
102
110
|
return new SafePlugin({
|
|
103
111
|
key: editorToolbarPluginKey,
|
|
104
112
|
state: {
|
|
113
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
114
|
+
|
|
105
115
|
init(_, editorState) {
|
|
106
116
|
return {
|
|
107
117
|
shouldShowToolbar: false,
|
|
108
118
|
selectedNode: getSelectedNode(editorState)
|
|
109
119
|
};
|
|
110
120
|
},
|
|
121
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
122
|
+
|
|
111
123
|
apply(tr, pluginState, _, newState) {
|
|
112
124
|
const meta = tr.getMeta(editorToolbarPluginKey);
|
|
113
125
|
let newPluginState = {
|
|
@@ -133,6 +145,8 @@ export const toolbarPlugin = ({
|
|
|
133
145
|
return newPluginState;
|
|
134
146
|
}
|
|
135
147
|
},
|
|
148
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
149
|
+
|
|
136
150
|
view(view) {
|
|
137
151
|
const unbind = bind(view.root, {
|
|
138
152
|
type: 'mouseup',
|
|
@@ -161,6 +175,8 @@ export const toolbarPlugin = ({
|
|
|
161
175
|
}
|
|
162
176
|
});
|
|
163
177
|
return {
|
|
178
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
179
|
+
|
|
164
180
|
destroy() {
|
|
165
181
|
unbind();
|
|
166
182
|
unbindEditorViewFocus();
|
|
@@ -168,7 +184,11 @@ export const toolbarPlugin = ({
|
|
|
168
184
|
};
|
|
169
185
|
},
|
|
170
186
|
props: {
|
|
187
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
188
|
+
|
|
171
189
|
handleDOMEvents: {
|
|
190
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
191
|
+
|
|
172
192
|
mousedown: view => {
|
|
173
193
|
view.dispatch(view.state.tr.setMeta(editorToolbarPluginKey, {
|
|
174
194
|
shouldShowToolbar: false
|
|
@@ -55,6 +55,8 @@ export var getSelectionToolbarOpenExperiencePlugin = function getSelectionToolba
|
|
|
55
55
|
}), new ExperienceCheckDomMutation({
|
|
56
56
|
onDomMutation: function onDomMutation(_ref2) {
|
|
57
57
|
var mutations = _ref2.mutations;
|
|
58
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
59
|
+
|
|
58
60
|
if (mutations.some(isSelectionToolbarAddedInMutation)) {
|
|
59
61
|
return {
|
|
60
62
|
status: 'success'
|
|
@@ -77,6 +79,8 @@ export var getSelectionToolbarOpenExperiencePlugin = function getSelectionToolba
|
|
|
77
79
|
init: function init() {
|
|
78
80
|
return {};
|
|
79
81
|
},
|
|
82
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
83
|
+
|
|
80
84
|
apply: function apply(_tr, pluginState, oldState, newState) {
|
|
81
85
|
if (!oldState.selection.empty && isSelectionWithoutTextContent(newState.selection)) {
|
|
82
86
|
experience.abort({
|
|
@@ -93,6 +97,8 @@ export var getSelectionToolbarOpenExperiencePlugin = function getSelectionToolba
|
|
|
93
97
|
}
|
|
94
98
|
},
|
|
95
99
|
props: {
|
|
100
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
101
|
+
|
|
96
102
|
handleDOMEvents: {
|
|
97
103
|
mousedown: function mousedown(_view, e) {
|
|
98
104
|
mouseDownPos = {
|
|
@@ -143,6 +149,8 @@ export var getSelectionToolbarOpenExperiencePlugin = function getSelectionToolba
|
|
|
143
149
|
var isSelectionToolbarAddedInMutation = function isSelectionToolbarAddedInMutation(_ref4) {
|
|
144
150
|
var type = _ref4.type,
|
|
145
151
|
addedNodes = _ref4.addedNodes;
|
|
152
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
153
|
+
|
|
146
154
|
return type === 'childList' && _toConsumableArray(addedNodes).some(isSelectionToolbarWithinNode);
|
|
147
155
|
};
|
|
148
156
|
var isSelectionToolbarWithinNode = function isSelectionToolbarWithinNode(node) {
|
|
@@ -23,6 +23,8 @@ function getSelectedNode(editorState) {
|
|
|
23
23
|
node: selection.node,
|
|
24
24
|
pos: selection.from,
|
|
25
25
|
nodeType: selection.node.type.name,
|
|
26
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
27
|
+
|
|
26
28
|
marks: selection.node.marks.map(function (mark) {
|
|
27
29
|
return "".concat(mark.type.name, ":").concat(JSON.stringify(mark.attrs));
|
|
28
30
|
})
|
|
@@ -35,6 +37,8 @@ function getSelectedNode(editorState) {
|
|
|
35
37
|
node: selectedNode.node,
|
|
36
38
|
pos: selectedNode.pos,
|
|
37
39
|
nodeType: selectedNode.node.type.name,
|
|
40
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
41
|
+
|
|
38
42
|
marks: selectedNode.node.marks.map(function (mark) {
|
|
39
43
|
return "".concat(mark.type.name, ":").concat(JSON.stringify(mark.attrs));
|
|
40
44
|
})
|
|
@@ -46,6 +50,8 @@ function getSelectedNode(editorState) {
|
|
|
46
50
|
node: parentNode.node,
|
|
47
51
|
pos: parentNode.pos,
|
|
48
52
|
nodeType: parentNode.node.type.name,
|
|
53
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
54
|
+
|
|
49
55
|
marks: parentNode.node.marks.map(function (mark) {
|
|
50
56
|
return "".concat(mark.type.name, ":").concat(JSON.stringify(mark.attrs));
|
|
51
57
|
})
|
|
@@ -56,6 +62,8 @@ function getSelectedNode(editorState) {
|
|
|
56
62
|
node: $pos.parent,
|
|
57
63
|
pos: $pos.pos,
|
|
58
64
|
nodeType: $pos.parent.type.name,
|
|
65
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
66
|
+
|
|
59
67
|
marks: $pos.marks().map(function (mark) {
|
|
60
68
|
return "".concat(mark.type.name, ":").concat(JSON.stringify(mark.attrs));
|
|
61
69
|
})
|
|
@@ -110,12 +118,14 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
110
118
|
return new SafePlugin({
|
|
111
119
|
key: editorToolbarPluginKey,
|
|
112
120
|
state: {
|
|
121
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
113
122
|
init: function init(_, editorState) {
|
|
114
123
|
return {
|
|
115
124
|
shouldShowToolbar: false,
|
|
116
125
|
selectedNode: getSelectedNode(editorState)
|
|
117
126
|
};
|
|
118
127
|
},
|
|
128
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
119
129
|
apply: function apply(tr, pluginState, _, newState) {
|
|
120
130
|
var meta = tr.getMeta(editorToolbarPluginKey);
|
|
121
131
|
var newPluginState = _objectSpread({}, pluginState);
|
|
@@ -136,6 +146,7 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
136
146
|
return newPluginState;
|
|
137
147
|
}
|
|
138
148
|
},
|
|
149
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
139
150
|
view: function view(_view) {
|
|
140
151
|
var unbind = bind(_view.root, {
|
|
141
152
|
type: 'mouseup',
|
|
@@ -164,6 +175,7 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
164
175
|
}
|
|
165
176
|
});
|
|
166
177
|
return {
|
|
178
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
167
179
|
destroy: function destroy() {
|
|
168
180
|
unbind();
|
|
169
181
|
unbindEditorViewFocus();
|
|
@@ -171,7 +183,11 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
171
183
|
};
|
|
172
184
|
},
|
|
173
185
|
props: {
|
|
186
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
187
|
+
|
|
174
188
|
handleDOMEvents: {
|
|
189
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
190
|
+
|
|
175
191
|
mousedown: function mousedown(view) {
|
|
176
192
|
view.dispatch(view.state.tr.setMeta(editorToolbarPluginKey, {
|
|
177
193
|
shouldShowToolbar: false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-toolbar",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.11",
|
|
4
4
|
"description": "Toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@atlaskit/editor-common": "^110.
|
|
49
|
+
"@atlaskit/editor-common": "^110.34.0",
|
|
50
50
|
"react": "^18.2.0"
|
|
51
51
|
},
|
|
52
52
|
"platform-feature-flags": {
|