@atlaskit/editor-core 187.31.2 → 187.31.5
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 +20 -0
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +2 -3
- package/dist/cjs/create-editor/create-plugins-list.js +2 -28
- package/dist/cjs/create-editor/create-preset.js +36 -0
- package/dist/cjs/labs/next/presets/useUniversalPreset.js +3 -3
- 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/create-editor/ReactEditorViewInternal.js +2 -3
- package/dist/es2019/create-editor/create-plugins-list.js +2 -23
- package/dist/es2019/create-editor/create-preset.js +25 -0
- package/dist/es2019/labs/next/presets/useUniversalPreset.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/create-editor/ReactEditorViewInternal.js +2 -3
- package/dist/esm/create-editor/create-plugins-list.js +2 -27
- package/dist/esm/create-editor/create-preset.js +29 -0
- package/dist/esm/labs/next/presets/useUniversalPreset.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/dist/types/create-editor/create-plugins-list.d.ts +2 -3
- package/dist/types/create-editor/create-preset.d.ts +3 -0
- package/dist/types/plugins/base/plugin.d.ts +2 -2
- package/dist/types/plugins/breakout/index.d.ts +2 -2
- package/dist/types/plugins/extension/index.d.ts +8 -8
- package/dist/types/plugins/extension/nodeviews/extension.d.ts +3 -3
- package/dist/types/plugins/extension/ui/Extension/Extension/index.d.ts +2 -2
- package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +2 -2
- package/dist/types/plugins/extension/ui/Extension/index.d.ts +2 -2
- package/dist/types/plugins/media/next-plugin-type.d.ts +12 -12
- package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +4 -4
- package/dist/types-ts4.5/create-editor/create-plugins-list.d.ts +2 -3
- package/dist/types-ts4.5/create-editor/create-preset.d.ts +3 -0
- package/dist/types-ts4.5/plugins/base/plugin.d.ts +2 -2
- package/dist/types-ts4.5/plugins/breakout/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/extension/index.d.ts +8 -8
- package/dist/types-ts4.5/plugins/extension/nodeviews/extension.d.ts +3 -3
- package/dist/types-ts4.5/plugins/extension/ui/Extension/Extension/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/extension/ui/Extension/ExtensionComponent.d.ts +2 -2
- package/dist/types-ts4.5/plugins/extension/ui/Extension/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/media/next-plugin-type.d.ts +12 -12
- package/dist/types-ts4.5/plugins/toolbar-lists-indentation/index.d.ts +4 -4
- package/package.json +8 -8
- package/report.api.md +12 -12
- package/tmp/api-report-tmp.d.ts +0 -1897
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.31.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`a1965abfbe9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a1965abfbe9) - Fix `allowBlockType` so that exclude codeBlock correctly disables codeBlock in the editor.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 187.31.4
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`24e27147cbd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/24e27147cbd) - Added atlaskit docs to all existing plugins.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
17
|
+
## 187.31.3
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [`0debfab882f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0debfab882f) - ED-17959 prevent redundant rerenders on insert block component and due to typeahead state changes
|
|
22
|
+
|
|
3
23
|
## 187.31.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -36,6 +36,7 @@ var _createSchema = require("./create-schema");
|
|
|
36
36
|
var _pluginPerformanceObserver = require("../utils/performance/plugin-performance-observer");
|
|
37
37
|
var _getParticipantsCount = require("../plugins/collab-edit/get-participants-count");
|
|
38
38
|
var _trackTransactions = require("../utils/performance/track-transactions");
|
|
39
|
+
var _createPluginsList = _interopRequireDefault(require("./create-plugins-list"));
|
|
39
40
|
var _consts = require("./consts");
|
|
40
41
|
var _ReactEditorViewContext = _interopRequireDefault(require("./ReactEditorViewContext"));
|
|
41
42
|
var _preset = require("@atlaskit/editor-common/preset");
|
|
@@ -759,9 +760,7 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
759
760
|
value:
|
|
760
761
|
// Helper to allow tests to inject plugins directly
|
|
761
762
|
function getPlugins(preset) {
|
|
762
|
-
var plugins = preset.
|
|
763
|
-
pluginInjectionAPI: this.pluginInjectionAPI
|
|
764
|
-
});
|
|
763
|
+
var plugins = (0, _createPluginsList.default)(preset, this.props.editorProps, this.pluginInjectionAPI);
|
|
765
764
|
this.editorPlugins = plugins;
|
|
766
765
|
return this.editorPlugins;
|
|
767
766
|
}
|
|
@@ -4,12 +4,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.createPreset = createPreset;
|
|
8
7
|
exports.default = createPluginsList;
|
|
9
8
|
exports.getDefaultPresetOptionsFromEditorProps = getDefaultPresetOptionsFromEditorProps;
|
|
10
9
|
exports.getScrollGutterOptions = getScrollGutterOptions;
|
|
11
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
var _universal = _interopRequireDefault(require("../labs/next/presets/universal"));
|
|
13
11
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
14
12
|
var _isFullPage = require("../utils/is-full-page");
|
|
15
13
|
var _featureFlagsFromProps = require("./feature-flags-from-props");
|
|
@@ -112,8 +110,7 @@ function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent) {
|
|
|
112
110
|
* Note: The order that presets are added determines
|
|
113
111
|
* their placement in the editor toolbar
|
|
114
112
|
*/
|
|
115
|
-
function createPluginsList(props,
|
|
116
|
-
var preset = (0, _universal.default)(props.appearance, getDefaultPresetOptionsFromEditorProps(props), (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance);
|
|
113
|
+
function createPluginsList(preset, props, pluginInjectionAPI) {
|
|
117
114
|
var excludes = new Set();
|
|
118
115
|
if (!isCodeBlockAllowed({
|
|
119
116
|
allowBlockType: props.allowBlockType
|
|
@@ -121,30 +118,7 @@ function createPluginsList(props, prevProps) {
|
|
|
121
118
|
excludes.add('codeBlock');
|
|
122
119
|
}
|
|
123
120
|
return preset.build({
|
|
121
|
+
pluginInjectionAPI: pluginInjectionAPI,
|
|
124
122
|
excludePlugins: excludes
|
|
125
123
|
});
|
|
126
|
-
}
|
|
127
|
-
function withDangerouslyAppendPlugins(preset) {
|
|
128
|
-
function createEditorNextPluginsFromDangerouslyAppended(plugins) {
|
|
129
|
-
return plugins ? plugins.map(function (plugin) {
|
|
130
|
-
return function () {
|
|
131
|
-
return plugin;
|
|
132
|
-
};
|
|
133
|
-
}) : [];
|
|
134
|
-
}
|
|
135
|
-
return function (editorPluginsToAppend) {
|
|
136
|
-
if (!editorPluginsToAppend || editorPluginsToAppend.length === 0) {
|
|
137
|
-
return preset;
|
|
138
|
-
}
|
|
139
|
-
var nextEditorPluginsToAppend = createEditorNextPluginsFromDangerouslyAppended(editorPluginsToAppend);
|
|
140
|
-
var presetWithAppendedPlugins = nextEditorPluginsToAppend.reduce(function (acc, plugin) {
|
|
141
|
-
return acc.add(plugin);
|
|
142
|
-
}, preset);
|
|
143
|
-
return presetWithAppendedPlugins;
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
function createPreset(props, prevProps) {
|
|
147
|
-
var _props$dangerouslyApp;
|
|
148
|
-
var preset = (0, _universal.default)(props.appearance, getDefaultPresetOptionsFromEditorProps(props), (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance);
|
|
149
|
-
return withDangerouslyAppendPlugins(preset)((_props$dangerouslyApp = props.dangerouslyAppendPlugins) === null || _props$dangerouslyApp === void 0 ? void 0 : _props$dangerouslyApp.__plugins);
|
|
150
124
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createPreset = createPreset;
|
|
8
|
+
var _universal = _interopRequireDefault(require("../labs/next/presets/universal"));
|
|
9
|
+
var _createPluginsList = require("./create-plugins-list");
|
|
10
|
+
var _featureFlagsFromProps = require("./feature-flags-from-props");
|
|
11
|
+
// Separate file, we should not accidentally import this into the `ComposableEditor`
|
|
12
|
+
// otherwise it will blow up the bundle size.
|
|
13
|
+
function createPreset(props, prevProps) {
|
|
14
|
+
var _props$dangerouslyApp;
|
|
15
|
+
var preset = (0, _universal.default)(props.appearance, (0, _createPluginsList.getDefaultPresetOptionsFromEditorProps)(props), (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance);
|
|
16
|
+
return withDangerouslyAppendPlugins(preset)((_props$dangerouslyApp = props.dangerouslyAppendPlugins) === null || _props$dangerouslyApp === void 0 ? void 0 : _props$dangerouslyApp.__plugins);
|
|
17
|
+
}
|
|
18
|
+
function withDangerouslyAppendPlugins(preset) {
|
|
19
|
+
function createEditorNextPluginsFromDangerouslyAppended(plugins) {
|
|
20
|
+
return plugins ? plugins.map(function (plugin) {
|
|
21
|
+
return function () {
|
|
22
|
+
return plugin;
|
|
23
|
+
};
|
|
24
|
+
}) : [];
|
|
25
|
+
}
|
|
26
|
+
return function (editorPluginsToAppend) {
|
|
27
|
+
if (!editorPluginsToAppend || editorPluginsToAppend.length === 0) {
|
|
28
|
+
return preset;
|
|
29
|
+
}
|
|
30
|
+
var nextEditorPluginsToAppend = createEditorNextPluginsFromDangerouslyAppended(editorPluginsToAppend);
|
|
31
|
+
var presetWithAppendedPlugins = nextEditorPluginsToAppend.reduce(function (acc, plugin) {
|
|
32
|
+
return acc.add(plugin);
|
|
33
|
+
}, preset);
|
|
34
|
+
return presetWithAppendedPlugins;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -8,13 +8,13 @@ exports.default = useUniversalPreset;
|
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
11
|
-
var
|
|
11
|
+
var _createPreset = require("../../../create-editor/create-preset");
|
|
12
12
|
var _presetUtils = require("../../../create-editor/preset-utils");
|
|
13
13
|
function useUniversalPreset(_ref) {
|
|
14
14
|
var props = _ref.props;
|
|
15
15
|
var previousEditorProps = (0, _hooks.usePreviousState)(props);
|
|
16
16
|
var _useState = (0, _react.useState)(function () {
|
|
17
|
-
return (0,
|
|
17
|
+
return (0, _createPreset.createPreset)(props, previousEditorProps);
|
|
18
18
|
}),
|
|
19
19
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
20
20
|
preset = _useState2[0],
|
|
@@ -27,7 +27,7 @@ function useUniversalPreset(_ref) {
|
|
|
27
27
|
if (!recreate) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
setPreset((0,
|
|
30
|
+
setPreset((0, _createPreset.createPreset)(props, previousEditorProps));
|
|
31
31
|
}, [props, previousEditorProps]);
|
|
32
32
|
return preset;
|
|
33
33
|
}
|
|
@@ -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.5";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
@@ -23,6 +23,7 @@ import { PluginPerformanceObserver } from '../utils/performance/plugin-performan
|
|
|
23
23
|
import { getParticipantsCount } from '../plugins/collab-edit/get-participants-count';
|
|
24
24
|
import { EVENT_NAME_DISPATCH_TRANSACTION, EVENT_NAME_STATE_APPLY, EVENT_NAME_UPDATE_STATE, EVENT_NAME_VIEW_STATE_UPDATED, EVENT_NAME_ON_CHANGE, TransactionTracker } from '../utils/performance/track-transactions';
|
|
25
25
|
import { countNodes } from '@atlaskit/editor-common/utils';
|
|
26
|
+
import createPluginsList from './create-plugins-list';
|
|
26
27
|
import { PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD, PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD, DEFAULT_SAMPLING_RATE_VALID_TRANSACTIONS } from './consts';
|
|
27
28
|
import ReactEditorViewContext from './ReactEditorViewContext';
|
|
28
29
|
import { EditorPluginInjectionAPI } from '@atlaskit/editor-common/preset';
|
|
@@ -704,9 +705,7 @@ export class ReactEditorView extends React.Component {
|
|
|
704
705
|
|
|
705
706
|
// Helper to allow tests to inject plugins directly
|
|
706
707
|
getPlugins(preset) {
|
|
707
|
-
const plugins = preset.
|
|
708
|
-
pluginInjectionAPI: this.pluginInjectionAPI
|
|
709
|
-
});
|
|
708
|
+
const plugins = createPluginsList(preset, this.props.editorProps, this.pluginInjectionAPI);
|
|
710
709
|
this.editorPlugins = plugins;
|
|
711
710
|
return this.editorPlugins;
|
|
712
711
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import createUniversalPreset from '../labs/next/presets/universal';
|
|
2
1
|
import { GUTTER_SIZE_MOBILE_IN_PX } from '@atlaskit/editor-common/utils';
|
|
3
2
|
import { isFullPage as fullPageCheck } from '../utils/is-full-page';
|
|
4
3
|
import { createFeatureFlagsFromProps } from './feature-flags-from-props';
|
|
@@ -100,8 +99,7 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
|
|
|
100
99
|
* Note: The order that presets are added determines
|
|
101
100
|
* their placement in the editor toolbar
|
|
102
101
|
*/
|
|
103
|
-
export default function createPluginsList(props,
|
|
104
|
-
const preset = createUniversalPreset(props.appearance, getDefaultPresetOptionsFromEditorProps(props), createFeatureFlagsFromProps(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance);
|
|
102
|
+
export default function createPluginsList(preset, props, pluginInjectionAPI) {
|
|
105
103
|
const excludes = new Set();
|
|
106
104
|
if (!isCodeBlockAllowed({
|
|
107
105
|
allowBlockType: props.allowBlockType
|
|
@@ -109,26 +107,7 @@ export default function createPluginsList(props, prevProps) {
|
|
|
109
107
|
excludes.add('codeBlock');
|
|
110
108
|
}
|
|
111
109
|
return preset.build({
|
|
110
|
+
pluginInjectionAPI,
|
|
112
111
|
excludePlugins: excludes
|
|
113
112
|
});
|
|
114
|
-
}
|
|
115
|
-
function withDangerouslyAppendPlugins(preset) {
|
|
116
|
-
function createEditorNextPluginsFromDangerouslyAppended(plugins) {
|
|
117
|
-
return plugins ? plugins.map(plugin => () => plugin) : [];
|
|
118
|
-
}
|
|
119
|
-
return editorPluginsToAppend => {
|
|
120
|
-
if (!editorPluginsToAppend || editorPluginsToAppend.length === 0) {
|
|
121
|
-
return preset;
|
|
122
|
-
}
|
|
123
|
-
const nextEditorPluginsToAppend = createEditorNextPluginsFromDangerouslyAppended(editorPluginsToAppend);
|
|
124
|
-
const presetWithAppendedPlugins = nextEditorPluginsToAppend.reduce((acc, plugin) => {
|
|
125
|
-
return acc.add(plugin);
|
|
126
|
-
}, preset);
|
|
127
|
-
return presetWithAppendedPlugins;
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
export function createPreset(props, prevProps) {
|
|
131
|
-
var _props$dangerouslyApp;
|
|
132
|
-
const preset = createUniversalPreset(props.appearance, getDefaultPresetOptionsFromEditorProps(props), createFeatureFlagsFromProps(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance);
|
|
133
|
-
return withDangerouslyAppendPlugins(preset)((_props$dangerouslyApp = props.dangerouslyAppendPlugins) === null || _props$dangerouslyApp === void 0 ? void 0 : _props$dangerouslyApp.__plugins);
|
|
134
113
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import createUniversalPreset from '../labs/next/presets/universal';
|
|
2
|
+
import { getDefaultPresetOptionsFromEditorProps } from './create-plugins-list';
|
|
3
|
+
import { createFeatureFlagsFromProps } from './feature-flags-from-props';
|
|
4
|
+
// Separate file, we should not accidentally import this into the `ComposableEditor`
|
|
5
|
+
// otherwise it will blow up the bundle size.
|
|
6
|
+
export function createPreset(props, prevProps) {
|
|
7
|
+
var _props$dangerouslyApp;
|
|
8
|
+
const preset = createUniversalPreset(props.appearance, getDefaultPresetOptionsFromEditorProps(props), createFeatureFlagsFromProps(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance);
|
|
9
|
+
return withDangerouslyAppendPlugins(preset)((_props$dangerouslyApp = props.dangerouslyAppendPlugins) === null || _props$dangerouslyApp === void 0 ? void 0 : _props$dangerouslyApp.__plugins);
|
|
10
|
+
}
|
|
11
|
+
function withDangerouslyAppendPlugins(preset) {
|
|
12
|
+
function createEditorNextPluginsFromDangerouslyAppended(plugins) {
|
|
13
|
+
return plugins ? plugins.map(plugin => () => plugin) : [];
|
|
14
|
+
}
|
|
15
|
+
return editorPluginsToAppend => {
|
|
16
|
+
if (!editorPluginsToAppend || editorPluginsToAppend.length === 0) {
|
|
17
|
+
return preset;
|
|
18
|
+
}
|
|
19
|
+
const nextEditorPluginsToAppend = createEditorNextPluginsFromDangerouslyAppended(editorPluginsToAppend);
|
|
20
|
+
const presetWithAppendedPlugins = nextEditorPluginsToAppend.reduce((acc, plugin) => {
|
|
21
|
+
return acc.add(plugin);
|
|
22
|
+
}, preset);
|
|
23
|
+
return presetWithAppendedPlugins;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useLayoutEffect, useState } from 'react';
|
|
2
2
|
import { usePreviousState } from '@atlaskit/editor-common/hooks';
|
|
3
|
-
import { createPreset } from '../../../create-editor/create-
|
|
3
|
+
import { createPreset } from '../../../create-editor/create-preset';
|
|
4
4
|
import { shouldRecreatePreset } from '../../../create-editor/preset-utils';
|
|
5
5
|
export default function useUniversalPreset({
|
|
6
6
|
props
|
|
@@ -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
|
|
@@ -34,6 +34,7 @@ import { PluginPerformanceObserver } from '../utils/performance/plugin-performan
|
|
|
34
34
|
import { getParticipantsCount } from '../plugins/collab-edit/get-participants-count';
|
|
35
35
|
import { EVENT_NAME_DISPATCH_TRANSACTION, EVENT_NAME_STATE_APPLY, EVENT_NAME_UPDATE_STATE, EVENT_NAME_VIEW_STATE_UPDATED, EVENT_NAME_ON_CHANGE, TransactionTracker } from '../utils/performance/track-transactions';
|
|
36
36
|
import { countNodes as _countNodes } from '@atlaskit/editor-common/utils';
|
|
37
|
+
import createPluginsList from './create-plugins-list';
|
|
37
38
|
import { PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD, PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD, DEFAULT_SAMPLING_RATE_VALID_TRANSACTIONS } from './consts';
|
|
38
39
|
import ReactEditorViewContext from './ReactEditorViewContext';
|
|
39
40
|
import { EditorPluginInjectionAPI } from '@atlaskit/editor-common/preset';
|
|
@@ -753,9 +754,7 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
753
754
|
value:
|
|
754
755
|
// Helper to allow tests to inject plugins directly
|
|
755
756
|
function getPlugins(preset) {
|
|
756
|
-
var plugins = preset.
|
|
757
|
-
pluginInjectionAPI: this.pluginInjectionAPI
|
|
758
|
-
});
|
|
757
|
+
var plugins = createPluginsList(preset, this.props.editorProps, this.pluginInjectionAPI);
|
|
759
758
|
this.editorPlugins = plugins;
|
|
760
759
|
return this.editorPlugins;
|
|
761
760
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
import createUniversalPreset from '../labs/next/presets/universal';
|
|
5
4
|
import { GUTTER_SIZE_MOBILE_IN_PX } from '@atlaskit/editor-common/utils';
|
|
6
5
|
import { isFullPage as fullPageCheck } from '../utils/is-full-page';
|
|
7
6
|
import { createFeatureFlagsFromProps } from './feature-flags-from-props';
|
|
@@ -102,8 +101,7 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
|
|
|
102
101
|
* Note: The order that presets are added determines
|
|
103
102
|
* their placement in the editor toolbar
|
|
104
103
|
*/
|
|
105
|
-
export default function createPluginsList(props,
|
|
106
|
-
var preset = createUniversalPreset(props.appearance, getDefaultPresetOptionsFromEditorProps(props), createFeatureFlagsFromProps(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance);
|
|
104
|
+
export default function createPluginsList(preset, props, pluginInjectionAPI) {
|
|
107
105
|
var excludes = new Set();
|
|
108
106
|
if (!isCodeBlockAllowed({
|
|
109
107
|
allowBlockType: props.allowBlockType
|
|
@@ -111,30 +109,7 @@ export default function createPluginsList(props, prevProps) {
|
|
|
111
109
|
excludes.add('codeBlock');
|
|
112
110
|
}
|
|
113
111
|
return preset.build({
|
|
112
|
+
pluginInjectionAPI: pluginInjectionAPI,
|
|
114
113
|
excludePlugins: excludes
|
|
115
114
|
});
|
|
116
|
-
}
|
|
117
|
-
function withDangerouslyAppendPlugins(preset) {
|
|
118
|
-
function createEditorNextPluginsFromDangerouslyAppended(plugins) {
|
|
119
|
-
return plugins ? plugins.map(function (plugin) {
|
|
120
|
-
return function () {
|
|
121
|
-
return plugin;
|
|
122
|
-
};
|
|
123
|
-
}) : [];
|
|
124
|
-
}
|
|
125
|
-
return function (editorPluginsToAppend) {
|
|
126
|
-
if (!editorPluginsToAppend || editorPluginsToAppend.length === 0) {
|
|
127
|
-
return preset;
|
|
128
|
-
}
|
|
129
|
-
var nextEditorPluginsToAppend = createEditorNextPluginsFromDangerouslyAppended(editorPluginsToAppend);
|
|
130
|
-
var presetWithAppendedPlugins = nextEditorPluginsToAppend.reduce(function (acc, plugin) {
|
|
131
|
-
return acc.add(plugin);
|
|
132
|
-
}, preset);
|
|
133
|
-
return presetWithAppendedPlugins;
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
export function createPreset(props, prevProps) {
|
|
137
|
-
var _props$dangerouslyApp;
|
|
138
|
-
var preset = createUniversalPreset(props.appearance, getDefaultPresetOptionsFromEditorProps(props), createFeatureFlagsFromProps(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance);
|
|
139
|
-
return withDangerouslyAppendPlugins(preset)((_props$dangerouslyApp = props.dangerouslyAppendPlugins) === null || _props$dangerouslyApp === void 0 ? void 0 : _props$dangerouslyApp.__plugins);
|
|
140
115
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import createUniversalPreset from '../labs/next/presets/universal';
|
|
2
|
+
import { getDefaultPresetOptionsFromEditorProps } from './create-plugins-list';
|
|
3
|
+
import { createFeatureFlagsFromProps } from './feature-flags-from-props';
|
|
4
|
+
// Separate file, we should not accidentally import this into the `ComposableEditor`
|
|
5
|
+
// otherwise it will blow up the bundle size.
|
|
6
|
+
export function createPreset(props, prevProps) {
|
|
7
|
+
var _props$dangerouslyApp;
|
|
8
|
+
var preset = createUniversalPreset(props.appearance, getDefaultPresetOptionsFromEditorProps(props), createFeatureFlagsFromProps(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance);
|
|
9
|
+
return withDangerouslyAppendPlugins(preset)((_props$dangerouslyApp = props.dangerouslyAppendPlugins) === null || _props$dangerouslyApp === void 0 ? void 0 : _props$dangerouslyApp.__plugins);
|
|
10
|
+
}
|
|
11
|
+
function withDangerouslyAppendPlugins(preset) {
|
|
12
|
+
function createEditorNextPluginsFromDangerouslyAppended(plugins) {
|
|
13
|
+
return plugins ? plugins.map(function (plugin) {
|
|
14
|
+
return function () {
|
|
15
|
+
return plugin;
|
|
16
|
+
};
|
|
17
|
+
}) : [];
|
|
18
|
+
}
|
|
19
|
+
return function (editorPluginsToAppend) {
|
|
20
|
+
if (!editorPluginsToAppend || editorPluginsToAppend.length === 0) {
|
|
21
|
+
return preset;
|
|
22
|
+
}
|
|
23
|
+
var nextEditorPluginsToAppend = createEditorNextPluginsFromDangerouslyAppended(editorPluginsToAppend);
|
|
24
|
+
var presetWithAppendedPlugins = nextEditorPluginsToAppend.reduce(function (acc, plugin) {
|
|
25
|
+
return acc.add(plugin);
|
|
26
|
+
}, preset);
|
|
27
|
+
return presetWithAppendedPlugins;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { useLayoutEffect, useState } from 'react';
|
|
3
3
|
import { usePreviousState } from '@atlaskit/editor-common/hooks';
|
|
4
|
-
import { createPreset } from '../../../create-editor/create-
|
|
4
|
+
import { createPreset } from '../../../create-editor/create-preset';
|
|
5
5
|
import { shouldRecreatePreset } from '../../../create-editor/preset-utils';
|
|
6
6
|
export default function useUniversalPreset(_ref) {
|
|
7
7
|
var props = _ref.props;
|
|
@@ -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
|
});
|