@atlaskit/editor-common 75.3.0 → 75.4.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 (46) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/hooks/useSharedPluginState.js +39 -3
  3. package/dist/cjs/monitoring/error.js +1 -1
  4. package/dist/cjs/preset/builder.js +48 -48
  5. package/dist/cjs/ui/DropList/index.js +1 -1
  6. package/dist/cjs/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.js +6 -6
  7. package/dist/cjs/ui-menu/Dropdown/index.js +3 -2
  8. package/dist/cjs/ui-menu/DropdownMenu/index.js +2 -2
  9. package/dist/cjs/ui-menu/ToolbarArrowKeyNavigationProvider/index.js +8 -8
  10. package/dist/cjs/ui-menu/ToolbarButton/index.js +1 -1
  11. package/dist/cjs/ui-react/with-react-editor-view-outer-listeners.js +4 -5
  12. package/dist/es2019/hooks/useSharedPluginState.js +41 -5
  13. package/dist/es2019/monitoring/error.js +1 -1
  14. package/dist/es2019/preset/builder.js +48 -48
  15. package/dist/es2019/ui/DropList/index.js +1 -1
  16. package/dist/es2019/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.js +6 -6
  17. package/dist/es2019/ui-menu/Dropdown/index.js +3 -2
  18. package/dist/es2019/ui-menu/DropdownMenu/index.js +3 -2
  19. package/dist/es2019/ui-menu/ToolbarArrowKeyNavigationProvider/index.js +8 -8
  20. package/dist/es2019/ui-menu/ToolbarButton/index.js +1 -1
  21. package/dist/es2019/ui-react/with-react-editor-view-outer-listeners.js +4 -5
  22. package/dist/esm/hooks/useSharedPluginState.js +40 -4
  23. package/dist/esm/monitoring/error.js +1 -1
  24. package/dist/esm/preset/builder.js +48 -48
  25. package/dist/esm/ui/DropList/index.js +1 -1
  26. package/dist/esm/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.js +6 -6
  27. package/dist/esm/ui-menu/Dropdown/index.js +3 -2
  28. package/dist/esm/ui-menu/DropdownMenu/index.js +3 -2
  29. package/dist/esm/ui-menu/ToolbarArrowKeyNavigationProvider/index.js +8 -8
  30. package/dist/esm/ui-menu/ToolbarButton/index.js +1 -1
  31. package/dist/esm/ui-react/with-react-editor-view-outer-listeners.js +4 -5
  32. package/dist/types/analytics/types/inline-comment-events.d.ts +2 -2
  33. package/dist/types/hooks/useSharedPluginState.d.ts +29 -0
  34. package/dist/types/types/floating-toolbar.d.ts +4 -3
  35. package/dist/types/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.d.ts +1 -1
  36. package/dist/types/ui-menu/Dropdown/index.d.ts +3 -2
  37. package/dist/types/ui-menu/DropdownMenu/index.d.ts +1 -2
  38. package/dist/types/ui-menu/ToolbarButton/index.d.ts +3 -3
  39. package/dist/types-ts4.5/analytics/types/inline-comment-events.d.ts +2 -2
  40. package/dist/types-ts4.5/hooks/useSharedPluginState.d.ts +29 -0
  41. package/dist/types-ts4.5/types/floating-toolbar.d.ts +4 -3
  42. package/dist/types-ts4.5/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.d.ts +1 -1
  43. package/dist/types-ts4.5/ui-menu/Dropdown/index.d.ts +3 -2
  44. package/dist/types-ts4.5/ui-menu/DropdownMenu/index.d.ts +1 -2
  45. package/dist/types-ts4.5/ui-menu/ToolbarButton/index.d.ts +3 -3
  46. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import React, { PureComponent } from 'react';
