@atlaskit/editor-core 187.47.9 → 187.48.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 +19 -0
- package/dist/cjs/{editor-next → composable-editor}/editor-internal.js +2 -22
- package/dist/cjs/{editor-next/index.js → composable-editor/editor.js} +16 -10
- package/dist/cjs/composable-editor.js +2 -3
- package/dist/cjs/editor.js +4 -4
- package/dist/cjs/index.js +7 -7
- package/dist/cjs/labs/next/presets/default.js +2 -2
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +3 -70
- package/dist/cjs/plugins/floating-toolbar/utils.js +0 -41
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +28 -11
- package/dist/cjs/test-utils.js +2 -2
- package/dist/cjs/ui/CollapsedEditor/index.js +3 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/{editor-next → composable-editor}/editor-internal.js +1 -23
- package/dist/es2019/{editor-next/index.js → composable-editor/editor.js} +15 -7
- package/dist/es2019/composable-editor.js +1 -1
- package/dist/es2019/editor.js +4 -4
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/labs/next/presets/default.js +1 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +1 -52
- package/dist/es2019/plugins/floating-toolbar/utils.js +0 -36
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +21 -4
- package/dist/es2019/test-utils.js +1 -1
- package/dist/es2019/ui/CollapsedEditor/index.js +3 -3
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/{editor-next → composable-editor}/editor-internal.js +1 -20
- package/dist/esm/{editor-next/index.js → composable-editor/editor.js} +15 -7
- package/dist/esm/composable-editor.js +1 -1
- package/dist/esm/editor.js +4 -4
- package/dist/esm/index.js +1 -1
- package/dist/esm/labs/next/presets/default.js +1 -1
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +1 -66
- package/dist/esm/plugins/floating-toolbar/utils.js +0 -37
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +21 -4
- package/dist/esm/test-utils.js +1 -1
- package/dist/esm/ui/CollapsedEditor/index.js +3 -3
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/{types-ts4.5/editor-next → types/composable-editor}/editor-internal.d.ts +4 -13
- package/dist/{types-ts4.5/editor-next/index.d.ts → types/composable-editor/editor.d.ts} +2 -4
- package/dist/types/{editor-next → composable-editor}/hooks/useMeasureEditorMountTime.d.ts +3 -3
- package/dist/types/{editor-next → composable-editor}/utils/getBaseFontSize.d.ts +1 -1
- package/dist/{types-ts4.5/editor-next → types/composable-editor}/utils/getProvidersFromEditorProps.d.ts +2 -2
- package/dist/types/{editor-next → composable-editor}/utils/sendDurationAnalytics.d.ts +4 -4
- package/dist/{types-ts4.5/editor-next → types/composable-editor}/utils/trackEditorActions.d.ts +3 -3
- package/dist/types/composable-editor.d.ts +1 -1
- package/dist/types/create-editor/create-plugins-list.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/labs/next/presets/default.d.ts +1 -1
- package/dist/types/plugins/code-block/ide-ux/quote-handling.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/commands.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -4
- package/dist/types/plugins/floating-toolbar/utils.d.ts +0 -2
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ConfigPanel/FormErrorBoundary.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/{types/editor-next → types-ts4.5/composable-editor}/editor-internal.d.ts +4 -13
- package/dist/{types/editor-next/index.d.ts → types-ts4.5/composable-editor/editor.d.ts} +2 -4
- package/dist/types-ts4.5/{editor-next → composable-editor}/hooks/useMeasureEditorMountTime.d.ts +3 -3
- package/dist/types-ts4.5/{editor-next → composable-editor}/utils/getBaseFontSize.d.ts +1 -1
- package/dist/{types/editor-next → types-ts4.5/composable-editor}/utils/getProvidersFromEditorProps.d.ts +2 -2
- package/dist/types-ts4.5/{editor-next → composable-editor}/utils/sendDurationAnalytics.d.ts +4 -4
- package/dist/{types/editor-next → types-ts4.5/composable-editor}/utils/trackEditorActions.d.ts +3 -3
- package/dist/types-ts4.5/composable-editor.d.ts +1 -1
- package/dist/types-ts4.5/create-editor/create-plugins-list.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +1 -1
- package/dist/types-ts4.5/plugins/code-block/ide-ux/quote-handling.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/commands.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Select.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -4
- package/dist/types-ts4.5/plugins/floating-toolbar/utils.d.ts +0 -2
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types-ts4.5/ui/ConfigPanel/FormErrorBoundary.d.ts +1 -1
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/package.json +8 -9
- package/report.api.md +3 -26
- package/tmp/api-report-tmp.d.ts +3 -26
- package/dist/cjs/plugins/base/commands.js +0 -20
- package/dist/cjs/plugins/base/index.js +0 -13
- package/dist/cjs/plugins/base/plugin.js +0 -143
- package/dist/cjs/plugins/base/pm-plugins/context-identifier.js +0 -58
- package/dist/cjs/plugins/base/pm-plugins/disable-spell-checking.js +0 -63
- package/dist/cjs/plugins/base/pm-plugins/filter-steps.js +0 -34
- package/dist/cjs/plugins/base/pm-plugins/fix-chrome-88-selection.js +0 -34
- package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +0 -265
- package/dist/cjs/plugins/base/pm-plugins/inline-cursor-target.js +0 -183
- package/dist/cjs/plugins/base/pm-plugins/newline-preserve-marks.js +0 -34
- package/dist/cjs/plugins/base/pm-plugins/scroll-gutter/index.js +0 -262
- package/dist/cjs/plugins/base/pm-plugins/scroll-gutter/plugin-key.js +0 -15
- package/dist/cjs/plugins/base/utils/frozen-editor.js +0 -11
- package/dist/cjs/plugins/base/utils/input-latency-tracking.js +0 -134
- package/dist/es2019/plugins/base/commands.js +0 -13
- package/dist/es2019/plugins/base/index.js +0 -2
- package/dist/es2019/plugins/base/plugin.js +0 -113
- package/dist/es2019/plugins/base/pm-plugins/context-identifier.js +0 -43
- package/dist/es2019/plugins/base/pm-plugins/disable-spell-checking.js +0 -54
- package/dist/es2019/plugins/base/pm-plugins/filter-steps.js +0 -23
- package/dist/es2019/plugins/base/pm-plugins/fix-chrome-88-selection.js +0 -24
- package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +0 -258
- package/dist/es2019/plugins/base/pm-plugins/inline-cursor-target.js +0 -186
- package/dist/es2019/plugins/base/pm-plugins/newline-preserve-marks.js +0 -20
- package/dist/es2019/plugins/base/pm-plugins/scroll-gutter/index.js +0 -242
- package/dist/es2019/plugins/base/pm-plugins/scroll-gutter/plugin-key.js +0 -7
- package/dist/es2019/plugins/base/utils/frozen-editor.js +0 -2
- package/dist/es2019/plugins/base/utils/input-latency-tracking.js +0 -104
- package/dist/esm/plugins/base/commands.js +0 -13
- package/dist/esm/plugins/base/index.js +0 -2
- package/dist/esm/plugins/base/plugin.js +0 -131
- package/dist/esm/plugins/base/pm-plugins/context-identifier.js +0 -48
- package/dist/esm/plugins/base/pm-plugins/disable-spell-checking.js +0 -56
- package/dist/esm/plugins/base/pm-plugins/filter-steps.js +0 -27
- package/dist/esm/plugins/base/pm-plugins/fix-chrome-88-selection.js +0 -26
- package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +0 -251
- package/dist/esm/plugins/base/pm-plugins/inline-cursor-target.js +0 -174
- package/dist/esm/plugins/base/pm-plugins/newline-preserve-marks.js +0 -26
- package/dist/esm/plugins/base/pm-plugins/scroll-gutter/index.js +0 -254
- package/dist/esm/plugins/base/pm-plugins/scroll-gutter/plugin-key.js +0 -7
- package/dist/esm/plugins/base/utils/frozen-editor.js +0 -4
- package/dist/esm/plugins/base/utils/input-latency-tracking.js +0 -128
- package/dist/types/plugins/base/commands.d.ts +0 -2
- package/dist/types/plugins/base/index.d.ts +0 -5
- package/dist/types/plugins/base/plugin.d.ts +0 -25
- package/dist/types/plugins/base/pm-plugins/context-identifier.d.ts +0 -13
- package/dist/types/plugins/base/pm-plugins/disable-spell-checking.d.ts +0 -4
- package/dist/types/plugins/base/pm-plugins/filter-steps.d.ts +0 -4
- package/dist/types/plugins/base/pm-plugins/fix-chrome-88-selection.d.ts +0 -5
- package/dist/types/plugins/base/pm-plugins/frozen-editor.d.ts +0 -12
- package/dist/types/plugins/base/pm-plugins/inline-cursor-target.d.ts +0 -17
- package/dist/types/plugins/base/pm-plugins/newline-preserve-marks.d.ts +0 -5
- package/dist/types/plugins/base/pm-plugins/scroll-gutter/index.d.ts +0 -22
- package/dist/types/plugins/base/pm-plugins/scroll-gutter/plugin-key.d.ts +0 -7
- package/dist/types/plugins/base/utils/frozen-editor.d.ts +0 -2
- package/dist/types/plugins/base/utils/input-latency-tracking.d.ts +0 -42
- package/dist/types-ts4.5/plugins/base/commands.d.ts +0 -2
- package/dist/types-ts4.5/plugins/base/index.d.ts +0 -5
- package/dist/types-ts4.5/plugins/base/plugin.d.ts +0 -27
- package/dist/types-ts4.5/plugins/base/pm-plugins/context-identifier.d.ts +0 -13
- package/dist/types-ts4.5/plugins/base/pm-plugins/disable-spell-checking.d.ts +0 -4
- package/dist/types-ts4.5/plugins/base/pm-plugins/filter-steps.d.ts +0 -4
- package/dist/types-ts4.5/plugins/base/pm-plugins/fix-chrome-88-selection.d.ts +0 -5
- package/dist/types-ts4.5/plugins/base/pm-plugins/frozen-editor.d.ts +0 -12
- package/dist/types-ts4.5/plugins/base/pm-plugins/inline-cursor-target.d.ts +0 -17
- package/dist/types-ts4.5/plugins/base/pm-plugins/newline-preserve-marks.d.ts +0 -5
- package/dist/types-ts4.5/plugins/base/pm-plugins/scroll-gutter/index.d.ts +0 -22
- package/dist/types-ts4.5/plugins/base/pm-plugins/scroll-gutter/plugin-key.d.ts +0 -7
- package/dist/types-ts4.5/plugins/base/utils/frozen-editor.d.ts +0 -2
- package/dist/types-ts4.5/plugins/base/utils/input-latency-tracking.d.ts +0 -42
- /package/dist/cjs/{editor-next → composable-editor}/hooks/useEditorMeasuresConstructor.js +0 -0
- /package/dist/cjs/{editor-next → composable-editor}/hooks/useMeasureEditorMountTime.js +0 -0
- /package/dist/cjs/{editor-next → composable-editor}/hooks/useProviderFactory.js +0 -0
- /package/dist/cjs/{editor-next → composable-editor}/utils/editorMeasureTTICallback.js +0 -0
- /package/dist/cjs/{editor-next → composable-editor}/utils/getBaseFontSize.js +0 -0
- /package/dist/cjs/{editor-next → composable-editor}/utils/getProvidersFromEditorProps.js +0 -0
- /package/dist/cjs/{editor-next → composable-editor}/utils/handleProviders.js +0 -0
- /package/dist/cjs/{editor-next → composable-editor}/utils/sendDurationAnalytics.js +0 -0
- /package/dist/cjs/{editor-next → composable-editor}/utils/trackEditorActions.js +0 -0
- /package/dist/es2019/{editor-next → composable-editor}/hooks/useEditorMeasuresConstructor.js +0 -0
- /package/dist/es2019/{editor-next → composable-editor}/hooks/useMeasureEditorMountTime.js +0 -0
- /package/dist/es2019/{editor-next → composable-editor}/hooks/useProviderFactory.js +0 -0
- /package/dist/es2019/{editor-next → composable-editor}/utils/editorMeasureTTICallback.js +0 -0
- /package/dist/es2019/{editor-next → composable-editor}/utils/getBaseFontSize.js +0 -0
- /package/dist/es2019/{editor-next → composable-editor}/utils/getProvidersFromEditorProps.js +0 -0
- /package/dist/es2019/{editor-next → composable-editor}/utils/handleProviders.js +0 -0
- /package/dist/es2019/{editor-next → composable-editor}/utils/sendDurationAnalytics.js +0 -0
- /package/dist/es2019/{editor-next → composable-editor}/utils/trackEditorActions.js +0 -0
- /package/dist/esm/{editor-next → composable-editor}/hooks/useEditorMeasuresConstructor.js +0 -0
- /package/dist/esm/{editor-next → composable-editor}/hooks/useMeasureEditorMountTime.js +0 -0
- /package/dist/esm/{editor-next → composable-editor}/hooks/useProviderFactory.js +0 -0
- /package/dist/esm/{editor-next → composable-editor}/utils/editorMeasureTTICallback.js +0 -0
- /package/dist/esm/{editor-next → composable-editor}/utils/getBaseFontSize.js +0 -0
- /package/dist/esm/{editor-next → composable-editor}/utils/getProvidersFromEditorProps.js +0 -0
- /package/dist/esm/{editor-next → composable-editor}/utils/handleProviders.js +0 -0
- /package/dist/esm/{editor-next → composable-editor}/utils/sendDurationAnalytics.js +0 -0
- /package/dist/esm/{editor-next → composable-editor}/utils/trackEditorActions.js +0 -0
- /package/dist/types/{editor-next → composable-editor}/hooks/useEditorMeasuresConstructor.d.ts +0 -0
- /package/dist/types/{editor-next → composable-editor}/hooks/useProviderFactory.d.ts +0 -0
- /package/dist/types/{editor-next → composable-editor}/utils/editorMeasureTTICallback.d.ts +0 -0
- /package/dist/types/{editor-next → composable-editor}/utils/handleProviders.d.ts +0 -0
- /package/dist/types-ts4.5/{editor-next → composable-editor}/hooks/useEditorMeasuresConstructor.d.ts +0 -0
- /package/dist/types-ts4.5/{editor-next → composable-editor}/hooks/useProviderFactory.d.ts +0 -0
- /package/dist/types-ts4.5/{editor-next → composable-editor}/utils/editorMeasureTTICallback.d.ts +0 -0
- /package/dist/types-ts4.5/{editor-next → composable-editor}/utils/handleProviders.d.ts +0 -0
|
@@ -6,7 +6,7 @@ import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-con
|
|
|
6
6
|
import { ACTION, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import { EditorExperience, ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
8
8
|
import { getAnalyticsAppearance, startMeasure, stopMeasure } from '@atlaskit/editor-common/utils';
|
|
9
|
-
import { basePlugin } from '
|
|
9
|
+
import { basePlugin } from '@atlaskit/editor-plugin-base';
|
|
10
10
|
import EditorActions from '../actions';
|
|
11
11
|
import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
|
|
12
12
|
import { name, version } from '../version-wrapper';
|
|
@@ -14,10 +14,16 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
|
14
14
|
import { useConstructor } from '@atlaskit/editor-common/hooks';
|
|
15
15
|
import { useEditorContext } from '../ui/EditorContext';
|
|
16
16
|
import measurements from '../utils/performance/measure-enum';
|
|
17
|
-
import EditorInternal from './editor-internal';
|
|
17
|
+
import { EditorInternal } from './editor-internal';
|
|
18
18
|
import sendDurationAnalytics from './utils/sendDurationAnalytics';
|
|
19
19
|
import trackEditorActions from './utils/trackEditorActions';
|
|
20
|
-
|
|
20
|
+
import useMeasureEditorMountTime from './hooks/useMeasureEditorMountTime';
|
|
21
|
+
import useProviderFactory from './hooks/useProviderFactory';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Editor wrapper that deals with the lifecycle logic of the editor
|
|
25
|
+
*/
|
|
26
|
+
function Editor(passedProps) {
|
|
21
27
|
var _editorContext$editor;
|
|
22
28
|
const defaultProps = {
|
|
23
29
|
appearance: 'comment',
|
|
@@ -61,6 +67,8 @@ export function Editor(passedProps) {
|
|
|
61
67
|
editorActions.current._privateUnregisterEditor();
|
|
62
68
|
(_props$onDestroy = props.onDestroy) === null || _props$onDestroy === void 0 ? void 0 : _props$onDestroy.call(props);
|
|
63
69
|
};
|
|
70
|
+
useMeasureEditorMountTime(props, getExperienceStore, createAnalyticsEvent);
|
|
71
|
+
const providerFactory = useProviderFactory(props, editorActions.current, createAnalyticsEvent);
|
|
64
72
|
return jsx(EditorInternal, {
|
|
65
73
|
props: props,
|
|
66
74
|
handleAnalyticsEvent: handleAnalyticsEvent,
|
|
@@ -71,12 +79,12 @@ export function Editor(passedProps) {
|
|
|
71
79
|
return (_props$onSave = props.onSave) === null || _props$onSave === void 0 ? void 0 : _props$onSave.call(props, view);
|
|
72
80
|
},
|
|
73
81
|
editorActions: editorActions.current,
|
|
74
|
-
getExperienceStore: getExperienceStore,
|
|
75
82
|
onEditorCreated: onEditorCreated,
|
|
76
|
-
onEditorDestroyed: onEditorDestroyed
|
|
83
|
+
onEditorDestroyed: onEditorDestroyed,
|
|
84
|
+
providerFactory: providerFactory
|
|
77
85
|
});
|
|
78
86
|
}
|
|
79
|
-
export
|
|
87
|
+
export function ComposableEditor(props) {
|
|
80
88
|
const editorSessionId = useRef(uuid());
|
|
81
89
|
return jsx(FabricEditorAnalyticsContext, {
|
|
82
90
|
data: {
|
|
@@ -88,7 +96,7 @@ export default function EditorNext(props) {
|
|
|
88
96
|
}
|
|
89
97
|
}, jsx(Editor, props));
|
|
90
98
|
}
|
|
91
|
-
|
|
99
|
+
ComposableEditor.propTypes = {
|
|
92
100
|
minHeight: ({
|
|
93
101
|
appearance,
|
|
94
102
|
minHeight
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ComposableEditor } from './composable-editor/editor';
|
package/dist/es2019/editor.js
CHANGED
|
@@ -4,15 +4,15 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
6
|
import editorDeprecationWarnings from './utils/editorDeprecationWarnings';
|
|
7
|
-
import
|
|
7
|
+
import { ComposableEditor } from './composable-editor';
|
|
8
8
|
import useUniversalPreset from './labs/next/presets/useUniversalPreset';
|
|
9
|
-
const
|
|
9
|
+
const ComposableEditorWrapper = ({
|
|
10
10
|
props
|
|
11
11
|
}) => {
|
|
12
12
|
const preset = useUniversalPreset({
|
|
13
13
|
props
|
|
14
14
|
});
|
|
15
|
-
return jsx(
|
|
15
|
+
return jsx(ComposableEditor, _extends({
|
|
16
16
|
preset: preset
|
|
17
17
|
}, props));
|
|
18
18
|
};
|
|
@@ -22,7 +22,7 @@ export default class Editor extends React.Component {
|
|
|
22
22
|
editorDeprecationWarnings(props);
|
|
23
23
|
}
|
|
24
24
|
render() {
|
|
25
|
-
return jsx(
|
|
25
|
+
return jsx(ComposableEditorWrapper, {
|
|
26
26
|
props: this.props
|
|
27
27
|
});
|
|
28
28
|
}
|
package/dist/es2019/index.js
CHANGED
|
@@ -41,7 +41,7 @@ export { commitStatusPicker, setStatusPickerAt, updateStatus, updateStatusWithAn
|
|
|
41
41
|
export { typeAheadPluginKey } from './plugins/type-ahead';
|
|
42
42
|
export { historyPluginKey } from './plugins/history';
|
|
43
43
|
export { INPUT_METHOD, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
44
|
-
export { setKeyboardHeight } from '
|
|
44
|
+
export { setKeyboardHeight } from '@atlaskit/editor-plugin-base';
|
|
45
45
|
export { setMobilePaddingTop, setIsExpanded } from './plugins/mobile-dimensions/commands';
|
|
46
46
|
|
|
47
47
|
// Used in editor-test-helpers and mobile bridge
|
|
@@ -7,7 +7,7 @@ import { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
|
|
|
7
7
|
import { textFormattingPlugin } from '@atlaskit/editor-plugin-text-formatting';
|
|
8
8
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
9
9
|
import { unsupportedContentPlugin } from '@atlaskit/editor-plugin-unsupported-content';
|
|
10
|
-
import { basePlugin } from '
|
|
10
|
+
import { basePlugin } from '@atlaskit/editor-plugin-base';
|
|
11
11
|
import { focusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
12
12
|
import { editorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
13
13
|
import typeAheadPlugin from '../../../plugins/type-ahead';
|
|
@@ -8,7 +8,6 @@ import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
|
8
8
|
import { themed } from '@atlaskit/theme/components';
|
|
9
9
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
10
10
|
import { DN70 } from '@atlaskit/theme/colors';
|
|
11
|
-
import { compareArrays, shallowEqual } from '../utils';
|
|
12
11
|
import { showConfirmDialog } from '../pm-plugins/toolbar-data/commands';
|
|
13
12
|
import { FloatingToolbarButton as Button, Announcer } from '@atlaskit/editor-common/ui';
|
|
14
13
|
import Dropdown from './Dropdown';
|
|
@@ -16,6 +15,7 @@ import Select from './Select';
|
|
|
16
15
|
import Separator from './Separator';
|
|
17
16
|
import Input from './Input';
|
|
18
17
|
import { ExtensionsPlaceholder } from './ExtensionsPlaceholder';
|
|
18
|
+
import { areSameItems } from '@atlaskit/editor-common/floating-toolbar';
|
|
19
19
|
import { ColorPickerButton } from '@atlaskit/editor-common/ui-menu';
|
|
20
20
|
import { backgroundPaletteTooltipMessages } from '@atlaskit/editor-common/ui-color';
|
|
21
21
|
import { EmojiPickerButton } from './EmojiPickerButton';
|
|
@@ -265,57 +265,6 @@ const toolbarOverflow = (scrollable, scrollDisabled, firstElementIsSelect) => cs
|
|
|
265
265
|
display: flex;
|
|
266
266
|
`}
|
|
267
267
|
`;
|
|
268
|
-
function makeSameType(_a, _b) {
|
|
269
|
-
return true;
|
|
270
|
-
}
|
|
271
|
-
const compareItemWithKeys = (leftItem, rightItem, excludedKeys = []) => Object.keys(leftItem).filter(key => excludedKeys.indexOf(key) === -1).every(key => leftItem[key] instanceof Object ? shallowEqual(leftItem[key], rightItem[key]) : leftItem[key] === rightItem[key]);
|
|
272
|
-
export const isSameItem = (leftItem, rightItem) => {
|
|
273
|
-
if (leftItem.type !== rightItem.type) {
|
|
274
|
-
return false;
|
|
275
|
-
}
|
|
276
|
-
switch (leftItem.type) {
|
|
277
|
-
case 'button':
|
|
278
|
-
// Need to typecast `rightItem as typeof leftItem` otherwise we will
|
|
279
|
-
// have to put the `type !==` inside each case.
|
|
280
|
-
return compareItemWithKeys(leftItem, rightItem, ['type', 'onClick', 'onMouseEnter', 'onMouseLeave']);
|
|
281
|
-
case 'copy-button':
|
|
282
|
-
return compareItemWithKeys(leftItem, rightItem, ['type', 'items']);
|
|
283
|
-
case 'input':
|
|
284
|
-
return compareItemWithKeys(leftItem, rightItem, ['type', 'onSubmit', 'onBlur']);
|
|
285
|
-
case 'select':
|
|
286
|
-
if (makeSameType(leftItem, rightItem) && Array.isArray(leftItem.options) && Array.isArray(rightItem.options) && !compareArrays(leftItem.options, rightItem.options, (left, right) => compareItemWithKeys(left, right))) {
|
|
287
|
-
return false;
|
|
288
|
-
}
|
|
289
|
-
return compareItemWithKeys(leftItem, rightItem, ['type', 'onChange', 'options']);
|
|
290
|
-
case 'dropdown':
|
|
291
|
-
if (makeSameType(leftItem, rightItem) && Array.isArray(leftItem.options) && Array.isArray(rightItem.options) &&
|
|
292
|
-
// @ts-expect-error TS2345: Argument of type 'DropdownOptionT<Function>[]' is not assignable to parameter of type 'any[][]'
|
|
293
|
-
!compareArrays(leftItem.options, rightItem.options, (left, right) =>
|
|
294
|
-
// @ts-expect-error TS2322: Type '"onClick"' is not assignable to type 'keyof any[]'
|
|
295
|
-
compareItemWithKeys(left, right, ['onClick']))) {
|
|
296
|
-
return false;
|
|
297
|
-
}
|
|
298
|
-
return compareItemWithKeys(leftItem, rightItem, ['type', 'options']);
|
|
299
|
-
case 'custom':
|
|
300
|
-
return false;
|
|
301
|
-
case 'separator':
|
|
302
|
-
return compareItemWithKeys(leftItem, rightItem);
|
|
303
|
-
case 'extensions-placeholder':
|
|
304
|
-
return compareItemWithKeys(leftItem, rightItem);
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
export const areSameItems = (leftArr, rightArr) => {
|
|
308
|
-
if (leftArr === undefined && rightArr === undefined) {
|
|
309
|
-
return true;
|
|
310
|
-
}
|
|
311
|
-
if (leftArr === undefined || rightArr === undefined) {
|
|
312
|
-
return false;
|
|
313
|
-
}
|
|
314
|
-
if (leftArr.length !== rightArr.length) {
|
|
315
|
-
return false;
|
|
316
|
-
}
|
|
317
|
-
return leftArr.every((item, index) => isSameItem(rightArr[index], item));
|
|
318
|
-
};
|
|
319
268
|
class Toolbar extends Component {
|
|
320
269
|
constructor(props) {
|
|
321
270
|
super(props);
|
|
@@ -1,39 +1,3 @@
|
|
|
1
|
-
export const shallowEqual = (objA, objB) => {
|
|
2
|
-
if (objA === objB) {
|
|
3
|
-
return true;
|
|
4
|
-
}
|
|
5
|
-
if (objA == null || objB == null) {
|
|
6
|
-
return false;
|
|
7
|
-
}
|
|
8
|
-
const keysA = Object.keys(objA);
|
|
9
|
-
const keysB = Object.keys(objB);
|
|
10
|
-
if (keysA.length !== keysB.length) {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
const bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
|
|
14
|
-
for (let idx = 0; idx < keysA.length; idx++) {
|
|
15
|
-
const key = keysA[idx];
|
|
16
|
-
if (!bHasOwnProperty(key)) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
if (objA[key] !== objB[key]) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return true;
|
|
24
|
-
};
|
|
25
|
-
export const compareArrays = (left, right, compareFn = shallowEqual) => {
|
|
26
|
-
if (left.length !== right.length) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
for (let idx = 0; idx < left.length; idx++) {
|
|
30
|
-
if (!compareFn(left[idx], right[idx])) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return true;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
1
|
// find node in descendants by condition
|
|
38
2
|
export function findNode(parent, predicate) {
|
|
39
3
|
let matchedNode;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { basePlugin } from './base';
|
|
2
1
|
export { default as betterTypeHistoryPlugin } from './better-type-history';
|
|
3
2
|
export { default as clearMarksOnChangeToEmptyDocumentPlugin } from './clear-marks-on-change-to-empty-document';
|
|
4
3
|
export { default as codeBlockPlugin } from './code-block';
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { pluginKey as floatingToolbarPluginKey } from '../../floating-toolbar';
|
|
3
|
-
import { pluginKey as statusPluginKey } from '../../status/plugin-key';
|
|
4
|
-
import { areSameItems } from '../../floating-toolbar/ui/Toolbar';
|
|
1
|
+
import { areSameItems } from '@atlaskit/editor-common/floating-toolbar';
|
|
5
2
|
import { isTypeAheadOpen } from '../../type-ahead/utils';
|
|
6
3
|
import { trackerStore } from '..';
|
|
7
4
|
const areToolbarsSame = (left, right) => {
|
|
@@ -34,6 +31,26 @@ export const subscribeToToolbarAndPickerUpdates = (editorView, cb) => {
|
|
|
34
31
|
if (isTypeAheadOpen(newEditorState)) {
|
|
35
32
|
return;
|
|
36
33
|
}
|
|
34
|
+
|
|
35
|
+
// Creating fake plugin keys for these plugins for the mean time until all these plugins are extracted.
|
|
36
|
+
const datePluginKey = {
|
|
37
|
+
key: 'datePlugin$',
|
|
38
|
+
getState: state => {
|
|
39
|
+
return state['datePlugin$'];
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const statusPluginKey = {
|
|
43
|
+
key: 'statusPlugin$',
|
|
44
|
+
getState: state => {
|
|
45
|
+
return state['statusPlugin$'];
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const floatingToolbarPluginKey = {
|
|
49
|
+
key: 'floatingToolbarPluginKey$',
|
|
50
|
+
getState: state => {
|
|
51
|
+
return state['floatingToolbarPluginKey$'];
|
|
52
|
+
}
|
|
53
|
+
};
|
|
37
54
|
const dateState = datePluginKey.getState(newEditorState);
|
|
38
55
|
const statusState = statusPluginKey.getState(newEditorState);
|
|
39
56
|
const {
|
|
@@ -3,7 +3,7 @@ import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
|
3
3
|
import { createSchema } from './create-editor/create-schema';
|
|
4
4
|
import { sortByOrder } from './create-editor/sort-by-order';
|
|
5
5
|
import { analyticsPluginKey } from './plugins/analytics/plugin-key';
|
|
6
|
-
import { basePlugin } from '
|
|
6
|
+
import { basePlugin } from '@atlaskit/editor-plugin-base';
|
|
7
7
|
export { createTypeAheadTools } from './plugins/type-ahead/api';
|
|
8
8
|
export function getFireAnalytics(editorView) {
|
|
9
9
|
var _analyticsPluginKey$g;
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import { IntlProviderIfMissingWrapper } from '@atlaskit/editor-common/ui';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import Editor from '../../editor';
|
|
5
|
-
import
|
|
5
|
+
import { ComposableEditor } from '../../composable-editor';
|
|
6
6
|
import EditorWithActions from '../../labs/EditorWithActions';
|
|
7
7
|
import ChromeCollapsed from '../ChromeCollapsed';
|
|
8
8
|
export default class CollapsedEditor extends React.Component {
|
|
@@ -24,10 +24,10 @@ export default class CollapsedEditor extends React.Component {
|
|
|
24
24
|
}
|
|
25
25
|
render() {
|
|
26
26
|
const child = React.Children.only(this.props.children);
|
|
27
|
-
if (child.type !== Editor && child.type !== EditorWithActions && child.type !==
|
|
27
|
+
if (child.type !== Editor && child.type !== EditorWithActions && child.type !== ComposableEditor) {
|
|
28
28
|
throw new Error('Expected child to be of type `Editor`');
|
|
29
29
|
}
|
|
30
|
-
this.functionalEditor = child.type ===
|
|
30
|
+
this.functionalEditor = child.type === ComposableEditor;
|
|
31
31
|
if (!this.props.isExpanded) {
|
|
32
32
|
return /*#__PURE__*/React.createElement(IntlProviderIfMissingWrapper, null, /*#__PURE__*/React.createElement(ChromeCollapsed, {
|
|
33
33
|
onFocus: this.props.onFocus,
|
|
@@ -15,31 +15,12 @@ import { ContextAdapter } from '../nodeviews/context-adapter';
|
|
|
15
15
|
import EditorContext from '../ui/EditorContext';
|
|
16
16
|
import { useSetPresetContext } from '../presets/context';
|
|
17
17
|
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
18
|
-
import useMeasureEditorMountTime from './hooks/useMeasureEditorMountTime';
|
|
19
|
-
import useProviderFactory from './hooks/useProviderFactory';
|
|
20
18
|
import { getBaseFontSize } from './utils/getBaseFontSize';
|
|
21
|
-
/**
|
|
22
|
-
* EditorInternal is used for the internal editor react component
|
|
23
|
-
* with the lifecycle methods extracted into hooks.
|
|
24
|
-
*/
|
|
25
|
-
export default function EditorInternal(props) {
|
|
26
|
-
var editorProps = props.props,
|
|
27
|
-
getExperienceStore = props.getExperienceStore,
|
|
28
|
-
editorActions = props.editorActions,
|
|
29
|
-
createAnalyticsEvent = props.createAnalyticsEvent;
|
|
30
|
-
useMeasureEditorMountTime(editorProps, getExperienceStore, createAnalyticsEvent);
|
|
31
|
-
var providerFactory = useProviderFactory(editorProps, editorActions, createAnalyticsEvent);
|
|
32
|
-
var updatedProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
33
|
-
providerFactory: providerFactory
|
|
34
|
-
});
|
|
35
|
-
return jsx(EditorInternalWithoutHooks, updatedProps);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
19
|
/**
|
|
39
20
|
* EditorInternalComponent is used to capture the common component
|
|
40
21
|
* from the `render` method of `Editor` and share it with `EditorNext`.
|
|
41
22
|
*/
|
|
42
|
-
export function
|
|
23
|
+
export function EditorInternal(_ref) {
|
|
43
24
|
var _props$performanceTra, _props$performanceTra2, _props$performanceTra3, _props$performanceTra4;
|
|
44
25
|
var props = _ref.props,
|
|
45
26
|
handleAnalyticsEvent = _ref.handleAnalyticsEvent,
|
|
@@ -9,7 +9,7 @@ import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-con
|
|
|
9
9
|
import { ACTION, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
10
10
|
import { EditorExperience, ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
11
11
|
import { getAnalyticsAppearance, startMeasure, stopMeasure } from '@atlaskit/editor-common/utils';
|
|
12
|
-
import { basePlugin } from '
|
|
12
|
+
import { basePlugin } from '@atlaskit/editor-plugin-base';
|
|
13
13
|
import EditorActions from '../actions';
|
|
14
14
|
import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
|
|
15
15
|
import { name, version } from '../version-wrapper';
|
|
@@ -17,10 +17,16 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
|
17
17
|
import { useConstructor } from '@atlaskit/editor-common/hooks';
|
|
18
18
|
import { useEditorContext } from '../ui/EditorContext';
|
|
19
19
|
import measurements from '../utils/performance/measure-enum';
|
|
20
|
-
import EditorInternal from './editor-internal';
|
|
20
|
+
import { EditorInternal } from './editor-internal';
|
|
21
21
|
import sendDurationAnalytics from './utils/sendDurationAnalytics';
|
|
22
22
|
import trackEditorActions from './utils/trackEditorActions';
|
|
23
|
-
|
|
23
|
+
import useMeasureEditorMountTime from './hooks/useMeasureEditorMountTime';
|
|
24
|
+
import useProviderFactory from './hooks/useProviderFactory';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Editor wrapper that deals with the lifecycle logic of the editor
|
|
28
|
+
*/
|
|
29
|
+
function Editor(passedProps) {
|
|
24
30
|
var _editorContext$editor;
|
|
25
31
|
var defaultProps = {
|
|
26
32
|
appearance: 'comment',
|
|
@@ -68,6 +74,8 @@ export function Editor(passedProps) {
|
|
|
68
74
|
editorActions.current._privateUnregisterEditor();
|
|
69
75
|
(_props$onDestroy = props.onDestroy) === null || _props$onDestroy === void 0 ? void 0 : _props$onDestroy.call(props);
|
|
70
76
|
};
|
|
77
|
+
useMeasureEditorMountTime(props, getExperienceStore, createAnalyticsEvent);
|
|
78
|
+
var providerFactory = useProviderFactory(props, editorActions.current, createAnalyticsEvent);
|
|
71
79
|
return jsx(EditorInternal, {
|
|
72
80
|
props: props,
|
|
73
81
|
handleAnalyticsEvent: handleAnalyticsEvent,
|
|
@@ -78,12 +86,12 @@ export function Editor(passedProps) {
|
|
|
78
86
|
return (_props$onSave = props.onSave) === null || _props$onSave === void 0 ? void 0 : _props$onSave.call(props, view);
|
|
79
87
|
},
|
|
80
88
|
editorActions: editorActions.current,
|
|
81
|
-
getExperienceStore: getExperienceStore,
|
|
82
89
|
onEditorCreated: onEditorCreated,
|
|
83
|
-
onEditorDestroyed: onEditorDestroyed
|
|
90
|
+
onEditorDestroyed: onEditorDestroyed,
|
|
91
|
+
providerFactory: providerFactory
|
|
84
92
|
});
|
|
85
93
|
}
|
|
86
|
-
export
|
|
94
|
+
export function ComposableEditor(props) {
|
|
87
95
|
var editorSessionId = useRef(uuid());
|
|
88
96
|
return jsx(FabricEditorAnalyticsContext, {
|
|
89
97
|
data: {
|
|
@@ -95,7 +103,7 @@ export default function EditorNext(props) {
|
|
|
95
103
|
}
|
|
96
104
|
}, jsx(Editor, props));
|
|
97
105
|
}
|
|
98
|
-
|
|
106
|
+
ComposableEditor.propTypes = {
|
|
99
107
|
minHeight: function minHeight(_ref) {
|
|
100
108
|
var appearance = _ref.appearance,
|
|
101
109
|
_minHeight = _ref.minHeight;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ComposableEditor } from './composable-editor/editor';
|
package/dist/esm/editor.js
CHANGED
|
@@ -11,14 +11,14 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import { jsx } from '@emotion/react';
|
|
13
13
|
import editorDeprecationWarnings from './utils/editorDeprecationWarnings';
|
|
14
|
-
import
|
|
14
|
+
import { ComposableEditor } from './composable-editor';
|
|
15
15
|
import useUniversalPreset from './labs/next/presets/useUniversalPreset';
|
|
16
|
-
var
|
|
16
|
+
var ComposableEditorWrapper = function ComposableEditorWrapper(_ref) {
|
|
17
17
|
var props = _ref.props;
|
|
18
18
|
var preset = useUniversalPreset({
|
|
19
19
|
props: props
|
|
20
20
|
});
|
|
21
|
-
return jsx(
|
|
21
|
+
return jsx(ComposableEditor, _extends({
|
|
22
22
|
preset: preset
|
|
23
23
|
}, props));
|
|
24
24
|
};
|
|
@@ -35,7 +35,7 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
35
35
|
_createClass(Editor, [{
|
|
36
36
|
key: "render",
|
|
37
37
|
value: function render() {
|
|
38
|
-
return jsx(
|
|
38
|
+
return jsx(ComposableEditorWrapper, {
|
|
39
39
|
props: this.props
|
|
40
40
|
});
|
|
41
41
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -41,7 +41,7 @@ export { commitStatusPicker, setStatusPickerAt, updateStatus, updateStatusWithAn
|
|
|
41
41
|
export { typeAheadPluginKey } from './plugins/type-ahead';
|
|
42
42
|
export { historyPluginKey } from './plugins/history';
|
|
43
43
|
export { INPUT_METHOD, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
44
|
-
export { setKeyboardHeight } from '
|
|
44
|
+
export { setKeyboardHeight } from '@atlaskit/editor-plugin-base';
|
|
45
45
|
export { setMobilePaddingTop, setIsExpanded } from './plugins/mobile-dimensions/commands';
|
|
46
46
|
|
|
47
47
|
// Used in editor-test-helpers and mobile bridge
|
|
@@ -7,7 +7,7 @@ import { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
|
|
|
7
7
|
import { textFormattingPlugin } from '@atlaskit/editor-plugin-text-formatting';
|
|
8
8
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
9
9
|
import { unsupportedContentPlugin } from '@atlaskit/editor-plugin-unsupported-content';
|
|
10
|
-
import { basePlugin } from '
|
|
10
|
+
import { basePlugin } from '@atlaskit/editor-plugin-base';
|
|
11
11
|
import { focusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
12
12
|
import { editorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
13
13
|
import typeAheadPlugin from '../../../plugins/type-ahead';
|
|
@@ -18,7 +18,6 @@ import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
|
18
18
|
import { themed } from '@atlaskit/theme/components';
|
|
19
19
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
20
20
|
import { DN70 } from '@atlaskit/theme/colors';
|
|
21
|
-
import { compareArrays, shallowEqual } from '../utils';
|
|
22
21
|
import { showConfirmDialog } from '../pm-plugins/toolbar-data/commands';
|
|
23
22
|
import { FloatingToolbarButton as Button, Announcer } from '@atlaskit/editor-common/ui';
|
|
24
23
|
import Dropdown from './Dropdown';
|
|
@@ -26,6 +25,7 @@ import Select from './Select';
|
|
|
26
25
|
import Separator from './Separator';
|
|
27
26
|
import Input from './Input';
|
|
28
27
|
import { ExtensionsPlaceholder } from './ExtensionsPlaceholder';
|
|
28
|
+
import { areSameItems } from '@atlaskit/editor-common/floating-toolbar';
|
|
29
29
|
import { ColorPickerButton } from '@atlaskit/editor-common/ui-menu';
|
|
30
30
|
import { backgroundPaletteTooltipMessages } from '@atlaskit/editor-common/ui-color';
|
|
31
31
|
import { EmojiPickerButton } from './EmojiPickerButton';
|
|
@@ -246,71 +246,6 @@ var toolbarContainer = function toolbarContainer(theme, scrollable, hasSelect, f
|
|
|
246
246
|
var toolbarOverflow = function toolbarOverflow(scrollable, scrollDisabled, firstElementIsSelect) {
|
|
247
247
|
return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n ", "\n"])), scrollable ? css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n ", "\n -webkit-overflow-scrolling: touch;\n padding: ", " 0 50px;\n > div {\n > div:first-child {\n ", "\n }\n > div:last-child {\n margin-right: ", ";\n }\n }\n "])), scrollDisabled ? css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n overflow: hidden;\n "]))) : css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n overflow-x: auto;\n overflow-y: hidden;\n "]))), "var(--ds-space-050, 4px)", firstElementIsSelect ? css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n margin-left: ", ";\n "])), "var(--ds-space-050, 4px)") : css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n margin-left: ", ";\n "])), "var(--ds-space-100, 8px)"), "var(--ds-space-100, 8px)") : css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n display: flex;\n "]))));
|
|
248
248
|
};
|
|
249
|
-
function makeSameType(_a, _b) {
|
|
250
|
-
return true;
|
|
251
|
-
}
|
|
252
|
-
var compareItemWithKeys = function compareItemWithKeys(leftItem, rightItem) {
|
|
253
|
-
var excludedKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
254
|
-
return Object.keys(leftItem).filter(function (key) {
|
|
255
|
-
return excludedKeys.indexOf(key) === -1;
|
|
256
|
-
}).every(function (key) {
|
|
257
|
-
return leftItem[key] instanceof Object ? shallowEqual(leftItem[key], rightItem[key]) : leftItem[key] === rightItem[key];
|
|
258
|
-
});
|
|
259
|
-
};
|
|
260
|
-
export var isSameItem = function isSameItem(leftItem, rightItem) {
|
|
261
|
-
if (leftItem.type !== rightItem.type) {
|
|
262
|
-
return false;
|
|
263
|
-
}
|
|
264
|
-
switch (leftItem.type) {
|
|
265
|
-
case 'button':
|
|
266
|
-
// Need to typecast `rightItem as typeof leftItem` otherwise we will
|
|
267
|
-
// have to put the `type !==` inside each case.
|
|
268
|
-
return compareItemWithKeys(leftItem, rightItem, ['type', 'onClick', 'onMouseEnter', 'onMouseLeave']);
|
|
269
|
-
case 'copy-button':
|
|
270
|
-
return compareItemWithKeys(leftItem, rightItem, ['type', 'items']);
|
|
271
|
-
case 'input':
|
|
272
|
-
return compareItemWithKeys(leftItem, rightItem, ['type', 'onSubmit', 'onBlur']);
|
|
273
|
-
case 'select':
|
|
274
|
-
if (makeSameType(leftItem, rightItem) && Array.isArray(leftItem.options) && Array.isArray(rightItem.options) && !compareArrays(leftItem.options, rightItem.options, function (left, right) {
|
|
275
|
-
return compareItemWithKeys(left, right);
|
|
276
|
-
})) {
|
|
277
|
-
return false;
|
|
278
|
-
}
|
|
279
|
-
return compareItemWithKeys(leftItem, rightItem, ['type', 'onChange', 'options']);
|
|
280
|
-
case 'dropdown':
|
|
281
|
-
if (makeSameType(leftItem, rightItem) && Array.isArray(leftItem.options) && Array.isArray(rightItem.options) &&
|
|
282
|
-
// @ts-expect-error TS2345: Argument of type 'DropdownOptionT<Function>[]' is not assignable to parameter of type 'any[][]'
|
|
283
|
-
!compareArrays(leftItem.options, rightItem.options, function (left, right) {
|
|
284
|
-
return (
|
|
285
|
-
// @ts-expect-error TS2322: Type '"onClick"' is not assignable to type 'keyof any[]'
|
|
286
|
-
compareItemWithKeys(left, right, ['onClick'])
|
|
287
|
-
);
|
|
288
|
-
})) {
|
|
289
|
-
return false;
|
|
290
|
-
}
|
|
291
|
-
return compareItemWithKeys(leftItem, rightItem, ['type', 'options']);
|
|
292
|
-
case 'custom':
|
|
293
|
-
return false;
|
|
294
|
-
case 'separator':
|
|
295
|
-
return compareItemWithKeys(leftItem, rightItem);
|
|
296
|
-
case 'extensions-placeholder':
|
|
297
|
-
return compareItemWithKeys(leftItem, rightItem);
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
export var areSameItems = function areSameItems(leftArr, rightArr) {
|
|
301
|
-
if (leftArr === undefined && rightArr === undefined) {
|
|
302
|
-
return true;
|
|
303
|
-
}
|
|
304
|
-
if (leftArr === undefined || rightArr === undefined) {
|
|
305
|
-
return false;
|
|
306
|
-
}
|
|
307
|
-
if (leftArr.length !== rightArr.length) {
|
|
308
|
-
return false;
|
|
309
|
-
}
|
|
310
|
-
return leftArr.every(function (item, index) {
|
|
311
|
-
return isSameItem(rightArr[index], item);
|
|
312
|
-
});
|
|
313
|
-
};
|
|
314
249
|
var Toolbar = /*#__PURE__*/function (_Component) {
|
|
315
250
|
_inherits(Toolbar, _Component);
|
|
316
251
|
var _super = _createSuper(Toolbar);
|
|
@@ -1,40 +1,3 @@
|
|
|
1
|
-
export var shallowEqual = function shallowEqual(objA, objB) {
|
|
2
|
-
if (objA === objB) {
|
|
3
|
-
return true;
|
|
4
|
-
}
|
|
5
|
-
if (objA == null || objB == null) {
|
|
6
|
-
return false;
|
|
7
|
-
}
|
|
8
|
-
var keysA = Object.keys(objA);
|
|
9
|
-
var keysB = Object.keys(objB);
|
|
10
|
-
if (keysA.length !== keysB.length) {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
|
|
14
|
-
for (var idx = 0; idx < keysA.length; idx++) {
|
|
15
|
-
var key = keysA[idx];
|
|
16
|
-
if (!bHasOwnProperty(key)) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
if (objA[key] !== objB[key]) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return true;
|
|
24
|
-
};
|
|
25
|
-
export var compareArrays = function compareArrays(left, right) {
|
|
26
|
-
var compareFn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : shallowEqual;
|
|
27
|
-
if (left.length !== right.length) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
for (var idx = 0; idx < left.length; idx++) {
|
|
31
|
-
if (!compareFn(left[idx], right[idx])) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return true;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
1
|
// find node in descendants by condition
|
|
39
2
|
export function findNode(parent, predicate) {
|
|
40
3
|
var matchedNode;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { basePlugin } from './base';
|
|
2
1
|
export { default as betterTypeHistoryPlugin } from './better-type-history';
|
|
3
2
|
export { default as clearMarksOnChangeToEmptyDocumentPlugin } from './clear-marks-on-change-to-empty-document';
|
|
4
3
|
export { default as codeBlockPlugin } from './code-block';
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { pluginKey as floatingToolbarPluginKey } from '../../floating-toolbar';
|
|
3
|
-
import { pluginKey as statusPluginKey } from '../../status/plugin-key';
|
|
4
|
-
import { areSameItems } from '../../floating-toolbar/ui/Toolbar';
|
|
1
|
+
import { areSameItems } from '@atlaskit/editor-common/floating-toolbar';
|
|
5
2
|
import { isTypeAheadOpen } from '../../type-ahead/utils';
|
|
6
3
|
import { trackerStore } from '..';
|
|
7
4
|
var areToolbarsSame = function areToolbarsSame(left, right) {
|
|
@@ -33,6 +30,26 @@ export var subscribeToToolbarAndPickerUpdates = function subscribeToToolbarAndPi
|
|
|
33
30
|
if (isTypeAheadOpen(newEditorState)) {
|
|
34
31
|
return;
|
|
35
32
|
}
|
|
33
|
+
|
|
34
|
+
// Creating fake plugin keys for these plugins for the mean time until all these plugins are extracted.
|
|
35
|
+
var datePluginKey = {
|
|
36
|
+
key: 'datePlugin$',
|
|
37
|
+
getState: function getState(state) {
|
|
38
|
+
return state['datePlugin$'];
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var statusPluginKey = {
|
|
42
|
+
key: 'statusPlugin$',
|
|
43
|
+
getState: function getState(state) {
|
|
44
|
+
return state['statusPlugin$'];
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var floatingToolbarPluginKey = {
|
|
48
|
+
key: 'floatingToolbarPluginKey$',
|
|
49
|
+
getState: function getState(state) {
|
|
50
|
+
return state['floatingToolbarPluginKey$'];
|
|
51
|
+
}
|
|
52
|
+
};
|
|
36
53
|
var dateState = datePluginKey.getState(newEditorState);
|
|
37
54
|
var statusState = statusPluginKey.getState(newEditorState);
|
|
38
55
|
var _ref2 = floatingToolbarPluginKey.getState(newEditorState),
|
package/dist/esm/test-utils.js
CHANGED
|
@@ -7,7 +7,7 @@ import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
|
7
7
|
import { createSchema } from './create-editor/create-schema';
|
|
8
8
|
import { sortByOrder } from './create-editor/sort-by-order';
|
|
9
9
|
import { analyticsPluginKey } from './plugins/analytics/plugin-key';
|
|
10
|
-
import { basePlugin } from '
|
|
10
|
+
import { basePlugin } from '@atlaskit/editor-plugin-base';
|
|
11
11
|
export { createTypeAheadTools } from './plugins/type-ahead/api';
|
|
12
12
|
export function getFireAnalytics(editorView) {
|
|
13
13
|
var _analyticsPluginKey$g;
|