@atlaskit/editor-core 186.0.1 → 187.1.1
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 +18 -0
- package/dist/cjs/labs-next.js +0 -65
- 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/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/labs-next.js +0 -4
- 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-ts4.5/labs/next/presets/default.d.ts +2 -3
- package/dist/types-ts4.5/labs-next.d.ts +0 -7
- package/package.json +5 -1
- 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,185 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { measureRender, getResponseEndTime, startMeasure, stopMeasure } from '@atlaskit/editor-common/utils';
|
|
7
|
-
import measurements from '../../../../../utils/performance/measure-enum';
|
|
8
|
-
import { getNodesCount } from '../../../../../utils';
|
|
9
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, PLATFORMS } from '../../../../../plugins/analytics';
|
|
10
|
-
import { getEnabledFeatureFlagKeys } from '@atlaskit/editor-common/normalize-feature-flags';
|
|
11
|
-
import { useAnalyticsHandler } from '../use-analytics';
|
|
12
|
-
import { createDispatchTransaction } from './create-dispatch-transaction';
|
|
13
|
-
import { createEditor } from './create-editor';
|
|
14
|
-
import { analyticsEventKey } from '../../../../../plugins/analytics/consts';
|
|
15
|
-
export function useEditor(config) {
|
|
16
|
-
startMeasure(measurements.EDITOR_MOUNTED);
|
|
17
|
-
var _useCreateEditor = useCreateEditor(config),
|
|
18
|
-
_useCreateEditor2 = _slicedToArray(_useCreateEditor, 2),
|
|
19
|
-
editorSharedConfig = _useCreateEditor2[0],
|
|
20
|
-
mountEditor = _useCreateEditor2[1];
|
|
21
|
-
useApplyEditorViewProps(editorSharedConfig, config.disabled);
|
|
22
|
-
useHandleEditorLifecycle(editorSharedConfig, config.featureFlags);
|
|
23
|
-
useAnalyticsHandler(editorSharedConfig);
|
|
24
|
-
return [editorSharedConfig, mountEditor];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
*
|
|
29
|
-
* Sub hooks ¯\_(ツ)_/¯
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Main hook that creates an instance of EditorView, EditorSharedConfig, etc...
|
|
35
|
-
*/
|
|
36
|
-
function useCreateEditor(config) {
|
|
37
|
-
var _React$useState = React.useState(null),
|
|
38
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
39
|
-
editorSharedConfig = _React$useState2[0],
|
|
40
|
-
setEditorSharedConfig = _React$useState2[1];
|
|
41
|
-
return [editorSharedConfig,
|
|
42
|
-
// This callback is being used as `ref={callback}` on EditorContentProvider,
|
|
43
|
-
// When called with `ref` mounts editor and creates editorSharedConfig.
|
|
44
|
-
React.useCallback(function (ref) {
|
|
45
|
-
// If editorSharedConfig already exists it means that editorView is mounted
|
|
46
|
-
// and we just need to ignore this function altogether.
|
|
47
|
-
if (!ref) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
setEditorSharedConfig(function (editorSharedConfig) {
|
|
51
|
-
if (!editorSharedConfig) {
|
|
52
|
-
measureRender(measurements.PROSEMIRROR_RENDERED, function (_ref) {
|
|
53
|
-
var duration = _ref.duration,
|
|
54
|
-
startTime = _ref.startTime,
|
|
55
|
-
distortedDuration = _ref.distortedDuration;
|
|
56
|
-
if (sharedConfig && sharedConfig.dispatch) {
|
|
57
|
-
sharedConfig.dispatch(analyticsEventKey, {
|
|
58
|
-
payload: {
|
|
59
|
-
action: ACTION.PROSEMIRROR_RENDERED,
|
|
60
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
61
|
-
attributes: {
|
|
62
|
-
duration: duration,
|
|
63
|
-
distortedDuration: distortedDuration,
|
|
64
|
-
startTime: startTime,
|
|
65
|
-
nodes: getNodesCount(sharedConfig.editorView.state.doc),
|
|
66
|
-
ttfb: getResponseEndTime()
|
|
67
|
-
},
|
|
68
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
var sharedConfig = editorSharedConfig || createEditor(_objectSpread(_objectSpread({}, config), {}, {
|
|
75
|
-
ref: ref
|
|
76
|
-
}));
|
|
77
|
-
stopMeasure(measurements.EDITOR_MOUNTED, function (duration, startTime) {
|
|
78
|
-
if (!sharedConfig) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Fire editor mounted event
|
|
83
|
-
sharedConfig.dispatch(analyticsEventKey, {
|
|
84
|
-
payload: {
|
|
85
|
-
action: ACTION.EDITOR_MOUNTED,
|
|
86
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
87
|
-
attributes: {
|
|
88
|
-
duration: duration,
|
|
89
|
-
startTime: startTime
|
|
90
|
-
},
|
|
91
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
return sharedConfig;
|
|
96
|
-
});
|
|
97
|
-
}, [config])];
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Applies updated EditorView properties e.g. set dispatchTransaction or 'disabled' state changes
|
|
102
|
-
*/
|
|
103
|
-
function useApplyEditorViewProps(editorSharedConfig, disabled) {
|
|
104
|
-
React.useEffect(function () {
|
|
105
|
-
if (editorSharedConfig) {
|
|
106
|
-
editorSharedConfig.editorView.setProps({
|
|
107
|
-
dispatchTransaction: createDispatchTransaction(editorSharedConfig)
|
|
108
|
-
});
|
|
109
|
-
editorSharedConfig.editorView.setProps({
|
|
110
|
-
editable: function editable(_state) {
|
|
111
|
-
return !disabled;
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}, [editorSharedConfig, disabled]);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Handles editor component unmount
|
|
120
|
-
*/
|
|
121
|
-
export function useHandleEditorLifecycle(editorSharedConfig, featureFlags) {
|
|
122
|
-
React.useEffect(function () {
|
|
123
|
-
//#region Did mount
|
|
124
|
-
if (editorSharedConfig) {
|
|
125
|
-
var onMount = editorSharedConfig.onMount,
|
|
126
|
-
editorActions = editorSharedConfig.editorActions,
|
|
127
|
-
editorView = editorSharedConfig.editorView,
|
|
128
|
-
eventDispatcher = editorSharedConfig.eventDispatcher,
|
|
129
|
-
dispatch = editorSharedConfig.dispatch;
|
|
130
|
-
editorActions._privateRegisterEditor(editorView, eventDispatcher);
|
|
131
|
-
if (onMount) {
|
|
132
|
-
onMount(editorActions);
|
|
133
|
-
}
|
|
134
|
-
var featureFlagsEnabled = featureFlags ? getEnabledFeatureFlagKeys(featureFlags) : [];
|
|
135
|
-
|
|
136
|
-
// Fire editor started event
|
|
137
|
-
dispatch(analyticsEventKey, {
|
|
138
|
-
payload: {
|
|
139
|
-
action: ACTION.STARTED,
|
|
140
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
141
|
-
attributes: {
|
|
142
|
-
platform: PLATFORMS.WEB,
|
|
143
|
-
featureFlags: featureFlagsEnabled
|
|
144
|
-
},
|
|
145
|
-
eventType: EVENT_TYPE.UI
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
//#endregion
|
|
150
|
-
|
|
151
|
-
return function () {
|
|
152
|
-
if (!editorSharedConfig) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
var eventDispatcher = editorSharedConfig.eventDispatcher,
|
|
156
|
-
editorView = editorSharedConfig.editorView,
|
|
157
|
-
onDestroy = editorSharedConfig.onDestroy,
|
|
158
|
-
editorActions = editorSharedConfig.editorActions;
|
|
159
|
-
if (eventDispatcher) {
|
|
160
|
-
eventDispatcher.destroy();
|
|
161
|
-
}
|
|
162
|
-
if (onDestroy) {
|
|
163
|
-
onDestroy();
|
|
164
|
-
}
|
|
165
|
-
editorActions._privateUnregisterEditor();
|
|
166
|
-
if (editorView) {
|
|
167
|
-
// Prevent any transactions from coming through when unmounting
|
|
168
|
-
editorView.setProps({
|
|
169
|
-
dispatchTransaction: function dispatchTransaction(_tr) {}
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
// Destroy plugin states and editor state
|
|
173
|
-
// when the editor is being unmounted
|
|
174
|
-
var editorState = editorView.state;
|
|
175
|
-
editorState.plugins.forEach(function (plugin) {
|
|
176
|
-
var state = plugin.getState(editorState);
|
|
177
|
-
if (state && state.destroy) {
|
|
178
|
-
state.destroy();
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
editorView.destroy();
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
}, [editorSharedConfig, featureFlags]);
|
|
185
|
-
}
|
|
@@ -1,25 +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
|
-
var maxHeight = props.maxHeight,
|
|
10
|
-
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
11
|
-
disabled = props.disabled;
|
|
12
|
-
var handleAnalyticsEvent = useCreateAnalyticsHandler(createAnalyticsEvent);
|
|
13
|
-
var renderWithConfig = useCallback(function (config) {
|
|
14
|
-
return /*#__PURE__*/React.createElement(MobileAppearance, {
|
|
15
|
-
editorView: config && config.editorView,
|
|
16
|
-
maxHeight: maxHeight,
|
|
17
|
-
editorDisabled: disabled
|
|
18
|
-
}, /*#__PURE__*/React.createElement(EditorContent, null));
|
|
19
|
-
}, [maxHeight, disabled]);
|
|
20
|
-
return /*#__PURE__*/React.createElement(ContextAdapter, null, /*#__PURE__*/React.createElement(Editor, _extends({}, props, {
|
|
21
|
-
onAnalyticsEvent: handleAnalyticsEvent
|
|
22
|
-
}), /*#__PURE__*/React.createElement(EditorSharedConfigConsumer, null, renderWithConfig)));
|
|
23
|
-
}
|
|
24
|
-
MobileEditor.displayName = 'MobileEditor';
|
|
25
|
-
export var Mobile = withAnalyticsEvents()(MobileEditor);
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
// #region Imports
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
//import { tablesPlugin } from '@atlaskit/editor-plugin-table';
|
|
6
|
-
//
|
|
7
|
-
//import {
|
|
8
|
-
// panelPlugin,
|
|
9
|
-
// listPlugin,
|
|
10
|
-
// textColorPlugin,
|
|
11
|
-
// breakoutPlugin,
|
|
12
|
-
// jiraIssuePlugin,
|
|
13
|
-
// extensionPlugin,
|
|
14
|
-
// rulePlugin,
|
|
15
|
-
// datePlugin,
|
|
16
|
-
// layoutPlugin,
|
|
17
|
-
// indentationPlugin,
|
|
18
|
-
// cardPlugin,
|
|
19
|
-
// statusPlugin,
|
|
20
|
-
// mediaPlugin,
|
|
21
|
-
// mentionsPlugin,
|
|
22
|
-
// tasksAndDecisionsPlugin,
|
|
23
|
-
// insertBlockPlugin,
|
|
24
|
-
// basePlugin,
|
|
25
|
-
// //placeholderPlugin,
|
|
26
|
-
//} from '../../../plugins';
|
|
27
|
-
import { PresetProvider } from '../Editor';
|
|
28
|
-
import { useDefaultPreset } from './default';
|
|
29
|
-
// #endregion
|
|
30
|
-
|
|
31
|
-
export function useCXHTMLPreset(_ref) {
|
|
32
|
-
var mentionProvider = _ref.mentionProvider,
|
|
33
|
-
mediaProvider = _ref.mediaProvider,
|
|
34
|
-
placeholder = _ref.placeholder,
|
|
35
|
-
featureFlags = _ref.featureFlags;
|
|
36
|
-
var _useDefaultPreset = useDefaultPreset({
|
|
37
|
-
featureFlags: featureFlags,
|
|
38
|
-
paste: {}
|
|
39
|
-
}),
|
|
40
|
-
_useDefaultPreset2 = _slicedToArray(_useDefaultPreset, 1),
|
|
41
|
-
defaultPreset = _useDefaultPreset2[0];
|
|
42
|
-
var preset = defaultPreset;
|
|
43
|
-
//.add([
|
|
44
|
-
// basePlugin,
|
|
45
|
-
// {
|
|
46
|
-
// allowInlineCursorTarget: true,
|
|
47
|
-
// allowScrollGutter: {
|
|
48
|
-
// getScrollElement: (_view) =>
|
|
49
|
-
// document.querySelector('.fabric-editor-popup-scroll-parent') ||
|
|
50
|
-
// null,
|
|
51
|
-
// },
|
|
52
|
-
// },
|
|
53
|
-
//])
|
|
54
|
-
//.add([tablesPlugin, { tableOptions: { advanced: true } }])
|
|
55
|
-
//.add([panelPlugin, { allowCustomPanel: true }])
|
|
56
|
-
//.add(listPlugin)
|
|
57
|
-
//.add(textColorPlugin)
|
|
58
|
-
//.add(breakoutPlugin)
|
|
59
|
-
//.add(jiraIssuePlugin)
|
|
60
|
-
//.add(extensionPlugin)
|
|
61
|
-
//.add(rulePlugin)
|
|
62
|
-
//.add(datePlugin)
|
|
63
|
-
//.add(layoutPlugin)
|
|
64
|
-
//.add(indentationPlugin)
|
|
65
|
-
//.add([cardPlugin, { allowBlockCards: true, platform: 'web' }])
|
|
66
|
-
//.add([statusPlugin, { menuDisabled: false }])
|
|
67
|
-
//.add(tasksAndDecisionsPlugin)
|
|
68
|
-
//.add(insertBlockPlugin)
|
|
69
|
-
////.add([placeholderPlugin, { placeholder }])
|
|
70
|
-
//.maybeAdd(mentionsPlugin, (plugin, builder) => {
|
|
71
|
-
// if (mentionProvider) {
|
|
72
|
-
// return builder.add(plugin);
|
|
73
|
-
// }
|
|
74
|
-
// return builder;
|
|
75
|
-
//})
|
|
76
|
-
//.maybeAdd(mediaPlugin, (plugin, builder) => {
|
|
77
|
-
// if (mediaProvider) {
|
|
78
|
-
// preset.add([
|
|
79
|
-
// plugin,
|
|
80
|
-
// {
|
|
81
|
-
// provider: mediaProvider,
|
|
82
|
-
// allowMediaSingle: true,
|
|
83
|
-
// allowMediaGroup: true,
|
|
84
|
-
// allowResizing: true,
|
|
85
|
-
// allowLinking: true,
|
|
86
|
-
// allowResizingInTables: true,
|
|
87
|
-
// allowAltTextOnImages: true,
|
|
88
|
-
// },
|
|
89
|
-
// ]);
|
|
90
|
-
// }
|
|
91
|
-
// return builder;
|
|
92
|
-
//});
|
|
93
|
-
|
|
94
|
-
return [preset];
|
|
95
|
-
}
|
|
96
|
-
export function EditorPresetCXHTML(props) {
|
|
97
|
-
var children = props.children,
|
|
98
|
-
excludes = props.excludes;
|
|
99
|
-
var _useCXHTMLPreset = useCXHTMLPreset(props),
|
|
100
|
-
_useCXHTMLPreset2 = _slicedToArray(_useCXHTMLPreset, 1),
|
|
101
|
-
preset = _useCXHTMLPreset2[0];
|
|
102
|
-
var plugins = preset.build({
|
|
103
|
-
excludePlugins: excludes
|
|
104
|
-
});
|
|
105
|
-
return /*#__PURE__*/React.createElement(PresetProvider, {
|
|
106
|
-
value: plugins
|
|
107
|
-
}, children);
|
|
108
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
// #region Imports
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import {
|
|
5
|
-
// useProvider,
|
|
6
|
-
useProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
7
|
-
//import analyticsPlugin from '../../../plugins/analytics';
|
|
8
|
-
//import basePlugin from '../../../plugins/base';
|
|
9
|
-
//import { cardPlugin } from '@atlaskit/editor-plugin-card';
|
|
10
|
-
//import datePlugin from '../../../plugins/date';
|
|
11
|
-
//import emojiPlugin from '../../../plugins/emoji';
|
|
12
|
-
//import extensionPlugin from '../../../plugins/extension';
|
|
13
|
-
//import layoutPlugin from '../../../plugins/layout';
|
|
14
|
-
//import listPlugin from '../../../plugins/list';
|
|
15
|
-
//import mentionsPlugin from '../../../plugins/mentions';
|
|
16
|
-
//import mobileDimensionsPlugin from '../../../plugins/mobile-dimensions';
|
|
17
|
-
//import panelPlugin from '../../../plugins/panel';
|
|
18
|
-
//import placeholderPlugin from '../../../plugins/placeholder';
|
|
19
|
-
//import rulePlugin from '../../../plugins/rule';
|
|
20
|
-
//import statusPlugin from '../../../plugins/status';
|
|
21
|
-
//import { tablesPlugin } from '@atlaskit/editor-plugin-table';
|
|
22
|
-
//import tasksAndDecisionsPlugin from '../../../plugins/tasks-and-decisions';
|
|
23
|
-
//import textColorPlugin from '../../../plugins/text-color';
|
|
24
|
-
//import maxContentSizePlugin from '../../../plugins/max-content-size';
|
|
25
|
-
//import expandPlugin from '../../../plugins/expand';
|
|
26
|
-
//import selectionPlugin from '../../../plugins/selection';
|
|
27
|
-
import { PresetProvider } from '../Editor';
|
|
28
|
-
import { useDefaultPreset } from './default';
|
|
29
|
-
import { addExcludesFromProviderFactory } from './utils';
|
|
30
|
-
//import { quickInsertPlugin } from '../../../plugins';
|
|
31
|
-
|
|
32
|
-
// #endregion
|
|
33
|
-
export function useMobilePreset(_ref) {
|
|
34
|
-
var media = _ref.media,
|
|
35
|
-
placeholder = _ref.placeholder,
|
|
36
|
-
maxContentSize = _ref.maxContentSize,
|
|
37
|
-
createAnalyticsEvent = _ref.createAnalyticsEvent,
|
|
38
|
-
featureFlags = _ref.featureFlags;
|
|
39
|
-
//const mediaProvider = useProvider('mediaProvider');
|
|
40
|
-
var _useDefaultPreset = useDefaultPreset({
|
|
41
|
-
featureFlags: featureFlags,
|
|
42
|
-
paste: {}
|
|
43
|
-
}),
|
|
44
|
-
_useDefaultPreset2 = _slicedToArray(_useDefaultPreset, 1),
|
|
45
|
-
defaultPreset = _useDefaultPreset2[0];
|
|
46
|
-
var preset = defaultPreset;
|
|
47
|
-
//.add([
|
|
48
|
-
// basePlugin,
|
|
49
|
-
// {
|
|
50
|
-
// allowScrollGutter: {
|
|
51
|
-
// getScrollElement: () => document.body,
|
|
52
|
-
// allowCustomScrollHandler: false,
|
|
53
|
-
// },
|
|
54
|
-
// },
|
|
55
|
-
//])
|
|
56
|
-
//.add([analyticsPlugin, createAnalyticsEvent])
|
|
57
|
-
//.add([tablesPlugin, { tableOptions: { allowControls: false } }])
|
|
58
|
-
//.add(panelPlugin)
|
|
59
|
-
//.add(listPlugin)
|
|
60
|
-
//.add(textColorPlugin)
|
|
61
|
-
//.add(extensionPlugin)
|
|
62
|
-
//.add(rulePlugin)
|
|
63
|
-
//.add(datePlugin)
|
|
64
|
-
//.add(layoutPlugin)
|
|
65
|
-
//.add([quickInsertPlugin, { headless: true, disableDefaultItems: true }])
|
|
66
|
-
//.add([statusPlugin, { menuDisabled: false }])
|
|
67
|
-
//.add([placeholderPlugin, { placeholder }])
|
|
68
|
-
//.add(mobileDimensionsPlugin)
|
|
69
|
-
//.add(expandPlugin)
|
|
70
|
-
////.add([selectionPlugin, { useLongPressSelection: false }])
|
|
71
|
-
//// Begin -> This would be exclude if the provider doesnt exist in the factory
|
|
72
|
-
//.add(tasksAndDecisionsPlugin)
|
|
73
|
-
//.add([cardPlugin, { allowBlockCards: true, platform: 'mobile' }])
|
|
74
|
-
//.add(mentionsPlugin)
|
|
75
|
-
//.add(emojiPlugin)
|
|
76
|
-
//// End
|
|
77
|
-
//.maybeAdd(maxContentSizePlugin, (plugin, builder) => {
|
|
78
|
-
// if (maxContentSize) {
|
|
79
|
-
// return builder.add([plugin, maxContentSize as any]);
|
|
80
|
-
// }
|
|
81
|
-
// return builder;
|
|
82
|
-
//})
|
|
83
|
-
//.maybeAdd(mediaPlugin, (plugin, builder) => {
|
|
84
|
-
// if (media) {
|
|
85
|
-
// return builder.add([
|
|
86
|
-
// plugin,
|
|
87
|
-
// {
|
|
88
|
-
// provider: mediaProvider,
|
|
89
|
-
// customMediaPicker: media.picker,
|
|
90
|
-
// fullWidthEnabled: false,
|
|
91
|
-
// allowMediaSingle: true,
|
|
92
|
-
// allowLazyLoading: false,
|
|
93
|
-
// allowMediaSingleEditable: false,
|
|
94
|
-
// allowRemoteDimensionsFetch: false,
|
|
95
|
-
// allowMarkingUploadsAsIncomplete: true,
|
|
96
|
-
// allowAltTextOnImages: true,
|
|
97
|
-
// allowTemplatePlaceholders: { allowInserting: true },
|
|
98
|
-
// },
|
|
99
|
-
// ]);
|
|
100
|
-
// }
|
|
101
|
-
|
|
102
|
-
// return builder;
|
|
103
|
-
//});
|
|
104
|
-
|
|
105
|
-
return [preset];
|
|
106
|
-
}
|
|
107
|
-
export function EditorPresetMobile(props) {
|
|
108
|
-
var children = props.children,
|
|
109
|
-
excludes = props.excludes;
|
|
110
|
-
var _useMobilePreset = useMobilePreset(props),
|
|
111
|
-
_useMobilePreset2 = _slicedToArray(_useMobilePreset, 1),
|
|
112
|
-
preset = _useMobilePreset2[0];
|
|
113
|
-
var providerFactory = useProviderFactory();
|
|
114
|
-
var plugins = preset.build({
|
|
115
|
-
excludePlugins: addExcludesFromProviderFactory(providerFactory, excludes)
|
|
116
|
-
});
|
|
117
|
-
return /*#__PURE__*/React.createElement(PresetProvider, {
|
|
118
|
-
value: plugins
|
|
119
|
-
}, children);
|
|
120
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export var addExcludesFromProviderFactory = function addExcludesFromProviderFactory(providerFactory) {
|
|
2
|
-
var excludes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set();
|
|
3
|
-
// TODO: Should I make this function pure?
|
|
4
|
-
if (!providerFactory.hasProvider('mentionProvider')) {
|
|
5
|
-
excludes.add('mention');
|
|
6
|
-
}
|
|
7
|
-
if (!providerFactory.hasProvider('emojiProvider')) {
|
|
8
|
-
excludes.add('emoji');
|
|
9
|
-
}
|
|
10
|
-
if (!providerFactory.hasProvider('macroProvider')) {
|
|
11
|
-
excludes.add('macro');
|
|
12
|
-
}
|
|
13
|
-
if (!providerFactory.hasProvider('autoformattingProvider')) {
|
|
14
|
-
excludes.add('customAutoformat');
|
|
15
|
-
}
|
|
16
|
-
if (!providerFactory.hasProvider('taskDecisionProvider')) {
|
|
17
|
-
excludes.add('taskDecision');
|
|
18
|
-
}
|
|
19
|
-
if (!providerFactory.hasProvider('cardProvider')) {
|
|
20
|
-
excludes.add('card');
|
|
21
|
-
}
|
|
22
|
-
return excludes;
|
|
23
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
type ContentComponentsProps = {
|
|
3
|
-
disabled?: any;
|
|
4
|
-
wrapperElement: HTMLElement | null;
|
|
5
|
-
containerElement: HTMLElement | null;
|
|
6
|
-
};
|
|
7
|
-
export declare function ContentComponents({ disabled, wrapperElement, containerElement, }: ContentComponentsProps): JSX.Element | null;
|
|
8
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { PresetProvider } from './internal/context/preset-context';
|
|
3
|
-
import { EditorSharedConfig, EditorSharedConfigConsumer, useEditorSharedConfig } from './internal/context/shared-config';
|
|
4
|
-
import { EditorContent } from './internal/components/EditorContent';
|
|
5
|
-
import { EditorProps } from './internal/editor-props-type';
|
|
6
|
-
/**
|
|
7
|
-
* Main Editor component. Use in combination with `EditorContent` and a `Preset`.
|
|
8
|
-
* Internally it constructs `ProseMirror View` and mounts it to `EditorContent`.
|
|
9
|
-
*
|
|
10
|
-
* `EditorContent` can be wrapped to implement any layout/design requirements.
|
|
11
|
-
*
|
|
12
|
-
* ```js
|
|
13
|
-
* <Preset>
|
|
14
|
-
* <Editor>
|
|
15
|
-
* <EditorContent/>
|
|
16
|
-
* </Editor>
|
|
17
|
-
* </Preset>
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
declare function Editor(props: EditorProps): JSX.Element;
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
* Public API Exports.
|
|
24
|
-
*
|
|
25
|
-
*/
|
|
26
|
-
export { PresetProvider, Editor, EditorContent, EditorSharedConfigConsumer, useEditorSharedConfig, };
|
|
27
|
-
export type { EditorProps, EditorSharedConfig, };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
-
import { EditorProps } from '../../types';
|
|
4
|
-
import EditorActions from '../../actions';
|
|
5
|
-
export type FullPageProps = EditorProps & {
|
|
6
|
-
onMount?: (actions: EditorActions) => void;
|
|
7
|
-
} & WithAnalyticsEventsProps;
|
|
8
|
-
declare const FullPageWithAnalytics: React.ForwardRefExoticComponent<Omit<FullPageProps, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
9
|
-
export { FullPageWithAnalytics as FullPage };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
declare const EditorContentProvider: React.Provider<(ref: HTMLDivElement) => void>;
|
|
3
|
-
/**
|
|
4
|
-
* ProseMirror View mount point.
|
|
5
|
-
*/
|
|
6
|
-
declare const EditorContent: React.MemoExoticComponent<() => JSX.Element>;
|
|
7
|
-
export { EditorContentProvider, EditorContent };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { WrappedComponentProps } from 'react-intl-next';
|
|
3
|
-
export declare const EditorInternal: React.FC<import("react-intl-next").WithIntlProps<import("../editor-props-type").EditorProps & {
|
|
4
|
-
portalProviderAPI: import("@atlaskit/editor-common/portal-provider").PortalProviderAPI;
|
|
5
|
-
} & WrappedComponentProps<"intl">>> & {
|
|
6
|
-
WrappedComponent: React.ComponentType<import("../editor-props-type").EditorProps & {
|
|
7
|
-
portalProviderAPI: import("@atlaskit/editor-common/portal-provider").PortalProviderAPI;
|
|
8
|
-
} & WrappedComponentProps<"intl">>;
|
|
9
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { EditorView } from 'prosemirror-view';
|
|
4
|
-
import { Transformer } from '@atlaskit/editor-common/types';
|
|
5
|
-
import { EventDispatcher, Dispatch } from '../../../../event-dispatcher';
|
|
6
|
-
import { EditorAppearanceComponentProps } from '../../../../types';
|
|
7
|
-
import { FireAnalyticsCallback } from '../../../../plugins/analytics';
|
|
8
|
-
import EditorActions from '../../../../actions';
|
|
9
|
-
import { EditorProps } from '../editor-props-type';
|
|
10
|
-
/**
|
|
11
|
-
* Provides access to most commonly used configurations and instances of classes,
|
|
12
|
-
* that most editor components rely on.
|
|
13
|
-
*/
|
|
14
|
-
export type EditorSharedConfig = {
|
|
15
|
-
editorView: EditorView;
|
|
16
|
-
eventDispatcher: EventDispatcher;
|
|
17
|
-
dispatch: Dispatch;
|
|
18
|
-
transformer?: Transformer<any>;
|
|
19
|
-
dispatchAnalyticsEvent?: FireAnalyticsCallback;
|
|
20
|
-
primaryToolbarComponents: EditorAppearanceComponentProps['primaryToolbarComponents'];
|
|
21
|
-
contentComponents: EditorAppearanceComponentProps['contentComponents'];
|
|
22
|
-
popupsMountPoint: EditorProps['popupsMountPoint'];
|
|
23
|
-
popupsBoundariesElement: EditorProps['popupsBoundariesElement'];
|
|
24
|
-
popupsScrollableElement: EditorProps['popupsScrollableElement'];
|
|
25
|
-
providerFactory: EditorAppearanceComponentProps['providerFactory'];
|
|
26
|
-
editorActions: EditorActions;
|
|
27
|
-
onChange?: EditorProps['onChange'];
|
|
28
|
-
onDestroy?: EditorProps['onDestroy'];
|
|
29
|
-
onMount?: EditorProps['onMount'];
|
|
30
|
-
};
|
|
31
|
-
export declare class EditorSharedConfigProvider extends React.Component<{
|
|
32
|
-
value: EditorSharedConfig | null;
|
|
33
|
-
}, any> {
|
|
34
|
-
static childContextTypes: {
|
|
35
|
-
editorSharedConfig: PropTypes.Requireable<object>;
|
|
36
|
-
};
|
|
37
|
-
getChildContext(): {
|
|
38
|
-
editorSharedConfig: EditorSharedConfig | null;
|
|
39
|
-
};
|
|
40
|
-
render(): JSX.Element;
|
|
41
|
-
}
|
|
42
|
-
export declare class EditorSharedConfigConsumer extends React.Component<{
|
|
43
|
-
children: (value: EditorSharedConfig | null) => React.ReactNode | null;
|
|
44
|
-
}> {
|
|
45
|
-
static contextTypes: {
|
|
46
|
-
editorSharedConfig: PropTypes.Requireable<object>;
|
|
47
|
-
};
|
|
48
|
-
render(): JSX.Element;
|
|
49
|
-
}
|
|
50
|
-
export declare const useEditorSharedConfig: () => EditorSharedConfig | null;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { Schema } from 'prosemirror-model';
|
|
3
|
-
import EditorActions from '../../../actions';
|
|
4
|
-
import { Transformer } from '@atlaskit/editor-common/types';
|
|
5
|
-
import { EditorPlugin } from '../../../types';
|
|
6
|
-
import { FireAnalyticsCallback } from '../../../plugins/analytics';
|
|
7
|
-
import { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
8
|
-
export type EditorProps = {
|
|
9
|
-
plugins?: Array<EditorPlugin>;
|
|
10
|
-
transformer?: (schema: Schema) => Transformer<any>;
|
|
11
|
-
children?: React.ReactChild;
|
|
12
|
-
defaultValue?: string | object;
|
|
13
|
-
popupsMountPoint?: HTMLElement;
|
|
14
|
-
popupsBoundariesElement?: HTMLElement;
|
|
15
|
-
popupsScrollableElement?: HTMLElement;
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
placeholder?: string;
|
|
18
|
-
onAnalyticsEvent?: FireAnalyticsCallback;
|
|
19
|
-
onChange?: (value: any, meta: {
|
|
20
|
-
source: 'remote' | 'local';
|
|
21
|
-
}) => void;
|
|
22
|
-
onSave?: (value: any) => void;
|
|
23
|
-
onCancel?: (value: any) => void;
|
|
24
|
-
onMount?: (actions: EditorActions) => void;
|
|
25
|
-
onDestroy?: () => void;
|
|
26
|
-
};
|
|
27
|
-
export type EditorPropsExtended = EditorProps & {
|
|
28
|
-
portalProviderAPI: PortalProviderAPI;
|
|
29
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
-
import { EditorSharedConfig } from '../../../internal/context/shared-config';
|
|
3
|
-
/**
|
|
4
|
-
* Subscribes to analytics events fired from editor components
|
|
5
|
-
* and passes them through to `fireAnalyticsEvent`.
|
|
6
|
-
*/
|
|
7
|
-
export declare function useAnalyticsHandler(editorSharedConfig: EditorSharedConfig | null): void;
|
|
8
|
-
export declare function useCreateAnalyticsHandler(createAnalyticsEvent?: CreateUIAnalyticsEvent): import("@atlaskit/editor-common/analytics").FireAnalyticsCallback;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { EditorView } from 'prosemirror-view';
|
|
2
|
-
import { Transaction } from 'prosemirror-state';
|
|
3
|
-
import { Transformer } from '@atlaskit/editor-common/types';
|
|
4
|
-
import { EditorSharedConfig } from '../../context/shared-config';
|
|
5
|
-
export declare function createDispatchTransaction(editorSharedConfig: EditorSharedConfig): (transaction: Transaction) => void;
|
|
6
|
-
export declare function getEditorValue(editorView: EditorView, transformer?: Transformer<any>): any;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
-
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
-
import EditorActions from '../../../../../actions';
|
|
4
|
-
import { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
5
|
-
import { EditorSharedConfig } from '../../context/shared-config';
|
|
6
|
-
import { EditorPropsExtended } from '../../editor-props-type';
|
|
7
|
-
import { FeatureFlags } from '../../../../../types/feature-flags';
|
|
8
|
-
import { IntlShape } from 'react-intl-next';
|
|
9
|
-
export declare function createEditor({ context, onAnalyticsEvent, transformer, providerFactory, plugins, portalProviderAPI, defaultValue, ref, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, editorActions, disabled, onChange, onDestroy, onMount, featureFlags, getIntl, }: CreateEditorParams): EditorSharedConfig | null;
|
|
10
|
-
export type CreateEditorParams = Pick<EditorPropsExtended, 'defaultValue' | 'plugins' | 'popupsMountPoint' | 'popupsBoundariesElement' | 'popupsScrollableElement' | 'onChange' | 'disabled' | 'transformer' | 'onAnalyticsEvent' | 'onDestroy' | 'onMount'> & {
|
|
11
|
-
context: any;
|
|
12
|
-
ref?: HTMLDivElement | null;
|
|
13
|
-
providerFactory: ProviderFactory;
|
|
14
|
-
portalProviderAPI: PortalProviderAPI;
|
|
15
|
-
createAnalyticsEvent?: CreateUIAnalyticsEvent;
|
|
16
|
-
editorActions: EditorActions;
|
|
17
|
-
featureFlags: FeatureFlags;
|
|
18
|
-
getIntl: () => IntlShape;
|
|
19
|
-
};
|