@atlaskit/editor-core 187.29.3 → 187.29.4
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 +10 -0
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +9 -46
- package/dist/cjs/plugins/media/toolbar/index.js +14 -1
- package/dist/cjs/plugins/media/ui/PixelEntry/constants.js +8 -0
- package/dist/cjs/plugins/media/ui/PixelEntry/index.js +14 -1
- package/dist/cjs/plugins/media/ui/PixelEntry/messages.js +10 -0
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +6 -3
- package/dist/cjs/plugins/type-ahead/index.js +1 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +4 -41
- package/dist/es2019/plugins/media/toolbar/index.js +16 -2
- package/dist/es2019/plugins/media/ui/PixelEntry/constants.js +1 -0
- package/dist/es2019/plugins/media/ui/PixelEntry/index.js +14 -1
- package/dist/es2019/plugins/media/ui/PixelEntry/messages.js +10 -0
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +6 -3
- package/dist/es2019/plugins/type-ahead/index.js +1 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +4 -41
- package/dist/esm/plugins/media/toolbar/index.js +15 -2
- package/dist/esm/plugins/media/ui/PixelEntry/constants.js +1 -0
- package/dist/esm/plugins/media/ui/PixelEntry/index.js +14 -1
- package/dist/esm/plugins/media/ui/PixelEntry/messages.js +10 -0
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +6 -3
- package/dist/esm/plugins/type-ahead/index.js +1 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/labs/next/presets/default.d.ts +8 -8
- package/dist/types/plugins/emoji/index.d.ts +1 -1
- package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +0 -12
- package/dist/types/plugins/media/ui/PixelEntry/constants.d.ts +1 -0
- package/dist/types/plugins/media/ui/PixelEntry/index.d.ts +1 -1
- package/dist/types/plugins/media/ui/PixelEntry/messages.d.ts +10 -0
- package/dist/types/plugins/media/ui/PixelEntry/types.d.ts +8 -0
- package/dist/types/plugins/type-ahead/api.d.ts +2 -1
- package/dist/types/plugins/type-ahead/index.d.ts +2 -13
- package/dist/types/plugins/type-ahead/types.d.ts +2 -3
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +8 -8
- package/dist/types-ts4.5/plugins/emoji/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaSingle.d.ts +0 -12
- package/dist/types-ts4.5/plugins/media/ui/PixelEntry/constants.d.ts +1 -0
- package/dist/types-ts4.5/plugins/media/ui/PixelEntry/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/ui/PixelEntry/messages.d.ts +10 -0
- package/dist/types-ts4.5/plugins/media/ui/PixelEntry/types.d.ts +8 -0
- package/dist/types-ts4.5/plugins/type-ahead/api.d.ts +2 -1
- package/dist/types-ts4.5/plugins/type-ahead/index.d.ts +2 -13
- package/dist/types-ts4.5/plugins/type-ahead/types.d.ts +2 -3
- package/package.json +2 -1
- package/report.api.md +2 -14
- package/tmp/api-report-tmp.d.ts +2 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.29.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`8595f0ddc4b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8595f0ddc4b) - Always show resizer handles when mediaSingle node is selected
|
|
8
|
+
- [`1af653a9630`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1af653a9630) - ED-19433 Initial scaffold for editor-plugin-type-ahead
|
|
9
|
+
- [`2f7d7be2983`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2f7d7be2983) - [ux] ED-19438 Added dark mode icons for headings 1 to 6
|
|
10
|
+
- [`1b917526a9f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1b917526a9f) - [ux] add convert to pixels cta in pixel entry for legacy experience
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 187.29.3
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -24,7 +24,6 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
24
24
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
25
25
|
var _nodes = require("../../../utils/nodes");
|
|
26
26
|
var _utils2 = require("../../../utils");
|
|
27
|
-
var _mediaSingle = require("../utils/media-single");
|
|
28
27
|
var _ResizableMediaSingleNext = _interopRequireDefault(require("../ui/ResizableMediaSingle/ResizableMediaSingleNext"));
|
|
29
28
|
var _ResizableMediaSingle = _interopRequireDefault(require("../ui/ResizableMediaSingle"));
|
|
30
29
|
var _main = require("../pm-plugins/main");
|
|
@@ -40,7 +39,7 @@ var _CaptionPlaceholder = _interopRequireDefault(require("../ui/CaptionPlacehold
|
|
|
40
39
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
41
40
|
var _captions = require("../commands/captions");
|
|
42
41
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
43
|
-
var
|
|
42
|
+
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
44
43
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
45
44
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
46
45
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -251,42 +250,6 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
251
250
|
}
|
|
252
251
|
(0, _captions.insertAndSelectCaptionFromMediaSinglePos)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions)(getPos(), node)(view.state, view.dispatch);
|
|
253
252
|
});
|
|
254
|
-
/**
|
|
255
|
-
* Get parent width for a nested media single node
|
|
256
|
-
* @param view Editor view
|
|
257
|
-
* @param pos node position
|
|
258
|
-
*/
|
|
259
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getLineLength", function (view, pos, includeMoreParentNodeTypes) {
|
|
260
|
-
if (typeof pos !== 'number') {
|
|
261
|
-
return null;
|
|
262
|
-
}
|
|
263
|
-
if ((0, _utils.isRichMediaInsideOfBlockNode)(view, pos)) {
|
|
264
|
-
var $pos = view.state.doc.resolve(pos);
|
|
265
|
-
var domNode = view.nodeDOM($pos.pos);
|
|
266
|
-
if ($pos.nodeAfter && _utils.floatingLayouts.indexOf($pos.nodeAfter.attrs.layout) > -1 && domNode && domNode.parentElement) {
|
|
267
|
-
return domNode.parentElement.offsetWidth;
|
|
268
|
-
}
|
|
269
|
-
if (domNode instanceof HTMLElement) {
|
|
270
|
-
return domNode.offsetWidth;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
return null;
|
|
274
|
-
});
|
|
275
|
-
/**
|
|
276
|
-
* Get parent width for a nested media single node for new experience
|
|
277
|
-
* @param view Editor view
|
|
278
|
-
* @param pos node position
|
|
279
|
-
*/
|
|
280
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getLineLengthNext", function (view, pos) {
|
|
281
|
-
if (typeof pos !== 'number') {
|
|
282
|
-
return null;
|
|
283
|
-
}
|
|
284
|
-
var $pos = view.state.doc.resolve(pos);
|
|
285
|
-
if ($pos && $pos.parent.type.name !== 'doc') {
|
|
286
|
-
return (0, _mediaSingle.getParentWidthForNestedMediaSingleNode)($pos, view);
|
|
287
|
-
}
|
|
288
|
-
return null;
|
|
289
|
-
});
|
|
290
253
|
return _this;
|
|
291
254
|
}
|
|
292
255
|
(0, _createClass2.default)(MediaSingleNode, [{
|
|
@@ -376,19 +339,19 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
376
339
|
stateWidth = _this$state.width,
|
|
377
340
|
stateHeight = _this$state.height;
|
|
378
341
|
if (width === null) {
|
|
379
|
-
width = stateWidth ||
|
|
342
|
+
width = stateWidth || _mediaSingle.DEFAULT_IMAGE_WIDTH;
|
|
380
343
|
}
|
|
381
344
|
if (height === null) {
|
|
382
|
-
height = stateHeight ||
|
|
345
|
+
height = stateHeight || _mediaSingle.DEFAULT_IMAGE_HEIGHT;
|
|
383
346
|
}
|
|
384
347
|
}
|
|
385
348
|
if (!width || !height) {
|
|
386
|
-
width =
|
|
387
|
-
height =
|
|
349
|
+
width = _mediaSingle.DEFAULT_IMAGE_WIDTH;
|
|
350
|
+
height = _mediaSingle.DEFAULT_IMAGE_HEIGHT;
|
|
388
351
|
}
|
|
389
352
|
var isSelected = selected();
|
|
390
|
-
var contentWidthForLegacyExperience =
|
|
391
|
-
var contentWidth =
|
|
353
|
+
var contentWidthForLegacyExperience = (0, _mediaSingle.getMaxWidthForNestedNode)(view, getPos()) || lineLength;
|
|
354
|
+
var contentWidth = (0, _mediaSingle.getMaxWidthForNestedNodeNext)(view, getPos()) || lineLength;
|
|
392
355
|
var mediaSingleProps = {
|
|
393
356
|
layout: layout,
|
|
394
357
|
width: width,
|
|
@@ -398,7 +361,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
398
361
|
pctWidth: mediaSingleWidthAttribute,
|
|
399
362
|
fullWidthMode: fullWidthMode,
|
|
400
363
|
hasFallbackContainer: false,
|
|
401
|
-
mediaSingleWidth: (0,
|
|
364
|
+
mediaSingleWidth: (0, _mediaSingle.calcMediaSinglePixelWidth)({
|
|
402
365
|
width: mediaSingleWidthAttribute,
|
|
403
366
|
widthType: widthType,
|
|
404
367
|
origWidth: width,
|
|
@@ -407,7 +370,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
407
370
|
// thus we use the legecy value (exclude table as container node)
|
|
408
371
|
contentWidth: contentWidthForLegacyExperience,
|
|
409
372
|
containerWidth: containerWidth,
|
|
410
|
-
gutterOffset:
|
|
373
|
+
gutterOffset: _mediaSingle.MEDIA_SINGLE_GUTTER_SIZE
|
|
411
374
|
})
|
|
412
375
|
};
|
|
413
376
|
var resizableMediaSingleProps = _objectSpread({
|
|
@@ -288,18 +288,20 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
288
288
|
var _selectedMediaNode$at = selectedMediaNode.attrs,
|
|
289
289
|
mediaWidth = _selectedMediaNode$at.width,
|
|
290
290
|
mediaHeight = _selectedMediaNode$at.height;
|
|
291
|
+
var isLegacy = widthType !== 'pixel';
|
|
291
292
|
var pixelWidth = (0, _mediaSingle.calcMediaSinglePixelWidth)({
|
|
292
293
|
width: singleMediaWidth,
|
|
293
294
|
widthType: widthType,
|
|
294
295
|
origWidth: mediaWidth || _mediaSingle.DEFAULT_IMAGE_WIDTH,
|
|
295
296
|
layout: layout,
|
|
296
|
-
contentWidth: contentWidth,
|
|
297
|
+
contentWidth: (0, _mediaSingle.getMaxWidthForNestedNode)(editorView, selectedMediaSingleNode.pos) || contentWidth,
|
|
297
298
|
containerWidth: containerWidth,
|
|
298
299
|
gutterOffset: _mediaSingle.MEDIA_SINGLE_GUTTER_SIZE
|
|
299
300
|
});
|
|
300
301
|
return /*#__PURE__*/_react.default.createElement(_PixelEntry.PixelEntry, {
|
|
301
302
|
intl: intl,
|
|
302
303
|
width: pluginState.isResizing ? pluginState.resizingWidth : pixelWidth,
|
|
304
|
+
showMigration: !pluginState.isResizing && isLegacy,
|
|
303
305
|
mediaWidth: mediaWidth || _mediaSingle.DEFAULT_IMAGE_WIDTH,
|
|
304
306
|
mediaHeight: mediaHeight || _mediaSingle.DEFAULT_IMAGE_HEIGHT,
|
|
305
307
|
validate: function validate(value) {
|
|
@@ -314,6 +316,17 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
314
316
|
width: width,
|
|
315
317
|
widthType: 'pixel'
|
|
316
318
|
}));
|
|
319
|
+
tr.setMeta('scrollIntoView', false);
|
|
320
|
+
tr.setSelection(_state2.NodeSelection.create(tr.doc, selectedMediaSingleNode.pos));
|
|
321
|
+
dispatch(tr);
|
|
322
|
+
},
|
|
323
|
+
onMigrate: function onMigrate() {
|
|
324
|
+
var tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, _objectSpread(_objectSpread({}, selectedMediaSingleNode.node.attrs), {}, {
|
|
325
|
+
width: pixelWidth,
|
|
326
|
+
widthType: 'pixel'
|
|
327
|
+
}));
|
|
328
|
+
tr.setMeta('scrollIntoView', false);
|
|
329
|
+
tr.setSelection(_state2.NodeSelection.create(tr.doc, selectedMediaSingleNode.pos));
|
|
317
330
|
dispatch(tr);
|
|
318
331
|
}
|
|
319
332
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PIXELENTRY_MIGRATION_BUTTON_TESTID = void 0;
|
|
7
|
+
var PIXELENTRY_MIGRATION_BUTTON_TESTID = 'pixel-entry-convert-pixels-btn';
|
|
8
|
+
exports.PIXELENTRY_MIGRATION_BUTTON_TESTID = PIXELENTRY_MIGRATION_BUTTON_TESTID;
|
|
@@ -16,6 +16,7 @@ var _button = _interopRequireDefault(require("@atlaskit/button"));
|
|
|
16
16
|
var _form = _interopRequireWildcard(require("@atlaskit/form"));
|
|
17
17
|
var _styles = require("./styles");
|
|
18
18
|
var _messages = require("./messages");
|
|
19
|
+
var _constants = require("./constants");
|
|
19
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
21
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
22
|
/** @jsx jsx */
|
|
@@ -26,7 +27,9 @@ var PixelEntry = function PixelEntry(_ref) {
|
|
|
26
27
|
mediaHeight = _ref.mediaHeight,
|
|
27
28
|
onSubmit = _ref.onSubmit,
|
|
28
29
|
validate = _ref.validate,
|
|
29
|
-
formatMessage = _ref.intl.formatMessage
|
|
30
|
+
formatMessage = _ref.intl.formatMessage,
|
|
31
|
+
showMigration = _ref.showMigration,
|
|
32
|
+
onMigrate = _ref.onMigrate;
|
|
30
33
|
var ratioWidth = (0, _react2.useMemo)(function () {
|
|
31
34
|
return mediaHeight / mediaWidth;
|
|
32
35
|
}, [mediaHeight, mediaWidth]);
|
|
@@ -96,6 +99,16 @@ var PixelEntry = function PixelEntry(_ref) {
|
|
|
96
99
|
}
|
|
97
100
|
};
|
|
98
101
|
}, [ratioHeight, ratioWidth]);
|
|
102
|
+
if (showMigration) {
|
|
103
|
+
return (0, _react.jsx)(_tooltip.default, {
|
|
104
|
+
content: formatMessage(_messages.messages.migrationButtonTooltip)
|
|
105
|
+
}, (0, _react.jsx)(_button.default, {
|
|
106
|
+
appearance: "warning",
|
|
107
|
+
spacing: "compact",
|
|
108
|
+
onClick: onMigrate,
|
|
109
|
+
testId: _constants.PIXELENTRY_MIGRATION_BUTTON_TESTID
|
|
110
|
+
}, formatMessage(_messages.messages.migrationButtonText)));
|
|
111
|
+
}
|
|
99
112
|
return (0, _react.jsx)("div", {
|
|
100
113
|
css: _styles.pixelEntryForm
|
|
101
114
|
}, (0, _react.jsx)(_form.default, {
|
|
@@ -35,6 +35,16 @@ var messages = (0, _reactIntlNext.defineMessages)({
|
|
|
35
35
|
id: 'fabric.editor.media.pixelEntry.submitButtonText',
|
|
36
36
|
defaultMessage: 'Submit',
|
|
37
37
|
description: 'The text give to the hidden submit button'
|
|
38
|
+
},
|
|
39
|
+
migrationButtonText: {
|
|
40
|
+
id: 'fabric.editor.media.pixelEntry.migrationButtonText',
|
|
41
|
+
defaultMessage: 'Convert to pixels',
|
|
42
|
+
description: 'The text give to the button used to covert to pixels for legacy experience'
|
|
43
|
+
},
|
|
44
|
+
migrationButtonTooltip: {
|
|
45
|
+
id: 'fabric.editor.media.pixelEntry.migrationButtonTooltip',
|
|
46
|
+
defaultMessage: 'Migrate from percentage to fixed pixel sizing',
|
|
47
|
+
description: 'The tooltip displayed on the migration button'
|
|
38
48
|
}
|
|
39
49
|
});
|
|
40
50
|
exports.messages = messages;
|
|
@@ -185,8 +185,10 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
185
185
|
});
|
|
186
186
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selectCurrentMediaNode", function () {
|
|
187
187
|
// TODO: if adding !this.props.selected, it doesn't work if media single node is at top postion
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
if (_this.pos === null) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
(0, _utils2.setNodeSelection)(_this.props.view, _this.pos);
|
|
190
192
|
});
|
|
191
193
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleResizeStart", function () {
|
|
192
194
|
_this.setState({
|
|
@@ -537,7 +539,8 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
537
539
|
handleResizeStop: this.handleResizeStop,
|
|
538
540
|
snap: this.state.snaps,
|
|
539
541
|
resizeRatio: _utils2.nonWrappedLayouts.includes(layout) ? 2 : 1,
|
|
540
|
-
"data-testid": resizerNextTestId
|
|
542
|
+
"data-testid": resizerNextTestId,
|
|
543
|
+
isHandleVisible: selected
|
|
541
544
|
}, children));
|
|
542
545
|
}
|
|
543
546
|
}]);
|
|
@@ -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.29.
|
|
9
|
+
var version = "187.29.4";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
@@ -5,10 +5,9 @@ import { jsx } from '@emotion/react';
|
|
|
5
5
|
import React, { Component } from 'react';
|
|
6
6
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
7
7
|
import { MediaSingle } from '@atlaskit/editor-common/ui';
|
|
8
|
-
import { browser
|
|
8
|
+
import { browser } from '@atlaskit/editor-common/utils';
|
|
9
9
|
import { isNodeSelectedOrInRange } from '../../../utils/nodes';
|
|
10
10
|
import { setNodeSelection, setTextSelection } from '../../../utils';
|
|
11
|
-
import { getParentWidthForNestedMediaSingleNode } from '../utils/media-single';
|
|
12
11
|
import ResizableMediaSingleNext from '../ui/ResizableMediaSingle/ResizableMediaSingleNext';
|
|
13
12
|
import ResizableMediaSingle from '../ui/ResizableMediaSingle';
|
|
14
13
|
import { MEDIA_CONTENT_WRAP_CLASS_NAME } from '../pm-plugins/main';
|
|
@@ -24,7 +23,7 @@ import CaptionPlaceholder from '../ui/CaptionPlaceholder';
|
|
|
24
23
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
25
24
|
import { insertAndSelectCaptionFromMediaSinglePos } from '../commands/captions';
|
|
26
25
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
27
|
-
import { calcMediaSinglePixelWidth, MEDIA_SINGLE_GUTTER_SIZE, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-single';
|
|
26
|
+
import { calcMediaSinglePixelWidth, MEDIA_SINGLE_GUTTER_SIZE, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH, getMaxWidthForNestedNode, getMaxWidthForNestedNodeNext } from '@atlaskit/editor-common/media-single';
|
|
28
27
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
29
28
|
export default class MediaSingleNode extends Component {
|
|
30
29
|
constructor(...args) {
|
|
@@ -177,42 +176,6 @@ export default class MediaSingleNode extends Component {
|
|
|
177
176
|
}
|
|
178
177
|
insertAndSelectCaptionFromMediaSinglePos(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions)(getPos(), node)(view.state, view.dispatch);
|
|
179
178
|
});
|
|
180
|
-
/**
|
|
181
|
-
* Get parent width for a nested media single node
|
|
182
|
-
* @param view Editor view
|
|
183
|
-
* @param pos node position
|
|
184
|
-
*/
|
|
185
|
-
_defineProperty(this, "getLineLength", (view, pos, includeMoreParentNodeTypes) => {
|
|
186
|
-
if (typeof pos !== 'number') {
|
|
187
|
-
return null;
|
|
188
|
-
}
|
|
189
|
-
if (isRichMediaInsideOfBlockNode(view, pos)) {
|
|
190
|
-
const $pos = view.state.doc.resolve(pos);
|
|
191
|
-
const domNode = view.nodeDOM($pos.pos);
|
|
192
|
-
if ($pos.nodeAfter && floatingLayouts.indexOf($pos.nodeAfter.attrs.layout) > -1 && domNode && domNode.parentElement) {
|
|
193
|
-
return domNode.parentElement.offsetWidth;
|
|
194
|
-
}
|
|
195
|
-
if (domNode instanceof HTMLElement) {
|
|
196
|
-
return domNode.offsetWidth;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
return null;
|
|
200
|
-
});
|
|
201
|
-
/**
|
|
202
|
-
* Get parent width for a nested media single node for new experience
|
|
203
|
-
* @param view Editor view
|
|
204
|
-
* @param pos node position
|
|
205
|
-
*/
|
|
206
|
-
_defineProperty(this, "getLineLengthNext", (view, pos) => {
|
|
207
|
-
if (typeof pos !== 'number') {
|
|
208
|
-
return null;
|
|
209
|
-
}
|
|
210
|
-
const $pos = view.state.doc.resolve(pos);
|
|
211
|
-
if ($pos && $pos.parent.type.name !== 'doc') {
|
|
212
|
-
return getParentWidthForNestedMediaSingleNode($pos, view);
|
|
213
|
-
}
|
|
214
|
-
return null;
|
|
215
|
-
});
|
|
216
179
|
}
|
|
217
180
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
218
181
|
if (nextProps.mediaProvider !== this.props.mediaProvider) {
|
|
@@ -294,8 +257,8 @@ export default class MediaSingleNode extends Component {
|
|
|
294
257
|
height = DEFAULT_IMAGE_HEIGHT;
|
|
295
258
|
}
|
|
296
259
|
const isSelected = selected();
|
|
297
|
-
const contentWidthForLegacyExperience =
|
|
298
|
-
const contentWidth =
|
|
260
|
+
const contentWidthForLegacyExperience = getMaxWidthForNestedNode(view, getPos()) || lineLength;
|
|
261
|
+
const contentWidth = getMaxWidthForNestedNodeNext(view, getPos()) || lineLength;
|
|
299
262
|
const mediaSingleProps = {
|
|
300
263
|
layout,
|
|
301
264
|
width,
|
|
@@ -25,7 +25,7 @@ import ImageBorderItem from '../ui/ImageBorder';
|
|
|
25
25
|
import { currentMediaNodeBorderMark } from '../utils/current-media-node';
|
|
26
26
|
import { shouldShowImageBorder } from './imageBorder';
|
|
27
27
|
import { PixelEntry } from '../ui/PixelEntry';
|
|
28
|
-
import { DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_GUTTER_SIZE, calcMediaSinglePixelWidth } from '@atlaskit/editor-common/media-single';
|
|
28
|
+
import { DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_GUTTER_SIZE, calcMediaSinglePixelWidth, getMaxWidthForNestedNode } from '@atlaskit/editor-common/media-single';
|
|
29
29
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
30
30
|
const remove = (state, dispatch) => {
|
|
31
31
|
if (dispatch) {
|
|
@@ -293,18 +293,20 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
293
293
|
width: mediaWidth,
|
|
294
294
|
height: mediaHeight
|
|
295
295
|
} = selectedMediaNode.attrs;
|
|
296
|
+
const isLegacy = widthType !== 'pixel';
|
|
296
297
|
const pixelWidth = calcMediaSinglePixelWidth({
|
|
297
298
|
width: singleMediaWidth,
|
|
298
299
|
widthType,
|
|
299
300
|
origWidth: mediaWidth || DEFAULT_IMAGE_WIDTH,
|
|
300
301
|
layout,
|
|
301
|
-
contentWidth,
|
|
302
|
+
contentWidth: getMaxWidthForNestedNode(editorView, selectedMediaSingleNode.pos) || contentWidth,
|
|
302
303
|
containerWidth,
|
|
303
304
|
gutterOffset: MEDIA_SINGLE_GUTTER_SIZE
|
|
304
305
|
});
|
|
305
306
|
return /*#__PURE__*/React.createElement(PixelEntry, {
|
|
306
307
|
intl: intl,
|
|
307
308
|
width: pluginState.isResizing ? pluginState.resizingWidth : pixelWidth,
|
|
309
|
+
showMigration: !pluginState.isResizing && isLegacy,
|
|
308
310
|
mediaWidth: mediaWidth || DEFAULT_IMAGE_WIDTH,
|
|
309
311
|
mediaHeight: mediaHeight || DEFAULT_IMAGE_HEIGHT,
|
|
310
312
|
validate: value => {
|
|
@@ -321,6 +323,18 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
321
323
|
width,
|
|
322
324
|
widthType: 'pixel'
|
|
323
325
|
});
|
|
326
|
+
tr.setMeta('scrollIntoView', false);
|
|
327
|
+
tr.setSelection(NodeSelection.create(tr.doc, selectedMediaSingleNode.pos));
|
|
328
|
+
dispatch(tr);
|
|
329
|
+
},
|
|
330
|
+
onMigrate: () => {
|
|
331
|
+
const tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, {
|
|
332
|
+
...selectedMediaSingleNode.node.attrs,
|
|
333
|
+
width: pixelWidth,
|
|
334
|
+
widthType: 'pixel'
|
|
335
|
+
});
|
|
336
|
+
tr.setMeta('scrollIntoView', false);
|
|
337
|
+
tr.setSelection(NodeSelection.create(tr.doc, selectedMediaSingleNode.pos));
|
|
324
338
|
dispatch(tr);
|
|
325
339
|
}
|
|
326
340
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PIXELENTRY_MIGRATION_BUTTON_TESTID = 'pixel-entry-convert-pixels-btn';
|
|
@@ -8,6 +8,7 @@ import Button from '@atlaskit/button';
|
|
|
8
8
|
import Form, { Field } from '@atlaskit/form';
|
|
9
9
|
import { pixelSizingInput, pixelSizingLabel, pixelSizingWidthInput, pixelSizingHeightInput, pixelSizingWrapper, pixelEntryForm, pixelEntryHiddenSubmit } from './styles';
|
|
10
10
|
import { messages } from './messages';
|
|
11
|
+
import { PIXELENTRY_MIGRATION_BUTTON_TESTID } from './constants';
|
|
11
12
|
export const PixelEntry = ({
|
|
12
13
|
width,
|
|
13
14
|
mediaWidth,
|
|
@@ -16,7 +17,9 @@ export const PixelEntry = ({
|
|
|
16
17
|
validate,
|
|
17
18
|
intl: {
|
|
18
19
|
formatMessage
|
|
19
|
-
}
|
|
20
|
+
},
|
|
21
|
+
showMigration,
|
|
22
|
+
onMigrate
|
|
20
23
|
}) => {
|
|
21
24
|
const ratioWidth = useMemo(() => {
|
|
22
25
|
return mediaHeight / mediaWidth;
|
|
@@ -79,6 +82,16 @@ export const PixelEntry = ({
|
|
|
79
82
|
}
|
|
80
83
|
}
|
|
81
84
|
}, [ratioHeight, ratioWidth]);
|
|
85
|
+
if (showMigration) {
|
|
86
|
+
return jsx(Tooltip, {
|
|
87
|
+
content: formatMessage(messages.migrationButtonTooltip)
|
|
88
|
+
}, jsx(Button, {
|
|
89
|
+
appearance: "warning",
|
|
90
|
+
spacing: "compact",
|
|
91
|
+
onClick: onMigrate,
|
|
92
|
+
testId: PIXELENTRY_MIGRATION_BUTTON_TESTID
|
|
93
|
+
}, formatMessage(messages.migrationButtonText)));
|
|
94
|
+
}
|
|
82
95
|
return jsx("div", {
|
|
83
96
|
css: pixelEntryForm
|
|
84
97
|
}, jsx(Form, {
|
|
@@ -29,5 +29,15 @@ export const messages = defineMessages({
|
|
|
29
29
|
id: 'fabric.editor.media.pixelEntry.submitButtonText',
|
|
30
30
|
defaultMessage: 'Submit',
|
|
31
31
|
description: 'The text give to the hidden submit button'
|
|
32
|
+
},
|
|
33
|
+
migrationButtonText: {
|
|
34
|
+
id: 'fabric.editor.media.pixelEntry.migrationButtonText',
|
|
35
|
+
defaultMessage: 'Convert to pixels',
|
|
36
|
+
description: 'The text give to the button used to covert to pixels for legacy experience'
|
|
37
|
+
},
|
|
38
|
+
migrationButtonTooltip: {
|
|
39
|
+
id: 'fabric.editor.media.pixelEntry.migrationButtonTooltip',
|
|
40
|
+
defaultMessage: 'Migrate from percentage to fixed pixel sizing',
|
|
41
|
+
description: 'The tooltip displayed on the migration button'
|
|
32
42
|
}
|
|
33
43
|
});
|
|
@@ -165,8 +165,10 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
165
165
|
});
|
|
166
166
|
_defineProperty(this, "selectCurrentMediaNode", () => {
|
|
167
167
|
// TODO: if adding !this.props.selected, it doesn't work if media single node is at top postion
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
if (this.pos === null) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
setNodeSelection(this.props.view, this.pos);
|
|
170
172
|
});
|
|
171
173
|
_defineProperty(this, "handleResizeStart", () => {
|
|
172
174
|
this.setState({
|
|
@@ -457,7 +459,8 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
457
459
|
handleResizeStop: this.handleResizeStop,
|
|
458
460
|
snap: this.state.snaps,
|
|
459
461
|
resizeRatio: nonWrappedLayouts.includes(layout) ? 2 : 1,
|
|
460
|
-
"data-testid": resizerNextTestId
|
|
462
|
+
"data-testid": resizerNextTestId,
|
|
463
|
+
isHandleVisible: selected
|
|
461
464
|
}, children));
|
|
462
465
|
}
|
|
463
466
|
}
|
|
@@ -18,10 +18,9 @@ import { jsx } from '@emotion/react';
|
|
|
18
18
|
import React, { Component } from 'react';
|
|
19
19
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
20
20
|
import { MediaSingle } from '@atlaskit/editor-common/ui';
|
|
21
|
-
import { browser
|
|
21
|
+
import { browser } from '@atlaskit/editor-common/utils';
|
|
22
22
|
import { isNodeSelectedOrInRange } from '../../../utils/nodes';
|
|
23
23
|
import { setNodeSelection, setTextSelection } from '../../../utils';
|
|
24
|
-
import { getParentWidthForNestedMediaSingleNode } from '../utils/media-single';
|
|
25
24
|
import ResizableMediaSingleNext from '../ui/ResizableMediaSingle/ResizableMediaSingleNext';
|
|
26
25
|
import ResizableMediaSingle from '../ui/ResizableMediaSingle';
|
|
27
26
|
import { MEDIA_CONTENT_WRAP_CLASS_NAME } from '../pm-plugins/main';
|
|
@@ -37,7 +36,7 @@ import CaptionPlaceholder from '../ui/CaptionPlaceholder';
|
|
|
37
36
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
38
37
|
import { insertAndSelectCaptionFromMediaSinglePos } from '../commands/captions';
|
|
39
38
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
40
|
-
import { calcMediaSinglePixelWidth, MEDIA_SINGLE_GUTTER_SIZE, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-single';
|
|
39
|
+
import { calcMediaSinglePixelWidth, MEDIA_SINGLE_GUTTER_SIZE, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH, getMaxWidthForNestedNode, getMaxWidthForNestedNodeNext } from '@atlaskit/editor-common/media-single';
|
|
41
40
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
42
41
|
var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
43
42
|
_inherits(MediaSingleNode, _Component);
|
|
@@ -242,42 +241,6 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
242
241
|
}
|
|
243
242
|
insertAndSelectCaptionFromMediaSinglePos(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions)(getPos(), node)(view.state, view.dispatch);
|
|
244
243
|
});
|
|
245
|
-
/**
|
|
246
|
-
* Get parent width for a nested media single node
|
|
247
|
-
* @param view Editor view
|
|
248
|
-
* @param pos node position
|
|
249
|
-
*/
|
|
250
|
-
_defineProperty(_assertThisInitialized(_this), "getLineLength", function (view, pos, includeMoreParentNodeTypes) {
|
|
251
|
-
if (typeof pos !== 'number') {
|
|
252
|
-
return null;
|
|
253
|
-
}
|
|
254
|
-
if (isRichMediaInsideOfBlockNode(view, pos)) {
|
|
255
|
-
var $pos = view.state.doc.resolve(pos);
|
|
256
|
-
var domNode = view.nodeDOM($pos.pos);
|
|
257
|
-
if ($pos.nodeAfter && floatingLayouts.indexOf($pos.nodeAfter.attrs.layout) > -1 && domNode && domNode.parentElement) {
|
|
258
|
-
return domNode.parentElement.offsetWidth;
|
|
259
|
-
}
|
|
260
|
-
if (domNode instanceof HTMLElement) {
|
|
261
|
-
return domNode.offsetWidth;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
return null;
|
|
265
|
-
});
|
|
266
|
-
/**
|
|
267
|
-
* Get parent width for a nested media single node for new experience
|
|
268
|
-
* @param view Editor view
|
|
269
|
-
* @param pos node position
|
|
270
|
-
*/
|
|
271
|
-
_defineProperty(_assertThisInitialized(_this), "getLineLengthNext", function (view, pos) {
|
|
272
|
-
if (typeof pos !== 'number') {
|
|
273
|
-
return null;
|
|
274
|
-
}
|
|
275
|
-
var $pos = view.state.doc.resolve(pos);
|
|
276
|
-
if ($pos && $pos.parent.type.name !== 'doc') {
|
|
277
|
-
return getParentWidthForNestedMediaSingleNode($pos, view);
|
|
278
|
-
}
|
|
279
|
-
return null;
|
|
280
|
-
});
|
|
281
244
|
return _this;
|
|
282
245
|
}
|
|
283
246
|
_createClass(MediaSingleNode, [{
|
|
@@ -378,8 +341,8 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
378
341
|
height = DEFAULT_IMAGE_HEIGHT;
|
|
379
342
|
}
|
|
380
343
|
var isSelected = selected();
|
|
381
|
-
var contentWidthForLegacyExperience =
|
|
382
|
-
var contentWidth =
|
|
344
|
+
var contentWidthForLegacyExperience = getMaxWidthForNestedNode(view, getPos()) || lineLength;
|
|
345
|
+
var contentWidth = getMaxWidthForNestedNodeNext(view, getPos()) || lineLength;
|
|
383
346
|
var mediaSingleProps = {
|
|
384
347
|
layout: layout,
|
|
385
348
|
width: width,
|
|
@@ -29,7 +29,7 @@ import ImageBorderItem from '../ui/ImageBorder';
|
|
|
29
29
|
import { currentMediaNodeBorderMark } from '../utils/current-media-node';
|
|
30
30
|
import { shouldShowImageBorder } from './imageBorder';
|
|
31
31
|
import { PixelEntry } from '../ui/PixelEntry';
|
|
32
|
-
import { DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_GUTTER_SIZE, calcMediaSinglePixelWidth } from '@atlaskit/editor-common/media-single';
|
|
32
|
+
import { DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_GUTTER_SIZE, calcMediaSinglePixelWidth, getMaxWidthForNestedNode } from '@atlaskit/editor-common/media-single';
|
|
33
33
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
34
34
|
var remove = function remove(state, dispatch) {
|
|
35
35
|
if (dispatch) {
|
|
@@ -281,18 +281,20 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
281
281
|
var _selectedMediaNode$at = selectedMediaNode.attrs,
|
|
282
282
|
mediaWidth = _selectedMediaNode$at.width,
|
|
283
283
|
mediaHeight = _selectedMediaNode$at.height;
|
|
284
|
+
var isLegacy = widthType !== 'pixel';
|
|
284
285
|
var pixelWidth = calcMediaSinglePixelWidth({
|
|
285
286
|
width: singleMediaWidth,
|
|
286
287
|
widthType: widthType,
|
|
287
288
|
origWidth: mediaWidth || DEFAULT_IMAGE_WIDTH,
|
|
288
289
|
layout: layout,
|
|
289
|
-
contentWidth: contentWidth,
|
|
290
|
+
contentWidth: getMaxWidthForNestedNode(editorView, selectedMediaSingleNode.pos) || contentWidth,
|
|
290
291
|
containerWidth: containerWidth,
|
|
291
292
|
gutterOffset: MEDIA_SINGLE_GUTTER_SIZE
|
|
292
293
|
});
|
|
293
294
|
return /*#__PURE__*/React.createElement(PixelEntry, {
|
|
294
295
|
intl: intl,
|
|
295
296
|
width: pluginState.isResizing ? pluginState.resizingWidth : pixelWidth,
|
|
297
|
+
showMigration: !pluginState.isResizing && isLegacy,
|
|
296
298
|
mediaWidth: mediaWidth || DEFAULT_IMAGE_WIDTH,
|
|
297
299
|
mediaHeight: mediaHeight || DEFAULT_IMAGE_HEIGHT,
|
|
298
300
|
validate: function validate(value) {
|
|
@@ -307,6 +309,17 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
307
309
|
width: width,
|
|
308
310
|
widthType: 'pixel'
|
|
309
311
|
}));
|
|
312
|
+
tr.setMeta('scrollIntoView', false);
|
|
313
|
+
tr.setSelection(NodeSelection.create(tr.doc, selectedMediaSingleNode.pos));
|
|
314
|
+
dispatch(tr);
|
|
315
|
+
},
|
|
316
|
+
onMigrate: function onMigrate() {
|
|
317
|
+
var tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, _objectSpread(_objectSpread({}, selectedMediaSingleNode.node.attrs), {}, {
|
|
318
|
+
width: pixelWidth,
|
|
319
|
+
widthType: 'pixel'
|
|
320
|
+
}));
|
|
321
|
+
tr.setMeta('scrollIntoView', false);
|
|
322
|
+
tr.setSelection(NodeSelection.create(tr.doc, selectedMediaSingleNode.pos));
|
|
310
323
|
dispatch(tr);
|
|
311
324
|
}
|
|
312
325
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var PIXELENTRY_MIGRATION_BUTTON_TESTID = 'pixel-entry-convert-pixels-btn';
|
|
@@ -9,13 +9,16 @@ import Button from '@atlaskit/button';
|
|
|
9
9
|
import Form, { Field } from '@atlaskit/form';
|
|
10
10
|
import { pixelSizingInput, pixelSizingLabel, pixelSizingWidthInput, pixelSizingHeightInput, pixelSizingWrapper, pixelEntryForm, pixelEntryHiddenSubmit } from './styles';
|
|
11
11
|
import { messages } from './messages';
|
|
12
|
+
import { PIXELENTRY_MIGRATION_BUTTON_TESTID } from './constants';
|
|
12
13
|
export var PixelEntry = function PixelEntry(_ref) {
|
|
13
14
|
var width = _ref.width,
|
|
14
15
|
mediaWidth = _ref.mediaWidth,
|
|
15
16
|
mediaHeight = _ref.mediaHeight,
|
|
16
17
|
onSubmit = _ref.onSubmit,
|
|
17
18
|
validate = _ref.validate,
|
|
18
|
-
formatMessage = _ref.intl.formatMessage
|
|
19
|
+
formatMessage = _ref.intl.formatMessage,
|
|
20
|
+
showMigration = _ref.showMigration,
|
|
21
|
+
onMigrate = _ref.onMigrate;
|
|
19
22
|
var ratioWidth = useMemo(function () {
|
|
20
23
|
return mediaHeight / mediaWidth;
|
|
21
24
|
}, [mediaHeight, mediaWidth]);
|
|
@@ -85,6 +88,16 @@ export var PixelEntry = function PixelEntry(_ref) {
|
|
|
85
88
|
}
|
|
86
89
|
};
|
|
87
90
|
}, [ratioHeight, ratioWidth]);
|
|
91
|
+
if (showMigration) {
|
|
92
|
+
return jsx(Tooltip, {
|
|
93
|
+
content: formatMessage(messages.migrationButtonTooltip)
|
|
94
|
+
}, jsx(Button, {
|
|
95
|
+
appearance: "warning",
|
|
96
|
+
spacing: "compact",
|
|
97
|
+
onClick: onMigrate,
|
|
98
|
+
testId: PIXELENTRY_MIGRATION_BUTTON_TESTID
|
|
99
|
+
}, formatMessage(messages.migrationButtonText)));
|
|
100
|
+
}
|
|
88
101
|
return jsx("div", {
|
|
89
102
|
css: pixelEntryForm
|
|
90
103
|
}, jsx(Form, {
|
|
@@ -29,5 +29,15 @@ export var messages = defineMessages({
|
|
|
29
29
|
id: 'fabric.editor.media.pixelEntry.submitButtonText',
|
|
30
30
|
defaultMessage: 'Submit',
|
|
31
31
|
description: 'The text give to the hidden submit button'
|
|
32
|
+
},
|
|
33
|
+
migrationButtonText: {
|
|
34
|
+
id: 'fabric.editor.media.pixelEntry.migrationButtonText',
|
|
35
|
+
defaultMessage: 'Convert to pixels',
|
|
36
|
+
description: 'The text give to the button used to covert to pixels for legacy experience'
|
|
37
|
+
},
|
|
38
|
+
migrationButtonTooltip: {
|
|
39
|
+
id: 'fabric.editor.media.pixelEntry.migrationButtonTooltip',
|
|
40
|
+
defaultMessage: 'Migrate from percentage to fixed pixel sizing',
|
|
41
|
+
description: 'The tooltip displayed on the migration button'
|
|
32
42
|
}
|
|
33
43
|
});
|
|
@@ -178,8 +178,10 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
178
178
|
});
|
|
179
179
|
_defineProperty(_assertThisInitialized(_this), "selectCurrentMediaNode", function () {
|
|
180
180
|
// TODO: if adding !this.props.selected, it doesn't work if media single node is at top postion
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
if (_this.pos === null) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
setNodeSelection(_this.props.view, _this.pos);
|
|
183
185
|
});
|
|
184
186
|
_defineProperty(_assertThisInitialized(_this), "handleResizeStart", function () {
|
|
185
187
|
_this.setState({
|
|
@@ -530,7 +532,8 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
530
532
|
handleResizeStop: this.handleResizeStop,
|
|
531
533
|
snap: this.state.snaps,
|
|
532
534
|
resizeRatio: nonWrappedLayouts.includes(layout) ? 2 : 1,
|
|
533
|
-
"data-testid": resizerNextTestId
|
|
535
|
+
"data-testid": resizerNextTestId,
|
|
536
|
+
isHandleVisible: selected
|
|
534
537
|
}, children));
|
|
535
538
|
}
|
|
536
539
|
}]);
|
|
@@ -221,18 +221,18 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
221
221
|
}>, (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"unsupportedContent", {}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"unsupportedContent", {}>, (config?: TypeAheadPluginOptions | undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"typeAhead", {
|
|
222
222
|
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
223
223
|
commands: {
|
|
224
|
-
openTypeAheadAtCursor: (
|
|
224
|
+
openTypeAheadAtCursor: (props: {
|
|
225
225
|
triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
|
|
226
|
-
inputMethod: import("
|
|
226
|
+
inputMethod: import("@atlaskit/editor-plugin-type-ahead").TypeAheadInputMethod;
|
|
227
227
|
query?: string | undefined;
|
|
228
228
|
}) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
229
229
|
};
|
|
230
230
|
}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"typeAhead", {
|
|
231
231
|
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
232
232
|
commands: {
|
|
233
|
-
openTypeAheadAtCursor: (
|
|
233
|
+
openTypeAheadAtCursor: (props: {
|
|
234
234
|
triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
|
|
235
|
-
inputMethod: import("
|
|
235
|
+
inputMethod: import("@atlaskit/editor-plugin-type-ahead").TypeAheadInputMethod;
|
|
236
236
|
query?: string | undefined;
|
|
237
237
|
}) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
238
238
|
};
|
|
@@ -606,18 +606,18 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
606
606
|
}>, (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"unsupportedContent", {}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"unsupportedContent", {}>, (config?: TypeAheadPluginOptions | undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"typeAhead", {
|
|
607
607
|
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
608
608
|
commands: {
|
|
609
|
-
openTypeAheadAtCursor: (
|
|
609
|
+
openTypeAheadAtCursor: (props: {
|
|
610
610
|
triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
|
|
611
|
-
inputMethod: import("
|
|
611
|
+
inputMethod: import("@atlaskit/editor-plugin-type-ahead").TypeAheadInputMethod;
|
|
612
612
|
query?: string | undefined;
|
|
613
613
|
}) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
614
614
|
};
|
|
615
615
|
}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"typeAhead", {
|
|
616
616
|
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
617
617
|
commands: {
|
|
618
|
-
openTypeAheadAtCursor: (
|
|
618
|
+
openTypeAheadAtCursor: (props: {
|
|
619
619
|
triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
|
|
620
|
-
inputMethod: import("
|
|
620
|
+
inputMethod: import("@atlaskit/editor-plugin-type-ahead").TypeAheadInputMethod;
|
|
621
621
|
query?: string | undefined;
|
|
622
622
|
}) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
623
623
|
};
|
|
@@ -7,7 +7,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
7
7
|
import type { TypeAheadItem } from '../type-ahead/types';
|
|
8
8
|
import type { EmojiPluginOptions, EmojiPluginState } from './types';
|
|
9
9
|
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
10
|
-
import type { TypeAheadPlugin } from '
|
|
10
|
+
import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
11
11
|
export declare const emojiToTypeaheadItem: (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem;
|
|
12
12
|
export declare function memoize<ResultFn extends (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem>(fn: ResultFn): {
|
|
13
13
|
call: ResultFn;
|
|
@@ -41,18 +41,6 @@ export default class MediaSingleNode extends Component<MediaSingleNodeProps, Med
|
|
|
41
41
|
onMediaSingleClicked: (event: MouseEvent) => void;
|
|
42
42
|
render(): jsx.JSX.Element;
|
|
43
43
|
private clickPlaceholder;
|
|
44
|
-
/**
|
|
45
|
-
* Get parent width for a nested media single node
|
|
46
|
-
* @param view Editor view
|
|
47
|
-
* @param pos node position
|
|
48
|
-
*/
|
|
49
|
-
private getLineLength;
|
|
50
|
-
/**
|
|
51
|
-
* Get parent width for a nested media single node for new experience
|
|
52
|
-
* @param view Editor view
|
|
53
|
-
* @param pos node position
|
|
54
|
-
*/
|
|
55
|
-
private getLineLengthNext;
|
|
56
44
|
}
|
|
57
45
|
declare class MediaSingleNodeView extends ReactNodeView<MediaSingleNodeViewProps> {
|
|
58
46
|
lastOffsetLeft: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PIXELENTRY_MIGRATION_BUTTON_TESTID = "pixel-entry-convert-pixels-btn";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
3
|
import type { PixelEntryProps } from './types';
|
|
4
|
-
export declare const PixelEntry: ({ width, mediaWidth, mediaHeight, onSubmit, validate, intl: { formatMessage }, }: PixelEntryProps) => jsx.JSX.Element;
|
|
4
|
+
export declare const PixelEntry: ({ width, mediaWidth, mediaHeight, onSubmit, validate, intl: { formatMessage }, showMigration, onMigrate, }: PixelEntryProps) => jsx.JSX.Element;
|
|
@@ -29,4 +29,14 @@ export declare const messages: {
|
|
|
29
29
|
defaultMessage: string;
|
|
30
30
|
description: string;
|
|
31
31
|
};
|
|
32
|
+
migrationButtonText: {
|
|
33
|
+
id: string;
|
|
34
|
+
defaultMessage: string;
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
migrationButtonTooltip: {
|
|
38
|
+
id: string;
|
|
39
|
+
defaultMessage: string;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
32
42
|
};
|
|
@@ -16,6 +16,10 @@ export type PixelEntryProps = {
|
|
|
16
16
|
* The original media height used to calculate the width
|
|
17
17
|
*/
|
|
18
18
|
mediaHeight: number;
|
|
19
|
+
/**
|
|
20
|
+
* show migration button to convert to pixels for legacy image resize experience
|
|
21
|
+
*/
|
|
22
|
+
showMigration?: boolean;
|
|
19
23
|
/**
|
|
20
24
|
* The submit function that is called when the form is valid and the submit key is pressed
|
|
21
25
|
*/
|
|
@@ -25,6 +29,10 @@ export type PixelEntryProps = {
|
|
|
25
29
|
* The value passed through the validator currently comes from the width input only.
|
|
26
30
|
*/
|
|
27
31
|
validate?: (value: number | '') => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Migration handler called when the CTA button is clicked
|
|
34
|
+
*/
|
|
35
|
+
onMigrate?: () => void;
|
|
28
36
|
};
|
|
29
37
|
export type PixelEntryFormValues = {
|
|
30
38
|
inputWidth: number | '';
|
|
@@ -2,7 +2,8 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
|
2
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { TypeAheadItem } from '@atlaskit/editor-common/provider-factory';
|
|
4
4
|
import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
5
|
-
import type {
|
|
5
|
+
import type { TypeAheadInputMethod } from '@atlaskit/editor-plugin-type-ahead';
|
|
6
|
+
import type { TypeAheadHandler } from './types';
|
|
6
7
|
import type { Command } from '../../types/command';
|
|
7
8
|
type CloseOptions = {
|
|
8
9
|
insertCurrentQueryAsRawText: boolean;
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import type { NextEditorPlugin } from '../../types/editor-plugin';
|
|
2
|
-
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
|
|
3
1
|
import { pluginKey as typeAheadPluginKey } from './pm-plugins/key';
|
|
4
|
-
import {
|
|
5
|
-
export type TypeAheadPluginOptions
|
|
6
|
-
isMobile?: boolean;
|
|
7
|
-
createAnalyticsEvent?: CreateUIAnalyticsEvent;
|
|
8
|
-
};
|
|
9
|
-
export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
|
|
10
|
-
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
11
|
-
commands: {
|
|
12
|
-
openTypeAheadAtCursor: typeof openTypeAheadAtCursor;
|
|
13
|
-
};
|
|
14
|
-
}>;
|
|
2
|
+
import type { TypeAheadPluginOptions, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
3
|
+
export type { TypeAheadPluginOptions, TypeAheadPlugin };
|
|
15
4
|
/**
|
|
16
5
|
*
|
|
17
6
|
* Revamped typeahead using decorations instead of the `typeAheadQuery` mark
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
2
2
|
import type { EditorState, Transaction, ReadonlyTransaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import type { INPUT_METHOD } from '../analytics/types/enums';
|
|
4
3
|
import type { CloseSelectionOptions } from './constants';
|
|
5
4
|
import type { UiComponentFactoryParams } from '../../types/ui-components';
|
|
6
5
|
import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
7
6
|
import type { TypeAheadStats, TypeAheadItemRenderProps, TypeAheadInsert, TypeAheadSelectItem, TypeAheadItem, TypeAheadForceSelect, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
8
|
-
|
|
7
|
+
import type { TypeAheadInputMethod } from '@atlaskit/editor-plugin-type-ahead';
|
|
8
|
+
export type { TypeAheadStats, TypeAheadItemRenderProps, TypeAheadInsert, TypeAheadSelectItem, TypeAheadItem, TypeAheadForceSelect, TypeAheadHandler, TypeAheadInputMethod, };
|
|
9
9
|
export type OnSelectItem = (props: {
|
|
10
10
|
index: number;
|
|
11
11
|
item: TypeAheadItem;
|
|
@@ -49,7 +49,6 @@ export type OnTextInsertProps = {
|
|
|
49
49
|
text: string;
|
|
50
50
|
};
|
|
51
51
|
export type OnTextInsert = (props: OnTextInsertProps) => void;
|
|
52
|
-
export type TypeAheadInputMethod = INPUT_METHOD.INSERT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR;
|
|
53
52
|
export type InsertionTransactionMeta = (editorState: EditorState) => Transaction | false;
|
|
54
53
|
type PopupMountPoints = Pick<UiComponentFactoryParams, 'popupsMountPoint' | 'popupsBoundariesElement' | 'popupsScrollableElement'>;
|
|
55
54
|
export type PopupMountPointReference = Record<'current', PopupMountPoints | null>;
|
|
@@ -269,18 +269,18 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
269
269
|
(config?: TypeAheadPluginOptions | undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"typeAhead", {
|
|
270
270
|
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
271
271
|
commands: {
|
|
272
|
-
openTypeAheadAtCursor: (
|
|
272
|
+
openTypeAheadAtCursor: (props: {
|
|
273
273
|
triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
|
|
274
|
-
inputMethod: import("
|
|
274
|
+
inputMethod: import("@atlaskit/editor-plugin-type-ahead").TypeAheadInputMethod;
|
|
275
275
|
query?: string | undefined;
|
|
276
276
|
}) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
277
277
|
};
|
|
278
278
|
}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"typeAhead", {
|
|
279
279
|
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
280
280
|
commands: {
|
|
281
|
-
openTypeAheadAtCursor: (
|
|
281
|
+
openTypeAheadAtCursor: (props: {
|
|
282
282
|
triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
|
|
283
|
-
inputMethod: import("
|
|
283
|
+
inputMethod: import("@atlaskit/editor-plugin-type-ahead").TypeAheadInputMethod;
|
|
284
284
|
query?: string | undefined;
|
|
285
285
|
}) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
286
286
|
};
|
|
@@ -734,18 +734,18 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
734
734
|
(config?: TypeAheadPluginOptions | undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"typeAhead", {
|
|
735
735
|
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
736
736
|
commands: {
|
|
737
|
-
openTypeAheadAtCursor: (
|
|
737
|
+
openTypeAheadAtCursor: (props: {
|
|
738
738
|
triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
|
|
739
|
-
inputMethod: import("
|
|
739
|
+
inputMethod: import("@atlaskit/editor-plugin-type-ahead").TypeAheadInputMethod;
|
|
740
740
|
query?: string | undefined;
|
|
741
741
|
}) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
742
742
|
};
|
|
743
743
|
}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"typeAhead", {
|
|
744
744
|
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
745
745
|
commands: {
|
|
746
|
-
openTypeAheadAtCursor: (
|
|
746
|
+
openTypeAheadAtCursor: (props: {
|
|
747
747
|
triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
|
|
748
|
-
inputMethod: import("
|
|
748
|
+
inputMethod: import("@atlaskit/editor-plugin-type-ahead").TypeAheadInputMethod;
|
|
749
749
|
query?: string | undefined;
|
|
750
750
|
}) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
751
751
|
};
|
|
@@ -7,7 +7,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
7
7
|
import type { TypeAheadItem } from '../type-ahead/types';
|
|
8
8
|
import type { EmojiPluginOptions, EmojiPluginState } from './types';
|
|
9
9
|
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
10
|
-
import type { TypeAheadPlugin } from '
|
|
10
|
+
import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
11
11
|
export declare const emojiToTypeaheadItem: (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem;
|
|
12
12
|
export declare function memoize<ResultFn extends (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem>(fn: ResultFn): {
|
|
13
13
|
call: ResultFn;
|
|
@@ -41,18 +41,6 @@ export default class MediaSingleNode extends Component<MediaSingleNodeProps, Med
|
|
|
41
41
|
onMediaSingleClicked: (event: MouseEvent) => void;
|
|
42
42
|
render(): jsx.JSX.Element;
|
|
43
43
|
private clickPlaceholder;
|
|
44
|
-
/**
|
|
45
|
-
* Get parent width for a nested media single node
|
|
46
|
-
* @param view Editor view
|
|
47
|
-
* @param pos node position
|
|
48
|
-
*/
|
|
49
|
-
private getLineLength;
|
|
50
|
-
/**
|
|
51
|
-
* Get parent width for a nested media single node for new experience
|
|
52
|
-
* @param view Editor view
|
|
53
|
-
* @param pos node position
|
|
54
|
-
*/
|
|
55
|
-
private getLineLengthNext;
|
|
56
44
|
}
|
|
57
45
|
declare class MediaSingleNodeView extends ReactNodeView<MediaSingleNodeViewProps> {
|
|
58
46
|
lastOffsetLeft: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PIXELENTRY_MIGRATION_BUTTON_TESTID = "pixel-entry-convert-pixels-btn";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
3
|
import type { PixelEntryProps } from './types';
|
|
4
|
-
export declare const PixelEntry: ({ width, mediaWidth, mediaHeight, onSubmit, validate, intl: { formatMessage }, }: PixelEntryProps) => jsx.JSX.Element;
|
|
4
|
+
export declare const PixelEntry: ({ width, mediaWidth, mediaHeight, onSubmit, validate, intl: { formatMessage }, showMigration, onMigrate, }: PixelEntryProps) => jsx.JSX.Element;
|
|
@@ -29,4 +29,14 @@ export declare const messages: {
|
|
|
29
29
|
defaultMessage: string;
|
|
30
30
|
description: string;
|
|
31
31
|
};
|
|
32
|
+
migrationButtonText: {
|
|
33
|
+
id: string;
|
|
34
|
+
defaultMessage: string;
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
migrationButtonTooltip: {
|
|
38
|
+
id: string;
|
|
39
|
+
defaultMessage: string;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
32
42
|
};
|
|
@@ -16,6 +16,10 @@ export type PixelEntryProps = {
|
|
|
16
16
|
* The original media height used to calculate the width
|
|
17
17
|
*/
|
|
18
18
|
mediaHeight: number;
|
|
19
|
+
/**
|
|
20
|
+
* show migration button to convert to pixels for legacy image resize experience
|
|
21
|
+
*/
|
|
22
|
+
showMigration?: boolean;
|
|
19
23
|
/**
|
|
20
24
|
* The submit function that is called when the form is valid and the submit key is pressed
|
|
21
25
|
*/
|
|
@@ -25,6 +29,10 @@ export type PixelEntryProps = {
|
|
|
25
29
|
* The value passed through the validator currently comes from the width input only.
|
|
26
30
|
*/
|
|
27
31
|
validate?: (value: number | '') => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Migration handler called when the CTA button is clicked
|
|
34
|
+
*/
|
|
35
|
+
onMigrate?: () => void;
|
|
28
36
|
};
|
|
29
37
|
export type PixelEntryFormValues = {
|
|
30
38
|
inputWidth: number | '';
|
|
@@ -2,7 +2,8 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
|
2
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { TypeAheadItem } from '@atlaskit/editor-common/provider-factory';
|
|
4
4
|
import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
5
|
-
import type {
|
|
5
|
+
import type { TypeAheadInputMethod } from '@atlaskit/editor-plugin-type-ahead';
|
|
6
|
+
import type { TypeAheadHandler } from './types';
|
|
6
7
|
import type { Command } from '../../types/command';
|
|
7
8
|
type CloseOptions = {
|
|
8
9
|
insertCurrentQueryAsRawText: boolean;
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import type { NextEditorPlugin } from '../../types/editor-plugin';
|
|
2
|
-
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
|
|
3
1
|
import { pluginKey as typeAheadPluginKey } from './pm-plugins/key';
|
|
4
|
-
import {
|
|
5
|
-
export type TypeAheadPluginOptions
|
|
6
|
-
isMobile?: boolean;
|
|
7
|
-
createAnalyticsEvent?: CreateUIAnalyticsEvent;
|
|
8
|
-
};
|
|
9
|
-
export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
|
|
10
|
-
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
11
|
-
commands: {
|
|
12
|
-
openTypeAheadAtCursor: typeof openTypeAheadAtCursor;
|
|
13
|
-
};
|
|
14
|
-
}>;
|
|
2
|
+
import type { TypeAheadPluginOptions, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
3
|
+
export type { TypeAheadPluginOptions, TypeAheadPlugin };
|
|
15
4
|
/**
|
|
16
5
|
*
|
|
17
6
|
* Revamped typeahead using decorations instead of the `typeAheadQuery` mark
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
2
2
|
import type { EditorState, Transaction, ReadonlyTransaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import type { INPUT_METHOD } from '../analytics/types/enums';
|
|
4
3
|
import type { CloseSelectionOptions } from './constants';
|
|
5
4
|
import type { UiComponentFactoryParams } from '../../types/ui-components';
|
|
6
5
|
import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
7
6
|
import type { TypeAheadStats, TypeAheadItemRenderProps, TypeAheadInsert, TypeAheadSelectItem, TypeAheadItem, TypeAheadForceSelect, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
8
|
-
|
|
7
|
+
import type { TypeAheadInputMethod } from '@atlaskit/editor-plugin-type-ahead';
|
|
8
|
+
export type { TypeAheadStats, TypeAheadItemRenderProps, TypeAheadInsert, TypeAheadSelectItem, TypeAheadItem, TypeAheadForceSelect, TypeAheadHandler, TypeAheadInputMethod, };
|
|
9
9
|
export type OnSelectItem = (props: {
|
|
10
10
|
index: number;
|
|
11
11
|
item: TypeAheadItem;
|
|
@@ -49,7 +49,6 @@ export type OnTextInsertProps = {
|
|
|
49
49
|
text: string;
|
|
50
50
|
};
|
|
51
51
|
export type OnTextInsert = (props: OnTextInsertProps) => void;
|
|
52
|
-
export type TypeAheadInputMethod = INPUT_METHOD.INSERT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR;
|
|
53
52
|
export type InsertionTransactionMeta = (editorState: EditorState) => Transaction | false;
|
|
54
53
|
type PopupMountPoints = Pick<UiComponentFactoryParams, 'popupsMountPoint' | 'popupsBoundariesElement' | 'popupsScrollableElement'>;
|
|
55
54
|
export type PopupMountPointReference = Record<'current', PopupMountPoints | null>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "187.29.
|
|
3
|
+
"version": "187.29.4",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"@atlaskit/editor-plugin-list": "^1.0.0",
|
|
77
77
|
"@atlaskit/editor-plugin-table": "^2.10.0",
|
|
78
78
|
"@atlaskit/editor-plugin-text-formatting": "^0.2.0",
|
|
79
|
+
"@atlaskit/editor-plugin-type-ahead": "^0.1.0",
|
|
79
80
|
"@atlaskit/editor-plugin-width": "^0.1.0",
|
|
80
81
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
81
82
|
"@atlaskit/editor-shared-styles": "^2.6.0",
|
package/report.api.md
CHANGED
|
@@ -42,7 +42,6 @@ import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider
|
|
|
42
42
|
import type { ContextUpdateHandler } from '@atlaskit/editor-common/types';
|
|
43
43
|
import { createTable } from '@atlaskit/editor-plugin-table/commands';
|
|
44
44
|
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
45
|
-
import type { CreateUIAnalyticsEvent as CreateUIAnalyticsEvent_2 } from '@atlaskit/analytics-next/types';
|
|
46
45
|
import { darkModeStatusColorPalette } from '@atlaskit/editor-common/ui-color';
|
|
47
46
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
48
47
|
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
@@ -156,8 +155,10 @@ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
|
156
155
|
import { TransactionTracking } from '@atlaskit/editor-common/types';
|
|
157
156
|
import type { Transformer as Transformer_2 } from '@atlaskit/editor-common/types';
|
|
158
157
|
import type { TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
158
|
+
import type { TypeAheadInputMethod } from '@atlaskit/editor-plugin-type-ahead';
|
|
159
159
|
import { TypeAheadItem } from '@atlaskit/editor-common/provider-factory';
|
|
160
160
|
import type { TypeAheadItem as TypeAheadItem_2 } from '@atlaskit/editor-common/types';
|
|
161
|
+
import type { TypeAheadPluginOptions } from '@atlaskit/editor-plugin-type-ahead';
|
|
161
162
|
import type { TypeAheadStats } from '@atlaskit/editor-common/types';
|
|
162
163
|
import { UIComponentFactory } from '@atlaskit/editor-common/types';
|
|
163
164
|
import { UploadEndEventPayload } from '@atlaskit/media-picker/types';
|
|
@@ -2054,24 +2055,11 @@ class TransactionTracker {
|
|
|
2054
2055
|
shouldTrackTransaction(options: TransactionTracking): boolean;
|
|
2055
2056
|
}
|
|
2056
2057
|
|
|
2057
|
-
// @public (undocumented)
|
|
2058
|
-
type TypeAheadInputMethod =
|
|
2059
|
-
| INPUT_METHOD.INSERT_MENU
|
|
2060
|
-
| INPUT_METHOD.KEYBOARD
|
|
2061
|
-
| INPUT_METHOD.QUICK_INSERT
|
|
2062
|
-
| INPUT_METHOD.TOOLBAR;
|
|
2063
|
-
|
|
2064
2058
|
export { TypeAheadItem };
|
|
2065
2059
|
|
|
2066
2060
|
// @public (undocumented)
|
|
2067
2061
|
export const typeAheadPluginKey: PluginKey<TypeAheadPluginState>;
|
|
2068
2062
|
|
|
2069
|
-
// @public (undocumented)
|
|
2070
|
-
type TypeAheadPluginOptions = {
|
|
2071
|
-
isMobile?: boolean;
|
|
2072
|
-
createAnalyticsEvent?: CreateUIAnalyticsEvent_2;
|
|
2073
|
-
};
|
|
2074
|
-
|
|
2075
2063
|
// @public (undocumented)
|
|
2076
2064
|
export type TypeAheadPluginState = {
|
|
2077
2065
|
decorationSet: DecorationSet;
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -31,7 +31,6 @@ import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider
|
|
|
31
31
|
import type { ContextUpdateHandler } from '@atlaskit/editor-common/types';
|
|
32
32
|
import { createTable } from '@atlaskit/editor-plugin-table/commands';
|
|
33
33
|
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
34
|
-
import type { CreateUIAnalyticsEvent as CreateUIAnalyticsEvent_2 } from '@atlaskit/analytics-next/types';
|
|
35
34
|
import { darkModeStatusColorPalette } from '@atlaskit/editor-common/ui-color';
|
|
36
35
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
37
36
|
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
@@ -145,8 +144,10 @@ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
|
145
144
|
import { TransactionTracking } from '@atlaskit/editor-common/types';
|
|
146
145
|
import type { Transformer as Transformer_2 } from '@atlaskit/editor-common/types';
|
|
147
146
|
import type { TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
147
|
+
import type { TypeAheadInputMethod } from '@atlaskit/editor-plugin-type-ahead';
|
|
148
148
|
import { TypeAheadItem } from '@atlaskit/editor-common/provider-factory';
|
|
149
149
|
import type { TypeAheadItem as TypeAheadItem_2 } from '@atlaskit/editor-common/types';
|
|
150
|
+
import type { TypeAheadPluginOptions } from '@atlaskit/editor-plugin-type-ahead';
|
|
150
151
|
import type { TypeAheadStats } from '@atlaskit/editor-common/types';
|
|
151
152
|
import { UIComponentFactory } from '@atlaskit/editor-common/types';
|
|
152
153
|
import { UploadEndEventPayload } from '@atlaskit/media-picker/types';
|
|
@@ -1831,20 +1832,11 @@ class TransactionTracker {
|
|
|
1831
1832
|
shouldTrackTransaction(options: TransactionTracking): boolean;
|
|
1832
1833
|
}
|
|
1833
1834
|
|
|
1834
|
-
// @public (undocumented)
|
|
1835
|
-
type TypeAheadInputMethod = INPUT_METHOD.INSERT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR;
|
|
1836
|
-
|
|
1837
1835
|
export { TypeAheadItem }
|
|
1838
1836
|
|
|
1839
1837
|
// @public (undocumented)
|
|
1840
1838
|
export const typeAheadPluginKey: PluginKey<TypeAheadPluginState>;
|
|
1841
1839
|
|
|
1842
|
-
// @public (undocumented)
|
|
1843
|
-
type TypeAheadPluginOptions = {
|
|
1844
|
-
isMobile?: boolean;
|
|
1845
|
-
createAnalyticsEvent?: CreateUIAnalyticsEvent_2;
|
|
1846
|
-
};
|
|
1847
|
-
|
|
1848
1840
|
// @public (undocumented)
|
|
1849
1841
|
export type TypeAheadPluginState = {
|
|
1850
1842
|
decorationSet: DecorationSet;
|