@atlaskit/editor-plugin-expand 1.3.0 → 1.3.2

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 (77) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/legacyExpand/nodeviews/index.js +18 -5
  3. package/dist/cjs/singlePlayerExpand/commands.js +134 -0
  4. package/dist/cjs/singlePlayerExpand/node-views/index.js +381 -0
  5. package/dist/cjs/singlePlayerExpand/plugin.js +72 -9
  6. package/dist/cjs/singlePlayerExpand/pm-plugins/keymap.js +121 -0
  7. package/dist/cjs/singlePlayerExpand/pm-plugins/main.js +68 -0
  8. package/dist/cjs/singlePlayerExpand/toolbar.js +59 -0
  9. package/dist/cjs/singlePlayerExpand/ui/ExpandButton.js +87 -0
  10. package/dist/cjs/singlePlayerExpand/ui/NodeView.js +59 -0
  11. package/dist/cjs/singlePlayerExpand/utils.js +35 -0
  12. package/dist/es2019/index.js +0 -2
  13. package/dist/es2019/legacyExpand/nodeviews/index.js +18 -5
  14. package/dist/es2019/legacyExpand/pm-plugins/keymap.js +1 -2
  15. package/dist/es2019/singlePlayerExpand/commands.js +118 -0
  16. package/dist/es2019/singlePlayerExpand/node-views/index.js +370 -0
  17. package/dist/es2019/singlePlayerExpand/plugin.js +69 -10
  18. package/dist/es2019/singlePlayerExpand/pm-plugins/keymap.js +137 -0
  19. package/dist/es2019/singlePlayerExpand/pm-plugins/main.js +53 -0
  20. package/dist/es2019/singlePlayerExpand/toolbar.js +51 -0
  21. package/dist/es2019/singlePlayerExpand/ui/ExpandButton.js +77 -0
  22. package/dist/es2019/singlePlayerExpand/ui/NodeView.js +52 -0
  23. package/dist/es2019/singlePlayerExpand/utils.js +5 -0
  24. package/dist/esm/index.js +0 -2
  25. package/dist/esm/legacyExpand/nodeviews/index.js +18 -5
  26. package/dist/esm/legacyExpand/pm-plugins/keymap.js +1 -2
  27. package/dist/esm/singlePlayerExpand/commands.js +128 -0
  28. package/dist/esm/singlePlayerExpand/node-views/index.js +373 -0
  29. package/dist/esm/singlePlayerExpand/plugin.js +71 -10
  30. package/dist/esm/singlePlayerExpand/pm-plugins/keymap.js +115 -0
  31. package/dist/esm/singlePlayerExpand/pm-plugins/main.js +60 -0
  32. package/dist/esm/singlePlayerExpand/toolbar.js +52 -0
  33. package/dist/esm/singlePlayerExpand/ui/ExpandButton.js +77 -0
  34. package/dist/esm/singlePlayerExpand/ui/NodeView.js +53 -0
  35. package/dist/esm/singlePlayerExpand/utils.js +5 -0
  36. package/dist/types/index.d.ts +1 -1
  37. package/dist/types/legacyExpand/nodeviews/index.d.ts +1 -1
  38. package/dist/types/legacyExpand/plugin.d.ts +1 -1
  39. package/dist/types/legacyExpand/pm-plugins/keymap.d.ts +1 -1
  40. package/dist/types/legacyExpand/pm-plugins/main.d.ts +2 -2
  41. package/dist/types/legacyExpand/pm-plugins/plugin-factory.d.ts +1 -1
  42. package/dist/types/legacyExpand/reducer.d.ts +1 -1
  43. package/dist/types/legacyExpand/toolbar.d.ts +1 -1
  44. package/dist/types/plugin.d.ts +1 -1
  45. package/dist/types/singlePlayerExpand/commands.d.ts +15 -0
  46. package/dist/types/singlePlayerExpand/node-views/index.d.ts +51 -0
  47. package/dist/types/singlePlayerExpand/plugin.d.ts +1 -1
  48. package/dist/types/singlePlayerExpand/pm-plugins/keymap.d.ts +6 -0
  49. package/dist/types/singlePlayerExpand/pm-plugins/main.d.ts +9 -0
  50. package/dist/types/singlePlayerExpand/toolbar.d.ts +3 -0
  51. package/dist/types/singlePlayerExpand/ui/ExpandButton.d.ts +13 -0
  52. package/dist/types/singlePlayerExpand/ui/NodeView.d.ts +5 -0
  53. package/dist/types/singlePlayerExpand/utils.d.ts +3 -0
  54. package/dist/{types-ts4.5/legacyExpand → types}/types.d.ts +1 -1
  55. package/dist/types-ts4.5/index.d.ts +1 -1
  56. package/dist/types-ts4.5/legacyExpand/nodeviews/index.d.ts +1 -1
  57. package/dist/types-ts4.5/legacyExpand/plugin.d.ts +1 -1
  58. package/dist/types-ts4.5/legacyExpand/pm-plugins/keymap.d.ts +1 -1
  59. package/dist/types-ts4.5/legacyExpand/pm-plugins/main.d.ts +2 -2
  60. package/dist/types-ts4.5/legacyExpand/pm-plugins/plugin-factory.d.ts +1 -1
  61. package/dist/types-ts4.5/legacyExpand/reducer.d.ts +1 -1
  62. package/dist/types-ts4.5/legacyExpand/toolbar.d.ts +1 -1
  63. package/dist/types-ts4.5/plugin.d.ts +1 -1
  64. package/dist/types-ts4.5/singlePlayerExpand/commands.d.ts +15 -0
  65. package/dist/types-ts4.5/singlePlayerExpand/node-views/index.d.ts +51 -0
  66. package/dist/types-ts4.5/singlePlayerExpand/plugin.d.ts +1 -1
  67. package/dist/types-ts4.5/singlePlayerExpand/pm-plugins/keymap.d.ts +6 -0
  68. package/dist/types-ts4.5/singlePlayerExpand/pm-plugins/main.d.ts +9 -0
  69. package/dist/types-ts4.5/singlePlayerExpand/toolbar.d.ts +3 -0
  70. package/dist/types-ts4.5/singlePlayerExpand/ui/ExpandButton.d.ts +13 -0
  71. package/dist/types-ts4.5/singlePlayerExpand/ui/NodeView.d.ts +5 -0
  72. package/dist/types-ts4.5/singlePlayerExpand/utils.d.ts +3 -0
  73. package/dist/{types/legacyExpand → types-ts4.5}/types.d.ts +1 -1
  74. package/package.json +5 -5
  75. /package/dist/cjs/{legacyExpand/types.js → types.js} +0 -0
  76. /package/dist/es2019/{legacyExpand/types.js → types.js} +0 -0
  77. /package/dist/esm/{legacyExpand/types.js → types.js} +0 -0
