@atlaskit/editor-core 187.14.12 → 187.15.1

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.
Files changed (71) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/create-editor/create-plugins-list.js +2 -7
  3. package/dist/cjs/create-editor/feature-flags-from-props.js +23 -28
  4. package/dist/cjs/plugins/media/toolbar/index.js +59 -4
  5. package/dist/cjs/plugins/media/ui/PixelEntry/index.js +152 -0
  6. package/dist/cjs/plugins/media/ui/PixelEntry/messages.js +40 -0
  7. package/dist/cjs/plugins/media/ui/PixelEntry/styles.js +25 -0
  8. package/dist/cjs/plugins/media/ui/PixelEntry/types.js +5 -0
  9. package/dist/cjs/plugins/type-ahead/index.js +1 -4
  10. package/dist/cjs/plugins/type-ahead/pm-plugins/decorations.js +2 -4
  11. package/dist/cjs/plugins/type-ahead/pm-plugins/main.js +2 -4
  12. package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +21 -40
  13. package/dist/cjs/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -9
  14. package/dist/cjs/plugins/type-ahead/utils.js +15 -19
  15. package/dist/cjs/version-wrapper.js +1 -1
  16. package/dist/cjs/version.json +1 -1
  17. package/dist/es2019/create-editor/create-plugins-list.js +2 -7
  18. package/dist/es2019/create-editor/feature-flags-from-props.js +23 -28
  19. package/dist/es2019/plugins/media/toolbar/index.js +62 -0
  20. package/dist/es2019/plugins/media/ui/PixelEntry/index.js +133 -0
  21. package/dist/es2019/plugins/media/ui/PixelEntry/messages.js +33 -0
  22. package/dist/es2019/plugins/media/ui/PixelEntry/styles.js +44 -0
  23. package/dist/es2019/plugins/media/ui/PixelEntry/types.js +1 -0
  24. package/dist/es2019/plugins/type-ahead/index.js +1 -4
  25. package/dist/es2019/plugins/type-ahead/pm-plugins/decorations.js +2 -4
  26. package/dist/es2019/plugins/type-ahead/pm-plugins/main.js +2 -4
  27. package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +21 -40
  28. package/dist/es2019/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -9
  29. package/dist/es2019/plugins/type-ahead/utils.js +15 -19
  30. package/dist/es2019/version-wrapper.js +1 -1
  31. package/dist/es2019/version.json +1 -1
  32. package/dist/esm/create-editor/create-plugins-list.js +2 -7
  33. package/dist/esm/create-editor/feature-flags-from-props.js +23 -28
  34. package/dist/esm/plugins/media/toolbar/index.js +59 -4
  35. package/dist/esm/plugins/media/ui/PixelEntry/index.js +140 -0
  36. package/dist/esm/plugins/media/ui/PixelEntry/messages.js +33 -0
  37. package/dist/esm/plugins/media/ui/PixelEntry/styles.js +11 -0
  38. package/dist/esm/plugins/media/ui/PixelEntry/types.js +1 -0
  39. package/dist/esm/plugins/type-ahead/index.js +1 -4
  40. package/dist/esm/plugins/type-ahead/pm-plugins/decorations.js +2 -4
  41. package/dist/esm/plugins/type-ahead/pm-plugins/main.js +2 -4
  42. package/dist/esm/plugins/type-ahead/ui/InputQuery.js +21 -40
  43. package/dist/esm/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -9
  44. package/dist/esm/plugins/type-ahead/utils.js +15 -19
  45. package/dist/esm/version-wrapper.js +1 -1
  46. package/dist/esm/version.json +1 -1
  47. package/dist/types/create-editor/create-plugins-list.d.ts +6 -6
  48. package/dist/types/plugins/media/ui/PixelEntry/index.d.ts +4 -0
  49. package/dist/types/plugins/media/ui/PixelEntry/messages.d.ts +32 -0
  50. package/dist/types/plugins/media/ui/PixelEntry/styles.d.ts +7 -0
  51. package/dist/types/plugins/media/ui/PixelEntry/types.d.ts +35 -0
  52. package/dist/types/plugins/type-ahead/index.d.ts +0 -1
  53. package/dist/types/plugins/type-ahead/pm-plugins/decorations.d.ts +1 -2
  54. package/dist/types/plugins/type-ahead/pm-plugins/main.d.ts +1 -2
  55. package/dist/types/plugins/type-ahead/ui/InputQuery.d.ts +0 -1
  56. package/dist/types/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +0 -1
  57. package/dist/types/plugins/type-ahead/utils.d.ts +1 -2
  58. package/dist/types-ts4.5/create-editor/create-plugins-list.d.ts +6 -6
  59. package/dist/types-ts4.5/plugins/media/ui/PixelEntry/index.d.ts +4 -0
  60. package/dist/types-ts4.5/plugins/media/ui/PixelEntry/messages.d.ts +32 -0
  61. package/dist/types-ts4.5/plugins/media/ui/PixelEntry/styles.d.ts +7 -0
  62. package/dist/types-ts4.5/plugins/media/ui/PixelEntry/types.d.ts +35 -0
  63. package/dist/types-ts4.5/plugins/type-ahead/index.d.ts +0 -1
  64. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/decorations.d.ts +1 -2
  65. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/main.d.ts +1 -2
  66. package/dist/types-ts4.5/plugins/type-ahead/ui/InputQuery.d.ts +0 -1
  67. package/dist/types-ts4.5/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +0 -1
  68. package/dist/types-ts4.5/plugins/type-ahead/utils.d.ts +1 -2
  69. package/package.json +1 -1
  70. package/report.api.md +1 -2
  71. package/tmp/api-report-tmp.d.ts +1 -2
@@ -65,8 +65,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
65
65
  onQueryFocus,
66
66
  onUndoRedo,
67
67
  editorView,
