@atlaskit/editor-core 186.0.1 → 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.
Files changed (102) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/labs-next.js +0 -65
  3. package/dist/cjs/version-wrapper.js +1 -1
  4. package/dist/cjs/version.json +1 -1
  5. package/dist/es2019/labs-next.js +0 -4
  6. package/dist/es2019/version-wrapper.js +1 -1
  7. package/dist/es2019/version.json +1 -1
  8. package/dist/esm/labs-next.js +0 -4
  9. package/dist/esm/version-wrapper.js +1 -1
  10. package/dist/esm/version.json +1 -1
  11. package/dist/types/labs/next/presets/default.d.ts +2 -3
  12. package/dist/types/labs-next.d.ts +0 -7
  13. package/dist/types-ts4.5/labs/next/presets/default.d.ts +2 -3
  14. package/dist/types-ts4.5/labs-next.d.ts +0 -7
  15. package/package.json +1 -1
  16. package/report.api.md +2 -26
  17. package/dist/cjs/labs/next/ContentComponents.js +0 -43
  18. package/dist/cjs/labs/next/Editor.js +0 -76
  19. package/dist/cjs/labs/next/Toolbar.js +0 -39
  20. package/dist/cjs/labs/next/full-page.js +0 -127
  21. package/dist/cjs/labs/next/internal/components/EditorContent.js +0 -25
  22. package/dist/cjs/labs/next/internal/components/EditorInternal.js +0 -81
  23. package/dist/cjs/labs/next/internal/context/preset-context.js +0 -15
  24. package/dist/cjs/labs/next/internal/context/shared-config.js +0 -77
  25. package/dist/cjs/labs/next/internal/editor-props-type.js +0 -5
  26. package/dist/cjs/labs/next/internal/hooks/use-analytics/index.js +0 -41
  27. package/dist/cjs/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +0 -62
  28. package/dist/cjs/labs/next/internal/hooks/use-editor/create-editor.js +0 -94
  29. package/dist/cjs/labs/next/internal/hooks/use-editor/index.js +0 -193
  30. package/dist/cjs/labs/next/mobile.js +0 -37
  31. package/dist/cjs/labs/next/presets/cxhtml.js +0 -117
  32. package/dist/cjs/labs/next/presets/mobile.js +0 -130
  33. package/dist/cjs/labs/next/presets/utils.js +0 -30
  34. package/dist/es2019/labs/next/ContentComponents.js +0 -38
  35. package/dist/es2019/labs/next/Editor.js +0 -46
  36. package/dist/es2019/labs/next/Toolbar.js +0 -34
  37. package/dist/es2019/labs/next/full-page.js +0 -192
  38. package/dist/es2019/labs/next/internal/components/EditorContent.js +0 -17
  39. package/dist/es2019/labs/next/internal/components/EditorInternal.js +0 -66
  40. package/dist/es2019/labs/next/internal/context/preset-context.js +0 -5
  41. package/dist/es2019/labs/next/internal/context/shared-config.js +0 -34
  42. package/dist/es2019/labs/next/internal/editor-props-type.js +0 -1
  43. package/dist/es2019/labs/next/internal/hooks/use-analytics/index.js +0 -32
  44. package/dist/es2019/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +0 -51
  45. package/dist/es2019/labs/next/internal/hooks/use-editor/create-editor.js +0 -85
  46. package/dist/es2019/labs/next/internal/hooks/use-editor/index.js +0 -179
  47. package/dist/es2019/labs/next/mobile.js +0 -27
  48. package/dist/es2019/labs/next/presets/cxhtml.js +0 -106
  49. package/dist/es2019/labs/next/presets/mobile.js +0 -118
  50. package/dist/es2019/labs/next/presets/utils.js +0 -22
  51. package/dist/esm/labs/next/ContentComponents.js +0 -36
  52. package/dist/esm/labs/next/Editor.js +0 -48
  53. package/dist/esm/labs/next/Toolbar.js +0 -32
  54. package/dist/esm/labs/next/full-page.js +0 -121
  55. package/dist/esm/labs/next/internal/components/EditorContent.js +0 -17
  56. package/dist/esm/labs/next/internal/components/EditorInternal.js +0 -73
  57. package/dist/esm/labs/next/internal/context/preset-context.js +0 -7
  58. package/dist/esm/labs/next/internal/context/shared-config.js +0 -68
  59. package/dist/esm/labs/next/internal/editor-props-type.js +0 -1
  60. package/dist/esm/labs/next/internal/hooks/use-analytics/index.js +0 -34
  61. package/dist/esm/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +0 -55
  62. package/dist/esm/labs/next/internal/hooks/use-editor/create-editor.js +0 -88
  63. package/dist/esm/labs/next/internal/hooks/use-editor/index.js +0 -185
  64. package/dist/esm/labs/next/mobile.js +0 -25
  65. package/dist/esm/labs/next/presets/cxhtml.js +0 -108
  66. package/dist/esm/labs/next/presets/mobile.js +0 -120
  67. package/dist/esm/labs/next/presets/utils.js +0 -23
  68. package/dist/types/labs/next/ContentComponents.d.ts +0 -8
  69. package/dist/types/labs/next/Editor.d.ts +0 -27
  70. package/dist/types/labs/next/Toolbar.d.ts +0 -6
  71. package/dist/types/labs/next/full-page.d.ts +0 -9
  72. package/dist/types/labs/next/internal/components/EditorContent.d.ts +0 -7
  73. package/dist/types/labs/next/internal/components/EditorInternal.d.ts +0 -9
  74. package/dist/types/labs/next/internal/context/preset-context.d.ts +0 -5
  75. package/dist/types/labs/next/internal/context/shared-config.d.ts +0 -50
  76. package/dist/types/labs/next/internal/editor-props-type.d.ts +0 -29
  77. package/dist/types/labs/next/internal/hooks/use-analytics/index.d.ts +0 -8
  78. package/dist/types/labs/next/internal/hooks/use-editor/create-dispatch-transaction.d.ts +0 -6
  79. package/dist/types/labs/next/internal/hooks/use-editor/create-editor.d.ts +0 -19
  80. package/dist/types/labs/next/internal/hooks/use-editor/index.d.ts +0 -11
  81. package/dist/types/labs/next/mobile.d.ts +0 -12
  82. package/dist/types/labs/next/presets/cxhtml.d.ts +0 -338
  83. package/dist/types/labs/next/presets/mobile.d.ts +0 -343
  84. package/dist/types/labs/next/presets/utils.d.ts +0 -3
  85. package/dist/types-ts4.5/labs/next/ContentComponents.d.ts +0 -8
  86. package/dist/types-ts4.5/labs/next/Editor.d.ts +0 -27
  87. package/dist/types-ts4.5/labs/next/Toolbar.d.ts +0 -6
  88. package/dist/types-ts4.5/labs/next/full-page.d.ts +0 -9
  89. package/dist/types-ts4.5/labs/next/internal/components/EditorContent.d.ts +0 -7
  90. package/dist/types-ts4.5/labs/next/internal/components/EditorInternal.d.ts +0 -9
  91. package/dist/types-ts4.5/labs/next/internal/context/preset-context.d.ts +0 -5
  92. package/dist/types-ts4.5/labs/next/internal/context/shared-config.d.ts +0 -50
  93. package/dist/types-ts4.5/labs/next/internal/editor-props-type.d.ts +0 -29
  94. package/dist/types-ts4.5/labs/next/internal/hooks/use-analytics/index.d.ts +0 -8
  95. package/dist/types-ts4.5/labs/next/internal/hooks/use-editor/create-dispatch-transaction.d.ts +0 -6
  96. package/dist/types-ts4.5/labs/next/internal/hooks/use-editor/create-editor.d.ts +0 -19
  97. package/dist/types-ts4.5/labs/next/internal/hooks/use-editor/index.d.ts +0 -14
  98. package/dist/types-ts4.5/labs/next/mobile.d.ts +0 -12
  99. package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +0 -414
  100. package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +0 -419
  101. package/dist/types-ts4.5/labs/next/presets/utils.d.ts +0 -3
  102. package/tmp/api-report-tmp.d.ts +0 -2278
