@atlaskit/editor-core 187.8.11 → 187.9.0

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 (73) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/plugins/floating-toolbar/index.js +1 -3
  3. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +33 -23
  4. package/dist/cjs/plugins/media/toolbar/index.js +16 -2
  5. package/dist/cjs/plugins/media/toolbar/utils.js +7 -2
  6. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +574 -0
  7. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/guidelines.js +117 -0
  8. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.js +15 -0
  9. package/dist/cjs/ui/ElementBrowser/components/ElementSearch.js +5 -3
  10. package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +8 -6
  11. package/dist/cjs/ui/Resizer/ResizeLabel/index.js +20 -0
  12. package/dist/cjs/ui/Resizer/ResizeLabel/styles.js +17 -0
  13. package/dist/cjs/version-wrapper.js +1 -1
  14. package/dist/cjs/version.json +1 -1
  15. package/dist/es2019/plugins/floating-toolbar/index.js +1 -1
  16. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +34 -23
  17. package/dist/es2019/plugins/media/toolbar/index.js +19 -3
  18. package/dist/es2019/plugins/media/toolbar/utils.js +7 -1
  19. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +493 -0
  20. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/guidelines.js +108 -0
  21. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.js +8 -0
  22. package/dist/es2019/ui/ElementBrowser/components/ElementSearch.js +5 -3
  23. package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +9 -6
  24. package/dist/es2019/ui/Resizer/ResizeLabel/index.js +12 -0
  25. package/dist/es2019/ui/Resizer/ResizeLabel/styles.js +25 -0
  26. package/dist/es2019/version-wrapper.js +1 -1
  27. package/dist/es2019/version.json +1 -1
  28. package/dist/esm/plugins/floating-toolbar/index.js +1 -3
  29. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +33 -23
  30. package/dist/esm/plugins/media/toolbar/index.js +17 -3
  31. package/dist/esm/plugins/media/toolbar/utils.js +5 -1
  32. package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +564 -0
  33. package/dist/esm/plugins/media/ui/ResizableMediaSingle/guidelines.js +108 -0
  34. package/dist/esm/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.js +8 -0
  35. package/dist/esm/ui/ElementBrowser/components/ElementSearch.js +5 -3
  36. package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +8 -6
  37. package/dist/esm/ui/Resizer/ResizeLabel/index.js +12 -0
  38. package/dist/esm/ui/Resizer/ResizeLabel/styles.js +7 -0
  39. package/dist/esm/version-wrapper.js +1 -1
  40. package/dist/esm/version.json +1 -1
  41. package/dist/types/labs/next/presets/universal.d.ts +1 -2
  42. package/dist/types/plugins/floating-toolbar/index.d.ts +3 -1
  43. package/dist/types/plugins/media/index.d.ts +2 -0
  44. package/dist/types/plugins/media/nodeviews/styles.d.ts +1 -1
  45. package/dist/types/plugins/media/pm-plugins/main.d.ts +1 -1
  46. package/dist/types/plugins/media/toolbar/utils.d.ts +1 -0
  47. package/dist/types/plugins/media/types.d.ts +1 -0
  48. package/dist/types/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +61 -0
  49. package/dist/types/plugins/media/ui/ResizableMediaSingle/guidelines.d.ts +4 -0
  50. package/dist/types/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.d.ts +7 -0
  51. package/dist/types/plugins/media/ui/ResizableMediaSingle/types.d.ts +1 -0
  52. package/dist/types/ui/ElementBrowser/components/ElementSearch.d.ts +2 -1
  53. package/dist/types/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +4 -4
  54. package/dist/types/ui/Resizer/ResizeLabel/index.d.ts +8 -0
  55. package/dist/types/ui/Resizer/ResizeLabel/styles.d.ts +3 -0
  56. package/dist/types-ts4.5/labs/next/presets/universal.d.ts +1 -2
  57. package/dist/types-ts4.5/plugins/floating-toolbar/index.d.ts +3 -1
  58. package/dist/types-ts4.5/plugins/media/index.d.ts +2 -0
  59. package/dist/types-ts4.5/plugins/media/nodeviews/styles.d.ts +1 -1
  60. package/dist/types-ts4.5/plugins/media/pm-plugins/main.d.ts +1 -1
  61. package/dist/types-ts4.5/plugins/media/toolbar/utils.d.ts +1 -0
  62. package/dist/types-ts4.5/plugins/media/types.d.ts +1 -0
  63. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +61 -0
  64. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/guidelines.d.ts +4 -0
  65. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.d.ts +7 -0
  66. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/types.d.ts +1 -0
  67. package/dist/types-ts4.5/ui/ElementBrowser/components/ElementSearch.d.ts +2 -1
  68. package/dist/types-ts4.5/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +4 -4
  69. package/dist/types-ts4.5/ui/Resizer/ResizeLabel/index.d.ts +8 -0
  70. package/dist/types-ts4.5/ui/Resizer/ResizeLabel/styles.d.ts +3 -0
  71. package/package.json +2 -2
  72. package/report.api.md +7 -4
  73. package/tmp/api-report-tmp.d.ts +5 -1
