@atlaskit/editor-core 198.6.3 → 198.6.5
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 +23 -0
- package/dist/cjs/composable-editor/editor-internal.js +3 -27
- package/dist/cjs/composable-editor/hooks/useProviders.js +3 -5
- package/dist/cjs/composable-editor/utils/handleProviders.js +0 -3
- package/dist/cjs/create-editor/ReactEditorView.js +13 -44
- package/dist/cjs/ui/Appearance/Chromeless.js +1 -2
- package/dist/cjs/ui/Appearance/Comment/Comment.js +1 -2
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +1 -1
- package/dist/cjs/ui/ContentStyles/index.js +2 -7
- package/dist/cjs/ui/EditorContext/index.js +40 -20
- package/dist/cjs/ui/WithEditorActions/index.js +70 -11
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/composable-editor/editor-internal.js +4 -28
- package/dist/es2019/composable-editor/hooks/useProviders.js +3 -5
- package/dist/es2019/composable-editor/utils/handleProviders.js +0 -3
- package/dist/es2019/create-editor/ReactEditorView.js +13 -44
- package/dist/es2019/ui/Appearance/Chromeless.js +1 -2
- package/dist/es2019/ui/Appearance/Comment/Comment.js +1 -2
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +1 -1
- package/dist/es2019/ui/ContentStyles/index.js +2 -8
- package/dist/es2019/ui/EditorContext/index.js +27 -13
- package/dist/es2019/ui/WithEditorActions/index.js +35 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/composable-editor/editor-internal.js +4 -28
- package/dist/esm/composable-editor/hooks/useProviders.js +3 -5
- package/dist/esm/composable-editor/utils/handleProviders.js +0 -3
- package/dist/esm/create-editor/ReactEditorView.js +13 -44
- package/dist/esm/ui/Appearance/Chromeless.js +1 -2
- package/dist/esm/ui/Appearance/Comment/Comment.js +1 -2
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +1 -1
- package/dist/esm/ui/ContentStyles/index.js +2 -7
- package/dist/esm/ui/EditorContext/index.js +39 -19
- package/dist/esm/ui/WithEditorActions/index.js +72 -13
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/create-editor/ReactEditorView.d.ts +1 -2
- package/dist/types/create-editor/create-universal-preset.d.ts +50 -22
- package/dist/types/presets/default.d.ts +44 -16
- package/dist/types/presets/universal.d.ts +50 -22
- package/dist/types/presets/useUniversalPreset.d.ts +50 -22
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/EditorContext/index.d.ts +9 -3
- package/dist/types/ui/WithEditorActions/index.d.ts +3 -12
- package/dist/types-ts4.5/create-editor/ReactEditorView.d.ts +1 -2
- package/dist/types-ts4.5/create-editor/create-universal-preset.d.ts +54 -22
- package/dist/types-ts4.5/presets/default.d.ts +48 -16
- package/dist/types-ts4.5/presets/universal.d.ts +54 -22
- package/dist/types-ts4.5/presets/useUniversalPreset.d.ts +54 -22
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/EditorContext/index.d.ts +9 -3
- package/dist/types-ts4.5/ui/WithEditorActions/index.d.ts +3 -12
- package/package.json +14 -13
|
@@ -18,7 +18,6 @@ import { EditorState, Selection, TextSelection } from '@atlaskit/editor-prosemir
|
|
|
18
18
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
19
19
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
20
20
|
import { createDispatch, EventDispatcher } from '../event-dispatcher';
|
|
21
|
-
import { EditorAPIContext } from '../presets/context';
|
|
22
21
|
import { findChangedNodesFromTransaction } from '../utils/findChangedNodesFromTransaction';
|
|
23
22
|
import { getNodesCount } from '../utils/getNodesCount';
|
|
24
23
|
import { isFullPage } from '../utils/is-full-page';
|
|
@@ -95,7 +94,7 @@ export class ReactEditorView extends React.Component {
|
|
|
95
94
|
return ((_this$props$editorPro3 = this.props.editorProps) === null || _this$props$editorPro3 === void 0 ? void 0 : (_this$props$editorPro4 = _this$props$editorPro3.performanceTracking) === null || _this$props$editorPro4 === void 0 ? void 0 : (_this$props$editorPro5 = _this$props$editorPro4.transactionTracking) === null || _this$props$editorPro5 === void 0 ? void 0 : _this$props$editorPro5.enabled) === false;
|
|
96
95
|
}
|
|
97
96
|
constructor(props) {
|
|
98
|
-
var _this$props$editorPro12, _props$
|
|
97
|
+
var _this$props$editorPro12, _props$setEditorAPI, _props$editorProps, _props$editorProps$pe, _props$editorProps$pe2;
|
|
99
98
|
super(props);
|
|
100
99
|
_defineProperty(this, "editorRef", /*#__PURE__*/React.createRef());
|
|
101
100
|
// ProseMirror is instantiated prior to the initial React render cycle,
|
|
@@ -546,7 +545,7 @@ export class ReactEditorView extends React.Component {
|
|
|
546
545
|
getEditorView: this.getEditorView
|
|
547
546
|
});
|
|
548
547
|
const _api = this.pluginInjectionAPI.api();
|
|
549
|
-
(_props$
|
|
548
|
+
(_props$setEditorAPI = props.setEditorAPI) === null || _props$setEditorAPI === void 0 ? void 0 : _props$setEditorAPI.call(props, _api);
|
|
550
549
|
this.eventDispatcher = new EventDispatcher();
|
|
551
550
|
this.dispatch = createDispatch(this.eventDispatcher);
|
|
552
551
|
this.errorReporter = createErrorReporter(props.editorProps.errorReporterHandler);
|
|
@@ -706,35 +705,10 @@ export class ReactEditorView extends React.Component {
|
|
|
706
705
|
return this.editorPlugins;
|
|
707
706
|
}
|
|
708
707
|
render() {
|
|
709
|
-
var _this$props$editorPro14, _this$props$editorPro15;
|
|
708
|
+
var _this$props$editorPro14, _this$props$editorPro15, _this$props$render, _this$props$render2, _this$props;
|
|
710
709
|
const renderTracking = (_this$props$editorPro14 = this.props.editorProps.performanceTracking) === null || _this$props$editorPro14 === void 0 ? void 0 : (_this$props$editorPro15 = _this$props$editorPro14.renderTracking) === null || _this$props$editorPro15 === void 0 ? void 0 : _this$props$editorPro15.reactEditorView;
|
|
711
710
|
const renderTrackingEnabled = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.enabled;
|
|
712
711
|
const useShallow = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.useShallow;
|
|
713
|
-
if (fg('platform_editor_remove_use_preset_context')) {
|
|
714
|
-
var _this$props$render, _this$props$render2, _this$props;
|
|
715
|
-
return /*#__PURE__*/React.createElement(ReactEditorViewContext.Provider, {
|
|
716
|
-
value: {
|
|
717
|
-
editorRef: this.editorRef,
|
|
718
|
-
editorView: this.view,
|
|
719
|
-
popupsMountPoint: this.props.editorProps.popupsMountPoint
|
|
720
|
-
}
|
|
721
|
-
}, renderTrackingEnabled && /*#__PURE__*/React.createElement(RenderTracking, {
|
|
722
|
-
componentProps: this.props,
|
|
723
|
-
action: ACTION.RE_RENDERED,
|
|
724
|
-
actionSubject: ACTION_SUBJECT.REACT_EDITOR_VIEW,
|
|
725
|
-
handleAnalyticsEvent: this.handleAnalyticsEvent,
|
|
726
|
-
useShallow: useShallow
|
|
727
|
-
}), this.props.render ? (_this$props$render = (_this$props$render2 = (_this$props = this.props).render) === null || _this$props$render2 === void 0 ? void 0 : _this$props$render2.call(_this$props, {
|
|
728
|
-
editor: this.editor,
|
|
729
|
-
view: this.view,
|
|
730
|
-
config: this.config,
|
|
731
|
-
eventDispatcher: this.eventDispatcher,
|
|
732
|
-
transformer: this.contentTransformer,
|
|
733
|
-
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
734
|
-
editorRef: this.editorRef,
|
|
735
|
-
editorAPI: this.props.editorAPI
|
|
736
|
-
})) !== null && _this$props$render !== void 0 ? _this$props$render : this.editor : this.editor);
|
|
737
|
-
}
|
|
738
712
|
return /*#__PURE__*/React.createElement(ReactEditorViewContext.Provider, {
|
|
739
713
|
value: {
|
|
740
714
|
editorRef: this.editorRef,
|
|
@@ -747,21 +721,16 @@ export class ReactEditorView extends React.Component {
|
|
|
747
721
|
actionSubject: ACTION_SUBJECT.REACT_EDITOR_VIEW,
|
|
748
722
|
handleAnalyticsEvent: this.handleAnalyticsEvent,
|
|
749
723
|
useShallow: useShallow
|
|
750
|
-
}), this.props.render ?
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
761
|
-
editorRef: this.editorRef,
|
|
762
|
-
editorAPI: editorApi
|
|
763
|
-
})) !== null && _this$props$render3 !== void 0 ? _this$props$render3 : this.editor;
|
|
764
|
-
}) : this.editor);
|
|
724
|
+
}), this.props.render ? (_this$props$render = (_this$props$render2 = (_this$props = this.props).render) === null || _this$props$render2 === void 0 ? void 0 : _this$props$render2.call(_this$props, {
|
|
725
|
+
editor: this.editor,
|
|
726
|
+
view: this.view,
|
|
727
|
+
config: this.config,
|
|
728
|
+
eventDispatcher: this.eventDispatcher,
|
|
729
|
+
transformer: this.contentTransformer,
|
|
730
|
+
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
731
|
+
editorRef: this.editorRef,
|
|
732
|
+
editorAPI: this.props.editorAPI
|
|
733
|
+
})) !== null && _this$props$render !== void 0 ? _this$props$render : this.editor : this.editor);
|
|
765
734
|
}
|
|
766
735
|
}
|
|
767
736
|
function getUAPrefix() {
|
|
@@ -9,7 +9,6 @@ import React, { Fragment } from 'react';
|
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
11
11
|
import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import { createEditorContentStyle } from '../ContentStyles';
|
|
14
13
|
import PluginSlot from '../PluginSlot';
|
|
15
14
|
import WithFlash from '../WithFlash';
|
|
@@ -89,7 +88,7 @@ export default class Editor extends React.Component {
|
|
|
89
88
|
, {
|
|
90
89
|
className: "ak-editor-content-area",
|
|
91
90
|
featureFlags: featureFlags,
|
|
92
|
-
viewMode:
|
|
91
|
+
viewMode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
93
92
|
}, customContentComponents && 'before' in customContentComponents ? customContentComponents.before : customContentComponents, jsx(PluginSlot, {
|
|
94
93
|
editorView: editorView,
|
|
95
94
|
editorActions: editorActions,
|
|
@@ -16,7 +16,6 @@ import { WidthConsumer, WidthProvider } from '@atlaskit/editor-common/ui';
|
|
|
16
16
|
import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
|
|
17
17
|
import { tableCommentEditorStyles } from '@atlaskit/editor-plugins/table/ui/common-styles';
|
|
18
18
|
import { akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
19
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
20
19
|
import messages from '../../../messages';
|
|
21
20
|
import { ClickAreaBlock } from '../../Addon';
|
|
22
21
|
import { createEditorContentStyle } from '../../ContentStyles';
|
|
@@ -210,7 +209,7 @@ export const CommentEditorWithIntl = props => {
|
|
|
210
209
|
'less-margin': width < akEditorMobileBreakoutPoint
|
|
211
210
|
}),
|
|
212
211
|
featureFlags: featureFlags,
|
|
213
|
-
viewMode:
|
|
212
|
+
viewMode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
214
213
|
}, customContentComponents && 'before' in customContentComponents ? customContentComponents.before : customContentComponents, jsx(PluginSlot, {
|
|
215
214
|
editorView: editorView,
|
|
216
215
|
editorActions: editorActions,
|
|
@@ -49,7 +49,7 @@ const Content = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
49
49
|
className: "fabric-editor-popup-scroll-parent",
|
|
50
50
|
featureFlags: props.featureFlags,
|
|
51
51
|
ref: scrollContainerRef,
|
|
52
|
-
viewMode:
|
|
52
|
+
viewMode: props === null || props === void 0 ? void 0 : props.viewMode
|
|
53
53
|
}, jsx(ClickAreaBlock, {
|
|
54
54
|
editorView: props.editorView,
|
|
55
55
|
editorDisabled: props.disabled
|
|
@@ -14,7 +14,6 @@ import { css, jsx, useTheme } from '@emotion/react';
|
|
|
14
14
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
15
15
|
import { telepointerStyle } from '@atlaskit/editor-common/collab';
|
|
16
16
|
import { EmojiSharedCssClassName } from '@atlaskit/editor-common/emoji';
|
|
17
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
18
17
|
import { MentionSharedCssClassName } from '@atlaskit/editor-common/mention';
|
|
19
18
|
import { PanelSharedCssClassName } from '@atlaskit/editor-common/panel';
|
|
20
19
|
import { gapCursorStyles } from '@atlaskit/editor-common/selection';
|
|
@@ -27,7 +26,6 @@ import { akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSma
|
|
|
27
26
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
28
27
|
import { useThemeObserver } from '@atlaskit/tokens';
|
|
29
28
|
import { InlineNodeViewSharedStyles } from '../../nodeviews/getInlineNodeViewProducer.styles';
|
|
30
|
-
import { usePresetContext } from '../../presets/context';
|
|
31
29
|
import { aiPanelStyles } from './ai-panels';
|
|
32
30
|
import { codeBlockStyles } from './code-block';
|
|
33
31
|
import { dateStyles } from './date';
|
|
@@ -376,17 +374,13 @@ export const createEditorContentStyle = styles => {
|
|
|
376
374
|
colorMode,
|
|
377
375
|
typography
|
|
378
376
|
} = useThemeObserver();
|
|
379
|
-
const editorAPI = usePresetContext();
|
|
380
|
-
const {
|
|
381
|
-
editorViewModeState
|
|
382
|
-
} = useSharedPluginState(editorAPI, ['editorViewMode']);
|
|
383
377
|
const memoizedStyle = useMemo(() => contentStyles({
|
|
384
378
|
theme,
|
|
385
379
|
colorMode,
|
|
386
380
|
featureFlags,
|
|
387
|
-
viewMode:
|
|
381
|
+
viewMode: props.viewMode,
|
|
388
382
|
typographyTheme: typography
|
|
389
|
-
}), [theme, colorMode, featureFlags,
|
|
383
|
+
}), [theme, colorMode, featureFlags, props.viewMode, typography]);
|
|
390
384
|
return (
|
|
391
385
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
392
386
|
jsx("div", {
|
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
+
import { EditorContext } from '@atlaskit/editor-common/UNSAFE_do_not_use_editor_context';
|
|
4
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import EditorActions from '../../actions';
|
|
6
|
-
import { PresetContextProvider } from '../../presets/context';
|
|
7
|
-
const EditorContext = /*#__PURE__*/React.createContext({});
|
|
8
7
|
export const useEditorContext = () => React.useContext(EditorContext);
|
|
9
|
-
export
|
|
8
|
+
export class LegacyEditorContext extends React.Component {
|
|
9
|
+
constructor(props) {
|
|
10
|
+
super(props);
|
|
11
|
+
}
|
|
12
|
+
render() {
|
|
13
|
+
if (fg('platform_editor_react18_phase2')) {
|
|
14
|
+
return /*#__PURE__*/React.createElement(LegacyEditorContextNew, this.props, this.props.children);
|
|
15
|
+
}
|
|
16
|
+
return /*#__PURE__*/React.createElement(LegacyEditorContextOld, this.props, this.props.children);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function LegacyEditorContextNew({
|
|
20
|
+
children,
|
|
21
|
+
editorActions
|
|
22
|
+
}) {
|
|
23
|
+
return /*#__PURE__*/React.createElement(EditorContext.Provider, {
|
|
24
|
+
value: {
|
|
25
|
+
editorActions: editorActions !== null && editorActions !== void 0 ? editorActions : new EditorActions()
|
|
26
|
+
}
|
|
27
|
+
}, children);
|
|
28
|
+
}
|
|
29
|
+
export default class LegacyEditorContextOld extends React.Component {
|
|
10
30
|
constructor(props) {
|
|
11
31
|
super(props);
|
|
12
32
|
this.editorActions = props.editorActions || new EditorActions();
|
|
@@ -17,17 +37,11 @@ export default class LegacyEditorContext extends React.Component {
|
|
|
17
37
|
};
|
|
18
38
|
}
|
|
19
39
|
render() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}, this.props.children);
|
|
24
|
-
} else {
|
|
25
|
-
return /*#__PURE__*/React.createElement(EditorContext.Provider, {
|
|
26
|
-
value: this.getChildContext()
|
|
27
|
-
}, /*#__PURE__*/React.createElement(PresetContextProvider, null, this.props.children));
|
|
28
|
-
}
|
|
40
|
+
return /*#__PURE__*/React.createElement(EditorContext.Provider, {
|
|
41
|
+
value: this.getChildContext()
|
|
42
|
+
}, this.props.children);
|
|
29
43
|
}
|
|
30
44
|
}
|
|
31
|
-
_defineProperty(
|
|
45
|
+
_defineProperty(LegacyEditorContextOld, "childContextTypes", {
|
|
32
46
|
editorActions: PropTypes.object
|
|
33
47
|
});
|
|
@@ -1,7 +1,41 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
+
import { EditorContext } from '@atlaskit/editor-common/UNSAFE_do_not_use_editor_context';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
6
|
export default class WithEditorActions extends React.Component {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props);
|
|
9
|
+
}
|
|
10
|
+
render() {
|
|
11
|
+
if (fg('platform_editor_react18_phase2')) {
|
|
12
|
+
return /*#__PURE__*/React.createElement(WithEditorActionsNew, this.props);
|
|
13
|
+
}
|
|
14
|
+
return /*#__PURE__*/React.createElement(WithEditorActionsOld, this.props);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function WithEditorActionsNew(props) {
|
|
18
|
+
const {
|
|
19
|
+
render
|
|
20
|
+
} = props;
|
|
21
|
+
const context = React.useContext(EditorContext);
|
|
22
|
+
return /*#__PURE__*/React.createElement(WithEditorActionsInner, {
|
|
23
|
+
render: render,
|
|
24
|
+
editorActions: context === null || context === void 0 ? void 0 : context.editorActions
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
class WithEditorActionsInner extends React.Component {
|
|
28
|
+
componentDidMount() {
|
|
29
|
+
this.props.editorActions._privateSubscribe(() => this.forceUpdate());
|
|
30
|
+
}
|
|
31
|
+
componentWillUnmount() {
|
|
32
|
+
this.props.editorActions._privateUnsubscribe(() => this.forceUpdate());
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
return this.props.render(this.props.editorActions);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
class WithEditorActionsOld extends React.Component {
|
|
5
39
|
constructor(...args) {
|
|
6
40
|
super(...args);
|
|
7
41
|
_defineProperty(this, "onContextUpdate", () => {
|
|
@@ -19,6 +53,6 @@ export default class WithEditorActions extends React.Component {
|
|
|
19
53
|
return this.props.render(this.context.editorActions);
|
|
20
54
|
}
|
|
21
55
|
}
|
|
22
|
-
_defineProperty(
|
|
56
|
+
_defineProperty(WithEditorActionsOld, "contextTypes", {
|
|
23
57
|
editorActions: PropTypes.object.isRequired
|
|
24
58
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "198.6.
|
|
2
|
+
export const version = "198.6.5";
|
|
@@ -7,18 +7,16 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
* @jsxRuntime classic
|
|
8
8
|
* @jsx jsx
|
|
9
9
|
*/
|
|
10
|
-
import { Fragment, memo,
|
|
10
|
+
import { Fragment, memo, useState } from 'react';
|
|
11
11
|
|
|
12
12
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
13
13
|
import { css, jsx } from '@emotion/react';
|
|
14
14
|
import { ACTION, ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
15
15
|
import { usePortalProvider } from '@atlaskit/editor-common/portal';
|
|
16
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
16
|
import ErrorBoundary from '../create-editor/ErrorBoundary';
|
|
18
17
|
import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
|
|
19
18
|
import ReactEditorView from '../create-editor/ReactEditorView';
|
|
20
19
|
import { ContextAdapter } from '../nodeviews/context-adapter';
|
|
21
|
-
import { usePresetContext, useSetPresetContext } from '../presets/context';
|
|
22
20
|
import EditorContext from '../ui/EditorContext';
|
|
23
21
|
import { IntlProviderIfMissingWrapper } from '../ui/IntlProviderIfMissingWrapper/IntlProviderIfMissingWrapper';
|
|
24
22
|
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
@@ -139,39 +137,17 @@ export var EditorInternal = /*#__PURE__*/memo(function (_ref) {
|
|
|
139
137
|
});
|
|
140
138
|
function ReactEditorViewContextWrapper(props) {
|
|
141
139
|
var _media, _linking;
|
|
142
|
-
//
|
|
143
|
-
var setInternalEditorAPI = useSetPresetContext();
|
|
144
|
-
var presetContextEditorAPI = usePresetContext();
|
|
145
|
-
|
|
146
|
-
// new way of storing the editorApi when FF platform_editor_remove_use_preset_context is enabled
|
|
140
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
147
141
|
var _useState = useState(undefined),
|
|
148
142
|
_useState2 = _slicedToArray(_useState, 2),
|
|
149
143
|
editorAPI = _useState2[0],
|
|
150
144
|
setEditorAPI = _useState2[1];
|
|
151
145
|
|
|
152
|
-
/**
|
|
153
|
-
* We use the context to retrieve the editorAPI
|
|
154
|
-
* externally for consumers via `usePreset`.
|
|
155
|
-
*
|
|
156
|
-
* However we also may need to retrieve this value internally via context
|
|
157
|
-
* so we should also set the value for the `EditorContext` that is used in
|
|
158
|
-
* `EditorInternal`.
|
|
159
|
-
*/
|
|
160
|
-
var setPresetContextEditorAPI = useCallback(
|
|
161
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
162
|
-
function (api) {
|
|
163
|
-
if (fg('platform_editor_remove_use_preset_context')) {
|
|
164
|
-
setEditorAPI(api);
|
|
165
|
-
} else {
|
|
166
|
-
setInternalEditorAPI === null || setInternalEditorAPI === void 0 || setInternalEditorAPI(api);
|
|
167
|
-
}
|
|
168
|
-
}, [setInternalEditorAPI, setEditorAPI]);
|
|
169
|
-
|
|
170
146
|
// TODO: Remove these when we deprecate these props from editor-props - smartLinks is unfortunately still used in some places, we can sidestep this problem if we move everyone across to ComposableEditor and deprecate Editor
|
|
171
147
|
var UNSAFE_cards = props.editorProps.UNSAFE_cards;
|
|
172
148
|
var smartLinks = props.editorProps.smartLinks;
|
|
173
149
|
useProviders({
|
|
174
|
-
editorApi:
|
|
150
|
+
editorApi: editorAPI,
|
|
175
151
|
contextIdentifierProvider: props.editorProps.contextIdentifierProvider,
|
|
176
152
|
mediaProvider: (_media = props.editorProps.media) === null || _media === void 0 ? void 0 : _media.provider,
|
|
177
153
|
cardProvider: ((_linking = props.editorProps.linking) === null || _linking === void 0 || (_linking = _linking.smartLinks) === null || _linking === void 0 ? void 0 : _linking.provider) || smartLinks && smartLinks.provider || UNSAFE_cards && UNSAFE_cards.provider,
|
|
@@ -181,6 +157,6 @@ function ReactEditorViewContextWrapper(props) {
|
|
|
181
157
|
});
|
|
182
158
|
return jsx(ReactEditorView, _extends({}, props, {
|
|
183
159
|
editorAPI: editorAPI,
|
|
184
|
-
|
|
160
|
+
setEditorAPI: setEditorAPI
|
|
185
161
|
}));
|
|
186
162
|
}
|
|
@@ -79,11 +79,9 @@ export var useProviders = function useProviders(_ref) {
|
|
|
79
79
|
}
|
|
80
80
|
}, [autoformattingProvider, editorApi]);
|
|
81
81
|
useEffect(function () {
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
editorApi === null || editorApi === void 0 || (_editorApi$taskDecisi = editorApi.taskDecision) === null || _editorApi$taskDecisi === void 0 || _editorApi$taskDecisi.actions.setProvider(taskDecisionProvider);
|
|
86
|
-
}
|
|
82
|
+
if (taskDecisionProvider) {
|
|
83
|
+
var _editorApi$taskDecisi;
|
|
84
|
+
editorApi === null || editorApi === void 0 || (_editorApi$taskDecisi = editorApi.taskDecision) === null || _editorApi$taskDecisi === void 0 || _editorApi$taskDecisi.actions.setProvider(taskDecisionProvider);
|
|
87
85
|
}
|
|
88
86
|
}, [taskDecisionProvider, editorApi]);
|
|
89
87
|
};
|
|
@@ -23,9 +23,6 @@ export default function handleProviders(providerFactory, _ref, extensionProvider
|
|
|
23
23
|
searchProvider = _ref.searchProvider;
|
|
24
24
|
providerFactory.setProvider('emojiProvider', emojiProvider);
|
|
25
25
|
providerFactory.setProvider('mentionProvider', mentionProvider);
|
|
26
|
-
if (!fg('platform_editor_td_provider_from_plugin_config')) {
|
|
27
|
-
providerFactory.setProvider('taskDecisionProvider', taskDecisionProvider);
|
|
28
|
-
}
|
|
29
26
|
providerFactory.setProvider('contextIdentifierProvider', contextIdentifierProvider);
|
|
30
27
|
providerFactory.setProvider('imageUploadProvider', imageUploadProvider);
|
|
31
28
|
providerFactory.setProvider('collabEditProvider', collabEditProvider);
|
|
@@ -28,7 +28,6 @@ import { EditorState, Selection, TextSelection } from '@atlaskit/editor-prosemir
|
|
|
28
28
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
29
29
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
30
30
|
import { createDispatch, EventDispatcher } from '../event-dispatcher';
|
|
31
|
-
import { EditorAPIContext } from '../presets/context';
|
|
32
31
|
import { findChangedNodesFromTransaction } from '../utils/findChangedNodesFromTransaction';
|
|
33
32
|
import { getNodesCount } from '../utils/getNodesCount';
|
|
34
33
|
import { isFullPage } from '../utils/is-full-page';
|
|
@@ -87,7 +86,7 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
87
86
|
_inherits(ReactEditorView, _React$Component);
|
|
88
87
|
var _super = _createSuper(ReactEditorView);
|
|
89
88
|
function ReactEditorView(props) {
|
|
90
|
-
var _this$props$editorPro5, _props$
|
|
89
|
+
var _this$props$editorPro5, _props$setEditorAPI, _props$editorProps;
|
|
91
90
|
var _this;
|
|
92
91
|
_classCallCheck(this, ReactEditorView);
|
|
93
92
|
_this = _super.call(this, props);
|
|
@@ -541,7 +540,7 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
541
540
|
getEditorView: _this.getEditorView
|
|
542
541
|
});
|
|
543
542
|
var _api = _this.pluginInjectionAPI.api();
|
|
544
|
-
(_props$
|
|
543
|
+
(_props$setEditorAPI = props.setEditorAPI) === null || _props$setEditorAPI === void 0 || _props$setEditorAPI.call(props, _api);
|
|
545
544
|
_this.eventDispatcher = new EventDispatcher();
|
|
546
545
|
_this.dispatch = createDispatch(_this.eventDispatcher);
|
|
547
546
|
_this.errorReporter = createErrorReporter(props.editorProps.errorReporterHandler);
|
|
@@ -755,36 +754,10 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
755
754
|
}, {
|
|
756
755
|
key: "render",
|
|
757
756
|
value: function render() {
|
|
758
|
-
var _this$props$editorPro10,
|
|
759
|
-
_this3 = this;
|
|
757
|
+
var _this$props$editorPro10, _this$props$render, _this$props$render2, _this$props;
|
|
760
758
|
var renderTracking = (_this$props$editorPro10 = this.props.editorProps.performanceTracking) === null || _this$props$editorPro10 === void 0 || (_this$props$editorPro10 = _this$props$editorPro10.renderTracking) === null || _this$props$editorPro10 === void 0 ? void 0 : _this$props$editorPro10.reactEditorView;
|
|
761
759
|
var renderTrackingEnabled = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.enabled;
|
|
762
760
|
var useShallow = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.useShallow;
|
|
763
|
-
if (fg('platform_editor_remove_use_preset_context')) {
|
|
764
|
-
var _this$props$render, _this$props$render2, _this$props;
|
|
765
|
-
return /*#__PURE__*/React.createElement(ReactEditorViewContext.Provider, {
|
|
766
|
-
value: {
|
|
767
|
-
editorRef: this.editorRef,
|
|
768
|
-
editorView: this.view,
|
|
769
|
-
popupsMountPoint: this.props.editorProps.popupsMountPoint
|
|
770
|
-
}
|
|
771
|
-
}, renderTrackingEnabled && /*#__PURE__*/React.createElement(RenderTracking, {
|
|
772
|
-
componentProps: this.props,
|
|
773
|
-
action: ACTION.RE_RENDERED,
|
|
774
|
-
actionSubject: ACTION_SUBJECT.REACT_EDITOR_VIEW,
|
|
775
|
-
handleAnalyticsEvent: this.handleAnalyticsEvent,
|
|
776
|
-
useShallow: useShallow
|
|
777
|
-
}), this.props.render ? (_this$props$render = (_this$props$render2 = (_this$props = this.props).render) === null || _this$props$render2 === void 0 ? void 0 : _this$props$render2.call(_this$props, {
|
|
778
|
-
editor: this.editor,
|
|
779
|
-
view: this.view,
|
|
780
|
-
config: this.config,
|
|
781
|
-
eventDispatcher: this.eventDispatcher,
|
|
782
|
-
transformer: this.contentTransformer,
|
|
783
|
-
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
784
|
-
editorRef: this.editorRef,
|
|
785
|
-
editorAPI: this.props.editorAPI
|
|
786
|
-
})) !== null && _this$props$render !== void 0 ? _this$props$render : this.editor : this.editor);
|
|
787
|
-
}
|
|
788
761
|
return /*#__PURE__*/React.createElement(ReactEditorViewContext.Provider, {
|
|
789
762
|
value: {
|
|
790
763
|
editorRef: this.editorRef,
|
|
@@ -797,20 +770,16 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
797
770
|
actionSubject: ACTION_SUBJECT.REACT_EDITOR_VIEW,
|
|
798
771
|
handleAnalyticsEvent: this.handleAnalyticsEvent,
|
|
799
772
|
useShallow: useShallow
|
|
800
|
-
}), this.props.render ?
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
editorRef: _this3.editorRef,
|
|
811
|
-
editorAPI: editorApi
|
|
812
|
-
})) !== null && _this3$props$render !== void 0 ? _this3$props$render : _this3.editor;
|
|
813
|
-
}) : this.editor);
|
|
773
|
+
}), this.props.render ? (_this$props$render = (_this$props$render2 = (_this$props = this.props).render) === null || _this$props$render2 === void 0 ? void 0 : _this$props$render2.call(_this$props, {
|
|
774
|
+
editor: this.editor,
|
|
775
|
+
view: this.view,
|
|
776
|
+
config: this.config,
|
|
777
|
+
eventDispatcher: this.eventDispatcher,
|
|
778
|
+
transformer: this.contentTransformer,
|
|
779
|
+
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
780
|
+
editorRef: this.editorRef,
|
|
781
|
+
editorAPI: this.props.editorAPI
|
|
782
|
+
})) !== null && _this$props$render !== void 0 ? _this$props$render : this.editor : this.editor);
|
|
814
783
|
}
|
|
815
784
|
}]);
|
|
816
785
|
return ReactEditorView;
|
|
@@ -17,7 +17,6 @@ import React, { Fragment } from 'react';
|
|
|
17
17
|
import { css, jsx } from '@emotion/react';
|
|
18
18
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
19
19
|
import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
20
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
21
20
|
import { createEditorContentStyle } from '../ContentStyles';
|
|
22
21
|
import PluginSlot from '../PluginSlot';
|
|
23
22
|
import WithFlash from '../WithFlash';
|
|
@@ -104,7 +103,7 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
104
103
|
, {
|
|
105
104
|
className: "ak-editor-content-area",
|
|
106
105
|
featureFlags: featureFlags,
|
|
107
|
-
viewMode:
|
|
106
|
+
viewMode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
108
107
|
}, customContentComponents && 'before' in customContentComponents ? customContentComponents.before : customContentComponents, jsx(PluginSlot, {
|
|
109
108
|
editorView: editorView,
|
|
110
109
|
editorActions: editorActions,
|
|
@@ -17,7 +17,6 @@ import { WidthConsumer, WidthProvider } from '@atlaskit/editor-common/ui';
|
|
|
17
17
|
import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
|
|
18
18
|
import { tableCommentEditorStyles } from '@atlaskit/editor-plugins/table/ui/common-styles';
|
|
19
19
|
import { akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
20
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
21
20
|
import messages from '../../../messages';
|
|
22
21
|
import { ClickAreaBlock } from '../../Addon';
|
|
23
22
|
import { createEditorContentStyle } from '../../ContentStyles';
|
|
@@ -213,7 +212,7 @@ export var CommentEditorWithIntl = function CommentEditorWithIntl(props) {
|
|
|
213
212
|
'less-margin': width < akEditorMobileBreakoutPoint
|
|
214
213
|
}),
|
|
215
214
|
featureFlags: featureFlags,
|
|
216
|
-
viewMode:
|
|
215
|
+
viewMode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
217
216
|
}, customContentComponents && 'before' in customContentComponents ? customContentComponents.before : customContentComponents, jsx(PluginSlot, {
|
|
218
217
|
editorView: editorView,
|
|
219
218
|
editorActions: editorActions,
|
|
@@ -51,7 +51,7 @@ var Content = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
51
51
|
className: "fabric-editor-popup-scroll-parent",
|
|
52
52
|
featureFlags: props.featureFlags,
|
|
53
53
|
ref: scrollContainerRef,
|
|
54
|
-
viewMode:
|
|
54
|
+
viewMode: props === null || props === void 0 ? void 0 : props.viewMode
|
|
55
55
|
}, jsx(ClickAreaBlock, {
|
|
56
56
|
editorView: props.editorView,
|
|
57
57
|
editorDisabled: props.disabled
|
|
@@ -16,7 +16,6 @@ import { css, jsx, useTheme } from '@emotion/react';
|
|
|
16
16
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
17
17
|
import { telepointerStyle } from '@atlaskit/editor-common/collab';
|
|
18
18
|
import { EmojiSharedCssClassName } from '@atlaskit/editor-common/emoji';
|
|
19
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
20
19
|
import { MentionSharedCssClassName } from '@atlaskit/editor-common/mention';
|
|
21
20
|
import { PanelSharedCssClassName } from '@atlaskit/editor-common/panel';
|
|
22
21
|
import { gapCursorStyles } from '@atlaskit/editor-common/selection';
|
|
@@ -29,7 +28,6 @@ import { akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSma
|
|
|
29
28
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
30
29
|
import { useThemeObserver } from '@atlaskit/tokens';
|
|
31
30
|
import { InlineNodeViewSharedStyles } from '../../nodeviews/getInlineNodeViewProducer.styles';
|
|
32
|
-
import { usePresetContext } from '../../presets/context';
|
|
33
31
|
import { aiPanelStyles } from './ai-panels';
|
|
34
32
|
import { codeBlockStyles } from './code-block';
|
|
35
33
|
import { dateStyles } from './date';
|
|
@@ -91,18 +89,15 @@ export var createEditorContentStyle = function createEditorContentStyle(styles)
|
|
|
91
89
|
var _useThemeObserver = useThemeObserver(),
|
|
92
90
|
colorMode = _useThemeObserver.colorMode,
|
|
93
91
|
typography = _useThemeObserver.typography;
|
|
94
|
-
var editorAPI = usePresetContext();
|
|
95
|
-
var _useSharedPluginState = useSharedPluginState(editorAPI, ['editorViewMode']),
|
|
96
|
-
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
97
92
|
var memoizedStyle = useMemo(function () {
|
|
98
93
|
return contentStyles({
|
|
99
94
|
theme: theme,
|
|
100
95
|
colorMode: colorMode,
|
|
101
96
|
featureFlags: featureFlags,
|
|
102
|
-
viewMode:
|
|
97
|
+
viewMode: props.viewMode,
|
|
103
98
|
typographyTheme: typography
|
|
104
99
|
});
|
|
105
|
-
}, [theme, colorMode, featureFlags,
|
|
100
|
+
}, [theme, colorMode, featureFlags, props.viewMode, typography]);
|
|
106
101
|
return (
|
|
107
102
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
108
103
|
jsx("div", {
|