@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,193 +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.useEditor = useEditor;
|
|
8
|
-
exports.useHandleEditorLifecycle = useHandleEditorLifecycle;
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
var _react = _interopRequireDefault(require("react"));
|
|
12
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
13
|
-
var _measureEnum = _interopRequireDefault(require("../../../../../utils/performance/measure-enum"));
|
|
14
|
-
var _utils2 = require("../../../../../utils");
|
|
15
|
-
var _analytics = require("../../../../../plugins/analytics");
|
|
16
|
-
var _normalizeFeatureFlags = require("@atlaskit/editor-common/normalize-feature-flags");
|
|
17
|
-
var _useAnalytics = require("../use-analytics");
|
|
18
|
-
var _createDispatchTransaction = require("./create-dispatch-transaction");
|
|
19
|
-
var _createEditor = require("./create-editor");
|
|
20
|
-
var _consts = require("../../../../../plugins/analytics/consts");
|
|
21
|
-
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; }
|
|
22
|
-
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) { (0, _defineProperty2.default)(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; }
|
|
23
|
-
function useEditor(config) {
|
|
24
|
-
(0, _utils.startMeasure)(_measureEnum.default.EDITOR_MOUNTED);
|
|
25
|
-
var _useCreateEditor = useCreateEditor(config),
|
|
26
|
-
_useCreateEditor2 = (0, _slicedToArray2.default)(_useCreateEditor, 2),
|
|
27
|
-
editorSharedConfig = _useCreateEditor2[0],
|
|
28
|
-
mountEditor = _useCreateEditor2[1];
|
|
29
|
-
useApplyEditorViewProps(editorSharedConfig, config.disabled);
|
|
30
|
-
useHandleEditorLifecycle(editorSharedConfig, config.featureFlags);
|
|
31
|
-
(0, _useAnalytics.useAnalyticsHandler)(editorSharedConfig);
|
|
32
|
-
return [editorSharedConfig, mountEditor];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
* Sub hooks ¯\_(ツ)_/¯
|
|
38
|
-
*
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Main hook that creates an instance of EditorView, EditorSharedConfig, etc...
|
|
43
|
-
*/
|
|
44
|
-
function useCreateEditor(config) {
|
|
45
|
-
var _React$useState = _react.default.useState(null),
|
|
46
|
-
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
|
47
|
-
editorSharedConfig = _React$useState2[0],
|
|
48
|
-
setEditorSharedConfig = _React$useState2[1];
|
|
49
|
-
return [editorSharedConfig,
|
|
50
|
-
// This callback is being used as `ref={callback}` on EditorContentProvider,
|
|
51
|
-
// When called with `ref` mounts editor and creates editorSharedConfig.
|
|
52
|
-
_react.default.useCallback(function (ref) {
|
|
53
|
-
// If editorSharedConfig already exists it means that editorView is mounted
|
|
54
|
-
// and we just need to ignore this function altogether.
|
|
55
|
-
if (!ref) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
setEditorSharedConfig(function (editorSharedConfig) {
|
|
59
|
-
if (!editorSharedConfig) {
|
|
60
|
-
(0, _utils.measureRender)(_measureEnum.default.PROSEMIRROR_RENDERED, function (_ref) {
|
|
61
|
-
var duration = _ref.duration,
|
|
62
|
-
startTime = _ref.startTime,
|
|
63
|
-
distortedDuration = _ref.distortedDuration;
|
|
64
|
-
if (sharedConfig && sharedConfig.dispatch) {
|
|
65
|
-
sharedConfig.dispatch(_consts.analyticsEventKey, {
|
|
66
|
-
payload: {
|
|
67
|
-
action: _analytics.ACTION.PROSEMIRROR_RENDERED,
|
|
68
|
-
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
69
|
-
attributes: {
|
|
70
|
-
duration: duration,
|
|
71
|
-
distortedDuration: distortedDuration,
|
|
72
|
-
startTime: startTime,
|
|
73
|
-
nodes: (0, _utils2.getNodesCount)(sharedConfig.editorView.state.doc),
|
|
74
|
-
ttfb: (0, _utils.getResponseEndTime)()
|
|
75
|
-
},
|
|
76
|
-
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
var sharedConfig = editorSharedConfig || (0, _createEditor.createEditor)(_objectSpread(_objectSpread({}, config), {}, {
|
|
83
|
-
ref: ref
|
|
84
|
-
}));
|
|
85
|
-
(0, _utils.stopMeasure)(_measureEnum.default.EDITOR_MOUNTED, function (duration, startTime) {
|
|
86
|
-
if (!sharedConfig) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Fire editor mounted event
|
|
91
|
-
sharedConfig.dispatch(_consts.analyticsEventKey, {
|
|
92
|
-
payload: {
|
|
93
|
-
action: _analytics.ACTION.EDITOR_MOUNTED,
|
|
94
|
-
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
95
|
-
attributes: {
|
|
96
|
-
duration: duration,
|
|
97
|
-
startTime: startTime
|
|
98
|
-
},
|
|
99
|
-
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
return sharedConfig;
|
|
104
|
-
});
|
|
105
|
-
}, [config])];
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Applies updated EditorView properties e.g. set dispatchTransaction or 'disabled' state changes
|
|
110
|
-
*/
|
|
111
|
-
function useApplyEditorViewProps(editorSharedConfig, disabled) {
|
|
112
|
-
_react.default.useEffect(function () {
|
|
113
|
-
if (editorSharedConfig) {
|
|
114
|
-
editorSharedConfig.editorView.setProps({
|
|
115
|
-
dispatchTransaction: (0, _createDispatchTransaction.createDispatchTransaction)(editorSharedConfig)
|
|
116
|
-
});
|
|
117
|
-
editorSharedConfig.editorView.setProps({
|
|
118
|
-
editable: function editable(_state) {
|
|
119
|
-
return !disabled;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
}, [editorSharedConfig, disabled]);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Handles editor component unmount
|
|
128
|
-
*/
|
|
129
|
-
function useHandleEditorLifecycle(editorSharedConfig, featureFlags) {
|
|
130
|
-
_react.default.useEffect(function () {
|
|
131
|
-
//#region Did mount
|
|
132
|
-
if (editorSharedConfig) {
|
|
133
|
-
var onMount = editorSharedConfig.onMount,
|
|
134
|
-
editorActions = editorSharedConfig.editorActions,
|
|
135
|
-
editorView = editorSharedConfig.editorView,
|
|
136
|
-
eventDispatcher = editorSharedConfig.eventDispatcher,
|
|
137
|
-
dispatch = editorSharedConfig.dispatch;
|
|
138
|
-
editorActions._privateRegisterEditor(editorView, eventDispatcher);
|
|
139
|
-
if (onMount) {
|
|
140
|
-
onMount(editorActions);
|
|
141
|
-
}
|
|
142
|
-
var featureFlagsEnabled = featureFlags ? (0, _normalizeFeatureFlags.getEnabledFeatureFlagKeys)(featureFlags) : [];
|
|
143
|
-
|
|
144
|
-
// Fire editor started event
|
|
145
|
-
dispatch(_consts.analyticsEventKey, {
|
|
146
|
-
payload: {
|
|
147
|
-
action: _analytics.ACTION.STARTED,
|
|
148
|
-
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
149
|
-
attributes: {
|
|
150
|
-
platform: _analytics.PLATFORMS.WEB,
|
|
151
|
-
featureFlags: featureFlagsEnabled
|
|
152
|
-
},
|
|
153
|
-
eventType: _analytics.EVENT_TYPE.UI
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
//#endregion
|
|
158
|
-
|
|
159
|
-
return function () {
|
|
160
|
-
if (!editorSharedConfig) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
var eventDispatcher = editorSharedConfig.eventDispatcher,
|
|
164
|
-
editorView = editorSharedConfig.editorView,
|
|
165
|
-
onDestroy = editorSharedConfig.onDestroy,
|
|
166
|
-
editorActions = editorSharedConfig.editorActions;
|
|
167
|
-
if (eventDispatcher) {
|
|
168
|
-
eventDispatcher.destroy();
|
|
169
|
-
}
|
|
170
|
-
if (onDestroy) {
|
|
171
|
-
onDestroy();
|
|
172
|
-
}
|
|
173
|
-
editorActions._privateUnregisterEditor();
|
|
174
|
-
if (editorView) {
|
|
175
|
-
// Prevent any transactions from coming through when unmounting
|
|
176
|
-
editorView.setProps({
|
|
177
|
-
dispatchTransaction: function dispatchTransaction(_tr) {}
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
// Destroy plugin states and editor state
|
|
181
|
-
// when the editor is being unmounted
|
|
182
|
-
var editorState = editorView.state;
|
|
183
|
-
editorState.plugins.forEach(function (plugin) {
|
|
184
|
-
var state = plugin.getState(editorState);
|
|
185
|
-
if (state && state.destroy) {
|
|
186
|
-
state.destroy();
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
editorView.destroy();
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
}, [editorSharedConfig, featureFlags]);
|
|
193
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.Mobile = void 0;
|
|
9
|
-
exports.MobileEditor = MobileEditor;
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
-
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
13
|
-
var _Mobile = require("../../ui/AppearanceComponents/Mobile");
|
|
14
|
-
var _Editor = require("./Editor");
|
|
15
|
-
var _useAnalytics = require("./internal/hooks/use-analytics");
|
|
16
|
-
var _contextAdapter = require("../../nodeviews/context-adapter");
|
|
17
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
function MobileEditor(props) {
|
|
20
|
-
var maxHeight = props.maxHeight,
|
|
21
|
-
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
22
|
-
disabled = props.disabled;
|
|
23
|
-
var handleAnalyticsEvent = (0, _useAnalytics.useCreateAnalyticsHandler)(createAnalyticsEvent);
|
|
24
|
-
var renderWithConfig = (0, _react.useCallback)(function (config) {
|
|
25
|
-
return /*#__PURE__*/_react.default.createElement(_Mobile.MobileAppearance, {
|
|
26
|
-
editorView: config && config.editorView,
|
|
27
|
-
maxHeight: maxHeight,
|
|
28
|
-
editorDisabled: disabled
|
|
29
|
-
}, /*#__PURE__*/_react.default.createElement(_Editor.EditorContent, null));
|
|
30
|
-
}, [maxHeight, disabled]);
|
|
31
|
-
return /*#__PURE__*/_react.default.createElement(_contextAdapter.ContextAdapter, null, /*#__PURE__*/_react.default.createElement(_Editor.Editor, (0, _extends2.default)({}, props, {
|
|
32
|
-
onAnalyticsEvent: handleAnalyticsEvent
|
|
33
|
-
}), /*#__PURE__*/_react.default.createElement(_Editor.EditorSharedConfigConsumer, null, renderWithConfig)));
|
|
34
|
-
}
|
|
35
|
-
MobileEditor.displayName = 'MobileEditor';
|
|
36
|
-
var Mobile = (0, _analyticsNext.withAnalyticsEvents)()(MobileEditor);
|
|
37
|
-
exports.Mobile = Mobile;
|
|
@@ -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
|
-
}
|