@@ -1,117 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.EditorPresetCXHTML = EditorPresetCXHTML;
8
- exports.useCXHTMLPreset = useCXHTMLPreset;
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _react = _interopRequireDefault(require("react"));
11
- var _Editor = require("../Editor");
12
- var _default = require("./default");
13
- // #region Imports
14
-
15
- //import { tablesPlugin } from '@atlaskit/editor-plugin-table';
16
- //
17
- //import {
18
- // panelPlugin,
19
- // listPlugin,
20
- // textColorPlugin,
21
- // breakoutPlugin,
22
- // jiraIssuePlugin,
23
- // extensionPlugin,
24
- // rulePlugin,
25
- // datePlugin,
26
- // layoutPlugin,
27
- // indentationPlugin,
28
- // cardPlugin,
29
- // statusPlugin,
30
- // mediaPlugin,
31
- // mentionsPlugin,
32
- // tasksAndDecisionsPlugin,
33
- // insertBlockPlugin,
34
- // basePlugin,
35
- // //placeholderPlugin,
36
- //} from '../../../plugins';
37
-
38
- // #endregion
39
-
40
- function useCXHTMLPreset(_ref) {
41
- var mentionProvider = _ref.mentionProvider,
42
- mediaProvider = _ref.mediaProvider,
43
- placeholder = _ref.placeholder,
44
- featureFlags = _ref.featureFlags;
45
- var _useDefaultPreset = (0, _default.useDefaultPreset)({
46
- featureFlags: featureFlags,
47
- paste: {}
48
- }),
49
- _useDefaultPreset2 = (0, _slicedToArray2.default)(_useDefaultPreset, 1),
50
- defaultPreset = _useDefaultPreset2[0];
51
- var preset = defaultPreset;
52
- //.add([
53
- // basePlugin,
54
- // {
55
- // allowInlineCursorTarget: true,
56
- // allowScrollGutter: {
57
- // getScrollElement: (_view) =>
58
- // document.querySelector('.fabric-editor-popup-scroll-parent') ||
59
- // null,
60
- // },
61
- // },
62
- //])
63
- //.add([tablesPlugin, { tableOptions: { advanced: true } }])
64
- //.add([panelPlugin, { allowCustomPanel: true }])
65
- //.add(listPlugin)
66
- //.add(textColorPlugin)
67
- //.add(breakoutPlugin)
68
- //.add(jiraIssuePlugin)
69
- //.add(extensionPlugin)
70
- //.add(rulePlugin)
71
- //.add(datePlugin)
72
- //.add(layoutPlugin)
73
- //.add(indentationPlugin)
74
- //.add([cardPlugin, { allowBlockCards: true, platform: 'web' }])
75
- //.add([statusPlugin, { menuDisabled: false }])
76
- //.add(tasksAndDecisionsPlugin)
77
- //.add(insertBlockPlugin)
78
- ////.add([placeholderPlugin, { placeholder }])
79
- //.maybeAdd(mentionsPlugin, (plugin, builder) => {
80
- // if (mentionProvider) {
81
- // return builder.add(plugin);
82
- // }
83
- // return builder;
84
- //})
85
- //.maybeAdd(mediaPlugin, (plugin, builder) => {
86
- // if (mediaProvider) {
87
- // preset.add([
88
- // plugin,
89
- // {
90
- // provider: mediaProvider,
91
- // allowMediaSingle: true,
92
- // allowMediaGroup: true,
93
- // allowResizing: true,
94
- // allowLinking: true,
95
- // allowResizingInTables: true,
96
- // allowAltTextOnImages: true,
97
- // },
98
- // ]);
99
- // }
100
- // return builder;
101
- //});
102
-
103
- return [preset];
104
- }
105
- function EditorPresetCXHTML(props) {
106
- var children = props.children,
107
- excludes = props.excludes;
108
- var _useCXHTMLPreset = useCXHTMLPreset(props),
109
- _useCXHTMLPreset2 = (0, _slicedToArray2.default)(_useCXHTMLPreset, 1),
110
- preset = _useCXHTMLPreset2[0];
111
- var plugins = preset.build({
112
- excludePlugins: excludes
113
- });
114
- return /*#__PURE__*/_react.default.createElement(_Editor.PresetProvider, {
115
- value: plugins
116
- }, children);
117
- }
@@ -1,130 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.EditorPresetMobile = EditorPresetMobile;
8
- exports.useMobilePreset = useMobilePreset;
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _react = _interopRequireDefault(require("react"));
11
- var _providerFactory = require("@atlaskit/editor-common/provider-factory");
12
- var _Editor = require("../Editor");
13
- var _default = require("./default");
14
- var _utils = require("./utils");
15
- // #region Imports
16
-
17
- //import analyticsPlugin from '../../../plugins/analytics';
18
- //import basePlugin from '../../../plugins/base';
19
- //import { cardPlugin } from '@atlaskit/editor-plugin-card';
20
- //import datePlugin from '../../../plugins/date';
21
- //import emojiPlugin from '../../../plugins/emoji';
22
- //import extensionPlugin from '../../../plugins/extension';
23
- //import layoutPlugin from '../../../plugins/layout';
24
- //import listPlugin from '../../../plugins/list';
25
-
26
- //import mentionsPlugin from '../../../plugins/mentions';
27
- //import mobileDimensionsPlugin from '../../../plugins/mobile-dimensions';
28
- //import panelPlugin from '../../../plugins/panel';
29
- //import placeholderPlugin from '../../../plugins/placeholder';
30
- //import rulePlugin from '../../../plugins/rule';
31
- //import statusPlugin from '../../../plugins/status';
32
- //import { tablesPlugin } from '@atlaskit/editor-plugin-table';
33
- //import tasksAndDecisionsPlugin from '../../../plugins/tasks-and-decisions';
34
- //import textColorPlugin from '../../../plugins/text-color';
35
- //import maxContentSizePlugin from '../../../plugins/max-content-size';
36
- //import expandPlugin from '../../../plugins/expand';
37
- //import selectionPlugin from '../../../plugins/selection';
38
-
39
- //import { quickInsertPlugin } from '../../../plugins';
40
-
41
- // #endregion
42
-
43
- function useMobilePreset(_ref) {
44
- var media = _ref.media,
45
- placeholder = _ref.placeholder,
46
- maxContentSize = _ref.maxContentSize,
47
- createAnalyticsEvent = _ref.createAnalyticsEvent,
48
- featureFlags = _ref.featureFlags;
49
- //const mediaProvider = useProvider('mediaProvider');
50
- var _useDefaultPreset = (0, _default.useDefaultPreset)({
51
- featureFlags: featureFlags,
52
- paste: {}
53
- }),
54
- _useDefaultPreset2 = (0, _slicedToArray2.default)(_useDefaultPreset, 1),
55
- defaultPreset = _useDefaultPreset2[0];
56
- var preset = defaultPreset;
57
- //.add([
58
- // basePlugin,
59
- // {
60
- // allowScrollGutter: {
61
- // getScrollElement: () => document.body,
62
- // allowCustomScrollHandler: false,
63
- // },
64
- // },
65
- //])
66
- //.add([analyticsPlugin, createAnalyticsEvent])
67
- //.add([tablesPlugin, { tableOptions: { allowControls: false } }])
68
- //.add(panelPlugin)
69
- //.add(listPlugin)
70
- //.add(textColorPlugin)
71
- //.add(extensionPlugin)
72
- //.add(rulePlugin)
73
- //.add(datePlugin)
74
- //.add(layoutPlugin)
75
- //.add([quickInsertPlugin, { headless: true, disableDefaultItems: true }])
76
- //.add([statusPlugin, { menuDisabled: false }])
77
- //.add([placeholderPlugin, { placeholder }])
78
- //.add(mobileDimensionsPlugin)
79
- //.add(expandPlugin)
80
- ////.add([selectionPlugin, { useLongPressSelection: false }])
81
- //// Begin -> This would be exclude if the provider doesnt exist in the factory
82
- //.add(tasksAndDecisionsPlugin)
83
- //.add([cardPlugin, { allowBlockCards: true, platform: 'mobile' }])
84
- //.add(mentionsPlugin)
85
- //.add(emojiPlugin)
86
- //// End
87
- //.maybeAdd(maxContentSizePlugin, (plugin, builder) => {
88
- // if (maxContentSize) {
89
- // return builder.add([plugin, maxContentSize as any]);
90
- // }
91
- // return builder;
92
- //})
93
- //.maybeAdd(mediaPlugin, (plugin, builder) => {
94
- // if (media) {
95
- // return builder.add([
96
- // plugin,
97
- // {
98
- // provider: mediaProvider,
99
- // customMediaPicker: media.picker,
100
- // fullWidthEnabled: false,
101
- // allowMediaSingle: true,
102
- // allowLazyLoading: false,
103
- // allowMediaSingleEditable: false,
104
- // allowRemoteDimensionsFetch: false,
105
- // allowMarkingUploadsAsIncomplete: true,
106
- // allowAltTextOnImages: true,
107
- // allowTemplatePlaceholders: { allowInserting: true },
108
- // },
109
- // ]);
110
- // }
111
-
112
- // return builder;
113
- //});
114
-
115
- return [preset];
116
- }
117
- function EditorPresetMobile(props) {
118
- var children = props.children,
119
- excludes = props.excludes;
120
- var _useMobilePreset = useMobilePreset(props),
121
- _useMobilePreset2 = (0, _slicedToArray2.default)(_useMobilePreset, 1),
122
- preset = _useMobilePreset2[0];
123
- var providerFactory = (0, _providerFactory.useProviderFactory)();
124
- var plugins = preset.build({
125
- excludePlugins: (0, _utils.addExcludesFromProviderFactory)(providerFactory, excludes)
126
- });
127
- return /*#__PURE__*/_react.default.createElement(_Editor.PresetProvider, {
128
- value: plugins
129
- }, children);
130
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.addExcludesFromProviderFactory = void 0;
7
- var addExcludesFromProviderFactory = function addExcludesFromProviderFactory(providerFactory) {
8
- var excludes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set();
9
- // TODO: Should I make this function pure?
10
- if (!providerFactory.hasProvider('mentionProvider')) {
11
- excludes.add('mention');
12
- }
13
- if (!providerFactory.hasProvider('emojiProvider')) {
14
- excludes.add('emoji');
15
- }
16
- if (!providerFactory.hasProvider('macroProvider')) {
17
- excludes.add('macro');
18
- }
19
- if (!providerFactory.hasProvider('autoformattingProvider')) {
20
- excludes.add('customAutoformat');
21
- }
22
- if (!providerFactory.hasProvider('taskDecisionProvider')) {
23
- excludes.add('taskDecision');
24
- }
25
- if (!providerFactory.hasProvider('cardProvider')) {
26
- excludes.add('card');
27
- }
28
- return excludes;
29
- };
30
- exports.addExcludesFromProviderFactory = addExcludesFromProviderFactory;
@@ -1,38 +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({
7
- disabled,
8
- wrapperElement,
9
- containerElement
10
- }) {
11
- const config = useEditorSharedConfig();
12
- if (!config) {
13
- return null;
14
- }
15
- return /*#__PURE__*/React.createElement(WithPluginState, {
16
- plugins: {
17
- disabled: disabledPluginKey
18
- },
19
- render: ({
20
- disabled
21
- }) => {
22
- var _disabled$editorDisab;
23
- return /*#__PURE__*/React.createElement(PluginSlot, {
24
- editorView: config.editorView,
25
- eventDispatcher: config.eventDispatcher,
26
- providerFactory: config.providerFactory,
27
- items: config.contentComponents,
28
- popupsMountPoint: config.popupsMountPoint,
29
- popupsBoundariesElement: config.popupsBoundariesElement,
30
- popupsScrollableElement: config.popupsScrollableElement,
31
- containerElement: containerElement // TODO: Figure out how to pass containerElement here ED-8448
32
- ,
33
- wrapperElement: wrapperElement,
34
- disabled: (_disabled$editorDisab = disabled === null || disabled === void 0 ? void 0 : disabled.editorDisabled) !== null && _disabled$editorDisab !== void 0 ? _disabled$editorDisab : false
35
- });
36
- }
37
- });
38
- }
@@ -1,46 +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
- const plugins = usePresetContext();
25
- return /*#__PURE__*/React.createElement(IntlProvider, {
26
- locale: "en"
27
- }, /*#__PURE__*/React.createElement(PortalProvider, {
28
- onAnalyticsEvent: props.onAnalyticsEvent,
29
- render: portalProviderAPI => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EditorInternal, _extends({}, props, {
30
- plugins: plugins.length ? plugins : props.plugins,
31
- portalProviderAPI: portalProviderAPI,
32
- onAnalyticsEvent: props.onAnalyticsEvent
33
- })), /*#__PURE__*/React.createElement(PortalRenderer, {
34
- portalProviderAPI: portalProviderAPI
35
- }))
36
- }));
37
- }
38
-
39
- /**
40
- *
41
- * Public API Exports.
42
- *
43
- */
44
- export {
45
- // Components
46
- PresetProvider, Editor, EditorContent, EditorSharedConfigConsumer, useEditorSharedConfig };
@@ -1,34 +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({
7
- containerElement
8
- }) {
9
- const config = useEditorSharedConfig();
10
- if (!config) {
11
- return null;
12
- }
13
- return /*#__PURE__*/React.createElement(WithPluginState, {
14
- plugins: {
15
- disabled: disabledPluginKey
16
- },
17
- render: ({
18
- disabled
19
- }) => {
20
- var _disabled$editorDisab;
21
- return /*#__PURE__*/React.createElement(ToolBar, {
22
- editorView: config.editorView,
23
- eventDispatcher: config.eventDispatcher,
24
- providerFactory: config.providerFactory,
25
- items: config.primaryToolbarComponents,
26
- popupsMountPoint: config.popupsMountPoint,
27
- popupsBoundariesElement: config.popupsBoundariesElement,
28
- popupsScrollableElement: config.popupsScrollableElement,
29
- disabled: (_disabled$editorDisab = disabled === null || disabled === void 0 ? void 0 : disabled.editorDisabled) !== null && _disabled$editorDisab !== void 0 ? _disabled$editorDisab : false,
30
- containerElement: containerElement
31
- });
32
- }
33
- });
34
- }
@@ -1,192 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- /** @jsx jsx */
3
- import rafSchedule from 'raf-schd';
4
- import React from 'react';
5
- import { css, jsx } from '@emotion/react';
6
- import { N30 } from '@atlaskit/theme/colors';
7
- import { withAnalyticsEvents } from '@atlaskit/analytics-next';
8
- import { BaseTheme } from '@atlaskit/editor-common/ui';
9
- import { akEditorMenuZIndex, akEditorToolbarKeylineHeight } from '@atlaskit/editor-shared-styles';
10
- import ContentStyles from '../../ui/ContentStyles';
11
- import { ClickAreaBlock } from '../../ui/Addon';
12
- import { scrollbarStyles } from '../../ui/styles';
13
- import { tableFullPageEditorStyles } from '@atlaskit/editor-plugin-table/ui/common-styles';
14
- import AvatarsWithPluginState from '../../plugins/collab-edit/ui';
15
- import { Editor, EditorContent, useEditorSharedConfig } from './Editor';
16
- import { Toolbar } from './Toolbar';
17
- import { ContentComponents } from './ContentComponents';
18
- import { useCreateAnalyticsHandler } from './internal/hooks/use-analytics';
19
- import { ContextPanelWidthProvider } from '@atlaskit/editor-common/ui';
20
- const fullPageEditorWrapper = css`
21
- min-width: 340px;
22
- height: 100%;
23
- display: flex;
24
- flex-direction: column;
25
- box-sizing: border-box;
26
- `;
27
- const scrollContainer = css`
28
- flex-grow: 1;
29
- overflow-y: scroll;
30
- position: relative;
31
- display: flex;
32
- flex-direction: column;
33
- scroll-behavior: smooth;
34
- ${scrollbarStyles};
35
- `;
36
- const GUTTER_PADDING = 32;
37
- const GUTTER_STYLE = {
38
- padding: `0 ${GUTTER_PADDING}px`
39
- };
40
- const contentArea = css`
41
- display: flex;
42
- flex-direction: row;
43
- height: 100%;
44
- box-sizing: border-box;
45
- `;
46
- const editorContentArea = theme => css`
47
- line-height: 24px;
48
- height: 100%;
49
- width: 100%;
50
- max-width: ${theme.layoutMaxWidth + GUTTER_PADDING * 2}px;
51
- padding-top: 50px;
52
- margin: 0 auto;
53
- display: flex;
54
- flex-direction: column;
55
- flex-grow: 1;
56
- padding-bottom: 55px;
57
-
58
- & .ProseMirror {
59
- flex-grow: 1;
60
- box-sizing: border-box;
61
- }
62
-
63
- && .ProseMirror {
64
- & > * {
65
- clear: both;
66
- }
67
- > p,
68
- > ul,
69
- > ol,
70
- > h1,
71
- > h2,
72
- > h3,
73
- > h4,
74
- > h5,
75
- > h6 {
76
- clear: none;
77
- }
78
- }
79
- ${tableFullPageEditorStyles};
80
- `;
81
- const mainToolbar = css`
82
- position: relative;
83
- align-items: center;
84
- box-shadow: 'none';
85
-
86
- transition: box-shadow 200ms;
87
- z-index: ${akEditorMenuZIndex};
88
- display: flex;
89
- height: 80px;
90
- flex-shrink: 0;
91
- background-color: ${"var(--ds-surface, white)"};
92
-
93
- & object {
94
- height: 0 !important;
95
- }
96
- `;
97
- const mainToolbarWithKeyline = css`
98
- ${mainToolbar}
99
- box-shadow: 0 ${akEditorToolbarKeylineHeight}px 0 0 ${`var(--ds-border, ${N30})`}
100
- `;
101
- const mainToolbarCustomComponentsSlot = css`
102
- display: flex;
103
- justify-content: flex-end;
104
- flex-grow: 1;
105
- `;
106
- const sidebarArea = css`
107
- height: 100%;
108
- box-sizing: border-box;
109
- `;
110
- function useKeyline() {
111
- const [showKeyline, setShowKeyline] = React.useState(false);
112
- const scrollContainerRef = React.useRef(null);
113
- React.useEffect(() => {
114
- let current = scrollContainerRef.current;
115
- const handleScroll = rafSchedule(() => {
116
- if (!current) {
117
- return;
118
- }
119
- const {
120
- scrollTop
121
- } = current;
122
- setShowKeyline(scrollTop > akEditorToolbarKeylineHeight);
123
- });
124
- if (!current) {
125
- return;
126
- }
127
- window.addEventListener('resize', handleScroll);
128
- current.addEventListener('scroll', handleScroll);
129
- handleScroll();
130
- return () => {
131
- if (current) {
132
- current.removeEventListener('scroll', handleScroll);
133
- }
134
- window.removeEventListener('resize', handleScroll);
135
- };
136
- }, []);
137
- return [showKeyline, scrollContainerRef];
138
- }
139
- function FullPage(props) {
140
- const {
141
- primaryToolbarComponents,
142
- contentComponents,
143
- collabEdit,
144
- createAnalyticsEvent,
145
- contextPanel
146
- } = props;
147
- const handleAnalyticsEvent = useCreateAnalyticsHandler(createAnalyticsEvent);
148
- const [showKeyline, scrollContainerRef] = useKeyline();
149
- const config = useEditorSharedConfig();
150
- const wrapperElementRef = /*#__PURE__*/React.createRef();
151
- return jsx(ContextPanelWidthProvider, null, jsx(Editor, _extends({}, props, {
152
- onAnalyticsEvent: handleAnalyticsEvent
153
- }), jsx(BaseTheme, null, jsx("div", {
154
- css: fullPageEditorWrapper,
155
- className: "akEditor",
156
- ref: wrapperElementRef
157
- }, jsx("div", {
158
- "data-testid": "ak-editor-main-toolbar",
159
- css: showKeyline ? mainToolbarWithKeyline : mainToolbar
160
- }, jsx(Toolbar, {
161
- containerElement: scrollContainerRef.current
162
- }), jsx("div", {
163
- css: mainToolbarCustomComponentsSlot
164
- }, !config ? null : jsx(AvatarsWithPluginState, {
165
- editorView: config.editorView,
166
- eventDispatcher: config.eventDispatcher,
167
- inviteToEditHandler: collabEdit === null || collabEdit === void 0 ? void 0 : collabEdit.inviteToEditHandler,
168
- isInviteToEditButtonSelected: collabEdit === null || collabEdit === void 0 ? void 0 : collabEdit.isInviteToEditButtonSelected,
169
- featureFlags: {}
170
- }), primaryToolbarComponents)), jsx("div", {
171
- css: contentArea
172
- }, jsx(ContentStyles, {
173
- ref: scrollContainerRef,
174
- className: "fabric-editor-popup-scroll-parent",
175
- css: scrollContainer
176
- }, jsx(ClickAreaBlock, {
177
- editorView: config === null || config === void 0 ? void 0 : config.editorView
178
- }, jsx("div", {
179
- css: editorContentArea
180
- }, jsx("div", {
181
- style: GUTTER_STYLE,
182
- className: "ak-editor-content-area"
183
- }, contentComponents, jsx(EditorContent, null), jsx(ContentComponents, {
184
- wrapperElement: wrapperElementRef.current,
185
- containerElement: scrollContainerRef.current
186
- }))))), contextPanel && jsx("div", {
187
- css: sidebarArea
188
- }, contextPanel))))));
189
- }
190
- FullPage.displayName = 'FullPageEditor';
191
- const FullPageWithAnalytics = withAnalyticsEvents()(FullPage);
192
- export { FullPageWithAnalytics as FullPage };
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- const EditorContentContext = /*#__PURE__*/React.createContext(() => {});
3
- const EditorContentProvider = EditorContentContext.Provider;
4
-
5
- /**
6
- * ProseMirror View mount point.
7
- */
8
- const EditorContent = /*#__PURE__*/React.memo(() => {
9
- const 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,66 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { WidthProvider } from '@atlaskit/editor-common/ui';
4
- import { injectIntl } from 'react-intl-next';
5
- import { useProviderFactory } from '@atlaskit/editor-common/provider-factory';
6
- import EditorContext from '../../../../ui/EditorContext';
7
- import EditorActions from '../../../../actions';
8
- import { EditorSharedConfigProvider } from '../context/shared-config';
9
- import { useEditor } from '../hooks/use-editor';
10
- import { EditorContentProvider } from './EditorContent';
11
- function BaseEditorInternal({
12
- onAnalyticsEvent,
13
- disabled,
14
- transformer,
15
- defaultValue,
16
- plugins,
17
- portalProviderAPI,
18
- popupsMountPoint,
19
- popupsBoundariesElement,
20
- popupsScrollableElement,
21
- onChange,
22
- onDestroy,
23
- onMount,
24
- children,
25
- intl
26
- }, context) {
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
- const maybeEditorActions = (context || {}).editorActions;
31
- const editorActions = React.useMemo(() => maybeEditorActions || new EditorActions(), [maybeEditorActions]);
32
-
33
- // Get the provider factory from context
34
- const providerFactory = useProviderFactory();
35
- const getIntl = () => intl;
36
- const [editorSharedConfig, mountEditor] = useEditor({
37
- context,
38
- editorActions,
39
- onAnalyticsEvent,
40
- disabled,
41
- transformer,
42
- defaultValue,
43
- plugins,
44
- portalProviderAPI,
45
- popupsMountPoint,
46
- popupsBoundariesElement,
47
- popupsScrollableElement,
48
- onChange,
49
- onDestroy,
50
- onMount,
51
- providerFactory,
52
- featureFlags: {},
53
- getIntl
54
- });
55
- return /*#__PURE__*/React.createElement(WidthProvider, null, /*#__PURE__*/React.createElement(EditorContext, {
56
- editorActions: editorActions
57
- }, /*#__PURE__*/React.createElement(EditorSharedConfigProvider, {
58
- value: editorSharedConfig
59
- }, /*#__PURE__*/React.createElement(EditorContentProvider, {
60
- value: mountEditor
61
- }, children))));
62
- }
63
- BaseEditorInternal.contextTypes = {
64
- editorActions: PropTypes.object
65
- };
66
- export const EditorInternal = injectIntl(BaseEditorInternal);
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- const PresetContext = /*#__PURE__*/React.createContext([]);
3
- const PresetProvider = PresetContext.Provider;
4
- const usePresetContext = () => React.useContext(PresetContext);
5
- export { PresetProvider, usePresetContext };