@atlaskit/editor-core 186.0.0 → 187.0.0
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/labs-next.js +0 -65
- package/dist/cjs/plugins/expand/commands.js +2 -0
- package/dist/cjs/plugins/expand/index.js +1 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/labs-next.js +0 -4
- package/dist/es2019/plugins/expand/commands.js +2 -0
- package/dist/es2019/plugins/expand/index.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/labs-next.js +0 -4
- package/dist/esm/plugins/expand/commands.js +2 -0
- package/dist/esm/plugins/expand/index.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/labs/next/presets/default.d.ts +2 -3
- package/dist/types/labs-next.d.ts +0 -7
- package/dist/types/plugins/expand/commands.d.ts +3 -3
- package/dist/types/plugins/expand/index.d.ts +2 -2
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +2 -3
- package/dist/types-ts4.5/labs-next.d.ts +0 -7
- package/dist/types-ts4.5/plugins/expand/commands.d.ts +3 -3
- package/dist/types-ts4.5/plugins/expand/index.d.ts +2 -2
- package/package.json +5 -5
- package/report.api.md +2 -26
- package/dist/cjs/labs/next/ContentComponents.js +0 -43
- package/dist/cjs/labs/next/Editor.js +0 -76
- package/dist/cjs/labs/next/Toolbar.js +0 -39
- package/dist/cjs/labs/next/full-page.js +0 -127
- package/dist/cjs/labs/next/internal/components/EditorContent.js +0 -25
- package/dist/cjs/labs/next/internal/components/EditorInternal.js +0 -81
- package/dist/cjs/labs/next/internal/context/preset-context.js +0 -15
- package/dist/cjs/labs/next/internal/context/shared-config.js +0 -77
- package/dist/cjs/labs/next/internal/editor-props-type.js +0 -5
- package/dist/cjs/labs/next/internal/hooks/use-analytics/index.js +0 -41
- package/dist/cjs/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +0 -62
- package/dist/cjs/labs/next/internal/hooks/use-editor/create-editor.js +0 -94
- package/dist/cjs/labs/next/internal/hooks/use-editor/index.js +0 -193
- package/dist/cjs/labs/next/mobile.js +0 -37
- package/dist/cjs/labs/next/presets/cxhtml.js +0 -117
- package/dist/cjs/labs/next/presets/mobile.js +0 -130
- package/dist/cjs/labs/next/presets/utils.js +0 -30
- package/dist/es2019/labs/next/ContentComponents.js +0 -38
- package/dist/es2019/labs/next/Editor.js +0 -46
- package/dist/es2019/labs/next/Toolbar.js +0 -34
- package/dist/es2019/labs/next/full-page.js +0 -192
- package/dist/es2019/labs/next/internal/components/EditorContent.js +0 -17
- package/dist/es2019/labs/next/internal/components/EditorInternal.js +0 -66
- package/dist/es2019/labs/next/internal/context/preset-context.js +0 -5
- package/dist/es2019/labs/next/internal/context/shared-config.js +0 -34
- package/dist/es2019/labs/next/internal/editor-props-type.js +0 -1
- package/dist/es2019/labs/next/internal/hooks/use-analytics/index.js +0 -32
- package/dist/es2019/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +0 -51
- package/dist/es2019/labs/next/internal/hooks/use-editor/create-editor.js +0 -85
- package/dist/es2019/labs/next/internal/hooks/use-editor/index.js +0 -179
- package/dist/es2019/labs/next/mobile.js +0 -27
- package/dist/es2019/labs/next/presets/cxhtml.js +0 -106
- package/dist/es2019/labs/next/presets/mobile.js +0 -118
- package/dist/es2019/labs/next/presets/utils.js +0 -22
- package/dist/esm/labs/next/ContentComponents.js +0 -36
- package/dist/esm/labs/next/Editor.js +0 -48
- package/dist/esm/labs/next/Toolbar.js +0 -32
- package/dist/esm/labs/next/full-page.js +0 -121
- package/dist/esm/labs/next/internal/components/EditorContent.js +0 -17
- package/dist/esm/labs/next/internal/components/EditorInternal.js +0 -73
- package/dist/esm/labs/next/internal/context/preset-context.js +0 -7
- package/dist/esm/labs/next/internal/context/shared-config.js +0 -68
- package/dist/esm/labs/next/internal/editor-props-type.js +0 -1
- package/dist/esm/labs/next/internal/hooks/use-analytics/index.js +0 -34
- package/dist/esm/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +0 -55
- package/dist/esm/labs/next/internal/hooks/use-editor/create-editor.js +0 -88
- package/dist/esm/labs/next/internal/hooks/use-editor/index.js +0 -185
- package/dist/esm/labs/next/mobile.js +0 -25
- package/dist/esm/labs/next/presets/cxhtml.js +0 -108
- package/dist/esm/labs/next/presets/mobile.js +0 -120
- package/dist/esm/labs/next/presets/utils.js +0 -23
- package/dist/types/labs/next/ContentComponents.d.ts +0 -8
- package/dist/types/labs/next/Editor.d.ts +0 -27
- package/dist/types/labs/next/Toolbar.d.ts +0 -6
- package/dist/types/labs/next/full-page.d.ts +0 -9
- package/dist/types/labs/next/internal/components/EditorContent.d.ts +0 -7
- package/dist/types/labs/next/internal/components/EditorInternal.d.ts +0 -9
- package/dist/types/labs/next/internal/context/preset-context.d.ts +0 -5
- package/dist/types/labs/next/internal/context/shared-config.d.ts +0 -50
- package/dist/types/labs/next/internal/editor-props-type.d.ts +0 -29
- package/dist/types/labs/next/internal/hooks/use-analytics/index.d.ts +0 -8
- package/dist/types/labs/next/internal/hooks/use-editor/create-dispatch-transaction.d.ts +0 -6
- package/dist/types/labs/next/internal/hooks/use-editor/create-editor.d.ts +0 -19
- package/dist/types/labs/next/internal/hooks/use-editor/index.d.ts +0 -11
- package/dist/types/labs/next/mobile.d.ts +0 -12
- package/dist/types/labs/next/presets/cxhtml.d.ts +0 -338
- package/dist/types/labs/next/presets/mobile.d.ts +0 -343
- package/dist/types/labs/next/presets/utils.d.ts +0 -3
- package/dist/types-ts4.5/labs/next/ContentComponents.d.ts +0 -8
- package/dist/types-ts4.5/labs/next/Editor.d.ts +0 -27
- package/dist/types-ts4.5/labs/next/Toolbar.d.ts +0 -6
- package/dist/types-ts4.5/labs/next/full-page.d.ts +0 -9
- package/dist/types-ts4.5/labs/next/internal/components/EditorContent.d.ts +0 -7
- package/dist/types-ts4.5/labs/next/internal/components/EditorInternal.d.ts +0 -9
- package/dist/types-ts4.5/labs/next/internal/context/preset-context.d.ts +0 -5
- package/dist/types-ts4.5/labs/next/internal/context/shared-config.d.ts +0 -50
- package/dist/types-ts4.5/labs/next/internal/editor-props-type.d.ts +0 -29
- package/dist/types-ts4.5/labs/next/internal/hooks/use-analytics/index.d.ts +0 -8
- package/dist/types-ts4.5/labs/next/internal/hooks/use-editor/create-dispatch-transaction.d.ts +0 -6
- package/dist/types-ts4.5/labs/next/internal/hooks/use-editor/create-editor.d.ts +0 -19
- package/dist/types-ts4.5/labs/next/internal/hooks/use-editor/index.d.ts +0 -14
- package/dist/types-ts4.5/labs/next/mobile.d.ts +0 -12
- package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +0 -414
- package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +0 -419
- package/dist/types-ts4.5/labs/next/presets/utils.d.ts +0 -3
- package/tmp/api-report-tmp.d.ts +0 -2278
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { useCallback } from 'react';
|
|
3
|
-
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
|
-
import { MobileAppearance } from '../../ui/AppearanceComponents/Mobile';
|
|
5
|
-
import { EditorSharedConfigConsumer, Editor, EditorContent } from './Editor';
|
|
6
|
-
import { useCreateAnalyticsHandler } from './internal/hooks/use-analytics';
|
|
7
|
-
import { ContextAdapter } from '../../nodeviews/context-adapter';
|
|
8
|
-
export function MobileEditor(props) {
|
|
9
|
-
const {
|
|
10
|
-
maxHeight,
|
|
11
|
-
createAnalyticsEvent,
|
|
12
|
-
disabled
|
|
13
|
-
} = props;
|
|
14
|
-
const handleAnalyticsEvent = useCreateAnalyticsHandler(createAnalyticsEvent);
|
|
15
|
-
const renderWithConfig = useCallback(config => {
|
|
16
|
-
return /*#__PURE__*/React.createElement(MobileAppearance, {
|
|
17
|
-
editorView: config && config.editorView,
|
|
18
|
-
maxHeight: maxHeight,
|
|
19
|
-
editorDisabled: disabled
|
|
20
|
-
}, /*#__PURE__*/React.createElement(EditorContent, null));
|
|
21
|
-
}, [maxHeight, disabled]);
|
|
22
|
-
return /*#__PURE__*/React.createElement(ContextAdapter, null, /*#__PURE__*/React.createElement(Editor, _extends({}, props, {
|
|
23
|
-
onAnalyticsEvent: handleAnalyticsEvent
|
|
24
|
-
}), /*#__PURE__*/React.createElement(EditorSharedConfigConsumer, null, renderWithConfig)));
|
|
25
|
-
}
|
|
26
|
-
MobileEditor.displayName = 'MobileEditor';
|
|
27
|
-
export const Mobile = withAnalyticsEvents()(MobileEditor);
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
// #region Imports
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
//import { tablesPlugin } from '@atlaskit/editor-plugin-table';
|
|
5
|
-
//
|
|
6
|
-
//import {
|
|
7
|
-
// panelPlugin,
|
|
8
|
-
// listPlugin,
|
|
9
|
-
// textColorPlugin,
|
|
10
|
-
// breakoutPlugin,
|
|
11
|
-
// jiraIssuePlugin,
|
|
12
|
-
// extensionPlugin,
|
|
13
|
-
// rulePlugin,
|
|
14
|
-
// datePlugin,
|
|
15
|
-
// layoutPlugin,
|
|
16
|
-
// indentationPlugin,
|
|
17
|
-
// cardPlugin,
|
|
18
|
-
// statusPlugin,
|
|
19
|
-
// mediaPlugin,
|
|
20
|
-
// mentionsPlugin,
|
|
21
|
-
// tasksAndDecisionsPlugin,
|
|
22
|
-
// insertBlockPlugin,
|
|
23
|
-
// basePlugin,
|
|
24
|
-
// //placeholderPlugin,
|
|
25
|
-
//} from '../../../plugins';
|
|
26
|
-
import { PresetProvider } from '../Editor';
|
|
27
|
-
import { useDefaultPreset } from './default';
|
|
28
|
-
// #endregion
|
|
29
|
-
|
|
30
|
-
export function useCXHTMLPreset({
|
|
31
|
-
mentionProvider,
|
|
32
|
-
mediaProvider,
|
|
33
|
-
placeholder,
|
|
34
|
-
featureFlags
|
|
35
|
-
}) {
|
|
36
|
-
const [defaultPreset] = useDefaultPreset({
|
|
37
|
-
featureFlags,
|
|
38
|
-
paste: {}
|
|
39
|
-
});
|
|
40
|
-
const preset = defaultPreset;
|
|
41
|
-
//.add([
|
|
42
|
-
// basePlugin,
|
|
43
|
-
// {
|
|
44
|
-
// allowInlineCursorTarget: true,
|
|
45
|
-
// allowScrollGutter: {
|
|
46
|
-
// getScrollElement: (_view) =>
|
|
47
|
-
// document.querySelector('.fabric-editor-popup-scroll-parent') ||
|
|
48
|
-
// null,
|
|
49
|
-
// },
|
|
50
|
-
// },
|
|
51
|
-
//])
|
|
52
|
-
//.add([tablesPlugin, { tableOptions: { advanced: true } }])
|
|
53
|
-
//.add([panelPlugin, { allowCustomPanel: true }])
|
|
54
|
-
//.add(listPlugin)
|
|
55
|
-
//.add(textColorPlugin)
|
|
56
|
-
//.add(breakoutPlugin)
|
|
57
|
-
//.add(jiraIssuePlugin)
|
|
58
|
-
//.add(extensionPlugin)
|
|
59
|
-
//.add(rulePlugin)
|
|
60
|
-
//.add(datePlugin)
|
|
61
|
-
//.add(layoutPlugin)
|
|
62
|
-
//.add(indentationPlugin)
|
|
63
|
-
//.add([cardPlugin, { allowBlockCards: true, platform: 'web' }])
|
|
64
|
-
//.add([statusPlugin, { menuDisabled: false }])
|
|
65
|
-
//.add(tasksAndDecisionsPlugin)
|
|
66
|
-
//.add(insertBlockPlugin)
|
|
67
|
-
////.add([placeholderPlugin, { placeholder }])
|
|
68
|
-
//.maybeAdd(mentionsPlugin, (plugin, builder) => {
|
|
69
|
-
// if (mentionProvider) {
|
|
70
|
-
// return builder.add(plugin);
|
|
71
|
-
// }
|
|
72
|
-
// return builder;
|
|
73
|
-
//})
|
|
74
|
-
//.maybeAdd(mediaPlugin, (plugin, builder) => {
|
|
75
|
-
// if (mediaProvider) {
|
|
76
|
-
// preset.add([
|
|
77
|
-
// plugin,
|
|
78
|
-
// {
|
|
79
|
-
// provider: mediaProvider,
|
|
80
|
-
// allowMediaSingle: true,
|
|
81
|
-
// allowMediaGroup: true,
|
|
82
|
-
// allowResizing: true,
|
|
83
|
-
// allowLinking: true,
|
|
84
|
-
// allowResizingInTables: true,
|
|
85
|
-
// allowAltTextOnImages: true,
|
|
86
|
-
// },
|
|
87
|
-
// ]);
|
|
88
|
-
// }
|
|
89
|
-
// return builder;
|
|
90
|
-
//});
|
|
91
|
-
|
|
92
|
-
return [preset];
|
|
93
|
-
}
|
|
94
|
-
export function EditorPresetCXHTML(props) {
|
|
95
|
-
const {
|
|
96
|
-
children,
|
|
97
|
-
excludes
|
|
98
|
-
} = props;
|
|
99
|
-
const [preset] = useCXHTMLPreset(props);
|
|
100
|
-
const plugins = preset.build({
|
|
101
|
-
excludePlugins: excludes
|
|
102
|
-
});
|
|
103
|
-
return /*#__PURE__*/React.createElement(PresetProvider, {
|
|
104
|
-
value: plugins
|
|
105
|
-
}, children);
|
|
106
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
// #region Imports
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
// useProvider,
|
|
5
|
-
useProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
6
|
-
//import analyticsPlugin from '../../../plugins/analytics';
|
|
7
|
-
//import basePlugin from '../../../plugins/base';
|
|
8
|
-
//import { cardPlugin } from '@atlaskit/editor-plugin-card';
|
|
9
|
-
//import datePlugin from '../../../plugins/date';
|
|
10
|
-
//import emojiPlugin from '../../../plugins/emoji';
|
|
11
|
-
//import extensionPlugin from '../../../plugins/extension';
|
|
12
|
-
//import layoutPlugin from '../../../plugins/layout';
|
|
13
|
-
//import listPlugin from '../../../plugins/list';
|
|
14
|
-
//import mentionsPlugin from '../../../plugins/mentions';
|
|
15
|
-
//import mobileDimensionsPlugin from '../../../plugins/mobile-dimensions';
|
|
16
|
-
//import panelPlugin from '../../../plugins/panel';
|
|
17
|
-
//import placeholderPlugin from '../../../plugins/placeholder';
|
|
18
|
-
//import rulePlugin from '../../../plugins/rule';
|
|
19
|
-
//import statusPlugin from '../../../plugins/status';
|
|
20
|
-
//import { tablesPlugin } from '@atlaskit/editor-plugin-table';
|
|
21
|
-
//import tasksAndDecisionsPlugin from '../../../plugins/tasks-and-decisions';
|
|
22
|
-
//import textColorPlugin from '../../../plugins/text-color';
|
|
23
|
-
//import maxContentSizePlugin from '../../../plugins/max-content-size';
|
|
24
|
-
//import expandPlugin from '../../../plugins/expand';
|
|
25
|
-
//import selectionPlugin from '../../../plugins/selection';
|
|
26
|
-
import { PresetProvider } from '../Editor';
|
|
27
|
-
import { useDefaultPreset } from './default';
|
|
28
|
-
import { addExcludesFromProviderFactory } from './utils';
|
|
29
|
-
//import { quickInsertPlugin } from '../../../plugins';
|
|
30
|
-
|
|
31
|
-
// #endregion
|
|
32
|
-
export function useMobilePreset({
|
|
33
|
-
media,
|
|
34
|
-
placeholder,
|
|
35
|
-
maxContentSize,
|
|
36
|
-
createAnalyticsEvent,
|
|
37
|
-
featureFlags
|
|
38
|
-
}) {
|
|
39
|
-
//const mediaProvider = useProvider('mediaProvider');
|
|
40
|
-
const [defaultPreset] = useDefaultPreset({
|
|
41
|
-
featureFlags,
|
|
42
|
-
paste: {}
|
|
43
|
-
});
|
|
44
|
-
const preset = defaultPreset;
|
|
45
|
-
//.add([
|
|
46
|
-
// basePlugin,
|
|
47
|
-
// {
|
|
48
|
-
// allowScrollGutter: {
|
|
49
|
-
// getScrollElement: () => document.body,
|
|
50
|
-
// allowCustomScrollHandler: false,
|
|
51
|
-
// },
|
|
52
|
-
// },
|
|
53
|
-
//])
|
|
54
|
-
//.add([analyticsPlugin, createAnalyticsEvent])
|
|
55
|
-
//.add([tablesPlugin, { tableOptions: { allowControls: false } }])
|
|
56
|
-
//.add(panelPlugin)
|
|
57
|
-
//.add(listPlugin)
|
|
58
|
-
//.add(textColorPlugin)
|
|
59
|
-
//.add(extensionPlugin)
|
|
60
|
-
//.add(rulePlugin)
|
|
61
|
-
//.add(datePlugin)
|
|
62
|
-
//.add(layoutPlugin)
|
|
63
|
-
//.add([quickInsertPlugin, { headless: true, disableDefaultItems: true }])
|
|
64
|
-
//.add([statusPlugin, { menuDisabled: false }])
|
|
65
|
-
//.add([placeholderPlugin, { placeholder }])
|
|
66
|
-
//.add(mobileDimensionsPlugin)
|
|
67
|
-
//.add(expandPlugin)
|
|
68
|
-
////.add([selectionPlugin, { useLongPressSelection: false }])
|
|
69
|
-
//// Begin -> This would be exclude if the provider doesnt exist in the factory
|
|
70
|
-
//.add(tasksAndDecisionsPlugin)
|
|
71
|
-
//.add([cardPlugin, { allowBlockCards: true, platform: 'mobile' }])
|
|
72
|
-
//.add(mentionsPlugin)
|
|
73
|
-
//.add(emojiPlugin)
|
|
74
|
-
//// End
|
|
75
|
-
//.maybeAdd(maxContentSizePlugin, (plugin, builder) => {
|
|
76
|
-
// if (maxContentSize) {
|
|
77
|
-
// return builder.add([plugin, maxContentSize as any]);
|
|
78
|
-
// }
|
|
79
|
-
// return builder;
|
|
80
|
-
//})
|
|
81
|
-
//.maybeAdd(mediaPlugin, (plugin, builder) => {
|
|
82
|
-
// if (media) {
|
|
83
|
-
// return builder.add([
|
|
84
|
-
// plugin,
|
|
85
|
-
// {
|
|
86
|
-
// provider: mediaProvider,
|
|
87
|
-
// customMediaPicker: media.picker,
|
|
88
|
-
// fullWidthEnabled: false,
|
|
89
|
-
// allowMediaSingle: true,
|
|
90
|
-
// allowLazyLoading: false,
|
|
91
|
-
// allowMediaSingleEditable: false,
|
|
92
|
-
// allowRemoteDimensionsFetch: false,
|
|
93
|
-
// allowMarkingUploadsAsIncomplete: true,
|
|
94
|
-
// allowAltTextOnImages: true,
|
|
95
|
-
// allowTemplatePlaceholders: { allowInserting: true },
|
|
96
|
-
// },
|
|
97
|
-
// ]);
|
|
98
|
-
// }
|
|
99
|
-
|
|
100
|
-
// return builder;
|
|
101
|
-
//});
|
|
102
|
-
|
|
103
|
-
return [preset];
|
|
104
|
-
}
|
|
105
|
-
export function EditorPresetMobile(props) {
|
|
106
|
-
const {
|
|
107
|
-
children,
|
|
108
|
-
excludes
|
|
109
|
-
} = props;
|
|
110
|
-
const [preset] = useMobilePreset(props);
|
|
111
|
-
const providerFactory = useProviderFactory();
|
|
112
|
-
const plugins = preset.build({
|
|
113
|
-
excludePlugins: addExcludesFromProviderFactory(providerFactory, excludes)
|
|
114
|
-
});
|
|
115
|
-
return /*#__PURE__*/React.createElement(PresetProvider, {
|
|
116
|
-
value: plugins
|
|
117
|
-
}, children);
|
|
118
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export const addExcludesFromProviderFactory = (providerFactory, excludes = new Set()) => {
|
|
2
|
-
// TODO: Should I make this function pure?
|
|
3
|
-
if (!providerFactory.hasProvider('mentionProvider')) {
|
|
4
|
-
excludes.add('mention');
|
|
5
|
-
}
|
|
6
|
-
if (!providerFactory.hasProvider('emojiProvider')) {
|
|
7
|
-
excludes.add('emoji');
|
|
8
|
-
}
|
|
9
|
-
if (!providerFactory.hasProvider('macroProvider')) {
|
|
10
|
-
excludes.add('macro');
|
|
11
|
-
}
|
|
12
|
-
if (!providerFactory.hasProvider('autoformattingProvider')) {
|
|
13
|
-
excludes.add('customAutoformat');
|
|
14
|
-
}
|
|
15
|
-
if (!providerFactory.hasProvider('taskDecisionProvider')) {
|
|
16
|
-
excludes.add('taskDecision');
|
|
17
|
-
}
|
|
18
|
-
if (!providerFactory.hasProvider('cardProvider')) {
|
|
19
|
-
excludes.add('card');
|
|
20
|
-
}
|
|
21
|
-
return excludes;
|
|
22
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { pluginKey as disabledPluginKey } from '../../plugins/editor-disabled';
|
|
3
|
-
import WithPluginState from '../../ui/WithPluginState';
|
|
4
|
-
import PluginSlot from '../../ui/PluginSlot';
|
|
5
|
-
import { useEditorSharedConfig } from './Editor';
|
|
6
|
-
export function ContentComponents(_ref) {
|
|
7
|
-
var disabled = _ref.disabled,
|
|
8
|
-
wrapperElement = _ref.wrapperElement,
|
|
9
|
-
containerElement = _ref.containerElement;
|
|
10
|
-
var config = useEditorSharedConfig();
|
|
11
|
-
if (!config) {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
15
|
-
plugins: {
|
|
16
|
-
disabled: disabledPluginKey
|
|
17
|
-
},
|
|
18
|
-
render: function render(_ref2) {
|
|
19
|
-
var _disabled$editorDisab;
|
|
20
|
-
var disabled = _ref2.disabled;
|
|
21
|
-
return /*#__PURE__*/React.createElement(PluginSlot, {
|
|
22
|
-
editorView: config.editorView,
|
|
23
|
-
eventDispatcher: config.eventDispatcher,
|
|
24
|
-
providerFactory: config.providerFactory,
|
|
25
|
-
items: config.contentComponents,
|
|
26
|
-
popupsMountPoint: config.popupsMountPoint,
|
|
27
|
-
popupsBoundariesElement: config.popupsBoundariesElement,
|
|
28
|
-
popupsScrollableElement: config.popupsScrollableElement,
|
|
29
|
-
containerElement: containerElement // TODO: Figure out how to pass containerElement here ED-8448
|
|
30
|
-
,
|
|
31
|
-
wrapperElement: wrapperElement,
|
|
32
|
-
disabled: (_disabled$editorDisab = disabled === null || disabled === void 0 ? void 0 : disabled.editorDisabled) !== null && _disabled$editorDisab !== void 0 ? _disabled$editorDisab : false
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { IntlProvider } from 'react-intl-next';
|
|
4
|
-
import { PortalRenderer, PortalProvider } from '@atlaskit/editor-common/portal-provider';
|
|
5
|
-
import { EditorInternal } from './internal/components/EditorInternal';
|
|
6
|
-
import { usePresetContext, PresetProvider } from './internal/context/preset-context';
|
|
7
|
-
import { EditorSharedConfigConsumer, useEditorSharedConfig } from './internal/context/shared-config';
|
|
8
|
-
import { EditorContent } from './internal/components/EditorContent';
|
|
9
|
-
/**
|
|
10
|
-
* Main Editor component. Use in combination with `EditorContent` and a `Preset`.
|
|
11
|
-
* Internally it constructs `ProseMirror View` and mounts it to `EditorContent`.
|
|
12
|
-
*
|
|
13
|
-
* `EditorContent` can be wrapped to implement any layout/design requirements.
|
|
14
|
-
*
|
|
15
|
-
* ```js
|
|
16
|
-
* <Preset>
|
|
17
|
-
* <Editor>
|
|
18
|
-
* <EditorContent/>
|
|
19
|
-
* </Editor>
|
|
20
|
-
* </Preset>
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
function Editor(props) {
|
|
24
|
-
var plugins = usePresetContext();
|
|
25
|
-
return /*#__PURE__*/React.createElement(IntlProvider, {
|
|
26
|
-
locale: "en"
|
|
27
|
-
}, /*#__PURE__*/React.createElement(PortalProvider, {
|
|
28
|
-
onAnalyticsEvent: props.onAnalyticsEvent,
|
|
29
|
-
render: function render(portalProviderAPI) {
|
|
30
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EditorInternal, _extends({}, props, {
|
|
31
|
-
plugins: plugins.length ? plugins : props.plugins,
|
|
32
|
-
portalProviderAPI: portalProviderAPI,
|
|
33
|
-
onAnalyticsEvent: props.onAnalyticsEvent
|
|
34
|
-
})), /*#__PURE__*/React.createElement(PortalRenderer, {
|
|
35
|
-
portalProviderAPI: portalProviderAPI
|
|
36
|
-
}));
|
|
37
|
-
}
|
|
38
|
-
}));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
* Public API Exports.
|
|
44
|
-
*
|
|
45
|
-
*/
|
|
46
|
-
export {
|
|
47
|
-
// Components
|
|
48
|
-
PresetProvider, Editor, EditorContent, EditorSharedConfigConsumer, useEditorSharedConfig };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { pluginKey as disabledPluginKey } from '../../plugins/editor-disabled';
|
|
3
|
-
import WithPluginState from '../../ui/WithPluginState';
|
|
4
|
-
import ToolBar from '../../ui/Toolbar';
|
|
5
|
-
import { useEditorSharedConfig } from './Editor';
|
|
6
|
-
export function Toolbar(_ref) {
|
|
7
|
-
var containerElement = _ref.containerElement;
|
|
8
|
-
var config = useEditorSharedConfig();
|
|
9
|
-
if (!config) {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
13
|
-
plugins: {
|
|
14
|
-
disabled: disabledPluginKey
|
|
15
|
-
},
|
|
16
|
-
render: function render(_ref2) {
|
|
17
|
-
var _disabled$editorDisab;
|
|
18
|
-
var disabled = _ref2.disabled;
|
|
19
|
-
return /*#__PURE__*/React.createElement(ToolBar, {
|
|
20
|
-
editorView: config.editorView,
|
|
21
|
-
eventDispatcher: config.eventDispatcher,
|
|
22
|
-
providerFactory: config.providerFactory,
|
|
23
|
-
items: config.primaryToolbarComponents,
|
|
24
|
-
popupsMountPoint: config.popupsMountPoint,
|
|
25
|
-
popupsBoundariesElement: config.popupsBoundariesElement,
|
|
26
|
-
popupsScrollableElement: config.popupsScrollableElement,
|
|
27
|
-
disabled: (_disabled$editorDisab = disabled === null || disabled === void 0 ? void 0 : disabled.editorDisabled) !== null && _disabled$editorDisab !== void 0 ? _disabled$editorDisab : false,
|
|
28
|
-
containerElement: containerElement
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
4
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
5
|
-
/** @jsx jsx */
|
|
6
|
-
import rafSchedule from 'raf-schd';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { css, jsx } from '@emotion/react';
|
|
9
|
-
import { N30 } from '@atlaskit/theme/colors';
|
|
10
|
-
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
11
|
-
import { BaseTheme } from '@atlaskit/editor-common/ui';
|
|
12
|
-
import { akEditorMenuZIndex, akEditorToolbarKeylineHeight } from '@atlaskit/editor-shared-styles';
|
|
13
|
-
import ContentStyles from '../../ui/ContentStyles';
|
|
14
|
-
import { ClickAreaBlock } from '../../ui/Addon';
|
|
15
|
-
import { scrollbarStyles } from '../../ui/styles';
|
|
16
|
-
import { tableFullPageEditorStyles } from '@atlaskit/editor-plugin-table/ui/common-styles';
|
|
17
|
-
import AvatarsWithPluginState from '../../plugins/collab-edit/ui';
|
|
18
|
-
import { Editor, EditorContent, useEditorSharedConfig } from './Editor';
|
|
19
|
-
import { Toolbar } from './Toolbar';
|
|
20
|
-
import { ContentComponents } from './ContentComponents';
|
|
21
|
-
import { useCreateAnalyticsHandler } from './internal/hooks/use-analytics';
|
|
22
|
-
import { ContextPanelWidthProvider } from '@atlaskit/editor-common/ui';
|
|
23
|
-
var fullPageEditorWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n min-width: 340px;\n height: 100%;\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n"])));
|
|
24
|
-
var scrollContainer = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex-grow: 1;\n overflow-y: scroll;\n position: relative;\n display: flex;\n flex-direction: column;\n scroll-behavior: smooth;\n ", ";\n"])), scrollbarStyles);
|
|
25
|
-
var GUTTER_PADDING = 32;
|
|
26
|
-
var GUTTER_STYLE = {
|
|
27
|
-
padding: "0 ".concat(GUTTER_PADDING, "px")
|
|
28
|
-
};
|
|
29
|
-
var contentArea = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n height: 100%;\n box-sizing: border-box;\n"])));
|
|
30
|
-
var editorContentArea = function editorContentArea(theme) {
|
|
31
|
-
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n line-height: 24px;\n height: 100%;\n width: 100%;\n max-width: ", "px;\n padding-top: 50px;\n margin: 0 auto;\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n padding-bottom: 55px;\n\n & .ProseMirror {\n flex-grow: 1;\n box-sizing: border-box;\n }\n\n && .ProseMirror {\n & > * {\n clear: both;\n }\n > p,\n > ul,\n > ol,\n > h1,\n > h2,\n > h3,\n > h4,\n > h5,\n > h6 {\n clear: none;\n }\n }\n ", ";\n"])), theme.layoutMaxWidth + GUTTER_PADDING * 2, tableFullPageEditorStyles);
|
|
32
|
-
};
|
|
33
|
-
var mainToolbar = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: relative;\n align-items: center;\n box-shadow: 'none';\n\n transition: box-shadow 200ms;\n z-index: ", ";\n display: flex;\n height: 80px;\n flex-shrink: 0;\n background-color: ", ";\n\n & object {\n height: 0 !important;\n }\n"])), akEditorMenuZIndex, "var(--ds-surface, white)");
|
|
34
|
-
var mainToolbarWithKeyline = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n box-shadow: 0 ", "px 0 0 ", "\n"])), mainToolbar, akEditorToolbarKeylineHeight, "var(--ds-border, ".concat(N30, ")"));
|
|
35
|
-
var mainToolbarCustomComponentsSlot = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: flex-end;\n flex-grow: 1;\n"])));
|
|
36
|
-
var sidebarArea = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n height: 100%;\n box-sizing: border-box;\n"])));
|
|
37
|
-
function useKeyline() {
|
|
38
|
-
var _React$useState = React.useState(false),
|
|
39
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
40
|
-
showKeyline = _React$useState2[0],
|
|
41
|
-
setShowKeyline = _React$useState2[1];
|
|
42
|
-
var scrollContainerRef = React.useRef(null);
|
|
43
|
-
React.useEffect(function () {
|
|
44
|
-
var current = scrollContainerRef.current;
|
|
45
|
-
var handleScroll = rafSchedule(function () {
|
|
46
|
-
if (!current) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
var scrollTop = current.scrollTop;
|
|
50
|
-
setShowKeyline(scrollTop > akEditorToolbarKeylineHeight);
|
|
51
|
-
});
|
|
52
|
-
if (!current) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
window.addEventListener('resize', handleScroll);
|
|
56
|
-
current.addEventListener('scroll', handleScroll);
|
|
57
|
-
handleScroll();
|
|
58
|
-
return function () {
|
|
59
|
-
if (current) {
|
|
60
|
-
current.removeEventListener('scroll', handleScroll);
|
|
61
|
-
}
|
|
62
|
-
window.removeEventListener('resize', handleScroll);
|
|
63
|
-
};
|
|
64
|
-
}, []);
|
|
65
|
-
return [showKeyline, scrollContainerRef];
|
|
66
|
-
}
|
|
67
|
-
function FullPage(props) {
|
|
68
|
-
var primaryToolbarComponents = props.primaryToolbarComponents,
|
|
69
|
-
contentComponents = props.contentComponents,
|
|
70
|
-
collabEdit = props.collabEdit,
|
|
71
|
-
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
72
|
-
contextPanel = props.contextPanel;
|
|
73
|
-
var handleAnalyticsEvent = useCreateAnalyticsHandler(createAnalyticsEvent);
|
|
74
|
-
var _useKeyline = useKeyline(),
|
|
75
|
-
_useKeyline2 = _slicedToArray(_useKeyline, 2),
|
|
76
|
-
showKeyline = _useKeyline2[0],
|
|
77
|
-
scrollContainerRef = _useKeyline2[1];
|
|
78
|
-
var config = useEditorSharedConfig();
|
|
79
|
-
var wrapperElementRef = /*#__PURE__*/React.createRef();
|
|
80
|
-
return jsx(ContextPanelWidthProvider, null, jsx(Editor, _extends({}, props, {
|
|
81
|
-
onAnalyticsEvent: handleAnalyticsEvent
|
|
82
|
-
}), jsx(BaseTheme, null, jsx("div", {
|
|
83
|
-
css: fullPageEditorWrapper,
|
|
84
|
-
className: "akEditor",
|
|
85
|
-
ref: wrapperElementRef
|
|
86
|
-
}, jsx("div", {
|
|
87
|
-
"data-testid": "ak-editor-main-toolbar",
|
|
88
|
-
css: showKeyline ? mainToolbarWithKeyline : mainToolbar
|
|
89
|
-
}, jsx(Toolbar, {
|
|
90
|
-
containerElement: scrollContainerRef.current
|
|
91
|
-
}), jsx("div", {
|
|
92
|
-
css: mainToolbarCustomComponentsSlot
|
|
93
|
-
}, !config ? null : jsx(AvatarsWithPluginState, {
|
|
94
|
-
editorView: config.editorView,
|
|
95
|
-
eventDispatcher: config.eventDispatcher,
|
|
96
|
-
inviteToEditHandler: collabEdit === null || collabEdit === void 0 ? void 0 : collabEdit.inviteToEditHandler,
|
|
97
|
-
isInviteToEditButtonSelected: collabEdit === null || collabEdit === void 0 ? void 0 : collabEdit.isInviteToEditButtonSelected,
|
|
98
|
-
featureFlags: {}
|
|
99
|
-
}), primaryToolbarComponents)), jsx("div", {
|
|
100
|
-
css: contentArea
|
|
101
|
-
}, jsx(ContentStyles, {
|
|
102
|
-
ref: scrollContainerRef,
|
|
103
|
-
className: "fabric-editor-popup-scroll-parent",
|
|
104
|
-
css: scrollContainer
|
|
105
|
-
}, jsx(ClickAreaBlock, {
|
|
106
|
-
editorView: config === null || config === void 0 ? void 0 : config.editorView
|
|
107
|
-
}, jsx("div", {
|
|
108
|
-
css: editorContentArea
|
|
109
|
-
}, jsx("div", {
|
|
110
|
-
style: GUTTER_STYLE,
|
|
111
|
-
className: "ak-editor-content-area"
|
|
112
|
-
}, contentComponents, jsx(EditorContent, null), jsx(ContentComponents, {
|
|
113
|
-
wrapperElement: wrapperElementRef.current,
|
|
114
|
-
containerElement: scrollContainerRef.current
|
|
115
|
-
}))))), contextPanel && jsx("div", {
|
|
116
|
-
css: sidebarArea
|
|
117
|
-
}, contextPanel))))));
|
|
118
|
-
}
|
|
119
|
-
FullPage.displayName = 'FullPageEditor';
|
|
120
|
-
var FullPageWithAnalytics = withAnalyticsEvents()(FullPage);
|
|
121
|
-
export { FullPageWithAnalytics as FullPage };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
var EditorContentContext = /*#__PURE__*/React.createContext(function () {});
|
|
3
|
-
var EditorContentProvider = EditorContentContext.Provider;
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* ProseMirror View mount point.
|
|
7
|
-
*/
|
|
8
|
-
var EditorContent = /*#__PURE__*/React.memo(function () {
|
|
9
|
-
var handleRef = React.useContext(EditorContentContext);
|
|
10
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
11
|
-
style: {
|
|
12
|
-
height: '100%'
|
|
13
|
-
},
|
|
14
|
-
ref: handleRef
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
export { EditorContentProvider, EditorContent };
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { WidthProvider } from '@atlaskit/editor-common/ui';
|
|
5
|
-
import { injectIntl } from 'react-intl-next';
|
|
6
|
-
import { useProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
7
|
-
import EditorContext from '../../../../ui/EditorContext';
|
|
8
|
-
import EditorActions from '../../../../actions';
|
|
9
|
-
import { EditorSharedConfigProvider } from '../context/shared-config';
|
|
10
|
-
import { useEditor } from '../hooks/use-editor';
|
|
11
|
-
import { EditorContentProvider } from './EditorContent';
|
|
12
|
-
function BaseEditorInternal(_ref, context) {
|
|
13
|
-
var onAnalyticsEvent = _ref.onAnalyticsEvent,
|
|
14
|
-
disabled = _ref.disabled,
|
|
15
|
-
transformer = _ref.transformer,
|
|
16
|
-
defaultValue = _ref.defaultValue,
|
|
17
|
-
plugins = _ref.plugins,
|
|
18
|
-
portalProviderAPI = _ref.portalProviderAPI,
|
|
19
|
-
popupsMountPoint = _ref.popupsMountPoint,
|
|
20
|
-
popupsBoundariesElement = _ref.popupsBoundariesElement,
|
|
21
|
-
popupsScrollableElement = _ref.popupsScrollableElement,
|
|
22
|
-
onChange = _ref.onChange,
|
|
23
|
-
onDestroy = _ref.onDestroy,
|
|
24
|
-
onMount = _ref.onMount,
|
|
25
|
-
children = _ref.children,
|
|
26
|
-
intl = _ref.intl;
|
|
27
|
-
// Need to memoize editor actions otherwise in case when editor is not
|
|
28
|
-
// wrapped with EditorContext every prop change triggers all hooks
|
|
29
|
-
// that depend on editorActions
|
|
30
|
-
var maybeEditorActions = (context || {}).editorActions;
|
|
31
|
-
var editorActions = React.useMemo(function () {
|
|
32
|
-
return maybeEditorActions || new EditorActions();
|
|
33
|
-
}, [maybeEditorActions]);
|
|
34
|
-
|
|
35
|
-
// Get the provider factory from context
|
|
36
|
-
var providerFactory = useProviderFactory();
|
|
37
|
-
var getIntl = function getIntl() {
|
|
38
|
-
return intl;
|
|
39
|
-
};
|
|
40
|
-
var _useEditor = useEditor({
|
|
41
|
-
context: context,
|
|
42
|
-
editorActions: editorActions,
|
|
43
|
-
onAnalyticsEvent: onAnalyticsEvent,
|
|
44
|
-
disabled: disabled,
|
|
45
|
-
transformer: transformer,
|
|
46
|
-
defaultValue: defaultValue,
|
|
47
|
-
plugins: plugins,
|
|
48
|
-
portalProviderAPI: portalProviderAPI,
|
|
49
|
-
popupsMountPoint: popupsMountPoint,
|
|
50
|
-
popupsBoundariesElement: popupsBoundariesElement,
|
|
51
|
-
popupsScrollableElement: popupsScrollableElement,
|
|
52
|
-
onChange: onChange,
|
|
53
|
-
onDestroy: onDestroy,
|
|
54
|
-
onMount: onMount,
|
|
55
|
-
providerFactory: providerFactory,
|
|
56
|
-
featureFlags: {},
|
|
57
|
-
getIntl: getIntl
|
|
58
|
-
}),
|
|
59
|
-
_useEditor2 = _slicedToArray(_useEditor, 2),
|
|
60
|
-
editorSharedConfig = _useEditor2[0],
|
|
61
|
-
mountEditor = _useEditor2[1];
|
|
62
|
-
return /*#__PURE__*/React.createElement(WidthProvider, null, /*#__PURE__*/React.createElement(EditorContext, {
|
|
63
|
-
editorActions: editorActions
|
|
64
|
-
}, /*#__PURE__*/React.createElement(EditorSharedConfigProvider, {
|
|
65
|
-
value: editorSharedConfig
|
|
66
|
-
}, /*#__PURE__*/React.createElement(EditorContentProvider, {
|
|
67
|
-
value: mountEditor
|
|
68
|
-
}, children))));
|
|
69
|
-
}
|
|
70
|
-
BaseEditorInternal.contextTypes = {
|
|
71
|
-
editorActions: PropTypes.object
|
|
72
|
-
};
|
|
73
|
-
export var EditorInternal = injectIntl(BaseEditorInternal);
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
var PresetContext = /*#__PURE__*/React.createContext([]);
|
|
3
|
-
var PresetProvider = PresetContext.Provider;
|
|
4
|
-
var usePresetContext = function usePresetContext() {
|
|
5
|
-
return React.useContext(PresetContext);
|
|
6
|
-
};
|
|
7
|
-
export { PresetProvider, usePresetContext };
|