68
- items,
69
- useBetterTypeaheadNavigation
68
+ items
70
69
  }) => {
71
70
  const ref = useRef(document.createElement('span'));
72
71
  const inputRef = useRef(null);
@@ -135,27 +134,6 @@ export const InputQuery = /*#__PURE__*/React.memo(({
135
134
  // Some suggested the other workaround maybe listen on`keypress` instead of `keydown`
136
135
  if (!event.isComposing && event.which !== 229 && event.keyCode !== 229) {
137
136
  if (selectedIndex === -1) {
138
- if (useBetterTypeaheadNavigation) {
139
- /**
140
- * TODO DTR-1401: (also see ED-17200) There are two options
141
- * here, either
142
- * - set the index directly to 1 in WrapperTypeAhead.tsx's
143
- * `insertSelectedItem` at the cost of breaking some of the a11y
144
- * focus changes,
145
- * - or do this jank at the cost of some small analytics noise.
146
- *
147
- * The focus behaviour still needs cleanup
148
- */
149
- selectPreviousItem();
150
- }
151
- selectNextItem();
152
- }
153
- onItemSelect(event.shiftKey ? SelectItemMode.SHIFT_ENTER : SelectItemMode.ENTER);
154
- }
155
- break;
156
- case 'Tab':
157
- if (selectedIndex === -1) {
158
- if (useBetterTypeaheadNavigation) {
159
137
  /**
160
138
  * TODO DTR-1401: (also see ED-17200) There are two options
161
139
  * here, either
@@ -164,33 +142,36 @@ export const InputQuery = /*#__PURE__*/React.memo(({
164
142
  * focus changes,
165
143
  * - or do this jank at the cost of some small analytics noise.
166
144
  *
145
+ * The focus behaviour still needs cleanup
167
146
  */
168
147
  selectPreviousItem();
148
+ selectNextItem();
169
149
  }
150
+ onItemSelect(event.shiftKey ? SelectItemMode.SHIFT_ENTER : SelectItemMode.ENTER);
151
+ }
152
+ break;
153
+ case 'Tab':
154
+ if (selectedIndex === -1) {
155
+ /**
156
+ * TODO DTR-1401: (also see ED-17200) There are two options
157
+ * here, either
158
+ * - set the index directly to 1 in WrapperTypeAhead.tsx's
159
+ * `insertSelectedItem` at the cost of breaking some of the a11y
160
+ * focus changes,
161
+ * - or do this jank at the cost of some small analytics noise.
162
+ *
163
+ */
164
+ selectPreviousItem();
170
165
  selectNextItem();
171
166
  }
172
167
  // TODO DTR-1401: why is this calling select item when hitting tab? fix this in DTR-1401
173
168
  onItemSelect(SelectItemMode.TAB);
174
169
  break;
175
170
  case 'ArrowDown':
176
- if (useBetterTypeaheadNavigation) {
177
- selectNextItem();
178
- } else {
179
- // TODO DTR-1401: why were we preventing selection?
180
- if (selectedIndex === -1) {
181
- selectNextItem();
182
- }
183
- }
171
+ selectNextItem();
184
172
  break;
185
173
  case 'ArrowUp':
186
- if (useBetterTypeaheadNavigation) {
187
- selectPreviousItem();
188
- } else {
189
- // TODO DTR-1401: why were we preventing selection?
190
- if (selectedIndex === -1) {
191
- selectPreviousItem();
192
- }
193
- }
174
+ selectPreviousItem();
194
175
  break;
195
176
  }
196
177
  const undoRedoType = isUndoRedoShortcut(event);
@@ -202,7 +183,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
202
183
  event.preventDefault();
203
184
  return false;
204
185
  }
205
- }, [useBetterTypeaheadNavigation, onUndoRedo, onItemSelect, selectNextItem, selectPreviousItem, cancel, cleanedInputContent, editorView.state]);
186
+ }, [onUndoRedo, onItemSelect, selectNextItem, selectPreviousItem, cancel, cleanedInputContent, editorView.state]);
206
187
  const onClick = useCallback(event => {
207
188
  var _inputRef$current;
208
189
  event.stopPropagation();
@@ -18,8 +18,7 @@ export const WrapperTypeAhead = /*#__PURE__*/React.memo(({
18
18
  inputMethod,
19
19
  getDecorationPosition,
20
20
  reopenQuery,
21
- onUndoRedo,
22
- useBetterTypeaheadNavigation
21
+ onUndoRedo
23
22
  }) => {
24
23
  const [closed, setClosed] = useState(false);
25
24
  const [query, setQuery] = useState(reopenQuery || '');
@@ -32,14 +31,12 @@ export const WrapperTypeAhead = /*#__PURE__*/React.memo(({
32
31
  const [onItemInsert, onTextInsert] = useItemInsert(triggerHandler, editorView, items);
33
32
  const selectNextItem = useMemo(() => moveSelectedIndex({
34
33
  editorView,
35
- direction: 'next',
36
- useBetterTypeaheadNavigation
37
- }), [editorView, useBetterTypeaheadNavigation]);
34
+ direction: 'next'
35
+ }), [editorView]);
38
36
  const selectPreviousItem = useMemo(() => moveSelectedIndex({
39
37
  editorView,
40
- direction: 'previous',
41
- useBetterTypeaheadNavigation
42
- }), [editorView, useBetterTypeaheadNavigation]);
38
+ direction: 'previous'
39
+ }), [editorView]);
43
40
  const cancel = useCallback(({
44
41
  setSelectionAt,
45
42
  addPrefixTrigger,
@@ -95,7 +92,6 @@ export const WrapperTypeAhead = /*#__PURE__*/React.memo(({
95
92
  return null;
96
93
  }
97
94
  return /*#__PURE__*/React.createElement(InputQuery, {
98
- useBetterTypeaheadNavigation: useBetterTypeaheadNavigation,
99
95
  triggerQueryPrefix: triggerHandler.trigger,
100
96
  onQueryChange: setQuery,
101
97
  onItemSelect: insertSelectedItem,
@@ -54,8 +54,7 @@ export const findHandlerByTrigger = ({
54
54
  };
55
55
  export const moveSelectedIndex = ({
56
56
  editorView,
57
- direction,
58
- useBetterTypeaheadNavigation
57
+ direction
59
58
  }) => () => {
60
59
  const typeAheadState = getPluginState(editorView.state);
61
60
  if (!typeAheadState) {
@@ -69,23 +68,20 @@ export const moveSelectedIndex = ({
69
68
  let nextIndex;
70
69
  if (direction === 'next') {
71
70
  stats.increaseArrowDown();
72
- if (useBetterTypeaheadNavigation) {
73
- /**
74
- * See: https://product-fabric.atlassian.net/browse/ED-17200
75
- * `selectedIndex` is forced to -1 now to not immediately focus the typeahead
76
- * and only do so when there is explicit logic to focus into the typeahead
77
- * options.
78
- *
79
- * This check for "set index to 1 when -1"
80
- * - is a temporary workaround to get back the previous behaviour without
81
- * entirely reverting the a11y improvements
82
- *
83
- */
84
- if (selectedIndex === -1 && items.length > 1) {
85
- nextIndex = 1;
86
- } else {
87
- nextIndex = selectedIndex >= items.length - 1 ? 0 : selectedIndex + 1;
88
- }
71
+
72
+ /**
73
+ * See: https://product-fabric.atlassian.net/browse/ED-17200
74
+ * `selectedIndex` is forced to -1 now to not immediately focus the typeahead
75
+ * and only do so when there is explicit logic to focus into the typeahead
76
+ * options.
77
+ *
78
+ * This check for "set index to 1 when -1"
79
+ * - is a temporary workaround to get back the previous behaviour without
80
+ * entirely reverting the a11y improvements
81
+ *
82
+ */
83
+ if (selectedIndex === -1 && items.length > 1) {
84
+ nextIndex = 1;
89
85
  } else {
90
86
  nextIndex = selectedIndex >= items.length - 1 ? 0 : selectedIndex + 1;
91
87
  }
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.14.12";
2
+ export const version = "187.15.1";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.14.12",
3
+ "version": "187.15.1",
4
4
  "sideEffects": false
5
5
  }
@@ -34,21 +34,16 @@ export function getScrollGutterOptions(props) {
34
34
  return undefined;
35
35
  }
36
36
  export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent) {
37
- var _props$performanceTra, _props$linking, _ref, _props$featureFlags$u, _props$featureFlags, _props$featureFlags2, _props$performanceTra2, _props$textFormatting, _props$linking2;
37
+ var _props$performanceTra, _props$linking, _props$performanceTra2, _props$textFormatting, _props$linking2;
38
38
  var appearance = props.appearance;
39
39
  var isMobile = appearance === 'mobile';
40
40
  var inputTracking = (_props$performanceTra = props.performanceTracking) === null || _props$performanceTra === void 0 ? void 0 : _props$performanceTra.inputTracking;
41
41
  var cardOptions = ((_props$linking = props.linking) === null || _props$linking === void 0 ? void 0 : _props$linking.smartLinks) || props.smartLinks || props.UNSAFE_cards;
42
-
43
- // duplicated logic from `feature-flags-from-props.ts` due to presets not being finalised
44
- var pseudoNormalisedUseBetterTypeaheadNavigation = (_ref = (_props$featureFlags$u = (_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags['use-better-typeahead-navigation']) !== null && _props$featureFlags$u !== void 0 ? _props$featureFlags$u : (_props$featureFlags2 = props.featureFlags) === null || _props$featureFlags2 === void 0 ? void 0 : _props$featureFlags2.useBetterTypeaheadNavigation) !== null && _ref !== void 0 ? _ref : null;
45
- var useBetterTypeaheadNavigation = Boolean(typeof pseudoNormalisedUseBetterTypeaheadNavigation === 'boolean' ? !!pseudoNormalisedUseBetterTypeaheadNavigation : true);
46
42
  return _objectSpread(_objectSpread({}, props), {}, {
47
43
  createAnalyticsEvent: createAnalyticsEvent,
48
44
  typeAhead: {
49
45
  createAnalyticsEvent: createAnalyticsEvent,
50
- isMobile: isMobile,
51
- useBetterTypeaheadNavigation: useBetterTypeaheadNavigation
46
+ isMobile: isMobile
52
47
  },
53
48
  featureFlags: createFeatureFlagsFromProps(props),
54
49
  paste: {
@@ -25,12 +25,9 @@ function getSpellCheck(featureFlags) {
25
25
  * which is used by both current and archv3 editors.
26
26
  */
27
27
  export function createFeatureFlagsFromProps(props) {
28
- var _props$featureFlags, _ref, _props$featureFlags$u, _props$featureFlags2, _props$featureFlags3, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags4, _props$featureFlags5, _props$allowTables, _props$featureFlags6, _props$featureFlags7, _props$allowTables2, _props$featureFlags8, _props$featureFlags9, _props$allowTables3, _props$featureFlags10, _props$featureFlags11, _props$allowTables4, _props$allowTables5, _props$featureFlags12, _props$featureFlags13, _props$allowTables6, _props$allowExtension, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29, _props$featureFlags30, _props$featureFlags31, _props$collabEdit, _props$collabEdit2, _props$featureFlags32, _props$featureFlags33, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37, _props$featureFlags38, _props$featureFlags39, _props$featureFlags40, _props$featureFlags41, _props$featureFlags42, _props$featureFlags43, _props$featureFlags44;
28
+ var _props$featureFlags, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags2, _props$featureFlags3, _props$allowTables, _props$featureFlags4, _props$featureFlags5, _props$allowTables2, _props$featureFlags6, _props$featureFlags7, _props$allowTables3, _props$featureFlags8, _props$featureFlags9, _props$allowTables4, _props$allowTables5, _props$featureFlags10, _props$featureFlags11, _props$allowTables6, _props$allowExtension, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29, _props$collabEdit, _props$collabEdit2, _props$featureFlags30, _props$featureFlags31, _props$featureFlags32, _props$featureFlags33, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37, _props$featureFlags38, _props$featureFlags39, _props$featureFlags40, _props$featureFlags41, _props$featureFlags42;
29
29
  var normalizedFeatureFlags = normalizeFeatureFlags(props.featureFlags);
30
30
  var tableCellOptionsInFloatingToolbar = normalizedFeatureFlags.tableCellOptionsInFloatingToolbar || ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.tableCellOptionsInFloatingToolbar) || undefined;
31
-
32
- // duplicated logic from `feature-flags-from-props.ts` due to presets not being finalised
33
- var pseudoNormalisedUseBetterTypeaheadNavigation = (_ref = (_props$featureFlags$u = (_props$featureFlags2 = props.featureFlags) === null || _props$featureFlags2 === void 0 ? void 0 : _props$featureFlags2['use-better-typeahead-navigation']) !== null && _props$featureFlags$u !== void 0 ? _props$featureFlags$u : (_props$featureFlags3 = props.featureFlags) === null || _props$featureFlags3 === void 0 ? void 0 : _props$featureFlags3.useBetterTypeaheadNavigation) !== null && _ref !== void 0 ? _ref : null;
34
31
  return _objectSpread(_objectSpread({}, normalizedFeatureFlags), {}, {
35
32
  newInsertionBehaviour: props.allowNewInsertionBehaviour,
36
33
  interactiveExpand: typeof props.allowExpand === 'boolean' ? props.allowExpand : Boolean(props.allowExpand && props.allowExpand.allowInteractiveExpand !== false),
@@ -41,36 +38,34 @@ export function createFeatureFlagsFromProps(props) {
41
38
  singleLayout: _typeof(props.allowLayouts) === 'object' && !!((_props$allowLayouts = props.allowLayouts) !== null && _props$allowLayouts !== void 0 && _props$allowLayouts.UNSAFE_allowSingleColumnLayout),
42
39
  undoRedoButtons: props.allowUndoRedoButtons,
43
40
  catchAllTracking: (_props$performanceTra = props.performanceTracking) === null || _props$performanceTra === void 0 ? void 0 : (_props$performanceTra2 = _props$performanceTra.catchAllTracking) === null || _props$performanceTra2 === void 0 ? void 0 : _props$performanceTra2.enabled,
44
- stickyHeadersOptimization: typeof ((_props$featureFlags4 = props.featureFlags) === null || _props$featureFlags4 === void 0 ? void 0 : _props$featureFlags4.stickyHeadersOptimization) === 'boolean' ? !!((_props$featureFlags5 = props.featureFlags) !== null && _props$featureFlags5 !== void 0 && _props$featureFlags5.stickyHeadersOptimization) : _typeof(props.allowTables) === 'object' && !!((_props$allowTables = props.allowTables) !== null && _props$allowTables !== void 0 && _props$allowTables.stickyHeadersOptimization),
45
- initialRenderOptimization: typeof ((_props$featureFlags6 = props.featureFlags) === null || _props$featureFlags6 === void 0 ? void 0 : _props$featureFlags6.initialRenderOptimization) === 'boolean' ? !!((_props$featureFlags7 = props.featureFlags) !== null && _props$featureFlags7 !== void 0 && _props$featureFlags7.initialRenderOptimization) : _typeof(props.allowTables) === 'object' && !!((_props$allowTables2 = props.allowTables) !== null && _props$allowTables2 !== void 0 && _props$allowTables2.initialRenderOptimization),
46
- mouseMoveOptimization: typeof ((_props$featureFlags8 = props.featureFlags) === null || _props$featureFlags8 === void 0 ? void 0 : _props$featureFlags8.mouseMoveOptimization) === 'boolean' ? !!((_props$featureFlags9 = props.featureFlags) !== null && _props$featureFlags9 !== void 0 && _props$featureFlags9.mouseMoveOptimization) : _typeof(props.allowTables) === 'object' && !!((_props$allowTables3 = props.allowTables) !== null && _props$allowTables3 !== void 0 && _props$allowTables3.mouseMoveOptimization),
47
- tableRenderOptimization: typeof ((_props$featureFlags10 = props.featureFlags) === null || _props$featureFlags10 === void 0 ? void 0 : _props$featureFlags10.tableRenderOptimization) === 'boolean' ? !!((_props$featureFlags11 = props.featureFlags) !== null && _props$featureFlags11 !== void 0 && _props$featureFlags11.tableRenderOptimization) : _typeof(props.allowTables) === 'object' && typeof ((_props$allowTables4 = props.allowTables) === null || _props$allowTables4 === void 0 ? void 0 : _props$allowTables4.tableRenderOptimization) === 'boolean' ? (_props$allowTables5 = props.allowTables) === null || _props$allowTables5 === void 0 ? void 0 : _props$allowTables5.tableRenderOptimization : true,
48
- tableOverflowShadowsOptimization: typeof ((_props$featureFlags12 = props.featureFlags) === null || _props$featureFlags12 === void 0 ? void 0 : _props$featureFlags12.tableOverflowShadowsOptimization) === 'boolean' ? !!((_props$featureFlags13 = props.featureFlags) !== null && _props$featureFlags13 !== void 0 && _props$featureFlags13.tableOverflowShadowsOptimization) : _typeof(props.allowTables) === 'object' && !!((_props$allowTables6 = props.allowTables) !== null && _props$allowTables6 !== void 0 && _props$allowTables6.tableOverflowShadowsOptimization),
41
+ stickyHeadersOptimization: typeof ((_props$featureFlags2 = props.featureFlags) === null || _props$featureFlags2 === void 0 ? void 0 : _props$featureFlags2.stickyHeadersOptimization) === 'boolean' ? !!((_props$featureFlags3 = props.featureFlags) !== null && _props$featureFlags3 !== void 0 && _props$featureFlags3.stickyHeadersOptimization) : _typeof(props.allowTables) === 'object' && !!((_props$allowTables = props.allowTables) !== null && _props$allowTables !== void 0 && _props$allowTables.stickyHeadersOptimization),
42
+ initialRenderOptimization: typeof ((_props$featureFlags4 = props.featureFlags) === null || _props$featureFlags4 === void 0 ? void 0 : _props$featureFlags4.initialRenderOptimization) === 'boolean' ? !!((_props$featureFlags5 = props.featureFlags) !== null && _props$featureFlags5 !== void 0 && _props$featureFlags5.initialRenderOptimization) : _typeof(props.allowTables) === 'object' && !!((_props$allowTables2 = props.allowTables) !== null && _props$allowTables2 !== void 0 && _props$allowTables2.initialRenderOptimization),
43
+ mouseMoveOptimization: typeof ((_props$featureFlags6 = props.featureFlags) === null || _props$featureFlags6 === void 0 ? void 0 : _props$featureFlags6.mouseMoveOptimization) === 'boolean' ? !!((_props$featureFlags7 = props.featureFlags) !== null && _props$featureFlags7 !== void 0 && _props$featureFlags7.mouseMoveOptimization) : _typeof(props.allowTables) === 'object' && !!((_props$allowTables3 = props.allowTables) !== null && _props$allowTables3 !== void 0 && _props$allowTables3.mouseMoveOptimization),
44
+ tableRenderOptimization: typeof ((_props$featureFlags8 = props.featureFlags) === null || _props$featureFlags8 === void 0 ? void 0 : _props$featureFlags8.tableRenderOptimization) === 'boolean' ? !!((_props$featureFlags9 = props.featureFlags) !== null && _props$featureFlags9 !== void 0 && _props$featureFlags9.tableRenderOptimization) : _typeof(props.allowTables) === 'object' && typeof ((_props$allowTables4 = props.allowTables) === null || _props$allowTables4 === void 0 ? void 0 : _props$allowTables4.tableRenderOptimization) === 'boolean' ? (_props$allowTables5 = props.allowTables) === null || _props$allowTables5 === void 0 ? void 0 : _props$allowTables5.tableRenderOptimization : true,
45
+ tableOverflowShadowsOptimization: typeof ((_props$featureFlags10 = props.featureFlags) === null || _props$featureFlags10 === void 0 ? void 0 : _props$featureFlags10.tableOverflowShadowsOptimization) === 'boolean' ? !!((_props$featureFlags11 = props.featureFlags) !== null && _props$featureFlags11 !== void 0 && _props$featureFlags11.tableOverflowShadowsOptimization) : _typeof(props.allowTables) === 'object' && !!((_props$allowTables6 = props.allowTables) !== null && _props$allowTables6 !== void 0 && _props$allowTables6.tableOverflowShadowsOptimization),
49
46
  extendFloatingToolbar: Boolean(_typeof(props.allowExtension) === 'object' && ((_props$allowExtension = props.allowExtension) === null || _props$allowExtension === void 0 ? void 0 : _props$allowExtension.allowExtendFloatingToolbars)),
50
- showAvatarGroupAsPlugin: Boolean(typeof ((_props$featureFlags14 = props.featureFlags) === null || _props$featureFlags14 === void 0 ? void 0 : _props$featureFlags14.showAvatarGroupAsPlugin) === 'boolean' ? !!((_props$featureFlags15 = props.featureFlags) !== null && _props$featureFlags15 !== void 0 && _props$featureFlags15.showAvatarGroupAsPlugin) : false),
51
- errorBoundaryDocStructure: Boolean(typeof ((_props$featureFlags16 = props.featureFlags) === null || _props$featureFlags16 === void 0 ? void 0 : _props$featureFlags16.useErrorBoundaryDocStructure) === 'boolean' ? !!((_props$featureFlags17 = props.featureFlags) !== null && _props$featureFlags17 !== void 0 && _props$featureFlags17.useErrorBoundaryDocStructure) : false),
52
- synchronyErrorDocStructure: Boolean(typeof ((_props$featureFlags18 = props.featureFlags) === null || _props$featureFlags18 === void 0 ? void 0 : _props$featureFlags18.synchronyErrorDocStructure) === 'boolean' ? !!((_props$featureFlags19 = props.featureFlags) !== null && _props$featureFlags19 !== void 0 && _props$featureFlags19.synchronyErrorDocStructure) : false),
53
- enableViewUpdateSubscription: Boolean(typeof ((_props$featureFlags20 = props.featureFlags) === null || _props$featureFlags20 === void 0 ? void 0 : _props$featureFlags20.enableViewUpdateSubscription) === 'boolean' ? !!((_props$featureFlags21 = props.featureFlags) !== null && _props$featureFlags21 !== void 0 && _props$featureFlags21.enableViewUpdateSubscription) : false),
54
- collabAvatarScroll: Boolean(typeof ((_props$featureFlags22 = props.featureFlags) === null || _props$featureFlags22 === void 0 ? void 0 : _props$featureFlags22.collabAvatarScroll) === 'boolean' ? !!((_props$featureFlags23 = props.featureFlags) !== null && _props$featureFlags23 !== void 0 && _props$featureFlags23.collabAvatarScroll) : false),
55
- ufo: Boolean(typeof ((_props$featureFlags24 = props.featureFlags) === null || _props$featureFlags24 === void 0 ? void 0 : _props$featureFlags24.ufo) === 'boolean' ? !!((_props$featureFlags25 = props.featureFlags) !== null && _props$featureFlags25 !== void 0 && _props$featureFlags25.ufo) : false),
56
- twoLineEditorToolbar: Boolean(typeof ((_props$featureFlags26 = props.featureFlags) === null || _props$featureFlags26 === void 0 ? void 0 : _props$featureFlags26.twoLineEditorToolbar) === 'boolean' ? !!((_props$featureFlags27 = props.featureFlags) !== null && _props$featureFlags27 !== void 0 && _props$featureFlags27.twoLineEditorToolbar) : false),
57
- saferDispatchedTransactions: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactions === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactions || (typeof ((_props$featureFlags28 = props.featureFlags) === null || _props$featureFlags28 === void 0 ? void 0 : _props$featureFlags28.saferDispatchedTransactions) === 'boolean' ? !!((_props$featureFlags29 = props.featureFlags) !== null && _props$featureFlags29 !== void 0 && _props$featureFlags29.saferDispatchedTransactions) : false)),
58
- saferDispatchedTransactionsAnalyticsOnly: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly || (typeof ((_props$featureFlags30 = props.featureFlags) === null || _props$featureFlags30 === void 0 ? void 0 : _props$featureFlags30.saferDispatchedTransactionsAnalyticsOnly) === 'boolean' ? !!((_props$featureFlags31 = props.featureFlags) !== null && _props$featureFlags31 !== void 0 && _props$featureFlags31.saferDispatchedTransactionsAnalyticsOnly) : false)),
47
+ showAvatarGroupAsPlugin: Boolean(typeof ((_props$featureFlags12 = props.featureFlags) === null || _props$featureFlags12 === void 0 ? void 0 : _props$featureFlags12.showAvatarGroupAsPlugin) === 'boolean' ? !!((_props$featureFlags13 = props.featureFlags) !== null && _props$featureFlags13 !== void 0 && _props$featureFlags13.showAvatarGroupAsPlugin) : false),
48
+ errorBoundaryDocStructure: Boolean(typeof ((_props$featureFlags14 = props.featureFlags) === null || _props$featureFlags14 === void 0 ? void 0 : _props$featureFlags14.useErrorBoundaryDocStructure) === 'boolean' ? !!((_props$featureFlags15 = props.featureFlags) !== null && _props$featureFlags15 !== void 0 && _props$featureFlags15.useErrorBoundaryDocStructure) : false),
49
+ synchronyErrorDocStructure: Boolean(typeof ((_props$featureFlags16 = props.featureFlags) === null || _props$featureFlags16 === void 0 ? void 0 : _props$featureFlags16.synchronyErrorDocStructure) === 'boolean' ? !!((_props$featureFlags17 = props.featureFlags) !== null && _props$featureFlags17 !== void 0 && _props$featureFlags17.synchronyErrorDocStructure) : false),
50
+ enableViewUpdateSubscription: Boolean(typeof ((_props$featureFlags18 = props.featureFlags) === null || _props$featureFlags18 === void 0 ? void 0 : _props$featureFlags18.enableViewUpdateSubscription) === 'boolean' ? !!((_props$featureFlags19 = props.featureFlags) !== null && _props$featureFlags19 !== void 0 && _props$featureFlags19.enableViewUpdateSubscription) : false),
51
+ collabAvatarScroll: Boolean(typeof ((_props$featureFlags20 = props.featureFlags) === null || _props$featureFlags20 === void 0 ? void 0 : _props$featureFlags20.collabAvatarScroll) === 'boolean' ? !!((_props$featureFlags21 = props.featureFlags) !== null && _props$featureFlags21 !== void 0 && _props$featureFlags21.collabAvatarScroll) : false),
52
+ ufo: Boolean(typeof ((_props$featureFlags22 = props.featureFlags) === null || _props$featureFlags22 === void 0 ? void 0 : _props$featureFlags22.ufo) === 'boolean' ? !!((_props$featureFlags23 = props.featureFlags) !== null && _props$featureFlags23 !== void 0 && _props$featureFlags23.ufo) : false),
53
+ twoLineEditorToolbar: Boolean(typeof ((_props$featureFlags24 = props.featureFlags) === null || _props$featureFlags24 === void 0 ? void 0 : _props$featureFlags24.twoLineEditorToolbar) === 'boolean' ? !!((_props$featureFlags25 = props.featureFlags) !== null && _props$featureFlags25 !== void 0 && _props$featureFlags25.twoLineEditorToolbar) : false),
54
+ saferDispatchedTransactions: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactions === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactions || (typeof ((_props$featureFlags26 = props.featureFlags) === null || _props$featureFlags26 === void 0 ? void 0 : _props$featureFlags26.saferDispatchedTransactions) === 'boolean' ? !!((_props$featureFlags27 = props.featureFlags) !== null && _props$featureFlags27 !== void 0 && _props$featureFlags27.saferDispatchedTransactions) : false)),
55
+ saferDispatchedTransactionsAnalyticsOnly: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly || (typeof ((_props$featureFlags28 = props.featureFlags) === null || _props$featureFlags28 === void 0 ? void 0 : _props$featureFlags28.saferDispatchedTransactionsAnalyticsOnly) === 'boolean' ? !!((_props$featureFlags29 = props.featureFlags) !== null && _props$featureFlags29 !== void 0 && _props$featureFlags29.saferDispatchedTransactionsAnalyticsOnly) : false)),
59
56
  useNativeCollabPlugin: Boolean(typeof ((_props$collabEdit = props.collabEdit) === null || _props$collabEdit === void 0 ? void 0 : _props$collabEdit.useNativePlugin) === 'boolean' ? !!((_props$collabEdit2 = props.collabEdit) !== null && _props$collabEdit2 !== void 0 && _props$collabEdit2.useNativePlugin) : false),
60
- chromeCursorHandlerFixedVersion: typeof ((_props$featureFlags32 = props.featureFlags) === null || _props$featureFlags32 === void 0 ? void 0 : _props$featureFlags32.chromeCursorHandlerFixedVersion) === 'string' ? Number(props.featureFlags.chromeCursorHandlerFixedVersion) || undefined : undefined,
57
+ chromeCursorHandlerFixedVersion: typeof ((_props$featureFlags30 = props.featureFlags) === null || _props$featureFlags30 === void 0 ? void 0 : _props$featureFlags30.chromeCursorHandlerFixedVersion) === 'string' ? Number(props.featureFlags.chromeCursorHandlerFixedVersion) || undefined : undefined,
61
58
  tableCellOptionsInFloatingToolbar: typeof tableCellOptionsInFloatingToolbar === 'boolean' ? tableCellOptionsInFloatingToolbar : false,
62
- showHoverPreview: Boolean(typeof ((_props$featureFlags33 = props.featureFlags) === null || _props$featureFlags33 === void 0 ? void 0 : _props$featureFlags33.showHoverPreview) === 'boolean' ? !!((_props$featureFlags34 = props.featureFlags) !== null && _props$featureFlags34 !== void 0 && _props$featureFlags34.showHoverPreview) : false),
63
- indentationButtonsInTheToolbar: Boolean(typeof normalizedFeatureFlags.indentationButtonsInTheToolbar === 'boolean' && !!normalizedFeatureFlags.indentationButtonsInTheToolbar || (typeof ((_props$featureFlags35 = props.featureFlags) === null || _props$featureFlags35 === void 0 ? void 0 : _props$featureFlags35.indentationButtonsInTheToolbar) === 'boolean' ? !!((_props$featureFlags36 = props.featureFlags) !== null && _props$featureFlags36 !== void 0 && _props$featureFlags36.indentationButtonsInTheToolbar) : false)),
64
- floatingToolbarCopyButton: Boolean(typeof normalizedFeatureFlags.floatingToolbarCopyButton === 'boolean' && !!normalizedFeatureFlags.floatingToolbarCopyButton || (typeof ((_props$featureFlags37 = props.featureFlags) === null || _props$featureFlags37 === void 0 ? void 0 : _props$featureFlags37.floatingToolbarCopyButton) === 'boolean' ? !!((_props$featureFlags38 = props.featureFlags) !== null && _props$featureFlags38 !== void 0 && _props$featureFlags38.floatingToolbarCopyButton) : false)),
65
- floatingToolbarLinkSettingsButton: typeof ((_props$featureFlags39 = props.featureFlags) === null || _props$featureFlags39 === void 0 ? void 0 : _props$featureFlags39['floating-toolbar-link-settings-button']) === 'string' ? props.featureFlags['floating-toolbar-link-settings-button'] || undefined : undefined,
59
+ showHoverPreview: Boolean(typeof ((_props$featureFlags31 = props.featureFlags) === null || _props$featureFlags31 === void 0 ? void 0 : _props$featureFlags31.showHoverPreview) === 'boolean' ? !!((_props$featureFlags32 = props.featureFlags) !== null && _props$featureFlags32 !== void 0 && _props$featureFlags32.showHoverPreview) : false),
60
+ indentationButtonsInTheToolbar: Boolean(typeof normalizedFeatureFlags.indentationButtonsInTheToolbar === 'boolean' && !!normalizedFeatureFlags.indentationButtonsInTheToolbar || (typeof ((_props$featureFlags33 = props.featureFlags) === null || _props$featureFlags33 === void 0 ? void 0 : _props$featureFlags33.indentationButtonsInTheToolbar) === 'boolean' ? !!((_props$featureFlags34 = props.featureFlags) !== null && _props$featureFlags34 !== void 0 && _props$featureFlags34.indentationButtonsInTheToolbar) : false)),
61
+ floatingToolbarCopyButton: Boolean(typeof normalizedFeatureFlags.floatingToolbarCopyButton === 'boolean' && !!normalizedFeatureFlags.floatingToolbarCopyButton || (typeof ((_props$featureFlags35 = props.featureFlags) === null || _props$featureFlags35 === void 0 ? void 0 : _props$featureFlags35.floatingToolbarCopyButton) === 'boolean' ? !!((_props$featureFlags36 = props.featureFlags) !== null && _props$featureFlags36 !== void 0 && _props$featureFlags36.floatingToolbarCopyButton) : false)),
62
+ floatingToolbarLinkSettingsButton: typeof ((_props$featureFlags37 = props.featureFlags) === null || _props$featureFlags37 === void 0 ? void 0 : _props$featureFlags37['floating-toolbar-link-settings-button']) === 'string' ? props.featureFlags['floating-toolbar-link-settings-button'] || undefined : undefined,
66
63
  disableSpellcheckByBrowser: getSpellCheck(props.featureFlags),
67
64
  // Including fallback to props.featureFlags so that mobile feature flags
68
65
  // are included (they are not kebab cased)
69
- restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$featureFlags40 = props.featureFlags) === null || _props$featureFlags40 === void 0 ? void 0 : _props$featureFlags40.restartNumberedLists) === true,
70
- useSomewhatSemanticTextColorNames: Boolean(typeof normalizedFeatureFlags.useSomewhatSemanticTextColorNames === 'boolean' && !!normalizedFeatureFlags.useSomewhatSemanticTextColorNames || (typeof ((_props$featureFlags41 = props.featureFlags) === null || _props$featureFlags41 === void 0 ? void 0 : _props$featureFlags41.useSomewhatSemanticTextColorNames) === 'boolean' ? !!((_props$featureFlags42 = props.featureFlags) !== null && _props$featureFlags42 !== void 0 && _props$featureFlags42.useSomewhatSemanticTextColorNames) : false)),
66
+ restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$featureFlags38 = props.featureFlags) === null || _props$featureFlags38 === void 0 ? void 0 : _props$featureFlags38.restartNumberedLists) === true,
67
+ useSomewhatSemanticTextColorNames: Boolean(typeof normalizedFeatureFlags.useSomewhatSemanticTextColorNames === 'boolean' && !!normalizedFeatureFlags.useSomewhatSemanticTextColorNames || (typeof ((_props$featureFlags39 = props.featureFlags) === null || _props$featureFlags39 === void 0 ? void 0 : _props$featureFlags39.useSomewhatSemanticTextColorNames) === 'boolean' ? !!((_props$featureFlags40 = props.featureFlags) !== null && _props$featureFlags40 !== void 0 && _props$featureFlags40.useSomewhatSemanticTextColorNames) : false)),
71
68
  lpLinkPickerFocusTrap: Boolean(normalizedFeatureFlags.lpLinkPickerFocusTrap),
72
- preventPopupOverflow: Boolean(typeof ((_props$featureFlags43 = props.featureFlags) === null || _props$featureFlags43 === void 0 ? void 0 : _props$featureFlags43['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags44 = props.featureFlags) !== null && _props$featureFlags44 !== void 0 && _props$featureFlags44['prevent-popup-overflow']) : false),
73
- // duplicated logic from `create-plugins-list.ts` due to presets not being finalised
74
- useBetterTypeaheadNavigation: Boolean(typeof pseudoNormalisedUseBetterTypeaheadNavigation === 'boolean' ? !!pseudoNormalisedUseBetterTypeaheadNavigation : true)
69
+ preventPopupOverflow: Boolean(typeof ((_props$featureFlags41 = props.featureFlags) === null || _props$featureFlags41 === void 0 ? void 0 : _props$featureFlags41['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags42 = props.featureFlags) !== null && _props$featureFlags42 !== void 0 && _props$featureFlags42['prevent-popup-overflow']) : false)
75
70
  });
76
71
  }
@@ -28,6 +28,9 @@ import { MediaInlineNodeSelector, MediaSingleNodeSelector } from '../nodeviews/s
28
28
  import ImageBorderItem from '../ui/ImageBorder';
29
29
  import { currentMediaNodeBorderMark } from '../utils/current-media-node';
30
30
  import { shouldShowImageBorder } from './imageBorder';
31
+ import { PixelEntry } from '../ui/PixelEntry';
32
+ import { DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, MEDIA_SINGLE_MIN_PIXEL_WIDTH } from '@atlaskit/editor-common/media-single';
33
+ import { akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
31
34
  var remove = function remove(state, dispatch) {
32
35
  if (dispatch) {
33
36
  dispatch(removeSelectedNode(state.tr));
@@ -248,6 +251,58 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
248
251
  type: 'separator'
249
252
  });
250
253
  }
254
+
255
+ // Pixel Entry Toolbar Support
256
+ if (getBooleanFF('platform.editor.media.extended-resize-experience') && allowResizing) {
257
+ toolbarButtons.push({
258
+ type: 'custom',
259
+ fallback: [],
260
+ render: function render(editorView) {
261
+ if (!editorView) {
262
+ return null;
263
+ }
264
+ var state = editorView.state,
265
+ dispatch = editorView.dispatch;
266
+ var selectedMediaSingleNode = getSelectedMediaSingle(state);
267
+ if (!selectedMediaSingleNode) {
268
+ return null;
269
+ }
270
+ var selectedMediaNode = selectedMediaSingleNode.node.content.firstChild;
271
+ if (!selectedMediaNode) {
272
+ return null;
273
+ }
274
+ var singleMediaWidth = selectedMediaSingleNode.node.attrs.width;
275
+ var _selectedMediaNode$at = selectedMediaNode.attrs,
276
+ mediaWidth = _selectedMediaNode$at.width,
277
+ mediaHeight = _selectedMediaNode$at.height;
278
+ return /*#__PURE__*/React.createElement(PixelEntry, {
279
+ intl: intl,
280
+ width: singleMediaWidth,
281
+ mediaWidth: mediaWidth || DEFAULT_IMAGE_WIDTH,
282
+ mediaHeight: mediaHeight || DEFAULT_IMAGE_HEIGHT,
283
+ validate: function validate(value) {
284
+ if (value !== '' && !isNaN(value) && value >= MEDIA_SINGLE_MIN_PIXEL_WIDTH && value <= akEditorFullWidthLayoutWidth) {
285
+ return true;
286
+ }
287
+ return false;
288
+ },
289
+ onSubmit: function onSubmit(_ref) {
290
+ var width = _ref.width;
291
+ var tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, _objectSpread(_objectSpread({}, selectedMediaSingleNode.node.attrs), {}, {
292
+ width: width,
293
+ widthType: 'pixel'
294
+ }));
295
+ dispatch(tr);
296
+ }
297
+ });
298
+ }
299
+ });
300
+ if (!pluginState.isResizing) {
301
+ toolbarButtons.push({
302
+ type: 'separator'
303
+ });
304
+ }
305
+ }
251
306
  if (allowLinking && shouldShowMediaLinkToolbar(state)) {
252
307
  toolbarButtons.push({
253
308
  type: 'custom',
@@ -296,8 +351,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
296
351
  type: 'separator'
297
352
  });
298
353
  }
299
- var _ref = (_pluginInjectionApi$d7 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d7 !== void 0 ? _pluginInjectionApi$d7 : {},
300
- hoverDecoration = _ref.hoverDecoration;
354
+ var _ref2 = (_pluginInjectionApi$d7 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d7 !== void 0 ? _pluginInjectionApi$d7 : {},
355
+ hoverDecoration = _ref2.hoverDecoration;
301
356
  var removeButton = {
302
357
  id: 'editor.media.delete',
303
358
  type: 'button',
@@ -341,8 +396,8 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
341
396
  getEditorFeatureFlags = options.getEditorFeatureFlags;
342
397
  var mediaPluginState = stateKey.getState(state);
343
398
  var mediaLinkingState = getMediaLinkingState(state);
344
- var _ref2 = (_pluginInjectionApi$d8 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d8 !== void 0 ? _pluginInjectionApi$d8 : {},
345
- hoverDecoration = _ref2.hoverDecoration;
399
+ var _ref3 = (_pluginInjectionApi$d8 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d8 !== void 0 ? _pluginInjectionApi$d8 : {},
400
+ hoverDecoration = _ref3.hoverDecoration;
346
401
  if (!mediaPluginState || mediaPluginState.isResizing) {
347
402
  return;
348
403
  }
@@ -0,0 +1,140 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ /** @jsx jsx */
4
+ import { jsx } from '@emotion/react';
5
+ import { useCallback, useEffect, useMemo, useState } from 'react';
6
+ import Textfield from '@atlaskit/textfield';
7
+ import Tooltip from '@atlaskit/tooltip';
8
+ import Button from '@atlaskit/button';
9
+ import Form, { Field } from '@atlaskit/form';
10
+ import { pixelSizingInput, pixelSizingLabel, pixelSizingWidthInput, pixelSizingHeightInput, pixelSizingWrapper, pixelEntryForm, pixelEntryHiddenSubmit } from './styles';
11
+ import { messages } from './messages';
12
+ export var PixelEntry = function PixelEntry(_ref) {
13
+ var width = _ref.width,
14
+ mediaWidth = _ref.mediaWidth,
15
+ mediaHeight = _ref.mediaHeight,
16
+ onSubmit = _ref.onSubmit,
17
+ validate = _ref.validate,
18
+ formatMessage = _ref.intl.formatMessage;
19
+ var ratioWidth = useMemo(function () {
20
+ return mediaHeight / mediaWidth;
21
+ }, [mediaHeight, mediaWidth]);
22
+ var ratioHeight = useMemo(function () {
23
+ return mediaWidth / mediaHeight;
24
+ }, [mediaHeight, mediaWidth]);
25
+ var _useState = useState(width),
26
+ _useState2 = _slicedToArray(_useState, 2),
27
+ computedWidth = _useState2[0],
28
+ setComputedWidth = _useState2[1];
29
+ var _useState3 = useState(Math.round(ratioWidth * width)),
30
+ _useState4 = _slicedToArray(_useState3, 2),
31
+ computedHeight = _useState4[0],
32
+ setComputedHeight = _useState4[1];
33
+
34
+ // Handle update to width from outside component
35
+ useEffect(function () {
36
+ setComputedWidth(width);
37
+ setComputedHeight(Math.round(ratioWidth * width));
38
+ }, [width, ratioWidth]);
39
+
40
+ // Handle submit when user presses enter in form
41
+ var handleOnSubmit = function handleOnSubmit(data) {
42
+ if (onSubmit) {
43
+ if (data.inputWidth === '') {
44
+ return;
45
+ }
46
+ onSubmit({
47
+ width: data.inputWidth
48
+ });
49
+ }
50
+ };
51
+
52
+ // Syncronous validation returning undefined for valid and string for invalid
53
+ var handleValidateWidth = useCallback(function (value) {
54
+ if (!value || !validate) {
55
+ return;
56
+ }
57
+ if (validate) {
58
+ return validate(value) === true ? undefined : formatMessage(messages.validationFailedMessage);
59
+ }
60
+ return;
61
+ }, [validate, formatMessage]);
62
+
63
+ // Handle updating computed fields based on
64
+ var handleOnChange = useCallback(function (type) {
65
+ return function (event) {
66
+ var value = parseInt(event.currentTarget.value);
67
+ var newInputValue = isNaN(value) ? '' : parseInt(event.currentTarget.value);
68
+ switch (type) {
69
+ case 'inputWidth':
70
+ {
71
+ setComputedWidth(newInputValue);
72
+ if (!isNaN(value)) {
73
+ setComputedHeight(Math.round(ratioWidth * value));
74
+ }
75
+ break;
76
+ }
77
+ case 'inputHeight':
78
+ {
79
+ setComputedHeight(newInputValue);
80
+ if (!isNaN(value)) {
81
+ setComputedWidth(Math.round(ratioHeight * value));
82
+ }
83
+ break;
84
+ }
85
+ }
86
+ };
87
+ }, [ratioHeight, ratioWidth]);
88
+ return jsx("div", {
89
+ css: pixelEntryForm
90
+ }, jsx(Form, {
91
+ onSubmit: handleOnSubmit
92
+ }, function (_ref2) {
93
+ var formProps = _ref2.formProps;
94
+ return jsx("form", formProps, jsx("div", {
95
+ css: pixelSizingWrapper
96
+ }, jsx(Field, {
97
+ key: "inputWidth",
98
+ name: "inputWidth",
99
+ validate: handleValidateWidth,
100
+ defaultValue: computedWidth
101
+ }, function (_ref3) {
102
+ var fieldProps = _ref3.fieldProps;
103
+ return jsx(Tooltip, {
104
+ hideTooltipOnMouseDown: true,
105
+ content: formatMessage(messages.inputWidthTooltip),
106
+ position: "top"
107
+ }, jsx(Textfield, _extends({}, fieldProps, {
108
+ css: [pixelSizingWidthInput, pixelSizingInput],
109
+ appearance: "none",
110
+ isCompact: true,
111
+ onChange: handleOnChange('inputWidth'),
112
+ pattern: "\\d*",
113
+ "aria-label": formatMessage(messages.inputWidthAriaLabel)
114
+ })));
115
+ }), jsx("span", {
116
+ css: pixelSizingLabel
117
+ }, "x"), jsx(Field, {
118
+ key: "inputHeight",
119
+ name: "inputHeight",
120
+ defaultValue: computedHeight
121
+ }, function (_ref4) {
122
+ var fieldProps = _ref4.fieldProps;
123
+ return jsx(Tooltip, {
124
+ hideTooltipOnMouseDown: true,
125
+ content: formatMessage(messages.inputHeightTooltip),
126
+ position: "top"
127
+ }, jsx(Textfield, _extends({}, fieldProps, {
128
+ css: [pixelSizingHeightInput, pixelSizingInput],
129
+ appearance: "none",
130
+ isCompact: true,
131
+ onChange: handleOnChange('inputHeight'),
132
+ pattern: "\\d*",
133
+ "aria-label": formatMessage(messages.inputHeightAriaLabel)
134
+ })));
135
+ }), jsx(Button, {
136
+ css: pixelEntryHiddenSubmit,
137
+ type: "submit"
138
+ }, formatMessage(messages.submitButtonText))));
139
+ }));
140
+ };
@@ -0,0 +1,33 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export var messages = defineMessages({
3
+ validationFailedMessage: {
4
+ id: 'fabric.editor.media.pixelEntry.validationFailedMessage',
5
+ defaultMessage: 'Validation for width failed',
6
+ description: 'The passed in validator function returned false'
7
+ },
8
+ inputWidthTooltip: {
9
+ id: 'fabric.editor.media.pixelEntry.inputWidthTooltip',
10
+ defaultMessage: 'Width',
11
+ description: 'The tooltip displayed ontop of the width input'
12
+ },
13
+ inputWidthAriaLabel: {
14
+ id: 'fabric.editor.media.pixelEntry.inputWidthAriaLabel',
15
+ defaultMessage: 'width input',
16
+ description: 'The width input aria label'
17
+ },
18
+ inputHeightTooltip: {
19
+ id: 'fabric.editor.media.pixelEntry.inputHeightTooltip',
20
+ defaultMessage: 'Height',
21
+ description: 'The tooltip displayed ontop of the height input'
22
+ },
23
+ inputHeightAriaLabel: {
24
+ id: 'fabric.editor.media.pixelEntry.inputHeightAriaLabel',
25
+ defaultMessage: 'height input',
26
+ description: 'The width input aria label'
27
+ },
28
+ submitButtonText: {
29
+ id: 'fabric.editor.media.pixelEntry.submitButtonText',
30
+ defaultMessage: 'Submit',
31
+ description: 'The text give to the hidden submit button'
32
+ }
33
+ });
@@ -0,0 +1,11 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
3
+ import { css } from '@emotion/react';
4
+ var PIXEL_SIZING_WRAPPER_MINIMUM_WIDTH = 120;
5
+ export var pixelSizingWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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)");
6
+ export var pixelEntryForm = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n form {\n width: 100%;\n }\n"])));
7
+ export var pixelSizingInput = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 100%;\n height: ", ";\n & input {\n text-align: center;\n }\n"])), "var(--ds-space-300, 24px)");
8
+ export var pixelSizingLabel = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n grid-area: label;\n line-height: ", ";\n"])), "var(--ds-space-300, 24px)");
9
+ export var pixelSizingWidthInput = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n grid-area: widthinput;\n"])));
10
+ export var pixelSizingHeightInput = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n grid-area: heightinput;\n"])));
11
+ export var pixelEntryHiddenSubmit = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n grid-area: submit;\n visibility: hidden;\n width: 0;\n height: 0;\n"])));
@@ -0,0 +1 @@
1
+ export {};
@@ -113,8 +113,6 @@ var TypeAheadMenu = /*#__PURE__*/React.memo(function (_ref) {
113
113
  *
114
114
  */
115
115
  var typeAheadPlugin = function typeAheadPlugin(options) {
116
- var _options$useBetterTyp;
117
- var useBetterTypeaheadNavigation = (_options$useBetterTyp = options === null || options === void 0 ? void 0 : options.useBetterTypeaheadNavigation) !== null && _options$useBetterTyp !== void 0 ? _options$useBetterTyp : true;
118
116
  var fireAnalyticsCallback = fireAnalyticsEvent(options === null || options === void 0 ? void 0 : options.createAnalyticsEvent);
119
117
  var popupMountRef = {
120
118
  current: null
@@ -141,8 +139,7 @@ var typeAheadPlugin = function typeAheadPlugin(options) {
141
139
  popupMountRef: popupMountRef,
142
140
  reactDispatch: dispatch,
143
141
  typeAheadHandlers: typeAhead,
144
- createAnalyticsEvent: options === null || options === void 0 ? void 0 : options.createAnalyticsEvent,
145
- useBetterTypeaheadNavigation: useBetterTypeaheadNavigation
142
+ createAnalyticsEvent: options === null || options === void 0 ? void 0 : options.createAnalyticsEvent
146
143
  });
147
144
  }
148
145
  }, {