@@ -0,0 +1,52 @@
1
+ import commonMessages from '@atlaskit/editor-common/messages';
2
+ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
3
+ import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
4
+ import { deleteExpand } from './commands';
5
+ import { findParentExpandNode } from './utils';
6
+ export var getToolbarConfig = function getToolbarConfig(api) {
7
+ return function (state, _ref) {
8
+ var _api$decorations$acti, _api$decorations, _api$analytics;
9
+ var formatMessage = _ref.formatMessage;
10
+ var _ref2 = (_api$decorations$acti = api === null || api === void 0 || (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions) !== null && _api$decorations$acti !== void 0 ? _api$decorations$acti : {},
11
+ hoverDecoration = _ref2.hoverDecoration;
12
+ var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
13
+ var selectedExpandNode = findParentExpandNode(state);
14
+ if (selectedExpandNode) {
15
+ var _state$schema$nodes = state.schema.nodes,
16
+ nestedExpand = _state$schema$nodes.nestedExpand,
17
+ expand = _state$schema$nodes.expand;
18
+ return {
19
+ title: 'Expand toolbar',
20
+ getDomRef: function getDomRef(view) {
21
+ return findDomRefAtPos(selectedExpandNode.pos, view.domAtPos.bind(view));
22
+ },
23
+ nodeType: [nestedExpand, expand],
24
+ offset: [0, 6],
25
+ items: [{
26
+ type: 'copy-button',
27
+ items: [{
28
+ state: state,
29
+ formatMessage: formatMessage,
30
+ nodeType: [nestedExpand, expand]
31
+ }, {
32
+ type: 'separator'
33
+ }]
34
+ }, {
35
+ id: 'editor.expand.delete',
36
+ type: 'button',
37
+ appearance: 'danger',
38
+ focusEditoronEnter: true,
39
+ icon: RemoveIcon,
40
+ onClick: deleteExpand(editorAnalyticsAPI),
41
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], true),
42
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], false),
43
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], true),
44
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], false),
45
+ title: formatMessage(commonMessages.remove),
46
+ tabIndex: null
47
+ }]
48
+ };
49
+ }
50
+ return;
51
+ };
52
+ };
@@ -0,0 +1,77 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ var _excluded = ["buttonStyles"];
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
+ /** @jsx jsx */
8
+ import React, { useCallback } from 'react';
9
+ import { jsx } from '@emotion/react';
10
+ import Button from '@atlaskit/button/custom-theme-button';
11
+ import { expandClassNames } from '@atlaskit/editor-common/styles';
12
+ import { expandLayoutWrapperStyle, ExpandLayoutWrapperWithRef, expandMessages } from '@atlaskit/editor-common/ui';
13
+ import { akEditorSwoopCubicBezier } from '@atlaskit/editor-shared-styles';
14
+ import ChevronRightIcon from '@atlaskit/icon/glyph/chevron-right';
15
+ import Tooltip from '@atlaskit/tooltip';
16
+ function withTooltip(Component) {
17
+ return function WithTooltip(props) {
18
+ return jsx(Tooltip, {
19
+ content: props.label,
20
+ position: "top",
21
+ tag: ExpandLayoutWrapperWithRef
22
+ }, jsx(Component, props));
23
+ };
24
+ }
25
+ export var ExpandButtonInner = function ExpandButtonInner(props) {
26
+ var useTheme = useCallback(function (currentTheme, themeProps) {
27
+ var _currentTheme = currentTheme(themeProps),
28
+ buttonStyles = _currentTheme.buttonStyles,
29
+ rest = _objectWithoutProperties(_currentTheme, _excluded);
30
+ return _objectSpread({
31
+ buttonStyles: _objectSpread(_objectSpread({}, buttonStyles), {}, {
32
+ height: '100%',
33
+ '& svg': {
34
+ transform: props.expanded ? 'transform: rotate(90deg);' : 'transform: rotate(0deg);',
35
+ transition: "transform 0.2s ".concat(akEditorSwoopCubicBezier, ";")
36
+ }
37
+ })
38
+ }, rest);
39
+ }, [props]);
40
+ return jsx(Button, {
41
+ appearance: "subtle",
42
+ className: expandClassNames.iconContainer,
43
+ iconBefore: jsx(ChevronRightIcon, {
44
+ label: ''
45
+ }),
46
+ shouldFitContainer: true,
47
+ theme: useTheme,
48
+ "aria-expanded": props.expanded,
49
+ isDisabled: !props.allowInteractiveExpand
50
+ });
51
+ };
52
+ var ButtonWithTooltip = withTooltip(ExpandButtonInner);
53
+ var ButtonWithoutTooltip = ExpandButtonInner;
54
+ export var ExpandButton = function ExpandButton(props) {
55
+ var expanded = props.expanded,
56
+ intl = props.intl;
57
+ var message = expanded ? expandMessages.collapseNode : expandMessages.expandNode;
58
+ var label = intl && intl.formatMessage(message) || message.defaultMessage;
59
+ // check to ensure device supports any-hover
60
+ var supportsAnyHover = !!window.matchMedia ? window.matchMedia('(any-hover: hover)').matches !== window.matchMedia('(any-hover: none)').matches : false;
61
+ var hoverEventCheck = supportsAnyHover ? window.matchMedia('(any-hover: hover)').matches : true;
62
+
63
+ // hoverEventCheck is to disable tooltips for mobile to prevent incorrect hover state causing issues on iOS
64
+ if (props.allowInteractiveExpand && hoverEventCheck) {
65
+ return jsx(ButtonWithTooltip, _extends({
66
+ label: label
67
+ }, props));
68
+ }
69
+ return (
70
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
71
+ jsx("div", {
72
+ css: expandLayoutWrapperStyle
73
+ }, jsx(ButtonWithoutTooltip, _extends({
74
+ label: label
75
+ }, props)))
76
+ );
77
+ };
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import { expandClassNames } from '@atlaskit/editor-common/styles';
4
+ import { expandMessages } from '@atlaskit/editor-common/ui';
5
+ import { ExpandButton } from '../ui/ExpandButton';
6
+
7
+ // TODO: https://product-fabric.atlassian.net/browse/ED-22841
8
+ export var buildExpandClassName = function buildExpandClassName(type) {
9
+ return "".concat(expandClassNames.prefix, " ").concat(expandClassNames.type(type), "\n ").concat(expandClassNames.expanded);
10
+ };
11
+ export var toDOM = function toDOM(node, __livePage, intl) {
12
+ return ['div', {
13
+ // prettier-ignore
14
+ 'class': buildExpandClassName(node.type.name),
15
+ 'data-node-type': node.type.name,
16
+ 'data-title': node.attrs.title
17
+ }, ['div', {
18
+ // prettier-ignore
19
+ 'class': expandClassNames.titleContainer,
20
+ contenteditable: 'false',
21
+ // Element gains access to focus events.
22
+ // This is needed to prevent PM gaining access
23
+ // on interacting with our controls.
24
+ tabindex: '-1'
25
+ },
26
+ // prettier-ignore
27
+ ['div', {
28
+ 'class': expandClassNames.icon
29
+ }], ['div', {
30
+ // prettier-ignore
31
+ 'class': expandClassNames.inputContainer
32
+ }, ['input', {
33
+ // prettier-ignore
34
+ 'class': expandClassNames.titleInput,
35
+ value: node.attrs.title,
36
+ placeholder: intl && intl.formatMessage(expandMessages.expandPlaceholderText) || expandMessages.expandPlaceholderText.defaultMessage,
37
+ type: 'text'
38
+ }]]],
39
+ // prettier-ignore
40
+ ['div', {
41
+ 'class': expandClassNames.content
42
+ }, 0]];
43
+ };
44
+ export var renderIcon = function renderIcon(icon, allowInteractiveExpand, intl, node) {
45
+ if (!icon) {
46
+ return;
47
+ }
48
+ ReactDOM.render( /*#__PURE__*/React.createElement(ExpandButton, {
49
+ intl: intl,
50
+ allowInteractiveExpand: allowInteractiveExpand,
51
+ expanded: true // TO-DO https://product-fabric.atlassian.net/browse/ED-22841
52
+ }), icon);
53
+ };
@@ -0,0 +1,5 @@
1
+ import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
2
+ export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
3
+ export var findParentExpandNode = function findParentExpandNode(state) {
4
+ return findParentNodeOfType(state.schema.nodes.expand)(state.selection) || findParentNodeOfType(state.schema.nodes.nestedExpand)(state.selection);
5
+ };
@@ -1,2 +1,2 @@
1
- export type { ExpandPlugin, ExpandPluginState, ExpandPluginOptions, } from './legacyExpand/types';
1
+ export type { ExpandPlugin, ExpandPluginState, ExpandPluginOptions, } from './types';
2
2
  export { expandPlugin } from './plugin';