2
- import { OpenChangedEvent } from '../../ui/DropList';
3
- import { ArrowKeyNavigationProviderOptions } from '../ArrowKeyNavigationProvider/types';
2
+ import type { OpenChangedEvent } from '../../ui/DropList';
3
+ import type { ArrowKeyNavigationProviderOptions } from '../ArrowKeyNavigationProvider/types';
4
4
  export interface Props {
5
5
  mountTo?: HTMLElement;
6
6
  boundariesElement?: HTMLElement;
@@ -13,6 +13,7 @@ export interface Props {
13
13
  zIndex?: number;
14
14
  arrowKeyNavigationProviderOptions: ArrowKeyNavigationProviderOptions;
15
15
  dropdownListId?: string;
16
+ alignDropdownWithParentElement?: boolean;
16
17
  }
17
18
  export interface State {
18
19
  target?: HTMLElement;
@@ -1,7 +1,6 @@
1
- /** @jsx jsx */
2
1
  import React, { PureComponent } from 'react';
3
2
  import { jsx } from '@emotion/react';
4
- import { Props, State } from './types';
3
+ import type { Props, State } from './types';
5
4
  export type { MenuItem } from './types';
6
5
  /**
7
6
  * Wrapper around @atlaskit/droplist which uses Popup and Portal to render
@@ -1,9 +1,9 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { ButtonProps } from '@atlaskit/button/types';
4
- import { PositionType } from '@atlaskit/tooltip';
3
+ import type { ButtonProps } from '@atlaskit/button/types';
4
+ import type { PositionType } from '@atlaskit/tooltip';
5
5
  import { TOOLBAR_ACTION_SUBJECT_ID } from '../../analytics';
6
- import { MenuItem } from '../DropdownMenu';
6
+ import type { MenuItem } from '../DropdownMenu';
7
7
  export declare const TOOLBAR_BUTTON: typeof TOOLBAR_ACTION_SUBJECT_ID;
8
8
  export type Props = {
9
9
  buttonId?: TOOLBAR_ACTION_SUBJECT_ID;
@@ -1,5 +1,5 @@
1
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD } from './enums';
2
- import { TrackAEP } from './utils';
1
+ import type { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD } from './enums';
2
+ import type { TrackAEP } from './utils';
3
3
  export type AnnotationActionType = ACTION.INSERTED | ACTION.CLOSED | ACTION.EDITED | ACTION.DELETED | ACTION.OPENED | ACTION.RESOLVED | ACTION.VIEWED;
4
4
  export type AnnotationAEP = TrackAEP<AnnotationActionType, ACTION_SUBJECT.ANNOTATION, ACTION_SUBJECT_ID.INLINE_COMMENT, AnnotationAEPAttributes, undefined>;
5
5
  export type AnnotationAEPAttributes = undefined | {} | AnnotationDraftAEPAttributes | AnnotationResolvedAEPAttributes;
@@ -4,6 +4,35 @@ type NamedPluginStatesFromInjectionAPI<API extends PublicPluginAPI<any> | undefi
4
4
  }>;
5
5
  type ExtractPluginNames<API extends PublicPluginAPI<any>> = API extends PublicPluginAPI<any> ? keyof API : never;
6
6
  /**
7
+ *
8
+ * ⚠️⚠️⚠️ This is a debounced hook ⚠️⚠️⚠️
9
+ * If the plugins you are listening to generate multiple shared states while the user is typing,
10
+ * your React Component will get only the last one.
11
+ *
12
+ * Usually, for UI updates, you may need only the last state. But, if you have a specific scenario requiring you to access all states,
13
+ * do not use this hook. Instead, you can subscribe directly to the plugin sharedState API:
14
+ *
15
+ * ```typescript
16
+ *
17
+ * function ExampleSpecialCase({ api }: Props) {
18
+ * const [dogState, setDogState] = React.useState(null);
19
+ * useEffect(() => {
20
+ * const unsub = api.dog.sharedState.onChange(({ nextSharedState, prevSharedState }) => {
21
+ * setDogState(nextSharedState);
22
+ * });
23
+ *
24
+ * return unsub;
25
+ * }, [api]);
26
+ *
27
+ * useEffect(() => {
28
+ * someCriticalAndWeirdUseCase(dogState);
29
+ *
30
+ * }, [dogState]);
31
+ *
32
+ * return null;
33
+ * }
34
+ *
35
+ * ```
7
36
  *
8
37
  * Used to return the current plugin state of
9
38
  * input dependencies
@@ -1,8 +1,8 @@
1
1
  import type React from 'react';
2
- import { IntlShape } from 'react-intl-next';
3
- import { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
2
+ import type { IntlShape } from 'react-intl-next';
3
+ import type { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
5
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
5
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
6
  import type { EmojiId } from '@atlaskit/emoji/types';
7
7
  import type { DispatchAnalyticsEvent } from '../analytics/types/dispatch-analytics-event';
8
8
  import type { ProviderFactory } from '../provider-factory';
@@ -191,6 +191,7 @@ export type FloatingToolbarDropdown<T extends {}> = {
191
191
  tooltip?: string;
192
192
  dropdownWidth?: number;
193
193
  showSelected?: boolean;
194
+ alignDropdownWithToolbar?: boolean;
194
195
  };
195
196
  type FloatingToolbarExtensionsPlaceholder = {
196
197
  type: 'extensions-placeholder';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { MenuArrowKeyNavigationProviderProps } from '../types';
2
+ import type { MenuArrowKeyNavigationProviderProps } from '../types';
3
3
  /**
4
4
  * This component is a wrapper of vertical menus which listens to keydown events of children
5
5
  * and handles up/down arrow key navigation
@@ -1,6 +1,6 @@
1
1
  import React, { PureComponent } from 'react';
2
- import { OpenChangedEvent } from '../../ui/DropList';
3
- import { ArrowKeyNavigationProviderOptions } from '../ArrowKeyNavigationProvider/types';
2
+ import type { OpenChangedEvent } from '../../ui/DropList';
3
+ import type { ArrowKeyNavigationProviderOptions } from '../ArrowKeyNavigationProvider/types';
4
4
  export interface Props {
5
5
  mountTo?: HTMLElement;
6
6
  boundariesElement?: HTMLElement;
@@ -13,6 +13,7 @@ export interface Props {
13
13
  zIndex?: number;
14
14
  arrowKeyNavigationProviderOptions: ArrowKeyNavigationProviderOptions;
15
15
  dropdownListId?: string;
16
+ alignDropdownWithParentElement?: boolean;
16
17
  }
17
18
  export interface State {
18
19
  target?: HTMLElement;
@@ -1,7 +1,6 @@
1
- /** @jsx jsx */
2
1
  import React, { PureComponent } from 'react';
3
2
  import { jsx } from '@emotion/react';
4
- import { Props, State } from './types';
3
+ import type { Props, State } from './types';
5
4
  export type { MenuItem } from './types';
6
5
  /**
7
6
  * Wrapper around @atlaskit/droplist which uses Popup and Portal to render
@@ -1,9 +1,9 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { ButtonProps } from '@atlaskit/button/types';
4
- import { PositionType } from '@atlaskit/tooltip';
3
+ import type { ButtonProps } from '@atlaskit/button/types';
4
+ import type { PositionType } from '@atlaskit/tooltip';
5
5
  import { TOOLBAR_ACTION_SUBJECT_ID } from '../../analytics';
6
- import { MenuItem } from '../DropdownMenu';
6
+ import type { MenuItem } from '../DropdownMenu';
7
7
  export declare const TOOLBAR_BUTTON: typeof TOOLBAR_ACTION_SUBJECT_ID;
8
8
  export type Props = {
9
9
  buttonId?: TOOLBAR_ACTION_SUBJECT_ID;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "75.3.0",
3
+ "version": "75.4.0",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"