@atlaskit/editor-core 187.31.3 → 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 +14 -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/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/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/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 +6 -6
- package/report.api.md +12 -12
- package/tmp/api-report-tmp.d.ts +0 -1897
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
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
|
+
|
|
3
17
|
## 187.31.3
|
|
4
18
|
|
|
5
19
|
### 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
|
}
|
|
@@ -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
|
|
@@ -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;
|
|
@@ -4,7 +4,7 @@ import type { EditorPluginFeatureProps } from '../types/editor-props';
|
|
|
4
4
|
import type { ScrollGutterPluginOptions } from '../plugins/base/pm-plugins/scroll-gutter';
|
|
5
5
|
import type { DefaultPresetPluginOptions } from '../labs/next/presets/default';
|
|
6
6
|
import type { EditorPresetProps } from '../labs/next/presets/types';
|
|
7
|
-
import type { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
7
|
+
import type { EditorPresetBuilder, EditorPluginInjectionAPI } from '@atlaskit/editor-common/preset';
|
|
8
8
|
export declare function getScrollGutterOptions(props: EditorProps): ScrollGutterPluginOptions | undefined;
|
|
9
9
|
export declare function getDefaultPresetOptionsFromEditorProps(props: EditorProps, createAnalyticsEvent?: CreateUIAnalyticsEvent): EditorPresetProps & DefaultPresetPluginOptions & EditorPluginFeatureProps;
|
|
10
10
|
/**
|
|
@@ -13,5 +13,4 @@ export declare function getDefaultPresetOptionsFromEditorProps(props: EditorProp
|
|
|
13
13
|
* Note: The order that presets are added determines
|
|
14
14
|
* their placement in the editor toolbar
|
|
15
15
|
*/
|
|
16
|
-
export default function createPluginsList(props: EditorProps,
|
|
17
|
-
export declare function createPreset(props: EditorProps, prevProps?: EditorProps): EditorPresetBuilder<any, any>;
|
|
16
|
+
export default function createPluginsList(preset: EditorPresetBuilder<any, any>, props: EditorProps, pluginInjectionAPI?: EditorPluginInjectionAPI): EditorPlugin[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NextEditorPlugin } from '../../types';
|
|
2
2
|
import type { ScrollGutterPluginOptions } from './pm-plugins/scroll-gutter';
|
|
3
3
|
import type { InputTracking, BrowserFreezetracking } from '../../types/performance-tracking';
|
|
4
|
-
import type
|
|
4
|
+
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
5
5
|
import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
|
|
6
6
|
export interface BasePluginOptions {
|
|
7
7
|
allowScrollGutter?: ScrollGutterPluginOptions;
|
|
@@ -15,7 +15,7 @@ export type BasePluginState = {
|
|
|
15
15
|
};
|
|
16
16
|
export type BasePlugin = NextEditorPlugin<'base', {
|
|
17
17
|
pluginConfiguration: BasePluginOptions | undefined;
|
|
18
|
-
dependencies: [
|
|
18
|
+
dependencies: [FeatureFlagsPlugin];
|
|
19
19
|
sharedState: BasePluginState;
|
|
20
20
|
}>;
|
|
21
21
|
export declare const isChromeWithSelectionBug: any;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
3
3
|
import type { BreakoutPluginState } from './types';
|
|
4
4
|
interface BreakoutPluginOptions {
|
|
5
5
|
allowBreakoutButton?: boolean;
|
|
6
6
|
}
|
|
7
7
|
declare const breakoutPlugin: NextEditorPlugin<'breakout', {
|
|
8
8
|
pluginConfiguration: BreakoutPluginOptions | undefined;
|
|
9
|
-
dependencies: [
|
|
9
|
+
dependencies: [WidthPlugin];
|
|
10
10
|
sharedState: Partial<BreakoutPluginState>;
|
|
11
11
|
}>;
|
|
12
12
|
export default breakoutPlugin;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ExtensionHandlers } from '@atlaskit/editor-common/extensions';
|
|
2
|
-
import type
|
|
2
|
+
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
3
3
|
import type { NextEditorPlugin, EditorAppearance, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
5
|
+
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
6
|
+
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
7
|
+
import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
8
8
|
interface ExtensionPluginOptions extends LongPressSelectionPluginOptions {
|
|
9
9
|
allowAutoSave?: boolean;
|
|
10
10
|
breakoutEnabled?: boolean;
|
|
@@ -14,10 +14,10 @@ interface ExtensionPluginOptions extends LongPressSelectionPluginOptions {
|
|
|
14
14
|
declare const extensionPlugin: NextEditorPlugin<'extension', {
|
|
15
15
|
pluginConfiguration: ExtensionPluginOptions | undefined;
|
|
16
16
|
dependencies: [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
OptionalPlugin<
|
|
17
|
+
FeatureFlagsPlugin,
|
|
18
|
+
WidthPlugin,
|
|
19
|
+
DecorationsPlugin,
|
|
20
|
+
OptionalPlugin<ContextPanelPlugin>
|
|
21
21
|
];
|
|
22
22
|
}>;
|
|
23
23
|
export default extensionPlugin;
|
|
@@ -9,7 +9,7 @@ import type { ForwardRef, getPosHandler } from '../../../nodeviews';
|
|
|
9
9
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
10
10
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
11
11
|
import type { EventDispatcher } from '../../../event-dispatcher';
|
|
12
|
-
import type {
|
|
12
|
+
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
13
13
|
interface ExtensionNodeViewOptions {
|
|
14
14
|
appearance?: EditorAppearance;
|
|
15
15
|
}
|
|
@@ -25,8 +25,8 @@ export declare class ExtensionNode extends ReactNodeView {
|
|
|
25
25
|
providerFactory: ProviderFactory;
|
|
26
26
|
extensionHandlers: ExtensionHandlers;
|
|
27
27
|
extensionNodeViewOptions?: ExtensionNodeViewOptions;
|
|
28
|
-
pluginInjectionApi: PluginInjectionAPIWithDependency<
|
|
28
|
+
pluginInjectionApi: PluginInjectionAPIWithDependency<WidthPlugin> | undefined;
|
|
29
29
|
}, forwardRef: ForwardRef): JSX.Element;
|
|
30
30
|
}
|
|
31
|
-
export default function ExtensionNodeView(portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, extensionHandlers: ExtensionHandlers, extensionNodeViewOptions: ExtensionNodeViewOptions, pluginInjectionApi: PluginInjectionAPIWithDependency<
|
|
31
|
+
export default function ExtensionNodeView(portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, extensionHandlers: ExtensionHandlers, extensionNodeViewOptions: ExtensionNodeViewOptions, pluginInjectionApi: PluginInjectionAPIWithDependency<WidthPlugin> | undefined): (node: PmNode, view: EditorView, getPos: getPosHandler) => NodeView;
|
|
32
32
|
export {};
|
|
@@ -4,7 +4,7 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
|
4
4
|
import type { ExtensionProvider, ReferenceEntity } from '@atlaskit/editor-common/extensions';
|
|
5
5
|
import type { ProsemirrorGetPosHandler } from '../../../../../nodeviews';
|
|
6
6
|
import type { EditorAppearance } from '../../../../../types/editor-appearance';
|
|
7
|
-
import type {
|
|
7
|
+
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
8
8
|
import type { PluginInjectionAPIWithDependency } from '@atlaskit/editor-common/types';
|
|
9
9
|
export interface Props {
|
|
10
10
|
node: PmNode;
|
|
@@ -16,7 +16,7 @@ export interface Props {
|
|
|
16
16
|
references?: ReferenceEntity[];
|
|
17
17
|
hideFrame?: boolean;
|
|
18
18
|
editorAppearance?: EditorAppearance;
|
|
19
|
-
pluginInjectionApi: PluginInjectionAPIWithDependency<
|
|
19
|
+
pluginInjectionApi: PluginInjectionAPIWithDependency<WidthPlugin> | undefined;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* End workaround
|
|
@@ -5,7 +5,7 @@ import { getNodeRenderer, getExtensionModuleNodePrivateProps } from '@atlaskit/e
|
|
|
5
5
|
import type { ExtensionHandlers, ExtensionProvider, ReferenceEntity } from '@atlaskit/editor-common/extensions';
|
|
6
6
|
import type { ProsemirrorGetPosHandler } from '../../../../nodeviews';
|
|
7
7
|
import type { EditorAppearance } from '../../../../types/editor-appearance';
|
|
8
|
-
import type {
|
|
8
|
+
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
9
9
|
import type { PluginInjectionAPIWithDependency } from '@atlaskit/editor-common/types';
|
|
10
10
|
export interface Props {
|
|
11
11
|
editorView: EditorView;
|
|
@@ -16,7 +16,7 @@ export interface Props {
|
|
|
16
16
|
extensionProvider?: Promise<ExtensionProvider>;
|
|
17
17
|
references?: ReferenceEntity[];
|
|
18
18
|
editorAppearance?: EditorAppearance;
|
|
19
|
-
pluginInjectionApi: PluginInjectionAPIWithDependency<
|
|
19
|
+
pluginInjectionApi: PluginInjectionAPIWithDependency<WidthPlugin> | undefined;
|
|
20
20
|
}
|
|
21
21
|
export interface State {
|
|
22
22
|
extensionProvider?: ExtensionProvider;
|
|
@@ -5,7 +5,7 @@ import type { ExtensionHandlers, ReferenceEntity } from '@atlaskit/editor-common
|
|
|
5
5
|
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
6
6
|
import type { ProsemirrorGetPosHandler } from '../../../../nodeviews/types';
|
|
7
7
|
import type { EditorAppearance } from '../../../../types/editor-appearance';
|
|
8
|
-
import type {
|
|
8
|
+
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
9
9
|
import type { PluginInjectionAPIWithDependency } from '@atlaskit/editor-common/types';
|
|
10
10
|
export interface Props {
|
|
11
11
|
editorView: EditorView;
|
|
@@ -16,7 +16,7 @@ export interface Props {
|
|
|
16
16
|
extensionHandlers: ExtensionHandlers;
|
|
17
17
|
references?: ReferenceEntity[];
|
|
18
18
|
editorAppearance?: EditorAppearance;
|
|
19
|
-
pluginInjectionApi: PluginInjectionAPIWithDependency<
|
|
19
|
+
pluginInjectionApi: PluginInjectionAPIWithDependency<WidthPlugin> | undefined;
|
|
20
20
|
}
|
|
21
21
|
export default class Extension extends Component<Props, any> {
|
|
22
22
|
static displayName: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
1
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
2
|
+
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
3
|
+
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
4
|
+
import type { GridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
5
|
+
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
6
|
+
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
7
7
|
import type { MediaPluginState } from './pm-plugins/types';
|
|
8
8
|
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
9
9
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
@@ -13,12 +13,12 @@ import type { MediaOptions } from './types';
|
|
|
13
13
|
export type MediaNextEditorPluginType = NextEditorPlugin<'media', {
|
|
14
14
|
pluginConfiguration: MediaOptions | undefined;
|
|
15
15
|
dependencies: [
|
|
16
|
-
|
|
17
|
-
OptionalPlugin<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
FeatureFlagsPlugin,
|
|
17
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
18
|
+
GuidelinePlugin,
|
|
19
|
+
GridPlugin,
|
|
20
|
+
WidthPlugin,
|
|
21
|
+
DecorationsPlugin,
|
|
22
22
|
FloatingToolbarPlugin,
|
|
23
23
|
EditorDisabledPlugin,
|
|
24
24
|
FocusPlugin
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type
|
|
3
|
-
import type {
|
|
2
|
+
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
3
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
4
|
import type { ListPlugin } from '@atlaskit/editor-plugin-list';
|
|
5
5
|
import type { IndentationButtons } from './pm-plugins/indentation-buttons';
|
|
6
6
|
type Config = {
|
|
@@ -10,9 +10,9 @@ type Config = {
|
|
|
10
10
|
declare const toolbarListsIndentationPlugin: NextEditorPlugin<'toolbarListsIndentation', {
|
|
11
11
|
pluginConfiguration: Config;
|
|
12
12
|
dependencies: [
|
|
13
|
-
|
|
13
|
+
FeatureFlagsPlugin,
|
|
14
14
|
ListPlugin,
|
|
15
|
-
OptionalPlugin<
|
|
15
|
+
OptionalPlugin<AnalyticsPlugin>
|
|
16
16
|
];
|
|
17
17
|
sharedState: IndentationButtons | undefined;
|
|
18
18
|
}>;
|