@@ -3,7 +3,7 @@ import type { SetSelectionRelativeToNode } from '@atlaskit/editor-common/selecti
3
3
  import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
4
4
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
5
5
  import type { Decoration, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
6
- import type { ExpandPlugin } from '../types';
6
+ import type { ExpandPlugin } from '../../types';
7
7
  export declare class ExpandNodeView implements NodeView {
8
8
  private selectNearNode;
9
9
  private __livePage;
@@ -1,3 +1,3 @@
1
- import type { ExpandPlugin } from './types';
1
+ import type { ExpandPlugin } from '../types';
2
2
  export { pluginKey } from './pm-plugins/plugin-factory';
3
3
  export declare const expandPlugin: ExpandPlugin;
@@ -1,6 +1,6 @@
1
1
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { ExpandPlugin } from '../types';
3
+ import type { ExpandPlugin } from '../../types';
4
4
  export declare function expandKeymap(api: ExtractInjectionAPI<ExpandPlugin> | undefined, options: {
5
5
  __livePage?: boolean;
6
6
  }): SafePlugin;
@@ -2,6 +2,6 @@ import type { IntlShape } from 'react-intl-next';
2
2
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
- import type { ExpandPlugin } from '../types';
5
+ import type { ExpandPlugin } from '../../types';
6
6
  export declare function containsClass(element: Element | null, className: string): boolean;
7
- export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorAppearance | undefined, useLongPressSelection: boolean | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean) => SafePlugin<import("../types").ExpandPluginState>;
7
+ export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorAppearance | undefined, useLongPressSelection: boolean | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean) => SafePlugin<import("../../types").ExpandPluginState>;
@@ -1,3 +1,3 @@
1
1
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
2
  export declare const pluginKey: PluginKey<any>;