@@ -19,6 +19,7 @@ function ElementSearch(_ref) {
19
19
  formatMessage = _ref.intl.formatMessage,
20
20
  focus = _ref.focus,
21
21
  onClick = _ref.onClick,
22
+ onKeyDown = _ref.onKeyDown,
22
23
  searchTerm = _ref.searchTerm;
23
24
  var ref = useFocus(focus);
24
25
  var onChange = function onChange(_ref2) {
@@ -34,6 +35,7 @@ function ElementSearch(_ref) {
34
35
  onChange: onChange,
35
36
  onClick: onClick,
36
37
  onFocus: onFocus,
38
+ onKeyDown: onKeyDown,
37
39
  onBlur: onBlur,
38
40
  elemBeforeInput: jsx("div", {
39
41
  css: elementBeforeInput,
@@ -65,10 +67,10 @@ var placeHolderMessage = {
65
67
  description: 'Search field placeholder'
66
68
  };
67
69
  var styledShortcut = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n padding: ", "px ", "px;\n width: ", "px;\n"])), shortcutStyle, GRID_SIZE / 2, GRID_SIZE, GRID_SIZE * 6);
68
- var wrapper = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n & > [data-ds--text-field--container] {\n height: ", "px;\n border-radius: ", "px;\n flex: 1 1 100%;\n overflow: visible;\n & > [data-ds--text-field--input] {\n margin-bottom: 3px;\n font-size: ", ";\n padding: ", "px 6px ", "px 0;\n }\n }\n"])), GRID_SIZE * 6, GRID_SIZE, relativeFontSizeToBase16(14), GRID_SIZE, GRID_SIZE);
70
+ var wrapper = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n & > [data-ds--text-field--container] {\n height: ", "px;\n border-radius: ", "px;\n flex: 1 1 100%;\n overflow: visible;\n & > [data-ds--text-field--input] {\n margin-bottom: 3px;\n font-size: ", ";\n padding: ", "px ", " ", "px 0;\n }\n }\n"])), GRID_SIZE * 6, GRID_SIZE, relativeFontSizeToBase16(14), GRID_SIZE, "var(--ds-space-075, 6px)", GRID_SIZE);
69
71
  var wrapperInline = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n & > [data-ds--text-field--container] {\n height: ", "px;\n flex: none;\n overflow: revert;\n }\n"])), GRID_SIZE * 5);
70
- var elementBeforeInput = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin: 1px 6px 0 8px;\n color: ", ";\n\n // Custom SearchIcon style\n span,\n svg {\n height: 20px;\n width: 20px;\n }\n"])), "var(--ds-icon, ".concat(N200, ")"));
71
- var elementAfterInput = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: 0 8px;\n height: ", ";\n text-align: center;\n"])), SEARCH_ITEM_HEIGHT_WIDTH);
72
+ var elementBeforeInput = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin: 1px ", " 0 ", ";\n color: ", ";\n\n // Custom SearchIcon style\n span,\n svg {\n height: 20px;\n width: 20px;\n }\n"])), "var(--ds-space-075, 6px)", "var(--ds-space-100, 8px)", "var(--ds-icon, ".concat(N200, ")"));
73
+ var elementAfterInput = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: 0 ", ";\n height: ", ";\n text-align: center;\n"])), "var(--ds-space-100, 8px)", SEARCH_ITEM_HEIGHT_WIDTH);
72
74
  var MemoizedElementSearchWithAnalytics = /*#__PURE__*/memo(withAnalyticsContext({
73
75
  component: 'Searchbar'
74
76
  })(injectIntl(ElementSearch)));
@@ -20,7 +20,7 @@ var baseBrowserContainerStyles = css(_templateObject2 || (_templateObject2 = _ta
20
20
  var mobileElementBrowserContainer = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", ";\n flex-direction: column;\n"])), baseBrowserContainerStyles);
21
21
  var elementBrowserContainer = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", ";\n flex-direction: row;\n"])), baseBrowserContainerStyles);
22
22
  var baseSidebarStyles = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n\n overflow-x: auto;\n overflow-y: hidden;\n"])));
23
- var mobileSideBar = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", ";\n flex: 0 0 ", ";\n padding: 12px 12px 0 12px;\n"])), baseSidebarStyles, INLINE_SIDEBAR_HEIGHT);
23
+ var mobileSideBar = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", ";\n flex: 0 0 ", ";\n padding: ", " ", " 0\n ", ";\n"])), baseSidebarStyles, INLINE_SIDEBAR_HEIGHT, "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)");
24
24
  var mobileSideBarShowCategories = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n flex: 0 0 auto;\n"])));
25
25
  var sideBar = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n ", ";\n flex: 0 0 'auto';\n"])), baseSidebarStyles);
26
26
  var sideBarShowCategories = css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n ", ";\n flex: 0 0 ", ";\n"])), baseSidebarStyles, SIDEBAR_WIDTH);
@@ -33,6 +33,7 @@ var categoryListWrapper = css(_templateObject15 || (_templateObject15 = _taggedT
33
33
  function StatelessElementBrowser(props) {
34
34
  var items = props.items,
35
35
  onSelectItem = props.onSelectItem,
36
+ onInsertItem = props.onInsertItem,
36
37
  viewMoreItem = props.viewMoreItem;
37
38
  var _useContainerWidth = useContainerWidth(),
38
39
  containerWidth = _useContainerWidth.containerWidth,
@@ -82,10 +83,11 @@ function StatelessElementBrowser(props) {
82
83
  if (e.key !== 'Enter') {
83
84
  return;
84
85
  }
85
- if (onSelectItem && selectedItem != null) {
86
- onSelectItem(selectedItem);
86
+ if (onInsertItem && selectedItem != null) {
87
+ onInsertItem(selectedItem);
87
88
  }
88
- }, [onSelectItem, selectedItem]);
89
+ e.preventDefault();
90
+ }, [onInsertItem, selectedItem]);
89
91
 
90
92
  /**
91
93
  * On arrow key selection and clicks the selectedItemIndex will change.
@@ -146,13 +148,13 @@ function MobileBrowser(_ref) {
146
148
  viewMoreItem = _ref.viewMoreItem;
147
149
  return jsx("div", {
148
150
  css: mobileElementBrowserContainer,
149
- onKeyPress: onKeyPress,
150
151
  onKeyDown: onKeyDown,
151
152
  "data-testid": "mobile__element-browser"
152
153
  }, jsx("div", {
153
154
  css: showCategories ? [mobileSideBar, mobileSideBarShowCategories] : mobileSideBar
154
155
  }, showSearch && jsx(ElementSearch, {
155
156
  onSearch: onSearch,
157
+ onKeyDown: onKeyPress,
156
158
  mode: mode,
157
159
  focus: focusOnSearch,
158
160
  onClick: setFocusOnSearch,
@@ -225,13 +227,13 @@ function DesktopBrowser(_ref2) {
225
227
  createAnalyticsEvent: createAnalyticsEvent
226
228
  }))), jsx("div", {
227
229
  css: mainContent,
228
- onKeyPress: onKeyPress,
229
230
  onKeyDown: onKeyDown,
230
231
  "data-testid": "main-content"
231
232
  }, showSearch && jsx("div", {
232
233
  css: searchContainer
233
234
  }, jsx(ElementSearch, {
234
235
  onSearch: onSearch,
236
+ onKeyDown: onKeyPress,
235
237
  mode: mode,
236
238
  focus: focusOnSearch,
237
239
  onClick: setFocusOnSearch,
@@ -0,0 +1,12 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { wrapper, text, smallText } from './styles';
4
+ var ResizeLabelBreakoutWidth = 110;
5
+ var ResizeLabel = function ResizeLabel(props) {
6
+ return jsx("div", {
7
+ css: wrapper
8
+ }, jsx("span", {
9
+ css: [text, props.containerWidth < ResizeLabelBreakoutWidth && smallText]
10
+ }, props.label));
11
+ };
12
+ export default ResizeLabel;
@@ -0,0 +1,7 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2, _templateObject3;
3
+ import { css } from '@emotion/react';
4
+ import { B300 } from '@atlaskit/theme/colors';
5
+ export var wrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size: ", ";\n width: 100%;\n text-align: center;\n position: absolute;\n transform: translateY(-125%);\n top: 0;\n"])), "var(--ds-font-size-100, 14px)");
6
+ export var text = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: inline-block;\n border-radius: 6px;\n min-width: 75px;\n background-color: ", ";\n color: ", ";\n padding: ", " ", ";\n letter-spacing: 0.5px;\n"])), "var(--ds-text-accent-blue, ".concat(B300, ")"), "var(--ds-text-inverse, white)", "var(--ds-space-050, 4px)", "var(--ds-space-200, 16px)");
7
+ export var smallText = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n letter-spacing: -0.5px;\n font-size: ", ";\n min-width: 27px;\n padding: ", " ", ";\n"])), "var(--ds-font-size-050, 8px)", "var(--ds-space-0, 0px)", "var(--ds-space-025, 2px)");
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.8.11";
2
+ export var version = "187.9.0";
3
3
  export var nextMajorVersion = function 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.8.11",
3
+ "version": "187.9.0",
4
4
  "sideEffects": false
5
5
  }
@@ -2,9 +2,8 @@ import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
2
  import type { EditorAppearance } from '@atlaskit/editor-common/types';
3
3
  import type { DefaultPresetPluginOptions } from './default';
4
4
  import type { EditorPresetProps } from './types';
5
- import type { EditorSharedPropsWithPlugins } from '../../../types/editor-props';
5
+ import type { EditorSharedPropsWithPlugins, EditorPluginFeatureProps, EditorProviderProps } from '../../../types/editor-props';
6
6
  import type { FeatureFlags } from '../../../types/feature-flags';
7
- import type { EditorPluginFeatureProps, EditorProviderProps } from '../../../types/editor-props';
8
7
  import type { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
9
8
  type UniversalPresetProps = EditorPresetProps & DefaultPresetPluginOptions & EditorSharedPropsWithPlugins & EditorPluginFeatureProps & EditorProviderProps;
10
9
  /**
@@ -3,7 +3,9 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
3
  import type { Node } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { FloatingToolbarConfig } from './types';
5
5
  import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
6
- export type FloatingToolbarPluginState = Record<'getConfigWithNodeInfo', (state: EditorState) => ConfigWithNodeInfo | null | undefined>;
6
+ export type FloatingToolbarPluginState = {
7
+ getConfigWithNodeInfo: (state: EditorState) => ConfigWithNodeInfo | null | undefined;
8
+ };
7
9
  export type ConfigWithNodeInfo = {
8
10
  config: FloatingToolbarConfig | undefined;
9
11
  pos: number;
@@ -5,6 +5,7 @@ import type { MediaState } from './pm-plugins/main';
5
5
  import type { CustomMediaPicker, MediaOptions } from './types';
6
6
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
7
7
  import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
8
+ import type { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
8
9
  import type { gridPlugin } from '@atlaskit/editor-plugin-grid';
9
10
  import type { widthPlugin } from '@atlaskit/editor-plugin-width';
10
11
  import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
@@ -18,6 +19,7 @@ declare const mediaPlugin: NextEditorPlugin<'media', {
18
19
  dependencies: [
19
20
  typeof featureFlagsPlugin,
20
21
  OptionalPlugin<typeof analyticsPlugin>,
22
+ typeof guidelinePlugin,
21
23
  typeof gridPlugin,
22
24
  typeof widthPlugin,
23
25
  typeof decorationsPlugin,
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- import { NumericalCardDimensions } from '@atlaskit/media-card';
4
+ import type { NumericalCardDimensions } from '@atlaskit/media-card';
5
5
  export declare const MediaInlineNodeSelector = "media-inline-node";
6
6
  export declare const MediaSingleNodeSelector = "media-single-node";
7
7
  export declare const figureWrapper: import("@emotion/react").SerializedStyles;
@@ -5,7 +5,6 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
5
  import type { MediaClientConfig } from '@atlaskit/media-core';
6
6
  import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
7
7
  import type { ContextIdentifierProvider, MediaProvider } from '@atlaskit/editor-common/provider-factory';
8
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
9
8
  import type { WidthPluginState } from '@atlaskit/editor-plugin-width';
10
9
  import type { Dispatch } from '../../../event-dispatcher';
11
10
  import type { ProsemirrorGetPosHandler } from '../../../nodeviews';
@@ -15,6 +14,7 @@ import type { MediaStateEventSubscriber } from '../picker-facade';
15
14
  import PickerFacade from '../picker-facade';
16
15
  import type { MediaNodeWithPosHandler, MediaPluginState } from './types';
17
16
  import type { IntlShape } from 'react-intl-next';
17
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
18
18
  import type mediaPlugin from '../index';
19
19
  export type { MediaState, MediaProvider, MediaStateStatus };
20
20
  export { stateKey } from './plugin-key';
@@ -6,3 +6,4 @@ import type { MediaPluginState } from '../pm-plugins/types';
6
6
  export declare const getSelectedMediaContainerNodeAttrs: (mediaPluginState: MediaPluginState) => MediaBaseAttributes | null;
7
7
  export declare const downloadMedia: (mediaPluginState: MediaPluginState) => Promise<boolean>;
8
8
  export declare const removeMediaGroupNode: (state: EditorState) => import("prosemirror-state").Transaction;
9
+ export declare const getSelectedMediaSingle: (state: EditorState) => import("prosemirror-utils").ContentNodeWithPos | undefined;
@@ -10,6 +10,7 @@ import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
10
10
  import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
11
11
  import type { PlaceholderTextOptions } from '../../plugins/placeholder-text/types';
12
12
  export type MediaStateStatus = 'unknown' | 'ready' | 'cancelled' | 'preview' | 'error' | 'mobile-upload-end';
13
+ export type MediaSingleWithType = 'pixel' | 'percentage';
13
14
  export interface MediaOptions {
14
15
  provider?: Providers['mediaProvider'];
15
16
  allowMediaSingle?: boolean | MediaSingleOptions;
@@ -0,0 +1,61 @@
1
+ /// <reference path="../../../../../../../../../typings/prosemirror.d.ts" />
2
+ /** @jsx jsx */
3
+ import React from 'react';
4
+ import { jsx } from '@emotion/react';
5
+ import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
6
+ import type { MediaClientConfig } from '@atlaskit/media-core';
7
+ import type { Props } from './types';
8
+ import type { Dimensions } from '@atlaskit/editor-common/resizer';
9
+ import type { WrappedComponentProps } from 'react-intl-next';
10
+ type State = {
11
+ offsetLeft: number;
12
+ isVideoFile: boolean;
13
+ resizedPctWidth?: number;
14
+ isResizing: boolean;
15
+ size: Dimensions;
16
+ };
17
+ export declare const resizerNextTestId = "mediaSingle.resizerNext.testid";
18
+ export declare function calcOffsetLeft(insideInlineLike: boolean, insideLayout: boolean, pmViewDom: Element, wrapper?: HTMLElement): number;
19
+ type ResizableMediaSingleNextProps = Props & WrappedComponentProps;
20
+ declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSingleNextProps, State> {
21
+ constructor(props: ResizableMediaSingleNextProps);
22
+ /**
23
+ * Calculate media single node initial width if props.mediaSingleWidth is undefined
24
+ * (Mainly when switching from lagacy experience to new experience).
25
+ *
26
+ * @returns initial width in pixel
27
+ */
28
+ calcInitialWidth(): number;
29
+ componentDidUpdate(prevProps: Props, prevState: State): boolean;
30
+ isNestedNode(): boolean;
31
+ private getDefaultGuidelines;
32
+ private getSnaps;
33
+ get wrappedLayout(): boolean;
34
+ componentDidMount(): Promise<void>;
35
+ UNSAFE_componentWillReceiveProps(nextProps: Props): void;
36
+ checkVideoFile(viewMediaClientConfig?: MediaClientConfig): Promise<void>;
37
+ calcNewSize: (newWidth: number, stop: boolean) => {
38
+ width: number | null;
39
+ layout: MediaSingleLayout;
40
+ };
41
+ calcUnwrappedLayout: (width: number, containerWidth: number, contentWidth: number) => 'center' | 'wide' | 'full-width';
42
+ get $pos(): import("prosemirror-model").ResolvedPos | null;
43
+ /**
44
+ * The maxmimum number of grid columns this node can resize to.
45
+ */
46
+ get gridWidth(): number;
47
+ calcColumnLeftOffset: () => number;
48
+ wrapper?: HTMLElement;
49
+ calcPxHeight: (newWidth: number) => number;
50
+ get insideInlineLike(): boolean;
51
+ get insideLayout(): boolean;
52
+ private saveWrapper;
53
+ private displayGuideline;
54
+ private setIsResizing;
55
+ render(): jsx.JSX.Element;
56
+ }
57
+ export { ResizableMediaSingleNext as UnwrappedResizableMediaSingleNext };
58
+ declare const _default: React.FC<import("react-intl-next").WithIntlProps<ResizableMediaSingleNextProps>> & {
59
+ WrappedComponent: React.ComponentType<ResizableMediaSingleNextProps>;
60
+ };
61
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import type { GuidelineConfig } from '@atlaskit/editor-common/guideline';
2
+ import type { EditorView } from 'prosemirror-view';
3
+ export declare const generateDefaultGuidelines: (editorWidth: number, containerWidth: number, isFullWidthMode?: boolean | undefined) => GuidelineConfig[];
4
+ export declare const generateDynamicGuidelines: (view: EditorView) => GuidelineConfig[];
@@ -0,0 +1,7 @@
1
+ export declare const messages: {
2
+ fullWidthImage: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ };
@@ -22,5 +22,6 @@ export type Props = MediaSingleProps & {
22
22
  viewMediaClientConfig?: MediaClientConfig;
23
23
  fullWidthMode?: boolean;
24
24
  dispatchAnalyticsEvent: DispatchAnalyticsEvent;
25
+ mediaSingleWidth?: number;
25
26
  pluginInjectionApi: ExtractInjectionAPI<typeof mediaPlugin> | undefined;
26
27
  };
@@ -1,12 +1,13 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { WrappedComponentProps } from 'react-intl-next';
3
+ import type { WrappedComponentProps } from 'react-intl-next';
4
4
  import { Modes } from '../types';
5
5
  interface Props {
6
6
  onSearch: (value: string) => void;
7
7
  mode: keyof typeof Modes;
8
8
  focus: boolean;
9
9
  onClick: (e: React.MouseEvent) => void;
10
+ onKeyDown: (e: React.KeyboardEvent) => void;
10
11
  searchTerm?: string;
11
12
  }
12
13
  declare const MemoizedElementSearchWithAnalytics: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<Props & WrappedComponentProps<"intl">, "intl"> & {
@@ -1,9 +1,9 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
4
- import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
5
- import { Category, Modes } from '../types';
6
- import { EmptyStateHandler } from '../../../types/empty-state-handler';
3
+ import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
4
+ import type { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
5
+ import type { Category, Modes } from '../types';
6
+ import type { EmptyStateHandler } from '../../../types/empty-state-handler';
7
7
  export type StatelessElementBrowserProps = {
8
8
  categories?: Category[];
9
9
  items: QuickInsertItem[];
@@ -0,0 +1,8 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ interface Props {
4
+ label: string;
5
+ containerWidth: number;
6
+ }
7
+ declare const ResizeLabel: (props: Props) => jsx.JSX.Element;
8
+ export default ResizeLabel;
@@ -0,0 +1,3 @@
1
+ export declare const wrapper: import("@emotion/react").SerializedStyles;
2
+ export declare const text: import("@emotion/react").SerializedStyles;
3
+ export declare const smallText: import("@emotion/react").SerializedStyles;
@@ -2,9 +2,8 @@ import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
2
  import type { EditorAppearance } from '@atlaskit/editor-common/types';
3
3
  import type { DefaultPresetPluginOptions } from './default';
4
4
  import type { EditorPresetProps } from './types';
5
- import type { EditorSharedPropsWithPlugins } from '../../../types/editor-props';
5
+ import type { EditorSharedPropsWithPlugins, EditorPluginFeatureProps, EditorProviderProps } from '../../../types/editor-props';
6
6
  import type { FeatureFlags } from '../../../types/feature-flags';
7
- import type { EditorPluginFeatureProps, EditorProviderProps } from '../../../types/editor-props';
8
7
  import type { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
9
8
  type UniversalPresetProps = EditorPresetProps & DefaultPresetPluginOptions & EditorSharedPropsWithPlugins & EditorPluginFeatureProps & EditorProviderProps;
10
9
  /**
@@ -3,7 +3,9 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
3
  import type { Node } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { FloatingToolbarConfig } from './types';
5
5
  import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
6
- export type FloatingToolbarPluginState = Record<'getConfigWithNodeInfo', (state: EditorState) => ConfigWithNodeInfo | null | undefined>;
6
+ export type FloatingToolbarPluginState = {
7
+ getConfigWithNodeInfo: (state: EditorState) => ConfigWithNodeInfo | null | undefined;
8
+ };
7
9
  export type ConfigWithNodeInfo = {
8
10
  config: FloatingToolbarConfig | undefined;
9
11
  pos: number;
@@ -5,6 +5,7 @@ import type { MediaState } from './pm-plugins/main';
5
5
  import type { CustomMediaPicker, MediaOptions } from './types';
6
6
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
7
7
  import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
8
+ import type { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
8
9
  import type { gridPlugin } from '@atlaskit/editor-plugin-grid';
9
10
  import type { widthPlugin } from '@atlaskit/editor-plugin-width';
10
11
  import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
@@ -18,6 +19,7 @@ declare const mediaPlugin: NextEditorPlugin<'media', {
18
19
  dependencies: [
19
20
  typeof featureFlagsPlugin,
20
21
  OptionalPlugin<typeof analyticsPlugin>,
22
+ typeof guidelinePlugin,
21
23
  typeof gridPlugin,
22
24
  typeof widthPlugin,
23
25
  typeof decorationsPlugin,
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- import { NumericalCardDimensions } from '@atlaskit/media-card';
4
+ import type { NumericalCardDimensions } from '@atlaskit/media-card';
5
5
  export declare const MediaInlineNodeSelector = "media-inline-node";
6
6
  export declare const MediaSingleNodeSelector = "media-single-node";
7
7
  export declare const figureWrapper: import("@emotion/react").SerializedStyles;
@@ -5,7 +5,6 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
5
  import type { MediaClientConfig } from '@atlaskit/media-core';
6
6
  import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
7
7
  import type { ContextIdentifierProvider, MediaProvider } from '@atlaskit/editor-common/provider-factory';
8
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
9
8
  import type { WidthPluginState } from '@atlaskit/editor-plugin-width';
10
9
  import type { Dispatch } from '../../../event-dispatcher';
11
10
  import type { ProsemirrorGetPosHandler } from '../../../nodeviews';
@@ -15,6 +14,7 @@ import type { MediaStateEventSubscriber } from '../picker-facade';
15
14
  import PickerFacade from '../picker-facade';
16
15
  import type { MediaNodeWithPosHandler, MediaPluginState } from './types';
17
16
  import type { IntlShape } from 'react-intl-next';
17
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
18
18
  import type mediaPlugin from '../index';
19
19
  export type { MediaState, MediaProvider, MediaStateStatus };
20
20
  export { stateKey } from './plugin-key';
@@ -6,3 +6,4 @@ import type { MediaPluginState } from '../pm-plugins/types';
6
6
  export declare const getSelectedMediaContainerNodeAttrs: (mediaPluginState: MediaPluginState) => MediaBaseAttributes | null;
7
7
  export declare const downloadMedia: (mediaPluginState: MediaPluginState) => Promise<boolean>;
8
8
  export declare const removeMediaGroupNode: (state: EditorState) => import("prosemirror-state").Transaction;
9
+ export declare const getSelectedMediaSingle: (state: EditorState) => import("prosemirror-utils").ContentNodeWithPos | undefined;
@@ -10,6 +10,7 @@ import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
10
10
  import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
11
11
  import type { PlaceholderTextOptions } from '../../plugins/placeholder-text/types';
12
12
  export type MediaStateStatus = 'unknown' | 'ready' | 'cancelled' | 'preview' | 'error' | 'mobile-upload-end';
13
+ export type MediaSingleWithType = 'pixel' | 'percentage';
13
14
  export interface MediaOptions {
14
15
  provider?: Providers['mediaProvider'];
15
16
  allowMediaSingle?: boolean | MediaSingleOptions;
@@ -0,0 +1,61 @@
1
+ /// <reference path="../../../../../../../../../typings/prosemirror.d.ts" />
2
+ /** @jsx jsx */
3
+ import React from 'react';
4
+ import { jsx } from '@emotion/react';
5
+ import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
6
+ import type { MediaClientConfig } from '@atlaskit/media-core';
7
+ import type { Props } from './types';
8
+ import type { Dimensions } from '@atlaskit/editor-common/resizer';
9
+ import type { WrappedComponentProps } from 'react-intl-next';
10
+ type State = {
11
+ offsetLeft: number;
12
+ isVideoFile: boolean;
13
+ resizedPctWidth?: number;
14
+ isResizing: boolean;
15
+ size: Dimensions;
16
+ };
17
+ export declare const resizerNextTestId = "mediaSingle.resizerNext.testid";
18
+ export declare function calcOffsetLeft(insideInlineLike: boolean, insideLayout: boolean, pmViewDom: Element, wrapper?: HTMLElement): number;
19
+ type ResizableMediaSingleNextProps = Props & WrappedComponentProps;
20
+ declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSingleNextProps, State> {
21
+ constructor(props: ResizableMediaSingleNextProps);
22
+ /**
23
+ * Calculate media single node initial width if props.mediaSingleWidth is undefined
24
+ * (Mainly when switching from lagacy experience to new experience).
25
+ *
26
+ * @returns initial width in pixel
27
+ */
28
+ calcInitialWidth(): number;
29
+ componentDidUpdate(prevProps: Props, prevState: State): boolean;
30
+ isNestedNode(): boolean;
31
+ private getDefaultGuidelines;
32
+ private getSnaps;
33
+ get wrappedLayout(): boolean;
34
+ componentDidMount(): Promise<void>;
35
+ UNSAFE_componentWillReceiveProps(nextProps: Props): void;
36
+ checkVideoFile(viewMediaClientConfig?: MediaClientConfig): Promise<void>;
37
+ calcNewSize: (newWidth: number, stop: boolean) => {
38
+ width: number | null;
39
+ layout: MediaSingleLayout;
40
+ };
41
+ calcUnwrappedLayout: (width: number, containerWidth: number, contentWidth: number) => 'center' | 'wide' | 'full-width';
42
+ get $pos(): import("prosemirror-model").ResolvedPos | null;
43
+ /**
44
+ * The maxmimum number of grid columns this node can resize to.
45
+ */
46
+ get gridWidth(): number;
47
+ calcColumnLeftOffset: () => number;
48
+ wrapper?: HTMLElement;
49
+ calcPxHeight: (newWidth: number) => number;
50
+ get insideInlineLike(): boolean;
51
+ get insideLayout(): boolean;
52
+ private saveWrapper;
53
+ private displayGuideline;
54
+ private setIsResizing;
55
+ render(): jsx.JSX.Element;
56
+ }
57
+ export { ResizableMediaSingleNext as UnwrappedResizableMediaSingleNext };
58
+ declare const _default: React.FC<import("react-intl-next").WithIntlProps<ResizableMediaSingleNextProps>> & {
59
+ WrappedComponent: React.ComponentType<ResizableMediaSingleNextProps>;
60
+ };
61
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import type { GuidelineConfig } from '@atlaskit/editor-common/guideline';
2
+ import type { EditorView } from 'prosemirror-view';
3
+ export declare const generateDefaultGuidelines: (editorWidth: number, containerWidth: number, isFullWidthMode?: boolean | undefined) => GuidelineConfig[];
4
+ export declare const generateDynamicGuidelines: (view: EditorView) => GuidelineConfig[];
@@ -0,0 +1,7 @@
1
+ export declare const messages: {
2
+ fullWidthImage: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ };
@@ -22,5 +22,6 @@ export type Props = MediaSingleProps & {
22
22
  viewMediaClientConfig?: MediaClientConfig;
23
23
  fullWidthMode?: boolean;
24
24
  dispatchAnalyticsEvent: DispatchAnalyticsEvent;
25
+ mediaSingleWidth?: number;
25
26
  pluginInjectionApi: ExtractInjectionAPI<typeof mediaPlugin> | undefined;
26
27
  };
@@ -1,12 +1,13 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { WrappedComponentProps } from 'react-intl-next';
3
+ import type { WrappedComponentProps } from 'react-intl-next';
4
4
  import { Modes } from '../types';
5
5
  interface Props {
6
6
  onSearch: (value: string) => void;
7
7
  mode: keyof typeof Modes;
8
8
  focus: boolean;
9
9
  onClick: (e: React.MouseEvent) => void;
10
+ onKeyDown: (e: React.KeyboardEvent) => void;
10
11
  searchTerm?: string;
11
12
  }
12
13
  declare const MemoizedElementSearchWithAnalytics: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<Props & WrappedComponentProps<"intl">, "intl"> & {
@@ -1,9 +1,9 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
4
- import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
5
- import { Category, Modes } from '../types';
6
- import { EmptyStateHandler } from '../../../types/empty-state-handler';
3
+ import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
4
+ import type { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
5
+ import type { Category, Modes } from '../types';
6
+ import type { EmptyStateHandler } from '../../../types/empty-state-handler';
7
7
  export type StatelessElementBrowserProps = {
8
8
  categories?: Category[];
9
9
  items: QuickInsertItem[];
@@ -0,0 +1,8 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ interface Props {
4
+ label: string;
5
+ containerWidth: number;
6
+ }
7
+ declare const ResizeLabel: (props: Props) => jsx.JSX.Element;
8
+ export default ResizeLabel;
@@ -0,0 +1,3 @@
1
+ export declare const wrapper: import("@emotion/react").SerializedStyles;
2
+ export declare const text: import("@emotion/react").SerializedStyles;
3
+ export declare const smallText: import("@emotion/react").SerializedStyles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.8.11",
3
+ "version": "187.9.0",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -55,7 +55,7 @@
55
55
  "@atlaskit/code": "^14.6.0",
56
56
  "@atlaskit/date": "^0.10.0",
57
57
  "@atlaskit/datetime-picker": "^12.7.0",
58
- "@atlaskit/editor-common": "^74.32.0",
58
+ "@atlaskit/editor-common": "^74.33.0",
59
59
  "@atlaskit/editor-json-transformer": "^8.10.0",
60
60
  "@atlaskit/editor-markdown-transformer": "^5.2.5",
61
61
  "@atlaskit/editor-palette": "1.5.1",
package/report.api.md CHANGED
@@ -88,6 +88,7 @@ import { GapCursorSelection } from '@atlaskit/editor-common/selection';
88
88
  import { Side as GapCursorSide } from '@atlaskit/editor-common/selection';
89
89
  import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
90
90
  import type { gridPlugin } from '@atlaskit/editor-plugin-grid';
91
+ import type { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
91
92
  import type { HeadingLevelsAndNormalText } from '@atlaskit/editor-common/types';
92
93
  import type { HyperlinkPluginOptions } from '@atlaskit/editor-common/types';
93
94
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
@@ -1103,10 +1104,11 @@ export { FloatingToolbarListPicker };
1103
1104
  export const floatingToolbarPluginKey: PluginKey<FloatingToolbarPluginState>;
1104
1105
 
1105
1106
  // @public (undocumented)
1106
- export type FloatingToolbarPluginState = Record<
1107
- 'getConfigWithNodeInfo',
1108
- (state: EditorState) => ConfigWithNodeInfo | null | undefined
1109
- >;
1107
+ export type FloatingToolbarPluginState = {
1108
+ getConfigWithNodeInfo: (
1109
+ state: EditorState,
1110
+ ) => ConfigWithNodeInfo | null | undefined;
1111
+ };
1110
1112
 
1111
1113
  export { FloatingToolbarSelect };
1112
1114
 
@@ -1418,6 +1420,7 @@ export const mediaPlugin: NextEditorPlugin<
1418
1420
  dependencies: [
1419
1421
  typeof featureFlagsPlugin,
1420
1422
  OptionalPlugin<typeof analyticsPlugin>,
1423
+ typeof guidelinePlugin,
1421
1424
  typeof gridPlugin,
1422
1425
  typeof widthPlugin,
1423
1426
  typeof decorationsPlugin,