@atlaskit/editor-core 187.31.3 → 187.31.6
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 +22 -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/default.js +2 -2
- package/dist/cjs/labs/next/presets/useUniversalPreset.js +3 -3
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/media/toolbar/index.js +20 -6
- package/dist/cjs/plugins/media/ui/PixelEntry/index.js +9 -2
- package/dist/cjs/plugins/media/ui/PixelEntry/messages.js +5 -0
- package/dist/cjs/plugins/media/ui/PixelEntry/styles.js +5 -3
- package/dist/cjs/plugins/selection/gap-cursor/utils.js +1 -2
- package/dist/cjs/ui/ContentStyles/index.js +20 -21
- 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/default.js +1 -1
- package/dist/es2019/labs/next/presets/useUniversalPreset.js +1 -1
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/media/toolbar/index.js +23 -7
- package/dist/es2019/plugins/media/ui/PixelEntry/index.js +10 -1
- package/dist/es2019/plugins/media/ui/PixelEntry/messages.js +5 -0
- package/dist/es2019/plugins/media/ui/PixelEntry/styles.js +7 -0
- package/dist/es2019/plugins/selection/gap-cursor/utils.js +1 -2
- package/dist/es2019/ui/ContentStyles/index.js +1 -2
- 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/default.js +1 -1
- package/dist/esm/labs/next/presets/useUniversalPreset.js +1 -1
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/media/toolbar/index.js +21 -7
- package/dist/esm/plugins/media/ui/PixelEntry/index.js +7 -1
- package/dist/esm/plugins/media/ui/PixelEntry/messages.js +5 -0
- package/dist/esm/plugins/media/ui/PixelEntry/styles.js +3 -2
- package/dist/esm/plugins/selection/gap-cursor/utils.js +1 -2
- package/dist/esm/ui/ContentStyles/index.js +1 -2
- 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/index.d.ts +0 -1
- package/dist/types/plugins/media/next-plugin-type.d.ts +12 -12
- package/dist/types/plugins/media/ui/PixelEntry/index.d.ts +5 -0
- package/dist/types/plugins/media/ui/PixelEntry/messages.d.ts +5 -0
- package/dist/types/plugins/media/ui/PixelEntry/styles.d.ts +1 -0
- 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/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/media/next-plugin-type.d.ts +12 -12
- package/dist/types-ts4.5/plugins/media/ui/PixelEntry/index.d.ts +5 -0
- package/dist/types-ts4.5/plugins/media/ui/PixelEntry/messages.d.ts +5 -0
- package/dist/types-ts4.5/plugins/media/ui/PixelEntry/styles.d.ts +1 -0
- package/dist/types-ts4.5/plugins/toolbar-lists-indentation/index.d.ts +4 -4
- package/package.json +7 -6
- package/report.api.md +12 -12
- package/tmp/api-report-tmp.d.ts +12 -12
- package/dist/cjs/plugins/unsupported-content/index.js +0 -87
- package/dist/cjs/plugins/unsupported-content/styles.js +0 -20
- package/dist/cjs/plugins/unsupported-content/unsupported-inline-node-view.js +0 -16
- package/dist/es2019/plugins/unsupported-content/index.js +0 -77
- package/dist/es2019/plugins/unsupported-content/styles.js +0 -27
- package/dist/es2019/plugins/unsupported-content/unsupported-inline-node-view.js +0 -7
- package/dist/esm/plugins/unsupported-content/index.js +0 -77
- package/dist/esm/plugins/unsupported-content/styles.js +0 -11
- package/dist/esm/plugins/unsupported-content/unsupported-inline-node-view.js +0 -7
- package/dist/types/plugins/unsupported-content/index.d.ts +0 -5
- package/dist/types/plugins/unsupported-content/styles.d.ts +0 -5
- package/dist/types/plugins/unsupported-content/unsupported-inline-node-view.d.ts +0 -11
- package/dist/types-ts4.5/plugins/unsupported-content/index.d.ts +0 -5
- package/dist/types-ts4.5/plugins/unsupported-content/styles.d.ts +0 -5
- package/dist/types-ts4.5/plugins/unsupported-content/unsupported-inline-node-view.d.ts +0 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.31.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e0f020abea0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e0f020abea0) - created new plugin for unsupported-content, moved code and styles
|
|
8
|
+
- [`dcf5ea47df4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/dcf5ea47df4) - [ux] Display 'Full width' in media single floating toolbar when the node reaches full width
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 187.31.5
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`a1965abfbe9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a1965abfbe9) - Fix `allowBlockType` so that exclude codeBlock correctly disables codeBlock in the editor.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
18
|
+
## 187.31.4
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [`24e27147cbd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/24e27147cbd) - Added atlaskit docs to all existing plugins.
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
3
25
|
## 187.31.3
|
|
4
26
|
|
|
5
27
|
### 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
|
+
}
|
|
@@ -12,7 +12,7 @@ var _clearMarksOnChangeToEmptyDocument = _interopRequireDefault(require("../../.
|
|
|
12
12
|
var _editorPluginHyperlink = require("@atlaskit/editor-plugin-hyperlink");
|
|
13
13
|
var _editorPluginTextFormatting = require("@atlaskit/editor-plugin-text-formatting");
|
|
14
14
|
var _editorPluginWidth = require("@atlaskit/editor-plugin-width");
|
|
15
|
-
var
|
|
15
|
+
var _editorPluginUnsupportedContent = require("@atlaskit/editor-plugin-unsupported-content");
|
|
16
16
|
var _base = require("../../../plugins/base");
|
|
17
17
|
var _editorPluginFocus = require("@atlaskit/editor-plugin-focus");
|
|
18
18
|
var _editorPluginEditorDisabled = require("@atlaskit/editor-plugin-editor-disabled");
|
|
@@ -76,7 +76,7 @@ function createDefaultPreset(options) {
|
|
|
76
76
|
return builder;
|
|
77
77
|
}).add([_editorPluginHyperlink.hyperlinkPlugin, options.hyperlinkOptions]).add([_editorPluginTextFormatting.textFormattingPlugin, options.textFormatting]).add(_editorPluginWidth.widthPlugin).add([_quickInsert.default, options.quickInsert]).add([_typeAhead.default, options.typeAhead || {
|
|
78
78
|
createAnalyticsEvent: options.createAnalyticsEvent
|
|
79
|
-
}]).add(
|
|
79
|
+
}]).add(_editorPluginUnsupportedContent.unsupportedContentPlugin).add(_editorPluginEditorDisabled.editorDisabledPlugin).add([_submitEditor.default, options.submitEditor]).add(_fakeTextCursor.default).add(_floatingToolbar.default).add([_selection.default, options.selection]).add([_codeBlock.default, options.codeBlock || {
|
|
80
80
|
appearance: 'full-page'
|
|
81
81
|
}]);
|
|
82
82
|
return preset;
|
|
@@ -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
|
}
|
|
@@ -353,12 +353,6 @@ Object.defineProperty(exports, "undoRedoPlugin", {
|
|
|
353
353
|
return _undoRedo.default;
|
|
354
354
|
}
|
|
355
355
|
});
|
|
356
|
-
Object.defineProperty(exports, "unsupportedContentPlugin", {
|
|
357
|
-
enumerable: true,
|
|
358
|
-
get: function get() {
|
|
359
|
-
return _unsupportedContent.default;
|
|
360
|
-
}
|
|
361
|
-
});
|
|
362
356
|
Object.defineProperty(exports, "viewUpdateSubscriptionPlugin", {
|
|
363
357
|
enumerable: true,
|
|
364
358
|
get: function get() {
|
|
@@ -395,7 +389,6 @@ var _submitEditor = _interopRequireDefault(require("./submit-editor"));
|
|
|
395
389
|
var _tasksAndDecisions = _interopRequireDefault(require("./tasks-and-decisions"));
|
|
396
390
|
var _textColor = _interopRequireDefault(require("./text-color"));
|
|
397
391
|
var _typeAhead = _interopRequireDefault(require("./type-ahead"));
|
|
398
|
-
var _unsupportedContent = _interopRequireDefault(require("./unsupported-content"));
|
|
399
392
|
var _floatingToolbar = _interopRequireDefault(require("./floating-toolbar"));
|
|
400
393
|
var _status = _interopRequireDefault(require("./status"));
|
|
401
394
|
var _breakout = _interopRequireDefault(require("./breakout"));
|
|
@@ -264,20 +264,17 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
264
264
|
|
|
265
265
|
// Pixel Entry Toolbar Support
|
|
266
266
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience') && allowResizing) {
|
|
267
|
+
var selectedMediaSingleNode = (0, _utils2.getSelectedMediaSingle)(state);
|
|
267
268
|
var sizeInput = {
|
|
268
269
|
type: 'custom',
|
|
269
270
|
fallback: [],
|
|
270
271
|
render: function render(editorView) {
|
|
271
272
|
var _widthPlugin$sharedSt2;
|
|
272
|
-
if (!editorView) {
|
|
273
|
+
if (!editorView || !selectedMediaSingleNode) {
|
|
273
274
|
return null;
|
|
274
275
|
}
|
|
275
276
|
var state = editorView.state,
|
|
276
277
|
dispatch = editorView.dispatch;
|
|
277
|
-
var selectedMediaSingleNode = (0, _utils2.getSelectedMediaSingle)(state);
|
|
278
|
-
if (!selectedMediaSingleNode) {
|
|
279
|
-
return null;
|
|
280
|
-
}
|
|
281
278
|
var contentWidth = (widthPlugin === null || widthPlugin === void 0 ? void 0 : (_widthPlugin$sharedSt2 = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt2 === void 0 ? void 0 : _widthPlugin$sharedSt2.lineLength) || _editorSharedStyles.akEditorDefaultLayoutWidth;
|
|
282
279
|
var selectedMediaNode = selectedMediaSingleNode.node.content.firstChild;
|
|
283
280
|
if (!selectedMediaNode) {
|
|
@@ -340,7 +337,24 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
340
337
|
}
|
|
341
338
|
};
|
|
342
339
|
if (pluginState.isResizing) {
|
|
343
|
-
// If the image is resizing
|
|
340
|
+
// If the image is resizing
|
|
341
|
+
// then return pixel entry component or full width label as the only toolbar item
|
|
342
|
+
if (!selectedMediaSingleNode) {
|
|
343
|
+
return [];
|
|
344
|
+
}
|
|
345
|
+
var layout = selectedMediaSingleNode.node.attrs.layout;
|
|
346
|
+
if (layout === 'full-width') {
|
|
347
|
+
var fullWidthLabel = {
|
|
348
|
+
type: 'custom',
|
|
349
|
+
fallback: [],
|
|
350
|
+
render: function render() {
|
|
351
|
+
return /*#__PURE__*/_react.default.createElement(_PixelEntry.FullWidthDisplay, {
|
|
352
|
+
intl: intl
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
return [fullWidthLabel];
|
|
357
|
+
}
|
|
344
358
|
return [sizeInput];
|
|
345
359
|
}
|
|
346
360
|
toolbarButtons.push(sizeInput);
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.PixelEntry = void 0;
|
|
8
|
+
exports.PixelEntry = exports.FullWidthDisplay = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _react = require("@emotion/react");
|
|
@@ -187,4 +187,11 @@ var PixelEntry = function PixelEntry(_ref) {
|
|
|
187
187
|
}, formatMessage(_messages.messages.submitButtonText))));
|
|
188
188
|
}));
|
|
189
189
|
};
|
|
190
|
-
exports.PixelEntry = PixelEntry;
|
|
190
|
+
exports.PixelEntry = PixelEntry;
|
|
191
|
+
var FullWidthDisplay = function FullWidthDisplay(_ref5) {
|
|
192
|
+
var formatMessage = _ref5.intl.formatMessage;
|
|
193
|
+
return (0, _react.jsx)("div", {
|
|
194
|
+
css: _styles.pixelSizingFullWidthLabelStyles
|
|
195
|
+
}, (0, _react.jsx)("span", null, formatMessage(_messages.messages.fullWidthLabel)));
|
|
196
|
+
};
|
|
197
|
+
exports.FullWidthDisplay = FullWidthDisplay;
|
|
@@ -36,6 +36,11 @@ var messages = (0, _reactIntlNext.defineMessages)({
|
|
|
36
36
|
defaultMessage: 'Submit',
|
|
37
37
|
description: 'The text give to the hidden submit button'
|
|
38
38
|
},
|
|
39
|
+
fullWidthLabel: {
|
|
40
|
+
id: 'fabric.editor.image.fullWidthLabel',
|
|
41
|
+
defaultMessage: 'Full-width',
|
|
42
|
+
description: 'The media has reached its maximum width'
|
|
43
|
+
},
|
|
39
44
|
migrationButtonText: {
|
|
40
45
|
id: 'fabric.editor.media.pixelEntry.migrationButtonText',
|
|
41
46
|
defaultMessage: 'Convert to pixels',
|
|
@@ -4,10 +4,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.pixelSizingWrapper = exports.pixelSizingWidthInput = exports.pixelSizingLabel = exports.pixelSizingInput = exports.pixelSizingHeightInput = exports.pixelEntryHiddenSubmit = exports.pixelEntryForm = void 0;
|
|
7
|
+
exports.pixelSizingWrapper = exports.pixelSizingWidthInput = exports.pixelSizingLabel = exports.pixelSizingInput = exports.pixelSizingHeightInput = exports.pixelSizingFullWidthLabelStyles = exports.pixelEntryHiddenSubmit = exports.pixelEntryForm = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
10
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
11
11
|
var PIXEL_SIZING_WRAPPER_MINIMUM_WIDTH = 120;
|
|
12
12
|
var pixelSizingWrapper = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: grid;\n grid-template-columns: 1fr 1em 1fr 0;\n grid-template-rows: auto;\n grid-template-areas: 'widthinput label heightinput submit';\n width: ", "px;\n text-align: center;\n height: ", ";\n\n // Atlaskit fieldset does not allow style override\n & > * {\n margin-top: 0 !important;\n }\n"])), PIXEL_SIZING_WRAPPER_MINIMUM_WIDTH, "var(--ds-space-300, 24px)");
|
|
13
13
|
exports.pixelSizingWrapper = pixelSizingWrapper;
|
|
@@ -22,4 +22,6 @@ exports.pixelSizingWidthInput = pixelSizingWidthInput;
|
|
|
22
22
|
var pixelSizingHeightInput = (0, _react.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n grid-area: heightinput;\n"])));
|
|
23
23
|
exports.pixelSizingHeightInput = pixelSizingHeightInput;
|
|
24
24
|
var pixelEntryHiddenSubmit = (0, _react.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n grid-area: submit;\n visibility: hidden;\n width: 0;\n height: 0;\n"])));
|
|
25
|
-
exports.pixelEntryHiddenSubmit = pixelEntryHiddenSubmit;
|
|
25
|
+
exports.pixelEntryHiddenSubmit = pixelEntryHiddenSubmit;
|
|
26
|
+
var pixelSizingFullWidthLabelStyles = (0, _react.css)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n min-width: ", "px;\n height: ", ";\n display: flex;\n justify-content: center;\n align-items: center;\n"])), PIXEL_SIZING_WRAPPER_MINIMUM_WIDTH, "var(--ds-space-300, 24px)");
|
|
27
|
+
exports.pixelSizingFullWidthLabelStyles = pixelSizingFullWidthLabelStyles;
|
|
@@ -9,7 +9,6 @@ exports.getMediaNearPos = getMediaNearPos;
|
|
|
9
9
|
exports.isTextBlockNearPos = exports.isLeftCursor = exports.isIgnoredClick = void 0;
|
|
10
10
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
11
11
|
var _selection = require("./selection");
|
|
12
|
-
var _styles2 = require("../../unsupported-content/styles");
|
|
13
12
|
var _CaptionPlaceholder = require("../../media/ui/CaptionPlaceholder");
|
|
14
13
|
var isLeftCursor = function isLeftCursor(side) {
|
|
15
14
|
return side === _selection.Side.LEFT;
|
|
@@ -119,7 +118,7 @@ var isIgnoredClick = function isIgnoredClick(elem) {
|
|
|
119
118
|
|
|
120
119
|
// Check if unsupported node selection
|
|
121
120
|
// (without this, selection requires double clicking in FF due to posAtCoords differences)
|
|
122
|
-
if (elem.closest(".".concat(
|
|
121
|
+
if (elem.closest(".".concat(_styles.UnsupportedSharedCssClassName.BLOCK_CONTAINER))) {
|
|
123
122
|
return true;
|
|
124
123
|
}
|
|
125
124
|
return false;
|
|
@@ -11,28 +11,27 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
13
13
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
14
|
-
var _styles2 = require("../../plugins/
|
|
15
|
-
var _styles3 = require("../../plugins/
|
|
16
|
-
var _styles4 = require("../../plugins/selection/gap-cursor/styles");
|
|
14
|
+
var _styles2 = require("../../plugins/collab-edit/styles");
|
|
15
|
+
var _styles3 = require("../../plugins/selection/gap-cursor/styles");
|
|
17
16
|
var _commonStyles = require("@atlaskit/editor-plugin-table/ui/common-styles");
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
var
|
|
17
|
+
var _styles4 = require("../../plugins/placeholder/styles");
|
|
18
|
+
var _styles5 = require("../../plugins/block-type/styles");
|
|
19
|
+
var _styles6 = require("../../plugins/code-block/styles");
|
|
20
|
+
var _styles7 = require("../../plugins/rule/styles");
|
|
21
|
+
var _styles8 = require("../../plugins/media/styles");
|
|
22
|
+
var _styles9 = require("../../plugins/layout/styles");
|
|
23
|
+
var _styles10 = require("../../plugins/panel/styles");
|
|
24
|
+
var _styles11 = require("../../plugins/fake-text-cursor/styles");
|
|
25
|
+
var _styles12 = require("../../plugins/mentions/styles");
|
|
26
|
+
var _styles13 = require("../../plugins/emoji/styles");
|
|
27
|
+
var _styles14 = require("../../plugins/placeholder-text/styles");
|
|
28
|
+
var _styles15 = require("../../plugins/extension/ui/styles");
|
|
29
|
+
var _styles16 = require("../../plugins/expand/ui/styles");
|
|
31
30
|
var _style = require("../../plugins/media/pm-plugins/alt-text/style");
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
var
|
|
31
|
+
var _styles17 = require("../../plugins/find-replace/styles");
|
|
32
|
+
var _styles18 = require("../../plugins/tasks-and-decisions/styles");
|
|
33
|
+
var _styles19 = require("../../plugins/status/styles");
|
|
34
|
+
var _styles20 = require("../../plugins/date/styles");
|
|
36
35
|
var _getInlineNodeViewProducer = require("../../nodeviews/getInlineNodeViewProducer.styles");
|
|
37
36
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
38
37
|
var _templateObject, _templateObject2, _templateObject3;
|
|
@@ -45,7 +44,7 @@ var listsStyles = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _
|
|
|
45
44
|
var contentStyles = function contentStyles(props) {
|
|
46
45
|
return (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid ", ";\n }\n\n ", "\n ", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n box-sizing: border-box;\n }\n\n .mediaGroupView-content-wrap ul {\n padding: 0;\n }\n\n /** Needed to override any cleared floats, e.g. image wrapping */\n\n div.fabric-editor-block-mark[class^='fabric-editor-align'] {\n clear: none !important;\n }\n\n .fabric-editor-align-end {\n text-align: right;\n }\n\n .fabric-editor-align-start {\n text-align: left;\n }\n\n .fabric-editor-align-center {\n text-align: center;\n }\n\n .pm-table-header-content-wrap :not(.fabric-editor-alignment),\n .pm-table-header-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark,\n .pm-table-cell-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark {\n p:first-of-type {\n margin-top: 0;\n }\n }\n\n .hyperlink-floating-toolbar,\n .", " {\n padding: 0;\n }\n\n /* Link icon in the Atlaskit package\n is bigger than the others\n */\n .hyperlink-open-link {\n svg {\n max-width: 18px;\n }\n &[href] {\n padding: 0 4px;\n }\n }\n"])), (0, _editorSharedStyles.editorFontSize)({
|
|
47
46
|
theme: props.theme
|
|
48
|
-
}), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)",
|
|
47
|
+
}), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", _styles14.placeholderTextStyles, _styles4.placeholderStyles, (0, _styles6.codeBlockStyles)(props), (0, _styles5.blocktypeStyles)(props), (0, _styles.codeMarkSharedStyles)(props), _styles.textColorStyles, listsStyles, (0, _styles7.ruleStyles)(props), _styles8.mediaStyles, (0, _styles9.layoutStyles)(props), _styles2.telepointerStyle, _styles3.gapCursorStyles, (0, _commonStyles.tableStyles)(props), (0, _styles10.panelStyles)(props), _styles11.fakeCursorStyles, _styles12.mentionsStyles, _styles13.emojiStyles, _styles.tasksAndDecisionsStyles, _styles.gridStyles, linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _styles15.extensionStyles, (0, _styles16.expandStyles)(props), _styles17.findReplaceStyles, _styles18.taskDecisionStyles, _styles19.statusStyles, (0, _styles.annotationSharedStyles)(props), _styles.smartCardStyles, _styles.smartCardSharedStyles, _styles20.dateStyles, _styles.embedCardStyles, _styles.unsupportedStyles, _styles.resizerStyles, _style.ClassNames.FLOATING_TOOLBAR_COMPONENT);
|
|
49
48
|
};
|
|
50
49
|
var createEditorContentStyle = function createEditorContentStyle(styles) {
|
|
51
50
|
return /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
@@ -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.6";
|
|
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
|
+
}
|
|
@@ -6,7 +6,7 @@ import clearMarksOnChangeToEmptyDocumentPlugin from '../../../plugins/clear-mark
|
|
|
6
6
|
import { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
|
|
7
7
|
import { textFormattingPlugin } from '@atlaskit/editor-plugin-text-formatting';
|
|
8
8
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
9
|
-
import unsupportedContentPlugin from '
|
|
9
|
+
import { unsupportedContentPlugin } from '@atlaskit/editor-plugin-unsupported-content';
|
|
10
10
|
import { basePlugin } from '../../../plugins/base';
|
|
11
11
|
import { focusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
12
12
|
import { editorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
@@ -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
|
|
@@ -29,7 +29,6 @@ export { default as submitEditorPlugin } from './submit-editor';
|
|
|
29
29
|
export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
|
|
30
30
|
export { default as textColorPlugin } from './text-color';
|
|
31
31
|
export { default as typeAheadPlugin } from './type-ahead';
|
|
32
|
-
export { default as unsupportedContentPlugin } from './unsupported-content';
|
|
33
32
|
export { default as floatingToolbarPlugin } from './floating-toolbar';
|
|
34
33
|
export { default as statusPlugin } from './status';
|
|
35
34
|
export { default as breakoutPlugin } from './breakout';
|
|
@@ -25,7 +25,7 @@ import { MediaInlineNodeSelector, MediaSingleNodeSelector } from '../nodeviews/s
|
|
|
25
25
|
import ImageBorderItem from '../ui/ImageBorder';
|
|
26
26
|
import { currentMediaNodeBorderMark } from '../utils/current-media-node';
|
|
27
27
|
import { shouldShowImageBorder } from './imageBorder';
|
|
28
|
-
import { PixelEntry } from '../ui/PixelEntry';
|
|
28
|
+
import { PixelEntry, FullWidthDisplay } from '../ui/PixelEntry';
|
|
29
29
|
import { DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, calcMinWidth, getMaxWidthForNestedNodeNext } from '@atlaskit/editor-common/media-single';
|
|
30
30
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
31
31
|
const remove = (state, dispatch) => {
|
|
@@ -266,22 +266,19 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
266
266
|
|
|
267
267
|
// Pixel Entry Toolbar Support
|
|
268
268
|
if (getBooleanFF('platform.editor.media.extended-resize-experience') && allowResizing) {
|
|
269
|
+
const selectedMediaSingleNode = getSelectedMediaSingle(state);
|
|
269
270
|
const sizeInput = {
|
|
270
271
|
type: 'custom',
|
|
271
272
|
fallback: [],
|
|
272
273
|
render: editorView => {
|
|
273
274
|
var _widthPlugin$sharedSt2;
|
|
274
|
-
if (!editorView) {
|
|
275
|
+
if (!editorView || !selectedMediaSingleNode) {
|
|
275
276
|
return null;
|
|
276
277
|
}
|
|
277
278
|
const {
|
|
278
279
|
state,
|
|
279
280
|
dispatch
|
|
280
281
|
} = editorView;
|
|
281
|
-
const selectedMediaSingleNode = getSelectedMediaSingle(state);
|
|
282
|
-
if (!selectedMediaSingleNode) {
|
|
283
|
-
return null;
|
|
284
|
-
}
|
|
285
282
|
const contentWidth = (widthPlugin === null || widthPlugin === void 0 ? void 0 : (_widthPlugin$sharedSt2 = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt2 === void 0 ? void 0 : _widthPlugin$sharedSt2.lineLength) || akEditorDefaultLayoutWidth;
|
|
286
283
|
const selectedMediaNode = selectedMediaSingleNode.node.content.firstChild;
|
|
287
284
|
if (!selectedMediaNode) {
|
|
@@ -350,7 +347,26 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
350
347
|
}
|
|
351
348
|
};
|
|
352
349
|
if (pluginState.isResizing) {
|
|
353
|
-
// If the image is resizing
|
|
350
|
+
// If the image is resizing
|
|
351
|
+
// then return pixel entry component or full width label as the only toolbar item
|
|
352
|
+
if (!selectedMediaSingleNode) {
|
|
353
|
+
return [];
|
|
354
|
+
}
|
|
355
|
+
const {
|
|
356
|
+
layout
|
|
357
|
+
} = selectedMediaSingleNode.node.attrs;
|
|
358
|
+
if (layout === 'full-width') {
|
|
359
|
+
const fullWidthLabel = {
|
|
360
|
+
type: 'custom',
|
|
361
|
+
fallback: [],
|
|
362
|
+
render: () => {
|
|
363
|
+
return /*#__PURE__*/React.createElement(FullWidthDisplay, {
|
|
364
|
+
intl: intl
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
return [fullWidthLabel];
|
|
369
|
+
}
|
|
354
370
|
return [sizeInput];
|
|
355
371
|
}
|
|
356
372
|
toolbarButtons.push(sizeInput);
|
|
@@ -6,7 +6,7 @@ import Textfield from '@atlaskit/textfield';
|
|
|
6
6
|
import Tooltip from '@atlaskit/tooltip';
|
|
7
7
|
import Button from '@atlaskit/button';
|
|
8
8
|
import Form, { Field } from '@atlaskit/form';
|
|
9
|
-
import { pixelSizingInput, pixelSizingLabel, pixelSizingWidthInput, pixelSizingHeightInput, pixelSizingWrapper, pixelEntryForm, pixelEntryHiddenSubmit } from './styles';
|
|
9
|
+
import { pixelSizingInput, pixelSizingLabel, pixelSizingWidthInput, pixelSizingHeightInput, pixelSizingWrapper, pixelEntryForm, pixelEntryHiddenSubmit, pixelSizingFullWidthLabelStyles } from './styles';
|
|
10
10
|
import { messages } from './messages';
|
|
11
11
|
import { PIXELENTRY_MIGRATION_BUTTON_TESTID } from './constants';
|
|
12
12
|
export const PixelEntry = ({
|
|
@@ -168,4 +168,13 @@ export const PixelEntry = ({
|
|
|
168
168
|
type: "submit"
|
|
169
169
|
}, formatMessage(messages.submitButtonText))));
|
|
170
170
|
}));
|
|
171
|
+
};
|
|
172
|
+
export const FullWidthDisplay = ({
|
|
173
|
+
intl: {
|
|
174
|
+
formatMessage
|
|
175
|
+
}
|
|
176
|
+
}) => {
|
|
177
|
+
return jsx("div", {
|
|
178
|
+
css: pixelSizingFullWidthLabelStyles
|
|
179
|
+
}, jsx("span", null, formatMessage(messages.fullWidthLabel)));
|
|
171
180
|
};
|
|
@@ -30,6 +30,11 @@ export const messages = defineMessages({
|
|
|
30
30
|
defaultMessage: 'Submit',
|
|
31
31
|
description: 'The text give to the hidden submit button'
|
|
32
32
|
},
|
|
33
|
+
fullWidthLabel: {
|
|
34
|
+
id: 'fabric.editor.image.fullWidthLabel',
|
|
35
|
+
defaultMessage: 'Full-width',
|
|
36
|
+
description: 'The media has reached its maximum width'
|
|
37
|
+
},
|
|
33
38
|
migrationButtonText: {
|
|
34
39
|
id: 'fabric.editor.media.pixelEntry.migrationButtonText',
|
|
35
40
|
defaultMessage: 'Convert to pixels',
|