@atlaskit/editor-core 187.31.2 → 187.31.3
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 +6 -0
- package/dist/cjs/plugins/insert-block/index.js +13 -12
- package/dist/cjs/plugins/type-ahead/pm-plugins/reducer.js +5 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/insert-block/index.js +13 -10
- package/dist/es2019/plugins/type-ahead/pm-plugins/reducer.js +5 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/insert-block/index.js +13 -12
- package/dist/esm/plugins/type-ahead/pm-plugins/reducer.js +5 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.31.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`0debfab882f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0debfab882f) - ED-17959 prevent redundant rerenders on insert block component and due to typeahead state changes
|
|
8
|
+
|
|
3
9
|
## 187.31.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -34,15 +34,6 @@ var toolbarSizeToButtons = function toolbarSizeToButtons(toolbarSize) {
|
|
|
34
34
|
return 0;
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
/**
|
|
38
|
-
* Wrapper over insertBlockTypeWithAnalytics to autobind toolbar input method
|
|
39
|
-
* @param name Block name
|
|
40
|
-
*/
|
|
41
|
-
function handleInsertBlockType(editorAnalyticsApi) {
|
|
42
|
-
return function (name) {
|
|
43
|
-
return (0, _commands.insertBlockTypesWithAnalytics)(name, _analytics.INPUT_METHOD.TOOLBAR, editorAnalyticsApi);
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
37
|
var insertBlockPlugin = function insertBlockPlugin() {
|
|
47
38
|
var _api$dependencies, _api$dependencies$fea;
|
|
48
39
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -68,6 +59,7 @@ var insertBlockPlugin = function insertBlockPlugin() {
|
|
|
68
59
|
return /*#__PURE__*/_react.default.createElement(_WithPluginState.default, {
|
|
69
60
|
plugins: {
|
|
70
61
|
typeAheadState: _key.pluginKey,
|
|
62
|
+
// needed to check isTypeAheadAllowed in ToolbarInsertBlock
|
|
71
63
|
blockTypeState: _main.pluginKey,
|
|
72
64
|
mediaState: _pluginKey.stateKey,
|
|
73
65
|
macroState: _pluginKey3.pluginKey,
|
|
@@ -115,7 +107,7 @@ var insertBlockPlugin = function insertBlockPlugin() {
|
|
|
115
107
|
};
|
|
116
108
|
};
|
|
117
109
|
function ToolbarInsertBlockWithInjectionApi(_ref3) {
|
|
118
|
-
var _pluginInjectionApi$
|
|
110
|
+
var _pluginInjectionApi$d2, _pluginInjectionApi$d3;
|
|
119
111
|
var editorView = _ref3.editorView,
|
|
120
112
|
editorActions = _ref3.editorActions,
|
|
121
113
|
dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent,
|
|
@@ -143,6 +135,15 @@ function ToolbarInsertBlockWithInjectionApi(_ref3) {
|
|
|
143
135
|
imageUploadState = _useSharedPluginState.imageUploadState,
|
|
144
136
|
mentionState = _useSharedPluginState.mentionState,
|
|
145
137
|
emojiState = _useSharedPluginState.emojiState;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Wrapper over insertBlockTypeWithAnalytics to autobind toolbar input method
|
|
141
|
+
* @param name Block name
|
|
142
|
+
*/
|
|
143
|
+
var handleInsertBlockType = _react.default.useCallback(function (name) {
|
|
144
|
+
var _pluginInjectionApi$d;
|
|
145
|
+
return (0, _commands.insertBlockTypesWithAnalytics)(name, _analytics.INPUT_METHOD.TOOLBAR, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions);
|
|
146
|
+
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions]);
|
|
146
147
|
return /*#__PURE__*/_react.default.createElement(_ToolbarInsertBlock.default, {
|
|
147
148
|
pluginInjectionApi: pluginInjectionApi,
|
|
148
149
|
buttons: buttons,
|
|
@@ -164,7 +165,7 @@ function ToolbarInsertBlockWithInjectionApi(_ref3) {
|
|
|
164
165
|
mediaSupported: !!mediaState,
|
|
165
166
|
imageUploadSupported: !!(pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.dependencies.imageUpload),
|
|
166
167
|
imageUploadEnabled: imageUploadState === null || imageUploadState === void 0 ? void 0 : imageUploadState.enabled,
|
|
167
|
-
handleImageUpload: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
168
|
+
handleImageUpload: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies.imageUpload) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : _pluginInjectionApi$d3.actions.startUpload,
|
|
168
169
|
availableWrapperBlockTypes: blockTypeState && blockTypeState.availableWrapperBlockTypes,
|
|
169
170
|
linkSupported: !!hyperlinkState,
|
|
170
171
|
linkDisabled: !hyperlinkState || !hyperlinkState.canInsertLink || !!hyperlinkState.activeLinkMark,
|
|
@@ -172,7 +173,7 @@ function ToolbarInsertBlockWithInjectionApi(_ref3) {
|
|
|
172
173
|
emojiProvider: providers.emojiProvider,
|
|
173
174
|
nativeStatusSupported: options.nativeStatusSupported,
|
|
174
175
|
horizontalRuleEnabled: options.horizontalRuleEnabled,
|
|
175
|
-
onInsertBlockType: handleInsertBlockType
|
|
176
|
+
onInsertBlockType: handleInsertBlockType,
|
|
176
177
|
onInsertMacroFromMacroBrowser: _macro.insertMacroFromMacroBrowser,
|
|
177
178
|
macroProvider: macroState.macroProvider,
|
|
178
179
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -144,6 +144,11 @@ var createReducer = function createReducer(_ref) {
|
|
|
144
144
|
var mappedDecorationSet = decorationSet.map(tr.mapping, tr.doc, {
|
|
145
145
|
onRemove: onRemove
|
|
146
146
|
});
|
|
147
|
+
|
|
148
|
+
// return same pluginState if decorationSet did not change
|
|
149
|
+
if (mappedDecorationSet === currentPluginState.decorationSet) {
|
|
150
|
+
return currentPluginState;
|
|
151
|
+
}
|
|
147
152
|
return _objectSpread(_objectSpread({}, currentPluginState), {}, {
|
|
148
153
|
decorationSet: mappedDecorationSet
|
|
149
154
|
});
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "187.31.
|
|
9
|
+
var version = "187.31.3";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
@@ -27,13 +27,6 @@ const toolbarSizeToButtons = toolbarSize => {
|
|
|
27
27
|
return 0;
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
/**
|
|
31
|
-
* Wrapper over insertBlockTypeWithAnalytics to autobind toolbar input method
|
|
32
|
-
* @param name Block name
|
|
33
|
-
*/
|
|
34
|
-
function handleInsertBlockType(editorAnalyticsApi) {
|
|
35
|
-
return name => insertBlockTypesWithAnalytics(name, INPUT_METHOD.TOOLBAR, editorAnalyticsApi);
|
|
36
|
-
}
|
|
37
30
|
const insertBlockPlugin = (options = {}, api) => {
|
|
38
31
|
var _api$dependencies, _api$dependencies$fea;
|
|
39
32
|
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
|
|
@@ -58,6 +51,7 @@ const insertBlockPlugin = (options = {}, api) => {
|
|
|
58
51
|
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
59
52
|
plugins: {
|
|
60
53
|
typeAheadState: typeAheadPluginKey,
|
|
54
|
+
// needed to check isTypeAheadAllowed in ToolbarInsertBlock
|
|
61
55
|
blockTypeState: blockTypeStateKey,
|
|
62
56
|
mediaState: mediaStateKey,
|
|
63
57
|
macroState: macroStateKey,
|
|
@@ -124,7 +118,7 @@ function ToolbarInsertBlockWithInjectionApi({
|
|
|
124
118
|
layoutState,
|
|
125
119
|
featureFlags
|
|
126
120
|
}) {
|
|
127
|
-
var _pluginInjectionApi$
|
|
121
|
+
var _pluginInjectionApi$d2, _pluginInjectionApi$d3;
|
|
128
122
|
const buttons = toolbarSizeToButtons(toolbarSize);
|
|
129
123
|
const {
|
|
130
124
|
dateState,
|
|
@@ -133,6 +127,15 @@ function ToolbarInsertBlockWithInjectionApi({
|
|
|
133
127
|
mentionState,
|
|
134
128
|
emojiState
|
|
135
129
|
} = useSharedPluginState(pluginInjectionApi, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji']);
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Wrapper over insertBlockTypeWithAnalytics to autobind toolbar input method
|
|
133
|
+
* @param name Block name
|
|
134
|
+
*/
|
|
135
|
+
const handleInsertBlockType = React.useCallback(name => {
|
|
136
|
+
var _pluginInjectionApi$d;
|
|
137
|
+
return insertBlockTypesWithAnalytics(name, INPUT_METHOD.TOOLBAR, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions);
|
|
138
|
+
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions]);
|
|
136
139
|
return /*#__PURE__*/React.createElement(ToolbarInsertBlock, {
|
|
137
140
|
pluginInjectionApi: pluginInjectionApi,
|
|
138
141
|
buttons: buttons,
|
|
@@ -154,7 +157,7 @@ function ToolbarInsertBlockWithInjectionApi({
|
|
|
154
157
|
mediaSupported: !!mediaState,
|
|
155
158
|
imageUploadSupported: !!(pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.dependencies.imageUpload),
|
|
156
159
|
imageUploadEnabled: imageUploadState === null || imageUploadState === void 0 ? void 0 : imageUploadState.enabled,
|
|
157
|
-
handleImageUpload: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
160
|
+
handleImageUpload: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies.imageUpload) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : _pluginInjectionApi$d3.actions.startUpload,
|
|
158
161
|
availableWrapperBlockTypes: blockTypeState && blockTypeState.availableWrapperBlockTypes,
|
|
159
162
|
linkSupported: !!hyperlinkState,
|
|
160
163
|
linkDisabled: !hyperlinkState || !hyperlinkState.canInsertLink || !!hyperlinkState.activeLinkMark,
|
|
@@ -162,7 +165,7 @@ function ToolbarInsertBlockWithInjectionApi({
|
|
|
162
165
|
emojiProvider: providers.emojiProvider,
|
|
163
166
|
nativeStatusSupported: options.nativeStatusSupported,
|
|
164
167
|
horizontalRuleEnabled: options.horizontalRuleEnabled,
|
|
165
|
-
onInsertBlockType: handleInsertBlockType
|
|
168
|
+
onInsertBlockType: handleInsertBlockType,
|
|
166
169
|
onInsertMacroFromMacroBrowser: insertMacroFromMacroBrowser,
|
|
167
170
|
macroProvider: macroState.macroProvider,
|
|
168
171
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -145,6 +145,11 @@ export const createReducer = ({
|
|
|
145
145
|
const mappedDecorationSet = decorationSet.map(tr.mapping, tr.doc, {
|
|
146
146
|
onRemove
|
|
147
147
|
});
|
|
148
|
+
|
|
149
|
+
// return same pluginState if decorationSet did not change
|
|
150
|
+
if (mappedDecorationSet === currentPluginState.decorationSet) {
|
|
151
|
+
return currentPluginState;
|
|
152
|
+
}
|
|
148
153
|
return {
|
|
149
154
|
...currentPluginState,
|
|
150
155
|
decorationSet: mappedDecorationSet
|
|
@@ -27,15 +27,6 @@ var toolbarSizeToButtons = function toolbarSizeToButtons(toolbarSize) {
|
|
|
27
27
|
return 0;
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
/**
|
|
31
|
-
* Wrapper over insertBlockTypeWithAnalytics to autobind toolbar input method
|
|
32
|
-
* @param name Block name
|
|
33
|
-
*/
|
|
34
|
-
function handleInsertBlockType(editorAnalyticsApi) {
|
|
35
|
-
return function (name) {
|
|
36
|
-
return insertBlockTypesWithAnalytics(name, INPUT_METHOD.TOOLBAR, editorAnalyticsApi);
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
30
|
var insertBlockPlugin = function insertBlockPlugin() {
|
|
40
31
|
var _api$dependencies, _api$dependencies$fea;
|
|
41
32
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -61,6 +52,7 @@ var insertBlockPlugin = function insertBlockPlugin() {
|
|
|
61
52
|
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
62
53
|
plugins: {
|
|
63
54
|
typeAheadState: typeAheadPluginKey,
|
|
55
|
+
// needed to check isTypeAheadAllowed in ToolbarInsertBlock
|
|
64
56
|
blockTypeState: blockTypeStateKey,
|
|
65
57
|
mediaState: mediaStateKey,
|
|
66
58
|
macroState: macroStateKey,
|
|
@@ -108,7 +100,7 @@ var insertBlockPlugin = function insertBlockPlugin() {
|
|
|
108
100
|
};
|
|
109
101
|
};
|
|
110
102
|
function ToolbarInsertBlockWithInjectionApi(_ref3) {
|
|
111
|
-
var _pluginInjectionApi$
|
|
103
|
+
var _pluginInjectionApi$d2, _pluginInjectionApi$d3;
|
|
112
104
|
var editorView = _ref3.editorView,
|
|
113
105
|
editorActions = _ref3.editorActions,
|
|
114
106
|
dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent,
|
|
@@ -136,6 +128,15 @@ function ToolbarInsertBlockWithInjectionApi(_ref3) {
|
|
|
136
128
|
imageUploadState = _useSharedPluginState.imageUploadState,
|
|
137
129
|
mentionState = _useSharedPluginState.mentionState,
|
|
138
130
|
emojiState = _useSharedPluginState.emojiState;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Wrapper over insertBlockTypeWithAnalytics to autobind toolbar input method
|
|
134
|
+
* @param name Block name
|
|
135
|
+
*/
|
|
136
|
+
var handleInsertBlockType = React.useCallback(function (name) {
|
|
137
|
+
var _pluginInjectionApi$d;
|
|
138
|
+
return insertBlockTypesWithAnalytics(name, INPUT_METHOD.TOOLBAR, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions);
|
|
139
|
+
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions]);
|
|
139
140
|
return /*#__PURE__*/React.createElement(ToolbarInsertBlock, {
|
|
140
141
|
pluginInjectionApi: pluginInjectionApi,
|
|
141
142
|
buttons: buttons,
|
|
@@ -157,7 +158,7 @@ function ToolbarInsertBlockWithInjectionApi(_ref3) {
|
|
|
157
158
|
mediaSupported: !!mediaState,
|
|
158
159
|
imageUploadSupported: !!(pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.dependencies.imageUpload),
|
|
159
160
|
imageUploadEnabled: imageUploadState === null || imageUploadState === void 0 ? void 0 : imageUploadState.enabled,
|
|
160
|
-
handleImageUpload: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
161
|
+
handleImageUpload: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies.imageUpload) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : _pluginInjectionApi$d3.actions.startUpload,
|
|
161
162
|
availableWrapperBlockTypes: blockTypeState && blockTypeState.availableWrapperBlockTypes,
|
|
162
163
|
linkSupported: !!hyperlinkState,
|
|
163
164
|
linkDisabled: !hyperlinkState || !hyperlinkState.canInsertLink || !!hyperlinkState.activeLinkMark,
|
|
@@ -165,7 +166,7 @@ function ToolbarInsertBlockWithInjectionApi(_ref3) {
|
|
|
165
166
|
emojiProvider: providers.emojiProvider,
|
|
166
167
|
nativeStatusSupported: options.nativeStatusSupported,
|
|
167
168
|
horizontalRuleEnabled: options.horizontalRuleEnabled,
|
|
168
|
-
onInsertBlockType: handleInsertBlockType
|
|
169
|
+
onInsertBlockType: handleInsertBlockType,
|
|
169
170
|
onInsertMacroFromMacroBrowser: insertMacroFromMacroBrowser,
|
|
170
171
|
macroProvider: macroState.macroProvider,
|
|
171
172
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -137,6 +137,11 @@ export var createReducer = function createReducer(_ref) {
|
|
|
137
137
|
var mappedDecorationSet = decorationSet.map(tr.mapping, tr.doc, {
|
|
138
138
|
onRemove: onRemove
|
|
139
139
|
});
|
|
140
|
+
|
|
141
|
+
// return same pluginState if decorationSet did not change
|
|
142
|
+
if (mappedDecorationSet === currentPluginState.decorationSet) {
|
|
143
|
+
return currentPluginState;
|
|
144
|
+
}
|
|
140
145
|
return _objectSpread(_objectSpread({}, currentPluginState), {}, {
|
|
141
146
|
decorationSet: mappedDecorationSet
|
|
142
147
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "187.31.
|
|
3
|
+
"version": "187.31.3",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@atlaskit/checkbox": "^12.6.0",
|
|
55
55
|
"@atlaskit/code": "^14.6.0",
|
|
56
56
|
"@atlaskit/date": "^0.10.0",
|
|
57
|
-
"@atlaskit/datetime-picker": "^12.
|
|
57
|
+
"@atlaskit/datetime-picker": "^12.8.0",
|
|
58
58
|
"@atlaskit/editor-common": "^74.52.0",
|
|
59
59
|
"@atlaskit/editor-json-transformer": "^8.10.0",
|
|
60
60
|
"@atlaskit/editor-markdown-transformer": "^5.2.5",
|
|
@@ -268,4 +268,4 @@
|
|
|
268
268
|
"type": "boolean"
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
}
|
|
271
|
+
}
|