3
- export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: import("../types").ExpandPluginState | ((state: import("prosemirror-state").EditorState) => import("../types").ExpandPluginState)) => import("prosemirror-state").SafeStateField<import("../types").ExpandPluginState>, createCommand: <A = import("../types").ExpandPluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("../types").ExpandPluginState;
3
+ export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: import("../..").ExpandPluginState | ((state: import("prosemirror-state").EditorState) => import("../..").ExpandPluginState)) => import("prosemirror-state").SafeStateField<import("../..").ExpandPluginState>, createCommand: <A = import("../../types").ExpandPluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("../..").ExpandPluginState;
@@ -1,3 +1,3 @@
1
- import type { ExpandPluginAction, ExpandPluginState } from './types';
1
+ import type { ExpandPluginAction, ExpandPluginState } from '../types';
2
2
  declare const _default: (pluginState: ExpandPluginState, action: ExpandPluginAction) => ExpandPluginState;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
1
  import type { ExtractInjectionAPI, FloatingToolbarHandler } from '@atlaskit/editor-common/types';
2
- import type { ExpandPlugin } from './types';
2
+ import type { ExpandPlugin } from '../types';
3
3
  export declare const getToolbarConfig: (api: ExtractInjectionAPI<ExpandPlugin> | undefined) => FloatingToolbarHandler;
