@atlaskit/editor-core 185.7.0 → 185.8.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.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/plugins/media/index.js +9 -1
- package/dist/cjs/ui/Appearance/FullPage/FullPage.js +88 -130
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +28 -9
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/media/index.js +10 -2
- package/dist/es2019/ui/Appearance/FullPage/FullPage.js +75 -115
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +62 -46
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/media/index.js +10 -2
- package/dist/esm/ui/Appearance/FullPage/FullPage.js +83 -130
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +25 -9
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/ui/Appearance/FullPage/FullPage.d.ts +1 -23
- package/dist/types/ui/Appearance/FullPage/FullPageContentArea.d.ts +6 -6
- package/dist/types/ui/Appearance/FullPage/FullPageToolbar.d.ts +2 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/FullPage.d.ts +1 -23
- package/dist/types-ts4.5/ui/Appearance/FullPage/FullPageContentArea.d.ts +6 -6
- package/dist/types-ts4.5/ui/Appearance/FullPage/FullPageToolbar.d.ts +2 -1
- package/package.json +14 -20
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx, useTheme } from '@emotion/react';
|
|
3
3
|
import { WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
4
4
|
import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useImperativeHandle, useRef } from 'react';
|
|
6
6
|
import { injectIntl } from 'react-intl-next';
|
|
7
7
|
import { ClickAreaBlock } from '../../Addon';
|
|
8
8
|
import ContextPanel from '../../ContextPanel';
|
|
@@ -10,55 +10,71 @@ import PluginSlot from '../../PluginSlot';
|
|
|
10
10
|
import { contentArea, editorContentAreaStyle, sidebarArea, ScrollContainer, editorContentGutterStyle, positionedOverEditorStyle } from './StyledComponents';
|
|
11
11
|
import messages from './messages';
|
|
12
12
|
export const CONTENT_AREA_TEST_ID = 'ak-editor-fp-content-area';
|
|
13
|
-
const Content = /*#__PURE__*/React.
|
|
13
|
+
const Content = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
14
14
|
const theme = useTheme();
|
|
15
15
|
const fullWidthMode = props.appearance === 'full-width';
|
|
16
|
+
const scrollContainerRef = useRef(null);
|
|
17
|
+
const contentAreaRef = useRef(null);
|
|
18
|
+
useImperativeHandle(ref, () => ({
|
|
19
|
+
get scrollContainer() {
|
|
20
|
+
return scrollContainerRef.current;
|
|
21
|
+
},
|
|
22
|
+
get contentArea() {
|
|
23
|
+
return contentAreaRef.current;
|
|
24
|
+
}
|
|
25
|
+
}), []);
|
|
16
26
|
return jsx(WidthConsumer, null, ({
|
|
17
27
|
width
|
|
18
28
|
}) => jsx(ContextPanelConsumer, null, ({
|
|
19
29
|
positionedOverEditor
|
|
20
|
-
}) =>
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
30
|
+
}) => {
|
|
31
|
+
var _contentAreaRef$curre;
|
|
32
|
+
return jsx("div", {
|
|
33
|
+
css: [contentArea, positionedOverEditor && positionedOverEditorStyle],
|
|
34
|
+
"data-testid": CONTENT_AREA_TEST_ID
|
|
35
|
+
}, jsx(ScrollContainer, {
|
|
36
|
+
className: "fabric-editor-popup-scroll-parent",
|
|
37
|
+
featureFlags: props.featureFlags,
|
|
38
|
+
ref: scrollContainerRef
|
|
39
|
+
}, jsx(ClickAreaBlock, {
|
|
40
|
+
editorView: props.editorView,
|
|
41
|
+
editorDisabled: props.disabled
|
|
42
|
+
}, jsx("div", {
|
|
43
|
+
css: editorContentAreaStyle({
|
|
44
|
+
fullWidthMode,
|
|
45
|
+
layoutMaxWidth: theme.layoutMaxWidth,
|
|
46
|
+
containerWidth: width
|
|
47
|
+
}),
|
|
48
|
+
role: "region",
|
|
49
|
+
"aria-label": props.intl.formatMessage(messages.editableContentLabel),
|
|
50
|
+
ref: contentAreaRef
|
|
51
|
+
}, jsx("div", {
|
|
52
|
+
css: editorContentGutterStyle,
|
|
53
|
+
className: ['ak-editor-content-area', fullWidthMode ? 'fabric-editor--full-width-mode' : ''].join(' '),
|
|
54
|
+
ref: contentAreaRef
|
|
55
|
+
}, props.customContentComponents, jsx(PluginSlot, {
|
|
56
|
+
editorView: props.editorView,
|
|
57
|
+
editorActions: props.editorActions,
|
|
58
|
+
eventDispatcher: props.eventDispatcher,
|
|
59
|
+
providerFactory: props.providerFactory,
|
|
60
|
+
appearance: props.appearance,
|
|
61
|
+
items: props.contentComponents,
|
|
62
|
+
pluginHooks: props.pluginHooks,
|
|
63
|
+
contentArea: (_contentAreaRef$curre = contentAreaRef.current) !== null && _contentAreaRef$curre !== void 0 ? _contentAreaRef$curre : undefined,
|
|
64
|
+
popupsMountPoint: props.popupsMountPoint,
|
|
65
|
+
popupsBoundariesElement: props.popupsBoundariesElement,
|
|
66
|
+
popupsScrollableElement: props.popupsScrollableElement,
|
|
67
|
+
disabled: !!props.disabled,
|
|
68
|
+
containerElement: scrollContainerRef.current,
|
|
69
|
+
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
|
|
70
|
+
wrapperElement: props.wrapperElement
|
|
71
|
+
}), props.editorDOMElement)))), jsx("div", {
|
|
72
|
+
css: sidebarArea
|
|
73
|
+
}, props.contextPanel || jsx(ContextPanel, {
|
|
74
|
+
visible: false
|
|
75
|
+
})));
|
|
76
|
+
}));
|
|
63
77
|
});
|
|
64
|
-
export const FullPageContentArea = injectIntl(Content
|
|
78
|
+
export const FullPageContentArea = injectIntl(Content, {
|
|
79
|
+
forwardRef: true
|
|
80
|
+
});
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PluginKey, NodeSelection } from 'prosemirror-state';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
-
import { media, mediaGroup,
|
|
4
|
+
import { media, mediaGroup, mediaInline, mediaSingleSpec } from '@atlaskit/adf-schema';
|
|
5
5
|
import { stateKey as pluginKey, createPlugin } from './pm-plugins/main';
|
|
6
6
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
7
7
|
import { createPlugin as createMediaAltTextPlugin } from './pm-plugins/alt-text';
|
|
@@ -22,6 +22,7 @@ import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
|
22
22
|
import { ReactMediaNode } from './nodeviews/mediaNodeView';
|
|
23
23
|
import { ReactMediaInlineNode } from './nodeviews/mediaInline';
|
|
24
24
|
import { stateKey } from './pm-plugins/plugin-key';
|
|
25
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
25
26
|
export { insertMediaSingleNode } from './utils/media-single';
|
|
26
27
|
var mediaPlugin = function mediaPlugin() {
|
|
27
28
|
var _api$dependencies, _api$dependencies$fea;
|
|
@@ -45,7 +46,14 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
45
46
|
mediaFeatureFlags = _ref.featureFlags;
|
|
46
47
|
var captions = getMediaFeatureFlag('captions', mediaFeatureFlags);
|
|
47
48
|
var allowMediaInline = getMediaFeatureFlag('mediaInline', mediaFeatureFlags);
|
|
48
|
-
var
|
|
49
|
+
var mediaSingleOption = getBooleanFF('platform.editor.media.extended-resize-experience') ? {
|
|
50
|
+
withCaption: captions,
|
|
51
|
+
withExtendedWidthTypes: true
|
|
52
|
+
} : {
|
|
53
|
+
withCaption: captions,
|
|
54
|
+
withExtendedWidthTypes: false
|
|
55
|
+
};
|
|
56
|
+
var mediaSingleNode = mediaSingleSpec(mediaSingleOption);
|
|
49
57
|
return [{
|
|
50
58
|
name: 'mediaGroup',
|
|
51
59
|
node: mediaGroup
|
|
@@ -1,137 +1,90 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
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); }; }
|
|
9
|
-
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; } }
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
10
2
|
/** @jsx jsx */
|
|
11
|
-
import React from 'react';
|
|
3
|
+
import React, { useEffect, useState, useRef, useMemo } from 'react';
|
|
12
4
|
import { jsx } from '@emotion/react';
|
|
13
|
-
import rafSchedule from 'raf-schd';
|
|
14
|
-
import { akEditorToolbarKeylineHeight } from '@atlaskit/editor-shared-styles';
|
|
15
5
|
import { fullPageEditorWrapper } from './StyledComponents';
|
|
16
6
|
import { ContextPanelWidthProvider } from '@atlaskit/editor-common/ui';
|
|
17
7
|
import { FullPageContentArea } from './FullPageContentArea';
|
|
18
8
|
import { FullPageToolbar } from './FullPageToolbar';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
_defineProperty(_assertThisInitialized(_this), "scrollContainer", null);
|
|
30
|
-
// Wrapper container for toolbar and content area
|
|
31
|
-
_defineProperty(_assertThisInitialized(_this), "wrapperElementRef", /*#__PURE__*/React.createRef());
|
|
32
|
-
_defineProperty(_assertThisInitialized(_this), "contentAreaRef", function (contentArea) {
|
|
33
|
-
_this.contentArea = contentArea;
|
|
34
|
-
});
|
|
35
|
-
_defineProperty(_assertThisInitialized(_this), "scrollContainerRef", function (ref) {
|
|
36
|
-
var previousScrollContainer = _this.scrollContainer;
|
|
37
|
-
|
|
38
|
-
// remove existing handler
|
|
39
|
-
if (previousScrollContainer) {
|
|
40
|
-
previousScrollContainer.removeEventListener('scroll', _this.updateToolbarKeyline);
|
|
41
|
-
}
|
|
42
|
-
_this.scrollContainer = ref ? ref : null;
|
|
43
|
-
if (_this.scrollContainer) {
|
|
44
|
-
_this.scrollContainer.addEventListener('scroll', _this.updateToolbarKeyline, false);
|
|
45
|
-
_this.updateToolbarKeyline();
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
_defineProperty(_assertThisInitialized(_this), "updateToolbarKeyline", rafSchedule(function () {
|
|
49
|
-
if (!_this.scrollContainer) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
var scrollTop = _this.scrollContainer.scrollTop;
|
|
53
|
-
var showKeyline = scrollTop > akEditorToolbarKeylineHeight;
|
|
54
|
-
if (showKeyline !== _this.state.showKeyline) {
|
|
55
|
-
_this.setState({
|
|
56
|
-
showKeyline: showKeyline
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
return false;
|
|
60
|
-
}));
|
|
61
|
-
_defineProperty(_assertThisInitialized(_this), "handleResize", function () {
|
|
62
|
-
_this.updateToolbarKeyline();
|
|
63
|
-
});
|
|
64
|
-
_this.featureFlags = props.featureFlags;
|
|
65
|
-
if (props.innerRef) {
|
|
66
|
-
_this.wrapperElementRef = props.innerRef;
|
|
9
|
+
import { browser } from '@atlaskit/editor-common/utils';
|
|
10
|
+
var useShowKeyline = function useShowKeyline(contentAreaRef) {
|
|
11
|
+
var _useState = useState(false),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
showKeyline = _useState2[0],
|
|
14
|
+
setShowKeyline = _useState2[1];
|
|
15
|
+
useEffect(function () {
|
|
16
|
+
var _contentAreaRef$curre;
|
|
17
|
+
if (!((_contentAreaRef$curre = contentAreaRef.current) !== null && _contentAreaRef$curre !== void 0 && _contentAreaRef$curre.contentArea)) {
|
|
18
|
+
return;
|
|
67
19
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
20
|
+
var intersection = new IntersectionObserver(function (_ref) {
|
|
21
|
+
var _ref2 = _slicedToArray(_ref, 1),
|
|
22
|
+
entry = _ref2[0];
|
|
23
|
+
setShowKeyline(!entry.isIntersecting && entry.boundingClientRect.top < entry.intersectionRect.top);
|
|
24
|
+
}, {
|
|
25
|
+
root: undefined,
|
|
26
|
+
// Safari seems to miss events (on fast scroll) sometimes due
|
|
27
|
+
// to differences in IntersectionObserver behaviour between browsers.
|
|
28
|
+
// By lowering the threshold a little it gives Safari more
|
|
29
|
+
// time to catch these events.
|
|
30
|
+
threshold: browser.safari ? 0.98 : 1
|
|
31
|
+
});
|
|
32
|
+
intersection.observe(contentAreaRef.current.contentArea);
|
|
33
|
+
return function () {
|
|
34
|
+
intersection.disconnect();
|
|
35
|
+
};
|
|
36
|
+
}, [contentAreaRef]);
|
|
37
|
+
return showKeyline;
|
|
38
|
+
};
|
|
39
|
+
export var FullPageEditor = function FullPageEditor(props) {
|
|
40
|
+
var _scrollContentContain, _scrollContentContain2, _wrapperElementRef$cu;
|
|
41
|
+
var wrapperElementRef = useMemo(function () {
|
|
42
|
+
return props.innerRef;
|
|
43
|
+
}, [props.innerRef]);
|
|
44
|
+
var scrollContentContainerRef = useRef(null);
|
|
45
|
+
var showKeyline = useShowKeyline(scrollContentContainerRef);
|
|
46
|
+
return jsx(ContextPanelWidthProvider, null, jsx("div", {
|
|
47
|
+
css: fullPageEditorWrapper,
|
|
48
|
+
className: "akEditor",
|
|
49
|
+
ref: wrapperElementRef
|
|
50
|
+
}, jsx(FullPageToolbar, {
|
|
51
|
+
appearance: props.appearance,
|
|
52
|
+
beforeIcon: props.primaryToolbarIconBefore,
|
|
53
|
+
collabEdit: props.collabEdit,
|
|
54
|
+
containerElement: (_scrollContentContain = (_scrollContentContain2 = scrollContentContainerRef.current) === null || _scrollContentContain2 === void 0 ? void 0 : _scrollContentContain2.scrollContainer) !== null && _scrollContentContain !== void 0 ? _scrollContentContain : null,
|
|
55
|
+
customPrimaryToolbarComponents: props.customPrimaryToolbarComponents,
|
|
56
|
+
disabled: !!props.disabled,
|
|
57
|
+
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
|
|
58
|
+
editorActions: props.editorActions,
|
|
59
|
+
editorDOMElement: props.editorDOMElement,
|
|
60
|
+
editorView: props.editorView,
|
|
61
|
+
eventDispatcher: props.eventDispatcher,
|
|
62
|
+
hasMinWidth: props.enableToolbarMinWidth,
|
|
63
|
+
popupsBoundariesElement: props.popupsBoundariesElement,
|
|
64
|
+
popupsMountPoint: props.popupsMountPoint,
|
|
65
|
+
popupsScrollableElement: props.popupsScrollableElement,
|
|
66
|
+
primaryToolbarComponents: props.primaryToolbarComponents,
|
|
67
|
+
providerFactory: props.providerFactory,
|
|
68
|
+
showKeyline: showKeyline,
|
|
69
|
+
featureFlags: props.featureFlags
|
|
70
|
+
}), jsx(FullPageContentArea, {
|
|
71
|
+
ref: scrollContentContainerRef,
|
|
72
|
+
appearance: props.appearance,
|
|
73
|
+
contentComponents: props.contentComponents,
|
|
74
|
+
contextPanel: props.contextPanel,
|
|
75
|
+
customContentComponents: props.customContentComponents,
|
|
76
|
+
disabled: props.disabled,
|
|
77
|
+
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
|
|
78
|
+
editorActions: props.editorActions,
|
|
79
|
+
editorDOMElement: props.editorDOMElement,
|
|
80
|
+
editorView: props.editorView,
|
|
81
|
+
eventDispatcher: props.eventDispatcher,
|
|
82
|
+
popupsBoundariesElement: props.popupsBoundariesElement,
|
|
83
|
+
popupsMountPoint: props.popupsMountPoint,
|
|
84
|
+
popupsScrollableElement: props.popupsScrollableElement,
|
|
85
|
+
providerFactory: props.providerFactory,
|
|
86
|
+
wrapperElement: (_wrapperElementRef$cu = wrapperElementRef === null || wrapperElementRef === void 0 ? void 0 : wrapperElementRef.current) !== null && _wrapperElementRef$cu !== void 0 ? _wrapperElementRef$cu : null,
|
|
87
|
+
pluginHooks: props.pluginHooks,
|
|
88
|
+
featureFlags: props.featureFlags
|
|
89
|
+
})));
|
|
90
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx, useTheme } from '@emotion/react';
|
|
3
3
|
import { WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
4
4
|
import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useImperativeHandle, useRef } from 'react';
|
|
6
6
|
import { injectIntl } from 'react-intl-next';
|
|
7
7
|
import { ClickAreaBlock } from '../../Addon';
|
|
8
8
|
import ContextPanel from '../../ContextPanel';
|
|
@@ -10,20 +10,33 @@ import PluginSlot from '../../PluginSlot';
|
|
|
10
10
|
import { contentArea, editorContentAreaStyle, sidebarArea, ScrollContainer, editorContentGutterStyle, positionedOverEditorStyle } from './StyledComponents';
|
|
11
11
|
import messages from './messages';
|
|
12
12
|
export var CONTENT_AREA_TEST_ID = 'ak-editor-fp-content-area';
|
|
13
|
-
var Content = /*#__PURE__*/React.
|
|
13
|
+
var Content = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
14
14
|
var theme = useTheme();
|
|
15
15
|
var fullWidthMode = props.appearance === 'full-width';
|
|
16
|
+
var scrollContainerRef = useRef(null);
|
|
17
|
+
var contentAreaRef = useRef(null);
|
|
18
|
+
useImperativeHandle(ref, function () {
|
|
19
|
+
return {
|
|
20
|
+
get scrollContainer() {
|
|
21
|
+
return scrollContainerRef.current;
|
|
22
|
+
},
|
|
23
|
+
get contentArea() {
|
|
24
|
+
return contentAreaRef.current;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}, []);
|
|
16
28
|
return jsx(WidthConsumer, null, function (_ref) {
|
|
17
29
|
var width = _ref.width;
|
|
18
30
|
return jsx(ContextPanelConsumer, null, function (_ref2) {
|
|
31
|
+
var _contentAreaRef$curre;
|
|
19
32
|
var positionedOverEditor = _ref2.positionedOverEditor;
|
|
20
33
|
return jsx("div", {
|
|
21
34
|
css: [contentArea, positionedOverEditor && positionedOverEditorStyle],
|
|
22
35
|
"data-testid": CONTENT_AREA_TEST_ID
|
|
23
36
|
}, jsx(ScrollContainer, {
|
|
24
|
-
ref: props.scrollContainerRef,
|
|
25
37
|
className: "fabric-editor-popup-scroll-parent",
|
|
26
|
-
featureFlags: props.featureFlags
|
|
38
|
+
featureFlags: props.featureFlags,
|
|
39
|
+
ref: scrollContainerRef
|
|
27
40
|
}, jsx(ClickAreaBlock, {
|
|
28
41
|
editorView: props.editorView,
|
|
29
42
|
editorDisabled: props.disabled
|
|
@@ -35,10 +48,11 @@ var Content = /*#__PURE__*/React.memo(function (props) {
|
|
|
35
48
|
}),
|
|
36
49
|
role: "region",
|
|
37
50
|
"aria-label": props.intl.formatMessage(messages.editableContentLabel),
|
|
38
|
-
ref:
|
|
51
|
+
ref: contentAreaRef
|
|
39
52
|
}, jsx("div", {
|
|
40
53
|
css: editorContentGutterStyle,
|
|
41
|
-
className: ['ak-editor-content-area', fullWidthMode ? 'fabric-editor--full-width-mode' : ''].join(' ')
|
|
54
|
+
className: ['ak-editor-content-area', fullWidthMode ? 'fabric-editor--full-width-mode' : ''].join(' '),
|
|
55
|
+
ref: contentAreaRef
|
|
42
56
|
}, props.customContentComponents, jsx(PluginSlot, {
|
|
43
57
|
editorView: props.editorView,
|
|
44
58
|
editorActions: props.editorActions,
|
|
@@ -47,12 +61,12 @@ var Content = /*#__PURE__*/React.memo(function (props) {
|
|
|
47
61
|
appearance: props.appearance,
|
|
48
62
|
items: props.contentComponents,
|
|
49
63
|
pluginHooks: props.pluginHooks,
|
|
50
|
-
contentArea:
|
|
64
|
+
contentArea: (_contentAreaRef$curre = contentAreaRef.current) !== null && _contentAreaRef$curre !== void 0 ? _contentAreaRef$curre : undefined,
|
|
51
65
|
popupsMountPoint: props.popupsMountPoint,
|
|
52
66
|
popupsBoundariesElement: props.popupsBoundariesElement,
|
|
53
67
|
popupsScrollableElement: props.popupsScrollableElement,
|
|
54
68
|
disabled: !!props.disabled,
|
|
55
|
-
containerElement:
|
|
69
|
+
containerElement: scrollContainerRef.current,
|
|
56
70
|
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
|
|
57
71
|
wrapperElement: props.wrapperElement
|
|
58
72
|
}), props.editorDOMElement)))), jsx("div", {
|
|
@@ -63,4 +77,6 @@ var Content = /*#__PURE__*/React.memo(function (props) {
|
|
|
63
77
|
});
|
|
64
78
|
});
|
|
65
79
|
});
|
|
66
|
-
export var FullPageContentArea = injectIntl(Content
|
|
80
|
+
export var FullPageContentArea = injectIntl(Content, {
|
|
81
|
+
forwardRef: true
|
|
82
|
+
});
|
package/dist/esm/version.json
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import React from 'react';
|
|
3
1
|
import { jsx } from '@emotion/react';
|
|
4
2
|
import { EditorAppearanceComponentProps } from '../../../types';
|
|
5
|
-
|
|
6
|
-
interface FullPageEditorState {
|
|
7
|
-
showKeyline: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare class FullPageEditor extends React.Component<EditorAppearanceComponentProps, FullPageEditorState> {
|
|
10
|
-
state: FullPageEditorState;
|
|
11
|
-
featureFlags: FeatureFlags;
|
|
12
|
-
static displayName: string;
|
|
13
|
-
private scrollContainer;
|
|
14
|
-
private contentArea;
|
|
15
|
-
private wrapperElementRef;
|
|
16
|
-
constructor(props: any);
|
|
17
|
-
private contentAreaRef;
|
|
18
|
-
private scrollContainerRef;
|
|
19
|
-
private updateToolbarKeyline;
|
|
20
|
-
private handleResize;
|
|
21
|
-
componentDidMount(): void;
|
|
22
|
-
componentWillUnmount(): void;
|
|
23
|
-
render(): jsx.JSX.Element;
|
|
24
|
-
}
|
|
25
|
-
export {};
|
|
3
|
+
export declare const FullPageEditor: (props: EditorAppearanceComponentProps) => jsx.JSX.Element;
|
|
@@ -10,7 +10,6 @@ import type { ReactHookFactory } from '@atlaskit/editor-common/types';
|
|
|
10
10
|
import type { FeatureFlags } from '../../../types/feature-flags';
|
|
11
11
|
interface FullPageEditorContentAreaProps {
|
|
12
12
|
appearance: EditorAppearance | undefined;
|
|
13
|
-
contentArea: HTMLElement | undefined;
|
|
14
13
|
contentComponents: UIComponentFactory[] | undefined;
|
|
15
14
|
pluginHooks: ReactHookFactory[] | undefined;
|
|
16
15
|
contextPanel: ReactComponents | undefined;
|
|
@@ -25,14 +24,15 @@ interface FullPageEditorContentAreaProps {
|
|
|
25
24
|
popupsBoundariesElement: HTMLElement | undefined;
|
|
26
25
|
popupsScrollableElement: HTMLElement | undefined;
|
|
27
26
|
providerFactory: ProviderFactory;
|
|
28
|
-
scrollContainer: HTMLElement | null;
|
|
29
|
-
contentAreaRef(ref: HTMLElement | null): void;
|
|
30
|
-
scrollContainerRef(ref: HTMLElement | null): void;
|
|
31
27
|
wrapperElement: HTMLElement | null;
|
|
32
28
|
featureFlags?: FeatureFlags;
|
|
33
29
|
}
|
|
34
30
|
export declare const CONTENT_AREA_TEST_ID = "ak-editor-fp-content-area";
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
type ScrollContainerRefs = {
|
|
32
|
+
scrollContainer: HTMLDivElement | null;
|
|
33
|
+
contentArea: HTMLDivElement | null;
|
|
34
|
+
};
|
|
35
|
+
export declare const FullPageContentArea: React.ForwardRefExoticComponent<Pick<import("react-intl-next").WithIntlProps<React.PropsWithChildren<FullPageEditorContentAreaProps & WrappedComponentProps<"intl"> & React.RefAttributes<ScrollContainerRefs>>>, "children" | "key" | "forwardedRef" | keyof FullPageEditorContentAreaProps> & React.RefAttributes<any>> & {
|
|
36
|
+
WrappedComponent: React.ComponentType<FullPageEditorContentAreaProps & WrappedComponentProps<"intl"> & React.RefAttributes<ScrollContainerRefs>>;
|
|
37
37
|
};
|
|
38
38
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React, { ReactElement } from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
3
4
|
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
4
5
|
import { EditorView } from 'prosemirror-view';
|
|
5
6
|
import { WrappedComponentProps } from 'react-intl-next';
|
|
@@ -30,7 +31,7 @@ export interface FullPageToolbarProps {
|
|
|
30
31
|
hasMinWidth?: boolean;
|
|
31
32
|
featureFlags?: FeatureFlags;
|
|
32
33
|
}
|
|
33
|
-
export declare const EditorToolbar: React.
|
|
34
|
+
export declare const EditorToolbar: React.MemoExoticComponent<(props: FullPageToolbarProps & WrappedComponentProps) => jsx.JSX.Element>;
|
|
34
35
|
export declare const FullPageToolbar: React.FC<import("react-intl-next").WithIntlProps<FullPageToolbarProps & WrappedComponentProps<"intl">>> & {
|
|
35
36
|
WrappedComponent: React.ComponentType<FullPageToolbarProps & WrappedComponentProps<"intl">>;
|
|
36
37
|
};
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import React from 'react';
|
|
3
1
|
import { jsx } from '@emotion/react';
|
|
4
2
|
import { EditorAppearanceComponentProps } from '../../../types';
|
|
5
|
-
|
|
6
|
-
interface FullPageEditorState {
|
|
7
|
-
showKeyline: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare class FullPageEditor extends React.Component<EditorAppearanceComponentProps, FullPageEditorState> {
|
|
10
|
-
state: FullPageEditorState;
|
|
11
|
-
featureFlags: FeatureFlags;
|
|
12
|
-
static displayName: string;
|
|
13
|
-
private scrollContainer;
|
|
14
|
-
private contentArea;
|
|
15
|
-
private wrapperElementRef;
|
|
16
|
-
constructor(props: any);
|
|
17
|
-
private contentAreaRef;
|
|
18
|
-
private scrollContainerRef;
|
|
19
|
-
private updateToolbarKeyline;
|
|
20
|
-
private handleResize;
|
|
21
|
-
componentDidMount(): void;
|
|
22
|
-
componentWillUnmount(): void;
|
|
23
|
-
render(): jsx.JSX.Element;
|
|
24
|
-
}
|
|
25
|
-
export {};
|
|
3
|
+
export declare const FullPageEditor: (props: EditorAppearanceComponentProps) => jsx.JSX.Element;
|
|
@@ -10,7 +10,6 @@ import type { ReactHookFactory } from '@atlaskit/editor-common/types';
|
|
|
10
10
|
import type { FeatureFlags } from '../../../types/feature-flags';
|
|
11
11
|
interface FullPageEditorContentAreaProps {
|
|
12
12
|
appearance: EditorAppearance | undefined;
|
|
13
|
-
contentArea: HTMLElement | undefined;
|
|
14
13
|
contentComponents: UIComponentFactory[] | undefined;
|
|
15
14
|
pluginHooks: ReactHookFactory[] | undefined;
|
|
16
15
|
contextPanel: ReactComponents | undefined;
|
|
@@ -25,14 +24,15 @@ interface FullPageEditorContentAreaProps {
|
|
|
25
24
|
popupsBoundariesElement: HTMLElement | undefined;
|
|
26
25
|
popupsScrollableElement: HTMLElement | undefined;
|
|
27
26
|
providerFactory: ProviderFactory;
|
|
28
|
-
scrollContainer: HTMLElement | null;
|
|
29
|
-
contentAreaRef(ref: HTMLElement | null): void;
|
|
30
|
-
scrollContainerRef(ref: HTMLElement | null): void;
|
|
31
27
|
wrapperElement: HTMLElement | null;
|
|
32
28
|
featureFlags?: FeatureFlags;
|
|
33
29
|
}
|
|
34
30
|
export declare const CONTENT_AREA_TEST_ID = "ak-editor-fp-content-area";
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
type ScrollContainerRefs = {
|
|
32
|
+
scrollContainer: HTMLDivElement | null;
|
|
33
|
+
contentArea: HTMLDivElement | null;
|
|
34
|
+
};
|
|
35
|
+
export declare const FullPageContentArea: React.ForwardRefExoticComponent<Pick<import("react-intl-next").WithIntlProps<React.PropsWithChildren<FullPageEditorContentAreaProps & WrappedComponentProps<"intl"> & React.RefAttributes<ScrollContainerRefs>>>, "children" | "key" | "forwardedRef" | keyof FullPageEditorContentAreaProps> & React.RefAttributes<any>> & {
|
|
36
|
+
WrappedComponent: React.ComponentType<FullPageEditorContentAreaProps & WrappedComponentProps<"intl"> & React.RefAttributes<ScrollContainerRefs>>;
|
|
37
37
|
};
|
|
38
38
|
export {};
|