@atlaskit/editor-core 185.1.1 → 185.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/create-editor/create-editor.js +4 -0
- package/dist/cjs/editor-next/editor-internal.js +2 -1
- package/dist/cjs/test-utils.js +4 -0
- package/dist/cjs/ui/Appearance/Chromeless.js +4 -2
- package/dist/cjs/ui/Appearance/Comment/Comment.js +5 -6
- package/dist/cjs/ui/Appearance/FullPage/FullPage.js +2 -1
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +2 -4
- package/dist/cjs/ui/Appearance/FullPage/StyledComponents.js +1 -1
- package/dist/cjs/ui/Appearance/Mobile.js +29 -4
- package/dist/cjs/ui/AppearanceComponents/Mobile.js +7 -5
- package/dist/cjs/ui/ContextPanel/index.js +7 -1
- package/dist/cjs/ui/PluginSlot/index.js +11 -5
- package/dist/cjs/ui/PluginSlot/mount-plugin-hooks.js +34 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/create-editor.js +4 -0
- package/dist/es2019/editor-next/editor-internal.js +2 -1
- package/dist/es2019/test-utils.js +4 -0
- package/dist/es2019/ui/Appearance/Chromeless.js +4 -2
- package/dist/es2019/ui/Appearance/Comment/Comment.js +5 -6
- package/dist/es2019/ui/Appearance/FullPage/FullPage.js +2 -1
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +2 -4
- package/dist/es2019/ui/Appearance/FullPage/StyledComponents.js +6 -1
- package/dist/es2019/ui/Appearance/Mobile.js +29 -4
- package/dist/es2019/ui/AppearanceComponents/Mobile.js +7 -6
- package/dist/es2019/ui/ContextPanel/index.js +6 -1
- package/dist/es2019/ui/PluginSlot/index.js +11 -5
- package/dist/es2019/ui/PluginSlot/mount-plugin-hooks.js +27 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/create-editor.js +4 -0
- package/dist/esm/editor-next/editor-internal.js +2 -1
- package/dist/esm/test-utils.js +4 -0
- package/dist/esm/ui/Appearance/Chromeless.js +4 -2
- package/dist/esm/ui/Appearance/Comment/Comment.js +5 -6
- package/dist/esm/ui/Appearance/FullPage/FullPage.js +2 -1
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +2 -4
- package/dist/esm/ui/Appearance/FullPage/StyledComponents.js +1 -1
- package/dist/esm/ui/Appearance/Mobile.js +29 -4
- package/dist/esm/ui/AppearanceComponents/Mobile.js +6 -5
- package/dist/esm/ui/ContextPanel/index.js +5 -1
- package/dist/esm/ui/PluginSlot/index.js +11 -5
- package/dist/esm/ui/PluginSlot/mount-plugin-hooks.js +27 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/get-plugins.d.ts +2 -1
- package/dist/types/test-utils.d.ts +2 -1
- package/dist/types/types/editor-appearance-component.d.ts +3 -1
- package/dist/types/types/editor-config.d.ts +2 -1
- package/dist/types/ui/Appearance/FullPage/FullPageContentArea.d.ts +3 -1
- package/dist/types/ui/Appearance/Mobile.d.ts +1 -1
- package/dist/types/ui/AppearanceComponents/Mobile.d.ts +8 -8
- package/dist/types/ui/ContextPanel/index.d.ts +1 -0
- package/dist/types/ui/PluginSlot/index.d.ts +3 -1
- package/dist/types/ui/PluginSlot/mount-plugin-hooks.d.ts +10 -0
- package/dist/types-ts4.5/create-editor/get-plugins.d.ts +2 -1
- package/dist/types-ts4.5/test-utils.d.ts +2 -1
- package/dist/types-ts4.5/types/editor-appearance-component.d.ts +3 -1
- package/dist/types-ts4.5/types/editor-config.d.ts +2 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/FullPageContentArea.d.ts +3 -1
- package/dist/types-ts4.5/ui/Appearance/Mobile.d.ts +1 -1
- package/dist/types-ts4.5/ui/AppearanceComponents/Mobile.d.ts +8 -8
- package/dist/types-ts4.5/ui/ContextPanel/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/PluginSlot/index.d.ts +3 -1
- package/dist/types-ts4.5/ui/PluginSlot/mount-plugin-hooks.d.ts +10 -0
- package/package.json +6 -6
- package/report.api.md +3 -0
- package/tmp/api-report-tmp.d.ts +2426 -0
- package/dist/cjs/ui/WidthEmitter/index.js +0 -64
- package/dist/es2019/ui/WidthEmitter/index.js +0 -56
- package/dist/esm/ui/WidthEmitter/index.js +0 -53
- package/dist/types/ui/WidthEmitter/index.d.ts +0 -7
- package/dist/types-ts4.5/ui/WidthEmitter/index.d.ts +0 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import React, { useCallback } from 'react';
|
|
2
|
+
import React, { useCallback, forwardRef } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { pluginKey as maxContentSizePluginKey } from '../../plugins/max-content-size';
|
|
5
5
|
import { mobileDimensionsPluginKey } from '../../plugins/mobile-dimensions/plugin-factory';
|
|
@@ -23,12 +23,12 @@ const mobileEditor = css`
|
|
|
23
23
|
`;
|
|
24
24
|
const ContentArea = createEditorContentStyle();
|
|
25
25
|
ContentArea.displayName = 'ContentArea';
|
|
26
|
-
export function MobileAppearance({
|
|
26
|
+
export const MobileAppearance = /*#__PURE__*/forwardRef(function MobileAppearance({
|
|
27
27
|
editorView,
|
|
28
28
|
persistScrollGutter,
|
|
29
29
|
children,
|
|
30
30
|
editorDisabled
|
|
31
|
-
}) {
|
|
31
|
+
}, ref) {
|
|
32
32
|
const render = useCallback(({
|
|
33
33
|
maxContentSize,
|
|
34
34
|
mobileDimensions
|
|
@@ -64,7 +64,8 @@ export function MobileAppearance({
|
|
|
64
64
|
return jsx(WithFlash, {
|
|
65
65
|
animate: maxContentSizeReached
|
|
66
66
|
}, jsx("div", {
|
|
67
|
-
css: mobileEditor
|
|
67
|
+
css: mobileEditor,
|
|
68
|
+
ref: ref
|
|
68
69
|
}, jsx(ClickArea, {
|
|
69
70
|
editorView: editorView || undefined,
|
|
70
71
|
minHeight: minHeight,
|
|
@@ -74,7 +75,7 @@ export function MobileAppearance({
|
|
|
74
75
|
}, jsx(ContentArea, null, jsx("div", {
|
|
75
76
|
className: "ak-editor-content-area"
|
|
76
77
|
}, children)))));
|
|
77
|
-
}, [children, editorView, persistScrollGutter, editorDisabled]);
|
|
78
|
+
}, [children, editorView, persistScrollGutter, editorDisabled, ref]);
|
|
78
79
|
return jsx(WithPluginState, {
|
|
79
80
|
plugins: {
|
|
80
81
|
maxContentSize: maxContentSizePluginKey,
|
|
@@ -82,4 +83,4 @@ export function MobileAppearance({
|
|
|
82
83
|
},
|
|
83
84
|
render: render
|
|
84
85
|
});
|
|
85
|
-
}
|
|
86
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import React from 'react';
|
|
4
|
+
import React, { useContext } from 'react';
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import Transition from 'react-transition-group/Transition';
|
|
7
7
|
import { N30 } from '@atlaskit/theme/colors';
|
|
@@ -11,6 +11,7 @@ import WithPluginState from '../WithPluginState';
|
|
|
11
11
|
import { pluginKey as contextPanelPluginKey } from '../../plugins/context-panel';
|
|
12
12
|
import WithEditorActions from '../WithEditorActions';
|
|
13
13
|
import { getChildBreakoutModes } from '../../utils/document';
|
|
14
|
+
import { WidthContext } from '@atlaskit/editor-common/ui';
|
|
14
15
|
const ANIM_SPEED_MS = 500;
|
|
15
16
|
const EDITOR_WIDTH = akEditorDefaultLayoutWidth + akEditorBreakoutPadding;
|
|
16
17
|
const WIDE_EDITOR_WIDTH = akEditorWideLayoutWidth + akEditorBreakoutPadding;
|
|
@@ -172,6 +173,9 @@ function ContextPanelWithActions({
|
|
|
172
173
|
}) {
|
|
173
174
|
const eventDispatcher = actions._privateGetEventDispatcher();
|
|
174
175
|
const editorView = actions._privateGetEditorView();
|
|
176
|
+
const {
|
|
177
|
+
width
|
|
178
|
+
} = useContext(WidthContext);
|
|
175
179
|
if (!eventDispatcher) {
|
|
176
180
|
return jsx(SwappableContentArea, _extends({
|
|
177
181
|
editorView: editorView
|
|
@@ -190,6 +194,7 @@ function ContextPanelWithActions({
|
|
|
190
194
|
const firstContent = contextPanel && contextPanel.contents.find(Boolean);
|
|
191
195
|
const editorWidth = {
|
|
192
196
|
...widthState,
|
|
197
|
+
containerWidth: width,
|
|
193
198
|
contentBreakoutModes: editorView ? getChildBreakoutModes(editorView.state.doc, editorView.state.schema) : []
|
|
194
199
|
};
|
|
195
200
|
return jsx(SwappableContentArea, _extends({}, props, {
|
|
@@ -2,9 +2,10 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
-
import { ACTION_SUBJECT } from '
|
|
5
|
+
import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { whichTransitionEvent } from '../../utils';
|
|
7
7
|
import { ErrorBoundary } from '../ErrorBoundary';
|
|
8
|
+
import { MountPluginHooks } from './mount-plugin-hooks';
|
|
8
9
|
const pluginsComponentsWrapper = css`
|
|
9
10
|
display: flex;
|
|
10
11
|
`;
|
|
@@ -76,17 +77,22 @@ export default class PluginSlot extends React.Component {
|
|
|
76
77
|
containerElement,
|
|
77
78
|
disabled,
|
|
78
79
|
dispatchAnalyticsEvent,
|
|
79
|
-
wrapperElement
|
|
80
|
+
wrapperElement,
|
|
81
|
+
pluginHooks
|
|
80
82
|
} = this.props;
|
|
81
|
-
if (!items || !editorView) {
|
|
83
|
+
if (!items && !pluginHooks || !editorView) {
|
|
82
84
|
return null;
|
|
83
85
|
}
|
|
84
86
|
return jsx(ErrorBoundary, {
|
|
85
87
|
component: ACTION_SUBJECT.PLUGIN_SLOT,
|
|
86
88
|
fallbackComponent: null
|
|
87
|
-
}, jsx(
|
|
89
|
+
}, jsx(MountPluginHooks, {
|
|
90
|
+
editorView: editorView,
|
|
91
|
+
pluginHooks: pluginHooks,
|
|
92
|
+
containerElement: containerElement
|
|
93
|
+
}), jsx("div", {
|
|
88
94
|
css: pluginsComponentsWrapper
|
|
89
|
-
}, items.map((component, key) => {
|
|
95
|
+
}, items === null || items === void 0 ? void 0 : items.map((component, key) => {
|
|
90
96
|
const props = {
|
|
91
97
|
key
|
|
92
98
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
function MountPluginHook({
|
|
3
|
+
usePluginHook,
|
|
4
|
+
editorView,
|
|
5
|
+
containerElement
|
|
6
|
+
}) {
|
|
7
|
+
usePluginHook({
|
|
8
|
+
editorView,
|
|
9
|
+
containerElement
|
|
10
|
+
});
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
export function MountPluginHooks({
|
|
14
|
+
pluginHooks,
|
|
15
|
+
editorView,
|
|
16
|
+
containerElement
|
|
17
|
+
}) {
|
|
18
|
+
if (!editorView) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, pluginHooks === null || pluginHooks === void 0 ? void 0 : pluginHooks.map((usePluginHook, key) => /*#__PURE__*/React.createElement(MountPluginHook, {
|
|
22
|
+
key: key,
|
|
23
|
+
usePluginHook: usePluginHook,
|
|
24
|
+
editorView: editorView,
|
|
25
|
+
containerElement: containerElement
|
|
26
|
+
})));
|
|
27
|
+
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -55,6 +55,9 @@ export function processPluginsList(plugins) {
|
|
|
55
55
|
if (plugin.contentComponent) {
|
|
56
56
|
acc.contentComponents.push(plugin.contentComponent);
|
|
57
57
|
}
|
|
58
|
+
if (plugin.usePluginHook) {
|
|
59
|
+
acc.pluginHooks.push(plugin.usePluginHook);
|
|
60
|
+
}
|
|
58
61
|
if (plugin.primaryToolbarComponent) {
|
|
59
62
|
acc.primaryToolbarComponents.push(plugin.primaryToolbarComponent);
|
|
60
63
|
}
|
|
@@ -73,6 +76,7 @@ export function processPluginsList(plugins) {
|
|
|
73
76
|
marks: [],
|
|
74
77
|
pmPlugins: [],
|
|
75
78
|
contentComponents: [],
|
|
79
|
+
pluginHooks: [],
|
|
76
80
|
primaryToolbarComponents: [],
|
|
77
81
|
secondaryToolbarComponents: [],
|
|
78
82
|
onEditorViewStateUpdatedCallbacks: []
|
|
@@ -136,7 +136,8 @@ export function EditorInternalWithoutHooks(_ref) {
|
|
|
136
136
|
persistScrollGutter: props.persistScrollGutter,
|
|
137
137
|
enableToolbarMinWidth: ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.toolbarMinWidthOverflow) != null ? !!((_props$featureFlags2 = props.featureFlags) !== null && _props$featureFlags2 !== void 0 && _props$featureFlags2.toolbarMinWidthOverflow) : props.allowUndoRedoButtons,
|
|
138
138
|
useStickyToolbar: props.useStickyToolbar,
|
|
139
|
-
featureFlags: featureFlags
|
|
139
|
+
featureFlags: featureFlags,
|
|
140
|
+
pluginHooks: config.pluginHooks
|
|
140
141
|
}));
|
|
141
142
|
}
|
|
142
143
|
}), jsx(PortalRenderer, {
|
package/dist/esm/test-utils.js
CHANGED
|
@@ -48,6 +48,9 @@ function lightProcessPluginsList(editorPlugins) {
|
|
|
48
48
|
if (editorPlugin.contentComponent) {
|
|
49
49
|
acc.contentComponents.push(editorPlugin.contentComponent);
|
|
50
50
|
}
|
|
51
|
+
if (editorPlugin.usePluginHook) {
|
|
52
|
+
acc.pluginHooks.push(editorPlugin.usePluginHook);
|
|
53
|
+
}
|
|
51
54
|
if (editorPlugin.onEditorViewStateUpdated) {
|
|
52
55
|
acc.onEditorViewStateUpdatedCallbacks.push(editorPlugin.onEditorViewStateUpdated);
|
|
53
56
|
}
|
|
@@ -57,6 +60,7 @@ function lightProcessPluginsList(editorPlugins) {
|
|
|
57
60
|
marks: [],
|
|
58
61
|
plugins: [],
|
|
59
62
|
contentComponents: [],
|
|
63
|
+
pluginHooks: [],
|
|
60
64
|
onEditorViewStateUpdatedCallbacks: []
|
|
61
65
|
});
|
|
62
66
|
}
|
|
@@ -50,7 +50,8 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
50
50
|
popupsBoundariesElement = _this$props.popupsBoundariesElement,
|
|
51
51
|
popupsScrollableElement = _this$props.popupsScrollableElement,
|
|
52
52
|
disabled = _this$props.disabled,
|
|
53
|
-
dispatchAnalyticsEvent = _this$props.dispatchAnalyticsEvent
|
|
53
|
+
dispatchAnalyticsEvent = _this$props.dispatchAnalyticsEvent,
|
|
54
|
+
pluginHooks = _this$props.pluginHooks;
|
|
54
55
|
var maxContentSizeReached = Boolean(maxContentSize === null || maxContentSize === void 0 ? void 0 : maxContentSize.maxContentSizeReached);
|
|
55
56
|
return jsx(WithFlash, {
|
|
56
57
|
animate: maxContentSizeReached
|
|
@@ -75,7 +76,8 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
75
76
|
containerElement: _this.containerElement,
|
|
76
77
|
disabled: !!disabled,
|
|
77
78
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
78
|
-
wrapperElement: _this.containerElement
|
|
79
|
+
wrapperElement: _this.containerElement,
|
|
80
|
+
pluginHooks: pluginHooks
|
|
79
81
|
}), editorDOMElement)));
|
|
80
82
|
});
|
|
81
83
|
return _this;
|
|
@@ -26,7 +26,6 @@ import { tableCommentEditorStyles } from '@atlaskit/editor-plugin-table/ui/commo
|
|
|
26
26
|
import WithFlash from '../../WithFlash';
|
|
27
27
|
import { WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
28
28
|
import { akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
29
|
-
import WidthEmitter from '../../WidthEmitter';
|
|
30
29
|
import { GRID_GUTTER } from '@atlaskit/editor-common/styles';
|
|
31
30
|
import classnames from 'classnames';
|
|
32
31
|
import { injectIntl } from 'react-intl-next';
|
|
@@ -86,7 +85,8 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
86
85
|
disabled = _this$props.disabled,
|
|
87
86
|
dispatchAnalyticsEvent = _this$props.dispatchAnalyticsEvent,
|
|
88
87
|
intl = _this$props.intl,
|
|
89
|
-
useStickyToolbar = _this$props.useStickyToolbar
|
|
88
|
+
useStickyToolbar = _this$props.useStickyToolbar,
|
|
89
|
+
pluginHooks = _this$props.pluginHooks;
|
|
90
90
|
var maxContentSizeReached = Boolean(maxContentSize === null || maxContentSize === void 0 ? void 0 : maxContentSize.maxContentSizeReached);
|
|
91
91
|
var showSecondaryToolbar = !!onSave || !!onCancel || !!customSecondaryToolbarComponents;
|
|
92
92
|
var isShortcutToFocusToolbar = function isShortcutToFocusToolbar(event) {
|
|
@@ -157,11 +157,10 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
157
157
|
popupsScrollableElement: popupsScrollableElement,
|
|
158
158
|
containerElement: _this.containerElement,
|
|
159
159
|
disabled: !!disabled,
|
|
160
|
-
wrapperElement: _this.wrapperElementRef.current
|
|
160
|
+
wrapperElement: _this.wrapperElementRef.current,
|
|
161
|
+
pluginHooks: pluginHooks
|
|
161
162
|
}), editorDOMElement);
|
|
162
|
-
})), jsx(
|
|
163
|
-
editorView: editorView
|
|
164
|
-
})), showSecondaryToolbar && jsx("div", {
|
|
163
|
+
}))), showSecondaryToolbar && jsx("div", {
|
|
165
164
|
css: secondaryToolbarStyle,
|
|
166
165
|
"data-testid": "ak-editor-secondary-toolbar"
|
|
167
166
|
}, jsx(ButtonGroup, null, !!onSave && jsx(Button, {
|
|
@@ -126,7 +126,8 @@ export var FullPageEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
126
126
|
providerFactory: props.providerFactory,
|
|
127
127
|
scrollContainer: this.scrollContainer,
|
|
128
128
|
scrollContainerRef: this.scrollContainerRef,
|
|
129
|
-
wrapperElement: this.wrapperElementRef.current
|
|
129
|
+
wrapperElement: this.wrapperElementRef.current,
|
|
130
|
+
pluginHooks: props.pluginHooks
|
|
130
131
|
})));
|
|
131
132
|
}
|
|
132
133
|
}]);
|
|
@@ -7,7 +7,6 @@ import { injectIntl } from 'react-intl-next';
|
|
|
7
7
|
import { ClickAreaBlock } from '../../Addon';
|
|
8
8
|
import ContextPanel from '../../ContextPanel';
|
|
9
9
|
import PluginSlot from '../../PluginSlot';
|
|
10
|
-
import WidthEmitter from '../../WidthEmitter';
|
|
11
10
|
import { contentArea, editorContentAreaStyle, sidebarArea, ScrollContainer, editorContentGutterStyle, positionedOverEditorStyle } from './StyledComponents';
|
|
12
11
|
import messages from './messages';
|
|
13
12
|
export var CONTENT_AREA_TEST_ID = 'ak-editor-fp-content-area';
|
|
@@ -46,6 +45,7 @@ var Content = /*#__PURE__*/React.memo(function (props) {
|
|
|
46
45
|
providerFactory: props.providerFactory,
|
|
47
46
|
appearance: props.appearance,
|
|
48
47
|
items: props.contentComponents,
|
|
48
|
+
pluginHooks: props.pluginHooks,
|
|
49
49
|
contentArea: props.contentArea,
|
|
50
50
|
popupsMountPoint: props.popupsMountPoint,
|
|
51
51
|
popupsBoundariesElement: props.popupsBoundariesElement,
|
|
@@ -58,9 +58,7 @@ var Content = /*#__PURE__*/React.memo(function (props) {
|
|
|
58
58
|
css: sidebarArea
|
|
59
59
|
}, props.contextPanel || jsx(ContextPanel, {
|
|
60
60
|
visible: false
|
|
61
|
-
}))
|
|
62
|
-
editorView: props.editorView
|
|
63
|
-
}));
|
|
61
|
+
})));
|
|
64
62
|
});
|
|
65
63
|
});
|
|
66
64
|
});
|
|
@@ -16,7 +16,7 @@ ScrollContainer.displayName = 'ScrollContainer';
|
|
|
16
16
|
|
|
17
17
|
// transition used to match scrollbar with config panel opening animation
|
|
18
18
|
// only use animation when opening as there is a bug with floating toolbars.
|
|
19
|
-
export var positionedOverEditorStyle = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding:
|
|
19
|
+
export var positionedOverEditorStyle = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding-right: ", "px;\n transition: padding 500ms ", ";\n\n .fabric-editor-popup-scroll-parent {\n padding-left: ", "px;\n transition: padding 500ms ", ";\n }\n"])), akEditorContextPanelWidth, akEditorSwoopCubicBezier, akEditorContextPanelWidth, akEditorSwoopCubicBezier);
|
|
20
20
|
export var contentArea = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n height: calc(100% - ", ");\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n transition: padding 0ms ", ";\n"])), ATLASSIAN_NAVIGATION_HEIGHT, akEditorSwoopCubicBezier);
|
|
21
21
|
export var sidebarArea = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n height: 100%;\n box-sizing: border-box;\n align-self: flex-end;\n"])));
|
|
22
22
|
|
|
@@ -1,18 +1,43 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MobileAppearance } from '../AppearanceComponents/Mobile';
|
|
3
|
-
import
|
|
3
|
+
import PluginSlot from '../PluginSlot';
|
|
4
4
|
export default function Mobile(_ref) {
|
|
5
|
+
var _innerRef$current;
|
|
5
6
|
var editorView = _ref.editorView,
|
|
6
7
|
maxHeight = _ref.maxHeight,
|
|
7
8
|
persistScrollGutter = _ref.persistScrollGutter,
|
|
8
9
|
editorDOMElement = _ref.editorDOMElement,
|
|
9
|
-
disabled = _ref.disabled
|
|
10
|
+
disabled = _ref.disabled,
|
|
11
|
+
contentComponents = _ref.contentComponents,
|
|
12
|
+
editorActions = _ref.editorActions,
|
|
13
|
+
eventDispatcher = _ref.eventDispatcher,
|
|
14
|
+
dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
|
|
15
|
+
providerFactory = _ref.providerFactory,
|
|
16
|
+
appearance = _ref.appearance,
|
|
17
|
+
popupsMountPoint = _ref.popupsMountPoint,
|
|
18
|
+
popupsBoundariesElement = _ref.popupsBoundariesElement,
|
|
19
|
+
popupsScrollableElement = _ref.popupsScrollableElement,
|
|
20
|
+
innerRef = _ref.innerRef,
|
|
21
|
+
pluginHooks = _ref.pluginHooks;
|
|
10
22
|
return /*#__PURE__*/React.createElement(MobileAppearance, {
|
|
23
|
+
ref: innerRef,
|
|
11
24
|
editorView: editorView || null,
|
|
12
25
|
maxHeight: maxHeight,
|
|
13
26
|
persistScrollGutter: persistScrollGutter,
|
|
14
27
|
editorDisabled: disabled
|
|
15
|
-
}, editorDOMElement,
|
|
16
|
-
editorView: editorView
|
|
28
|
+
}, editorDOMElement, /*#__PURE__*/React.createElement(PluginSlot, {
|
|
29
|
+
editorView: editorView,
|
|
30
|
+
editorActions: editorActions,
|
|
31
|
+
eventDispatcher: eventDispatcher,
|
|
32
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
33
|
+
providerFactory: providerFactory,
|
|
34
|
+
appearance: appearance,
|
|
35
|
+
popupsMountPoint: popupsMountPoint,
|
|
36
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
37
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
38
|
+
containerElement: (_innerRef$current = innerRef === null || innerRef === void 0 ? void 0 : innerRef.current) !== null && _innerRef$current !== void 0 ? _innerRef$current : null,
|
|
39
|
+
disabled: !!disabled,
|
|
40
|
+
wrapperElement: null,
|
|
41
|
+
pluginHooks: pluginHooks
|
|
17
42
|
}));
|
|
18
43
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject;
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import React, { useCallback } from 'react';
|
|
4
|
+
import React, { useCallback, forwardRef } from 'react';
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import { pluginKey as maxContentSizePluginKey } from '../../plugins/max-content-size';
|
|
7
7
|
import { mobileDimensionsPluginKey } from '../../plugins/mobile-dimensions/plugin-factory';
|
|
@@ -12,7 +12,7 @@ import { ClickAreaMobile as ClickArea } from '../Addon';
|
|
|
12
12
|
var mobileEditor = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n min-height: 30px;\n width: 100%;\n max-width: inherit;\n box-sizing: border-box;\n word-wrap: break-word;\n\n div > .ProseMirror {\n outline: none;\n white-space: pre-wrap;\n padding: 0;\n margin: 0;\n }\n"])));
|
|
13
13
|
var ContentArea = createEditorContentStyle();
|
|
14
14
|
ContentArea.displayName = 'ContentArea';
|
|
15
|
-
export function MobileAppearance(_ref) {
|
|
15
|
+
export var MobileAppearance = /*#__PURE__*/forwardRef(function MobileAppearance(_ref, ref) {
|
|
16
16
|
var editorView = _ref.editorView,
|
|
17
17
|
persistScrollGutter = _ref.persistScrollGutter,
|
|
18
18
|
children = _ref.children,
|
|
@@ -49,7 +49,8 @@ export function MobileAppearance(_ref) {
|
|
|
49
49
|
return jsx(WithFlash, {
|
|
50
50
|
animate: maxContentSizeReached
|
|
51
51
|
}, jsx("div", {
|
|
52
|
-
css: mobileEditor
|
|
52
|
+
css: mobileEditor,
|
|
53
|
+
ref: ref
|
|
53
54
|
}, jsx(ClickArea, {
|
|
54
55
|
editorView: editorView || undefined,
|
|
55
56
|
minHeight: minHeight,
|
|
@@ -59,7 +60,7 @@ export function MobileAppearance(_ref) {
|
|
|
59
60
|
}, jsx(ContentArea, null, jsx("div", {
|
|
60
61
|
className: "ak-editor-content-area"
|
|
61
62
|
}, children)))));
|
|
62
|
-
}, [children, editorView, persistScrollGutter, editorDisabled]);
|
|
63
|
+
}, [children, editorView, persistScrollGutter, editorDisabled, ref]);
|
|
63
64
|
return jsx(WithPluginState, {
|
|
64
65
|
plugins: {
|
|
65
66
|
maxContentSize: maxContentSizePluginKey,
|
|
@@ -67,4 +68,4 @@ export function MobileAppearance(_ref) {
|
|
|
67
68
|
},
|
|
68
69
|
render: render
|
|
69
70
|
});
|
|
70
|
-
}
|
|
71
|
+
});
|
|
@@ -15,7 +15,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
15
15
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
16
16
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
17
17
|
/** @jsx jsx */
|
|
18
|
-
import React from 'react';
|
|
18
|
+
import React, { useContext } from 'react';
|
|
19
19
|
import { css, jsx } from '@emotion/react';
|
|
20
20
|
import Transition from 'react-transition-group/Transition';
|
|
21
21
|
import { N30 } from '@atlaskit/theme/colors';
|
|
@@ -25,6 +25,7 @@ import WithPluginState from '../WithPluginState';
|
|
|
25
25
|
import { pluginKey as contextPanelPluginKey } from '../../plugins/context-panel';
|
|
26
26
|
import WithEditorActions from '../WithEditorActions';
|
|
27
27
|
import { getChildBreakoutModes } from '../../utils/document';
|
|
28
|
+
import { WidthContext } from '@atlaskit/editor-common/ui';
|
|
28
29
|
var ANIM_SPEED_MS = 500;
|
|
29
30
|
var EDITOR_WIDTH = akEditorDefaultLayoutWidth + akEditorBreakoutPadding;
|
|
30
31
|
var WIDE_EDITOR_WIDTH = akEditorWideLayoutWidth + akEditorBreakoutPadding;
|
|
@@ -174,6 +175,8 @@ function ContextPanelWithActions(_ref2) {
|
|
|
174
175
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
175
176
|
var eventDispatcher = actions._privateGetEventDispatcher();
|
|
176
177
|
var editorView = actions._privateGetEditorView();
|
|
178
|
+
var _useContext = useContext(WidthContext),
|
|
179
|
+
width = _useContext.width;
|
|
177
180
|
if (!eventDispatcher) {
|
|
178
181
|
return jsx(SwappableContentArea, _extends({
|
|
179
182
|
editorView: editorView
|
|
@@ -190,6 +193,7 @@ function ContextPanelWithActions(_ref2) {
|
|
|
190
193
|
widthState = _ref3.widthState;
|
|
191
194
|
var firstContent = contextPanel && contextPanel.contents.find(Boolean);
|
|
192
195
|
var editorWidth = _objectSpread(_objectSpread({}, widthState), {}, {
|
|
196
|
+
containerWidth: width,
|
|
193
197
|
contentBreakoutModes: editorView ? getChildBreakoutModes(editorView.state.doc, editorView.state.schema) : []
|
|
194
198
|
});
|
|
195
199
|
return jsx(SwappableContentArea, _extends({}, props, {
|
|
@@ -12,9 +12,10 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
12
12
|
/** @jsx jsx */
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import { css, jsx } from '@emotion/react';
|
|
15
|
-
import { ACTION_SUBJECT } from '
|
|
15
|
+
import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
16
16
|
import { whichTransitionEvent } from '../../utils';
|
|
17
17
|
import { ErrorBoundary } from '../ErrorBoundary';
|
|
18
|
+
import { MountPluginHooks } from './mount-plugin-hooks';
|
|
18
19
|
var pluginsComponentsWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n"])));
|
|
19
20
|
var PluginSlot = /*#__PURE__*/function (_React$Component) {
|
|
20
21
|
_inherits(PluginSlot, _React$Component);
|
|
@@ -101,16 +102,21 @@ var PluginSlot = /*#__PURE__*/function (_React$Component) {
|
|
|
101
102
|
containerElement = _this$props2.containerElement,
|
|
102
103
|
disabled = _this$props2.disabled,
|
|
103
104
|
dispatchAnalyticsEvent = _this$props2.dispatchAnalyticsEvent,
|
|
104
|
-
wrapperElement = _this$props2.wrapperElement
|
|
105
|
-
|
|
105
|
+
wrapperElement = _this$props2.wrapperElement,
|
|
106
|
+
pluginHooks = _this$props2.pluginHooks;
|
|
107
|
+
if (!items && !pluginHooks || !editorView) {
|
|
106
108
|
return null;
|
|
107
109
|
}
|
|
108
110
|
return jsx(ErrorBoundary, {
|
|
109
111
|
component: ACTION_SUBJECT.PLUGIN_SLOT,
|
|
110
112
|
fallbackComponent: null
|
|
111
|
-
}, jsx(
|
|
113
|
+
}, jsx(MountPluginHooks, {
|
|
114
|
+
editorView: editorView,
|
|
115
|
+
pluginHooks: pluginHooks,
|
|
116
|
+
containerElement: containerElement
|
|
117
|
+
}), jsx("div", {
|
|
112
118
|
css: pluginsComponentsWrapper
|
|
113
|
-
}, items.map(function (component, key) {
|
|
119
|
+
}, items === null || items === void 0 ? void 0 : items.map(function (component, key) {
|
|
114
120
|
var props = {
|
|
115
121
|
key: key
|
|
116
122
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
function MountPluginHook(_ref) {
|
|
3
|
+
var usePluginHook = _ref.usePluginHook,
|
|
4
|
+
editorView = _ref.editorView,
|
|
5
|
+
containerElement = _ref.containerElement;
|
|
6
|
+
usePluginHook({
|
|
7
|
+
editorView: editorView,
|
|
8
|
+
containerElement: containerElement
|
|
9
|
+
});
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
export function MountPluginHooks(_ref2) {
|
|
13
|
+
var pluginHooks = _ref2.pluginHooks,
|
|
14
|
+
editorView = _ref2.editorView,
|
|
15
|
+
containerElement = _ref2.containerElement;
|
|
16
|
+
if (!editorView) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, pluginHooks === null || pluginHooks === void 0 ? void 0 : pluginHooks.map(function (usePluginHook, key) {
|
|
20
|
+
return /*#__PURE__*/React.createElement(MountPluginHook, {
|
|
21
|
+
key: key,
|
|
22
|
+
usePluginHook: usePluginHook,
|
|
23
|
+
editorView: editorView,
|
|
24
|
+
containerElement: containerElement
|
|
25
|
+
});
|
|
26
|
+
}));
|
|
27
|
+
}
|
package/dist/esm/version.json
CHANGED
|
@@ -7,7 +7,7 @@ import { MarkConfig, NodeConfig } from '../types/pm-config';
|
|
|
7
7
|
import { EditorReactContext } from '../types/editor-react-context';
|
|
8
8
|
import { FeatureFlags } from '../types/feature-flags';
|
|
9
9
|
import { IntlShape } from 'react-intl-next';
|
|
10
|
-
import { UIComponentFactory } from '@atlaskit/editor-common/types';
|
|
10
|
+
import type { UIComponentFactory, ReactHookFactory } from '@atlaskit/editor-common/types';
|
|
11
11
|
export type LightPMPluginFactoryParams = {
|
|
12
12
|
schema: Schema;
|
|
13
13
|
dispatch: Dispatch;
|
|
@@ -38,6 +38,7 @@ export interface LightEditorPlugin {
|
|
|
38
38
|
nodes?: () => NodeConfig[];
|
|
39
39
|
pmPlugins?: (pluginOptions?: any) => Array<LightPMPlugin>;
|
|
40
40
|
contentComponent?: UIComponentFactory;
|
|
41
|
+
usePluginHook?: ReactHookFactory;
|
|
41
42
|
pluginsOptions?: Record<string, any>;
|
|
42
43
|
onEditorViewStateUpdated?: OnEditorViewStateUpdated;
|
|
43
44
|
}
|
|
@@ -8,12 +8,13 @@ export type { LightEditorPlugin } from './create-editor/get-plugins';
|
|
|
8
8
|
export type { DispatchAnalyticsEvent } from './plugins/analytics/types';
|
|
9
9
|
export type { FeatureFlags } from './types/feature-flags';
|
|
10
10
|
import { EditorPresetBuilder, type EditorPluginInjectionAPI } from '@atlaskit/editor-common/preset';
|
|
11
|
-
import type { AllEditorPresetPluginTypes, UIComponentFactory } from '@atlaskit/editor-common/types';
|
|
11
|
+
import type { AllEditorPresetPluginTypes, UIComponentFactory, ReactHookFactory } from '@atlaskit/editor-common/types';
|
|
12
12
|
export interface LightEditorConfig {
|
|
13
13
|
nodes: NodeConfig[];
|
|
14
14
|
marks: MarkConfig[];
|
|
15
15
|
plugins: Array<LightPMPlugin>;
|
|
16
16
|
contentComponents: UIComponentFactory[];
|
|
17
|
+
pluginHooks: ReactHookFactory[];
|
|
17
18
|
onEditorViewStateUpdatedCallbacks: Array<OnEditorViewStateUpdated>;
|
|
18
19
|
}
|
|
19
20
|
export declare function getFireAnalytics(editorView: EditorView): any;
|
|
@@ -8,11 +8,12 @@ import { UIComponentFactory } from '../types/ui-components';
|
|
|
8
8
|
import { ReactComponents, PrimaryToolbarComponents, UseStickyToolbarType } from '../types/editor-props';
|
|
9
9
|
import { ToolbarUIComponentFactory } from '../ui/Toolbar/types';
|
|
10
10
|
import { CollabEditOptions } from '../plugins/collab-edit/types';
|
|
11
|
-
import { DispatchAnalyticsEvent } from '
|
|
11
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
12
12
|
import { EditorAppearance } from './editor-appearance';
|
|
13
13
|
import { MenuItem } from '../ui/DropdownMenu/types';
|
|
14
14
|
import { ReactElement } from 'react';
|
|
15
15
|
import { FeatureFlags } from './feature-flags';
|
|
16
|
+
import type { ReactHookFactory } from '@atlaskit/editor-common/types';
|
|
16
17
|
export interface EditorAppearanceComponentProps {
|
|
17
18
|
appearance?: EditorAppearance;
|
|
18
19
|
onSave?: (editorView: EditorView) => void;
|
|
@@ -26,6 +27,7 @@ export interface EditorAppearanceComponentProps {
|
|
|
26
27
|
maxHeight?: number;
|
|
27
28
|
minHeight?: number;
|
|
28
29
|
contentComponents?: UIComponentFactory[];
|
|
30
|
+
pluginHooks?: ReactHookFactory[];
|
|
29
31
|
primaryToolbarComponents?: ToolbarUIComponentFactory[];
|
|
30
32
|
primaryToolbarIconBefore?: ReactElement;
|
|
31
33
|
secondaryToolbarComponents?: UIComponentFactory[];
|
|
@@ -2,7 +2,7 @@ import { ToolbarUIComponentFactory } from '../ui/Toolbar/types';
|
|
|
2
2
|
import { Transaction, EditorState } from 'prosemirror-state';
|
|
3
3
|
import { PMPlugin } from './pm-plugin';
|
|
4
4
|
import { MarkConfig, NodeConfig } from './pm-config';
|
|
5
|
-
import { UIComponentFactory } from '
|
|
5
|
+
import type { UIComponentFactory, ReactHookFactory } from '@atlaskit/editor-common/types';
|
|
6
6
|
type EditorViewStateUpdatedCallbackProps = {
|
|
7
7
|
readonly originalTransaction: Readonly<Transaction>;
|
|
8
8
|
readonly transactions: Transaction[];
|
|
@@ -14,6 +14,7 @@ export interface EditorConfig {
|
|
|
14
14
|
marks: MarkConfig[];
|
|
15
15
|
pmPlugins: Array<PMPlugin>;
|
|
16
16
|
contentComponents: UIComponentFactory[];
|
|
17
|
+
pluginHooks: ReactHookFactory[];
|
|
17
18
|
primaryToolbarComponents: ToolbarUIComponentFactory[];
|
|
18
19
|
secondaryToolbarComponents: UIComponentFactory[];
|
|
19
20
|
onEditorViewStateUpdatedCallbacks: Array<{
|
|
@@ -5,11 +5,13 @@ import { WrappedComponentProps } from 'react-intl-next';
|
|
|
5
5
|
import EditorActions from '../../../actions';
|
|
6
6
|
import { EventDispatcher } from '../../../event-dispatcher';
|
|
7
7
|
import { ReactComponents, EditorAppearance, UIComponentFactory } from '../../../types';
|
|
8
|
-
import { DispatchAnalyticsEvent } from '
|
|
8
|
+
import { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
9
|
+
import type { ReactHookFactory } from '@atlaskit/editor-common/types';
|
|
9
10
|
interface FullPageEditorContentAreaProps {
|
|
10
11
|
appearance: EditorAppearance | undefined;
|
|
11
12
|
contentArea: HTMLElement | undefined;
|
|
12
13
|
contentComponents: UIComponentFactory[] | undefined;
|
|
14
|
+
pluginHooks: ReactHookFactory[] | undefined;
|
|
13
15
|
contextPanel: ReactComponents | undefined;
|
|
14
16
|
customContentComponents: ReactComponents | undefined;
|
|
15
17
|
disabled: boolean | undefined;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { EditorAppearanceComponentProps } from '../../types';
|
|
3
|
-
export default function Mobile({ editorView, maxHeight, persistScrollGutter, editorDOMElement, disabled, }: EditorAppearanceComponentProps): JSX.Element;
|
|
3
|
+
export default function Mobile({ editorView, maxHeight, persistScrollGutter, editorDOMElement, disabled, contentComponents, editorActions, eventDispatcher, dispatchAnalyticsEvent, providerFactory, appearance, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, innerRef, pluginHooks, }: EditorAppearanceComponentProps): JSX.Element;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { jsx } from '@emotion/react';
|
|
4
3
|
import { EditorView } from 'prosemirror-view';
|
|
5
|
-
|
|
4
|
+
export declare const MobileAppearance: React.ForwardRefExoticComponent<{
|
|
6
5
|
editorView: EditorView | null;
|
|
7
|
-
maxHeight?: number;
|
|
8
|
-
persistScrollGutter?: boolean;
|
|
9
|
-
editorDisabled?: boolean;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
maxHeight?: number | undefined;
|
|
7
|
+
persistScrollGutter?: boolean | undefined;
|
|
8
|
+
editorDisabled?: boolean | undefined;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
} & {
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
} & React.RefAttributes<HTMLDivElement>>;
|