@@ -1,2 +1,2 @@
1
- import type { ExpandPlugin } from './legacyExpand/types';
1
+ import type { ExpandPlugin } from './types';
2
2
  export declare const expandPlugin: ExpandPlugin;
@@ -0,0 +1,15 @@
1
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
+ import type { Command } from '@atlaskit/editor-common/types';
3
+ import type { NodeType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
5
+ export declare const createExpandNode: (state: EditorState) => PMNode | null;
6
+ export declare const insertExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
7
+ export declare const deleteExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
8
+ export declare const deleteExpandAtPos: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (expandNodePos: number, expandNode: PMNode) => Command;
9
+ export declare const setSelectionInsideExpand: (expandPos: number) => Command;
10
+ export declare const updateExpandTitle: ({ title, nodeType, pos, }: {
11
+ title: string;
12
+ pos: number;
13
+ nodeType: NodeType;
14
+ }) => Command;
15
+ export declare const focusTitle: (pos: number) => Command;
@@ -0,0 +1,51 @@
1
+ import type { IntlShape } from 'react-intl-next';
2
+ import type { SetSelectionRelativeToNode } from '@atlaskit/editor-common/selection';
3
+ import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
4
+ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
5
+ import type { Decoration, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
6
+ import type { ExpandPlugin } from '../../types';
7
+ export declare class ExpandNodeView implements NodeView {
8
+ private selectNearNode;
9
+ private __livePage;
10
+ node: PmNode;
11
+ view: EditorView;
12
+ dom: HTMLElement;
13
+ contentDOM?: HTMLElement;
14
+ icon?: HTMLElement | null;
15
+ input?: HTMLInputElement | null;
16
+ titleContainer?: HTMLElement | null;
17
+ content?: HTMLElement | null;
18
+ getPos: getPosHandlerNode;
19
+ intl: IntlShape;
20
+ allowInteractiveExpand: boolean;
21
+ isMobile: boolean;
22
+ api: ExtractInjectionAPI<ExpandPlugin> | undefined;
23
+ constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, selectNearNode: SetSelectionRelativeToNode | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean);
24
+ private focusTitle;
25
+ private handleIconKeyDown;
26
+ private handleClick;
27
+ private handleInput;
28
+ private handleFocus;
29
+ private handleTitleKeydown;
30
+ private deleteEmptyExpand;
31
+ private moveToOutsideOfTitle;
32
+ private isCollapsed;
33
+ private setRightGapCursor;
34
+ private setLeftGapCursor;
35
+ private handleArrowRightFromTitle;
36
+ private handleArrowLeftFromTitle;
37
+ stopEvent(event: Event): boolean;
38
+ ignoreMutation(mutationRecord: MutationRecord | {
39
+ type: 'selection';
40
+ target: Element;
41
+ }): boolean;
42
+ update(node: PmNode, _decorations: readonly Decoration[]): boolean;
43
+ destroy(): void;
44
+ }
45
+ export default function ({ getIntl, isMobile, api, allowInteractiveExpand, __livePage, }: {
46
+ getIntl: () => IntlShape;
47
+ isMobile: boolean;
48
+ api: ExtractInjectionAPI<ExpandPlugin> | undefined;
49
+ allowInteractiveExpand: boolean;
50
+ __livePage: boolean;
51
+ }): (node: PmNode, view: EditorView, getPos: getPosHandler) => NodeView;
@@ -1,2 +1,2 @@
1
- import type { ExpandPlugin } from '../legacyExpand/types';
1
+ import type { ExpandPlugin } from '../types';
2
2
  export declare const expandPlugin: ExpandPlugin;
@@ -0,0 +1,6 @@
1
+ import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { ExpandPlugin } from '../../types';
4
+ export declare function expandKeymap(api: ExtractInjectionAPI<ExpandPlugin> | undefined, options: {
5
+ __livePage?: boolean;
6
+ }): SafePlugin;
@@ -0,0 +1,9 @@
1
+ import type { IntlShape } from 'react-intl-next';
2
+ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
+ import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
+ import type { ExpandPlugin } from '../../types';
7
+ export declare const pluginKey: PluginKey<any>;
8
+ export declare function containsClass(element: Element | null, className: string): boolean;
9
+ export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorAppearance | undefined, useLongPressSelection: boolean | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean) => SafePlugin<any>;
@@ -0,0 +1,3 @@
1
+ import type { ExtractInjectionAPI, FloatingToolbarHandler } from '@atlaskit/editor-common/types';
2
+ import type { ExpandPlugin } from '../types';
3
+ export declare const getToolbarConfig: (api: ExtractInjectionAPI<ExpandPlugin> | undefined) => FloatingToolbarHandler;
@@ -0,0 +1,13 @@
1
+ import { jsx } from '@emotion/react';
2
+ import type { IntlShape } from 'react-intl-next';
3
+ interface ExpandIconButtonProps {
4
+ allowInteractiveExpand: boolean;
5
+ expanded: boolean;
6
+ intl?: IntlShape;
7
+ }
8
+ interface ExpandIconButtonWithLabelProps extends ExpandIconButtonProps {
9
+ label: string;
10
+ }
11
+ export declare const ExpandButtonInner: (props: ExpandIconButtonWithLabelProps) => jsx.JSX.Element;
12
+ export declare const ExpandButton: (props: ExpandIconButtonProps) => jsx.JSX.Element;
13
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { IntlShape } from 'react-intl-next';
2
+ import type { DOMOutputSpec, Node as PmNode } from '@atlaskit/editor-prosemirror/model';
3
+ export declare const buildExpandClassName: (type: string) => string;
4
+ export declare const toDOM: (node: PmNode, __livePage: boolean, intl?: IntlShape) => DOMOutputSpec;
5
+ export declare const renderIcon: (icon: HTMLElement | null, allowInteractiveExpand: boolean, intl?: IntlShape, node?: PmNode) => void;
@@ -0,0 +1,3 @@
1
+ import type { EditorState } from '@atlaskit/editor-prosemirror/dist/types/state';
2
+ export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, } from '@atlaskit/editor-common/transforms';
3
+ export declare const findParentExpandNode: (state: EditorState) => import("prosemirror-utils/dist/types").FindResult;
@@ -2,7 +2,7 @@ import type { EditorAppearance, LongPressSelectionPluginOptions, NextEditorPlugi
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
3
  import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
4
4
  import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
5
- import type { insertExpand } from './commands';
5
+ import type { insertExpand } from './legacyExpand/commands';
6
6
  export interface ExpandPluginState {
7
7
  expandRef?: HTMLDivElement | null;
8
8
  }
@@ -1,2 +1,2 @@
1
- export type { ExpandPlugin, ExpandPluginState, ExpandPluginOptions, } from './legacyExpand/types';
1
+ export type { ExpandPlugin, ExpandPluginState, ExpandPluginOptions, } from './types';
2
2
  export { expandPlugin } from './plugin';
@@ -3,7 +3,7 @@ import type { SetSelectionRelativeToNode } from '@atlaskit/editor-common/selecti
3
3
  import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
4
4
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
5
5
  import type { Decoration, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
6
- import type { ExpandPlugin } from '../types';
6
+ import type { ExpandPlugin } from '../../types';
7
7
  export declare class ExpandNodeView implements NodeView {
8
8
  private selectNearNode;
9
9
  private __livePage;
@@ -1,3 +1,3 @@
1
- import type { ExpandPlugin } from './types';
1
+ import type { ExpandPlugin } from '../types';
2
2
  export { pluginKey } from './pm-plugins/plugin-factory';
3
3
  export declare const expandPlugin: ExpandPlugin;
@@ -1,6 +1,6 @@
1
1
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { ExpandPlugin } from '../types';
3
+ import type { ExpandPlugin } from '../../types';
4
4
  export declare function expandKeymap(api: ExtractInjectionAPI<ExpandPlugin> | undefined, options: {
5
5
  __livePage?: boolean;
6
6
  }): SafePlugin;
@@ -2,6 +2,6 @@ import type { IntlShape } from 'react-intl-next';
2
2
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
- import type { ExpandPlugin } from '../types';
5
+ import type { ExpandPlugin } from '../../types';
6
6
  export declare function containsClass(element: Element | null, className: string): boolean;
7
- export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorAppearance | undefined, useLongPressSelection: boolean | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean) => SafePlugin<import("../types").ExpandPluginState>;
7
+ export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorAppearance | undefined, useLongPressSelection: boolean | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean) => SafePlugin<import("../../types").ExpandPluginState>;
@@ -1,3 +1,3 @@
1
1
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
2
  export declare const pluginKey: PluginKey<any>;
3
- export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: import("../types").ExpandPluginState | ((state: import("prosemirror-state").EditorState) => import("../types").ExpandPluginState)) => import("prosemirror-state").SafeStateField<import("../types").ExpandPluginState>, createCommand: <A = import("../types").ExpandPluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("../types").ExpandPluginState;
3
+ export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: import("../..").ExpandPluginState | ((state: import("prosemirror-state").EditorState) => import("../..").ExpandPluginState)) => import("prosemirror-state").SafeStateField<import("../..").ExpandPluginState>, createCommand: <A = import("../../types").ExpandPluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("../..").ExpandPluginState;
@@ -1,3 +1,3 @@
1
- import type { ExpandPluginAction, ExpandPluginState } from './types';
1
+ import type { ExpandPluginAction, ExpandPluginState } from '../types';
2
2
  declare const _default: (pluginState: ExpandPluginState, action: ExpandPluginAction) => ExpandPluginState;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
1
  import type { ExtractInjectionAPI, FloatingToolbarHandler } from '@atlaskit/editor-common/types';
2
- import type { ExpandPlugin } from './types';
2
+ import type { ExpandPlugin } from '../types';
3
3
  export declare const getToolbarConfig: (api: ExtractInjectionAPI<ExpandPlugin> | undefined) => FloatingToolbarHandler;
@@ -1,2 +1,2 @@
1
- import type { ExpandPlugin } from './legacyExpand/types';
1
+ import type { ExpandPlugin } from './types';
2
2
  export declare const expandPlugin: ExpandPlugin;
@@ -0,0 +1,15 @@
1
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
+ import type { Command } from '@atlaskit/editor-common/types';
3
+ import type { NodeType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
5
+ export declare const createExpandNode: (state: EditorState) => PMNode | null;
6
+ export declare const insertExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
7
+ export declare const deleteExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
8
+ export declare const deleteExpandAtPos: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (expandNodePos: number, expandNode: PMNode) => Command;
9
+ export declare const setSelectionInsideExpand: (expandPos: number) => Command;
10
+ export declare const updateExpandTitle: ({ title, nodeType, pos, }: {
11
+ title: string;
12
+ pos: number;
13
+ nodeType: NodeType;
14
+ }) => Command;
15
+ export declare const focusTitle: (pos: number) => Command;
@@ -0,0 +1,51 @@
1
+ import type { IntlShape } from 'react-intl-next';
2
+ import type { SetSelectionRelativeToNode } from '@atlaskit/editor-common/selection';
3
+ import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
4
+ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
5
+ import type { Decoration, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
6
+ import type { ExpandPlugin } from '../../types';
7
+ export declare class ExpandNodeView implements NodeView {
8
+ private selectNearNode;
9
+ private __livePage;
10
+ node: PmNode;
11
+ view: EditorView;
12
+ dom: HTMLElement;
13
+ contentDOM?: HTMLElement;
14
+ icon?: HTMLElement | null;
15
+ input?: HTMLInputElement | null;
16
+ titleContainer?: HTMLElement | null;
17
+ content?: HTMLElement | null;
18
+ getPos: getPosHandlerNode;
19
+ intl: IntlShape;
20
+ allowInteractiveExpand: boolean;
21
+ isMobile: boolean;
22
+ api: ExtractInjectionAPI<ExpandPlugin> | undefined;
23
+ constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, selectNearNode: SetSelectionRelativeToNode | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean);
24
+ private focusTitle;
25
+ private handleIconKeyDown;
26
+ private handleClick;
27
+ private handleInput;
28
+ private handleFocus;
29
+ private handleTitleKeydown;
30
+ private deleteEmptyExpand;
31
+ private moveToOutsideOfTitle;
32
+ private isCollapsed;
33
+ private setRightGapCursor;
34
+ private setLeftGapCursor;
35
+ private handleArrowRightFromTitle;
36
+ private handleArrowLeftFromTitle;
37
+ stopEvent(event: Event): boolean;
38
+ ignoreMutation(mutationRecord: MutationRecord | {
39
+ type: 'selection';
40
+ target: Element;
41
+ }): boolean;
42
+ update(node: PmNode, _decorations: readonly Decoration[]): boolean;
43
+ destroy(): void;
44
+ }
45
+ export default function ({ getIntl, isMobile, api, allowInteractiveExpand, __livePage, }: {
46
+ getIntl: () => IntlShape;
47
+ isMobile: boolean;
48
+ api: ExtractInjectionAPI<ExpandPlugin> | undefined;
49
+ allowInteractiveExpand: boolean;
50
+ __livePage: boolean;
51
+ }): (node: PmNode, view: EditorView, getPos: getPosHandler) => NodeView;
@@ -1,2 +1,2 @@
1
- import type { ExpandPlugin } from '../legacyExpand/types';
1
+ import type { ExpandPlugin } from '../types';
2
2
  export declare const expandPlugin: ExpandPlugin;
@@ -0,0 +1,6 @@
1
+ import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { ExpandPlugin } from '../../types';
4
+ export declare function expandKeymap(api: ExtractInjectionAPI<ExpandPlugin> | undefined, options: {
5
+ __livePage?: boolean;
6
+ }): SafePlugin;
@@ -0,0 +1,9 @@
1
+ import type { IntlShape } from 'react-intl-next';
2
+ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
+ import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
+ import type { ExpandPlugin } from '../../types';
7
+ export declare const pluginKey: PluginKey<any>;
8
+ export declare function containsClass(element: Element | null, className: string): boolean;
9
+ export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorAppearance | undefined, useLongPressSelection: boolean | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean) => SafePlugin<any>;
@@ -0,0 +1,3 @@
1
+ import type { ExtractInjectionAPI, FloatingToolbarHandler } from '@atlaskit/editor-common/types';
2
+ import type { ExpandPlugin } from '../types';
3
+ export declare const getToolbarConfig: (api: ExtractInjectionAPI<ExpandPlugin> | undefined) => FloatingToolbarHandler;
@@ -0,0 +1,13 @@
1
+ import { jsx } from '@emotion/react';
2
+ import type { IntlShape } from 'react-intl-next';
3
+ interface ExpandIconButtonProps {
4
+ allowInteractiveExpand: boolean;
5
+ expanded: boolean;
6
+ intl?: IntlShape;
7
+ }
8
+ interface ExpandIconButtonWithLabelProps extends ExpandIconButtonProps {
9
+ label: string;
10
+ }
11
+ export declare const ExpandButtonInner: (props: ExpandIconButtonWithLabelProps) => jsx.JSX.Element;
12
+ export declare const ExpandButton: (props: ExpandIconButtonProps) => jsx.JSX.Element;
13
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { IntlShape } from 'react-intl-next';
2
+ import type { DOMOutputSpec, Node as PmNode } from '@atlaskit/editor-prosemirror/model';
3
+ export declare const buildExpandClassName: (type: string) => string;
4
+ export declare const toDOM: (node: PmNode, __livePage: boolean, intl?: IntlShape) => DOMOutputSpec;
5
+ export declare const renderIcon: (icon: HTMLElement | null, allowInteractiveExpand: boolean, intl?: IntlShape, node?: PmNode) => void;
@@ -0,0 +1,3 @@
1
+ import type { EditorState } from '@atlaskit/editor-prosemirror/dist/types/state';
2
+ export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, } from '@atlaskit/editor-common/transforms';
3
+ export declare const findParentExpandNode: (state: EditorState) => import("prosemirror-utils/dist/types").FindResult;
@@ -2,7 +2,7 @@ import type { EditorAppearance, LongPressSelectionPluginOptions, NextEditorPlugi
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
3
  import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
4
4
  import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
5
- import type { insertExpand } from './commands';
5
+ import type { insertExpand } from './legacyExpand/commands';
6
6
  export interface ExpandPluginState {
7
7
  expandRef?: HTMLDivElement | null;
8
8
  }