@atlaskit/editor-core 188.8.0 → 188.9.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 (95) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/composable-editor/editor-internal.js +2 -2
  3. package/dist/cjs/create-editor/ReactEditorView.js +796 -8
  4. package/dist/cjs/labs/next/presets/universal.js +7 -4
  5. package/dist/cjs/plugins/index.js +0 -21
  6. package/dist/cjs/version-wrapper.js +1 -1
  7. package/dist/es2019/composable-editor/editor-internal.js +1 -1
  8. package/dist/es2019/create-editor/ReactEditorView.js +753 -2
  9. package/dist/es2019/labs/next/presets/universal.js +4 -1
  10. package/dist/es2019/plugins/index.js +0 -3
  11. package/dist/es2019/version-wrapper.js +1 -1
  12. package/dist/esm/composable-editor/editor-internal.js +1 -1
  13. package/dist/esm/create-editor/ReactEditorView.js +797 -8
  14. package/dist/esm/labs/next/presets/universal.js +4 -1
  15. package/dist/esm/plugins/index.js +0 -3
  16. package/dist/esm/version-wrapper.js +1 -1
  17. package/dist/types/create-editor/ReactEditorView.d.ts +119 -5
  18. package/dist/types/plugins/index.d.ts +0 -3
  19. package/dist/types/plugins/insert-block/types.d.ts +1 -1
  20. package/dist/types/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +1 -1
  21. package/dist/types-ts4.5/create-editor/ReactEditorView.d.ts +119 -5
  22. package/dist/types-ts4.5/plugins/index.d.ts +0 -3
  23. package/dist/types-ts4.5/plugins/insert-block/types.d.ts +1 -1
  24. package/dist/types-ts4.5/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +1 -1
  25. package/package.json +5 -3
  26. package/dist/cjs/create-editor/ReactEditorViewInternal.js +0 -812
  27. package/dist/cjs/create-editor/ReactEditorViewNext.js +0 -15
  28. package/dist/cjs/plugins/save-on-enter/index.js +0 -70
  29. package/dist/cjs/plugins/scroll-into-view/index.js +0 -55
  30. package/dist/cjs/plugins/status/actions.js +0 -158
  31. package/dist/cjs/plugins/status/analytics.js +0 -31
  32. package/dist/cjs/plugins/status/index.js +0 -143
  33. package/dist/cjs/plugins/status/keymap.js +0 -22
  34. package/dist/cjs/plugins/status/nodeviews/status.js +0 -58
  35. package/dist/cjs/plugins/status/plugin-key.js +0 -9
  36. package/dist/cjs/plugins/status/plugin.js +0 -133
  37. package/dist/cjs/plugins/status/types.js +0 -5
  38. package/dist/cjs/plugins/status/ui/statusPicker.js +0 -314
  39. package/dist/cjs/plugins/status/utils.js +0 -22
  40. package/dist/es2019/create-editor/ReactEditorViewInternal.js +0 -753
  41. package/dist/es2019/create-editor/ReactEditorViewNext.js +0 -7
  42. package/dist/es2019/plugins/save-on-enter/index.js +0 -63
  43. package/dist/es2019/plugins/scroll-into-view/index.js +0 -44
  44. package/dist/es2019/plugins/status/actions.js +0 -144
  45. package/dist/es2019/plugins/status/analytics.js +0 -18
  46. package/dist/es2019/plugins/status/index.js +0 -135
  47. package/dist/es2019/plugins/status/keymap.js +0 -13
  48. package/dist/es2019/plugins/status/nodeviews/status.js +0 -60
  49. package/dist/es2019/plugins/status/plugin-key.js +0 -3
  50. package/dist/es2019/plugins/status/plugin.js +0 -113
  51. package/dist/es2019/plugins/status/types.js +0 -1
  52. package/dist/es2019/plugins/status/ui/statusPicker.js +0 -293
  53. package/dist/es2019/plugins/status/utils.js +0 -12
  54. package/dist/esm/create-editor/ReactEditorViewInternal.js +0 -806
  55. package/dist/esm/create-editor/ReactEditorViewNext.js +0 -7
  56. package/dist/esm/plugins/save-on-enter/index.js +0 -63
  57. package/dist/esm/plugins/scroll-into-view/index.js +0 -50
  58. package/dist/esm/plugins/status/actions.js +0 -151
  59. package/dist/esm/plugins/status/analytics.js +0 -24
  60. package/dist/esm/plugins/status/index.js +0 -136
  61. package/dist/esm/plugins/status/keymap.js +0 -15
  62. package/dist/esm/plugins/status/nodeviews/status.js +0 -51
  63. package/dist/esm/plugins/status/plugin-key.js +0 -3
  64. package/dist/esm/plugins/status/plugin.js +0 -115
  65. package/dist/esm/plugins/status/types.js +0 -1
  66. package/dist/esm/plugins/status/ui/statusPicker.js +0 -308
  67. package/dist/esm/plugins/status/utils.js +0 -16
  68. package/dist/types/create-editor/ReactEditorViewInternal.d.ts +0 -119
  69. package/dist/types/create-editor/ReactEditorViewNext.d.ts +0 -8
  70. package/dist/types/plugins/save-on-enter/index.d.ts +0 -10
  71. package/dist/types/plugins/scroll-into-view/index.d.ts +0 -14
  72. package/dist/types/plugins/status/actions.d.ts +0 -16
  73. package/dist/types/plugins/status/analytics.d.ts +0 -4
  74. package/dist/types/plugins/status/index.d.ts +0 -15
  75. package/dist/types/plugins/status/keymap.d.ts +0 -3
  76. package/dist/types/plugins/status/nodeviews/status.d.ts +0 -25
  77. package/dist/types/plugins/status/plugin-key.d.ts +0 -4
  78. package/dist/types/plugins/status/plugin.d.ts +0 -7
  79. package/dist/types/plugins/status/types.d.ts +0 -18
  80. package/dist/types/plugins/status/ui/statusPicker.d.ts +0 -63
  81. package/dist/types/plugins/status/utils.d.ts +0 -5
  82. package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +0 -119
  83. package/dist/types-ts4.5/create-editor/ReactEditorViewNext.d.ts +0 -8
  84. package/dist/types-ts4.5/plugins/save-on-enter/index.d.ts +0 -10
  85. package/dist/types-ts4.5/plugins/scroll-into-view/index.d.ts +0 -14
  86. package/dist/types-ts4.5/plugins/status/actions.d.ts +0 -16
  87. package/dist/types-ts4.5/plugins/status/analytics.d.ts +0 -4
  88. package/dist/types-ts4.5/plugins/status/index.d.ts +0 -17
  89. package/dist/types-ts4.5/plugins/status/keymap.d.ts +0 -3
  90. package/dist/types-ts4.5/plugins/status/nodeviews/status.d.ts +0 -25
  91. package/dist/types-ts4.5/plugins/status/plugin-key.d.ts +0 -4
  92. package/dist/types-ts4.5/plugins/status/plugin.d.ts +0 -7
  93. package/dist/types-ts4.5/plugins/status/types.d.ts +0 -18
  94. package/dist/types-ts4.5/plugins/status/ui/statusPicker.d.ts +0 -63
  95. package/dist/types-ts4.5/plugins/status/utils.d.ts +0 -5
@@ -1,308 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
9
- var _templateObject;
10
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
- /** @jsx jsx */
13
-
14
- import React from 'react';
15
- import { css, jsx } from '@emotion/react';
16
- import { withAnalyticsEvents } from '@atlaskit/analytics-next';
17
- import { Popup } from '@atlaskit/editor-common/ui';
18
- import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
19
- import { StatusPicker as AkStatusPicker } from '@atlaskit/status/picker';
20
- import { borderRadius } from '@atlaskit/theme/constants';
21
- import { N0 } from '@atlaskit/theme/colors';
22
- import { withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
23
- import { DEFAULT_STATUS } from '../actions';
24
- import { analyticsState, createStatusAnalyticsAndFire } from '../analytics';
25
- var PopupWithListeners = withOuterListeners(Popup);
26
- export var InputMethod = /*#__PURE__*/function (InputMethod) {
27
- InputMethod["blur"] = "blur";
28
- InputMethod["escKey"] = "escKey";
29
- InputMethod["enterKey"] = "enterKey";
30
- return InputMethod;
31
- }({});
32
- export var closingMethods = /*#__PURE__*/function (closingMethods) {
33
- closingMethods["ArrowLeft"] = "arrowLeft";
34
- closingMethods["ArrowRight"] = "arrowRight";
35
- return closingMethods;
36
- }({});
37
- var pickerContainer = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: ", ";\n padding: ", " 0;\n border-radius: ", "px;\n box-shadow: ", ";\n :focus {\n outline: none;\n }\n input {\n text-transform: uppercase;\n }\n"])), "var(--ds-surface-overlay, ".concat(N0, ")"), "var(--ds-space-100, 8px)", borderRadius(), "var(--ds-shadow-overlay, 0 0 1px rgba(9, 30, 66, 0.31), 0 4px 8px -2px rgba(9, 30, 66, 0.25))");
38
- export var StatusPickerWithoutAnalytcs = /*#__PURE__*/function (_React$Component) {
39
- _inherits(StatusPickerWithoutAnalytcs, _React$Component);
40
- var _super = _createSuper(StatusPickerWithoutAnalytcs);
41
- function StatusPickerWithoutAnalytcs(props) {
42
- var _this;
43
- _classCallCheck(this, StatusPickerWithoutAnalytcs);
44
- _this = _super.call(this, props);
45
- _defineProperty(_assertThisInitialized(_this), "handleClickOutside", function (event) {
46
- event.preventDefault();
47
- _this.inputMethod = InputMethod.blur;
48
- var selectedText = window.getSelection();
49
- if (!selectedText) {
50
- _this.props.closeStatusPicker();
51
- }
52
- });
53
- _defineProperty(_assertThisInitialized(_this), "handleEscapeKeydown", function (event) {
54
- event.preventDefault();
55
- _this.inputMethod = InputMethod.escKey;
56
- _this.props.onEnter(_this.state);
57
- });
58
- _defineProperty(_assertThisInitialized(_this), "handleTabPress", function (event) {
59
- var colorButtons = event.currentTarget.querySelectorAll('button');
60
- var inputField = event.currentTarget.querySelector('input');
61
- var isInputFocussed = document.activeElement === inputField;
62
- var isButtonFocussed = Array.from(colorButtons).some(function (buttonElement) {
63
- var _document;
64
- return ((_document = document) === null || _document === void 0 ? void 0 : _document.activeElement) === buttonElement;
65
- });
66
- if (event !== null && event !== void 0 && event.shiftKey) {
67
- /* shift + tab */
68
- if (isInputFocussed) {
69
- colorButtons[0].focus();
70
- event.preventDefault();
71
- }
72
- /* After the user presses shift + tab the color-palette component updates tab index for the first color to be 0.
73
- To correctly set focus to the input field instead of the first color button we need to set focus manually
74
- */
75
- if (isButtonFocussed) {
76
- inputField === null || inputField === void 0 || inputField.focus();
77
- event.preventDefault();
78
- }
79
- } else {
80
- /* tab */
81
- if (isButtonFocussed) {
82
- inputField === null || inputField === void 0 || inputField.focus();
83
- event.preventDefault();
84
- }
85
- }
86
- });
87
- _defineProperty(_assertThisInitialized(_this), "handleArrow", function (event, closingMethod) {
88
- var _document2;
89
- if (((_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.activeElement) === _this.popupBodyWrapper.current) {
90
- var _this$popupBodyWrappe;
91
- event.preventDefault();
92
- (_this$popupBodyWrappe = _this.popupBodyWrapper) === null || _this$popupBodyWrappe === void 0 || (_this$popupBodyWrappe = _this$popupBodyWrappe.current) === null || _this$popupBodyWrappe === void 0 || _this$popupBodyWrappe.blur();
93
- _this.props.closeStatusPicker({
94
- closingMethod: closingMethod
95
- });
96
- }
97
- });
98
- _defineProperty(_assertThisInitialized(_this), "onKeyDown", function (event) {
99
- var isTabPressed = event.key === 'Tab';
100
- if (isTabPressed) {
101
- return _this.handleTabPress(event);
102
- }
103
- if (event.key in closingMethods) {
104
- return _this.handleArrow(event, closingMethods[event.key]);
105
- }
106
- });
107
- _defineProperty(_assertThisInitialized(_this), "onColorHover", function (color) {
108
- _this.createStatusAnalyticsAndFireFunc({
109
- action: 'hovered',
110
- actionSubject: 'statusColorPicker',
111
- attributes: {
112
- color: color,
113
- localId: _this.state.localId,
114
- state: analyticsState(_this.props.isNew)
115
- }
116
- });
117
- });
118
- _defineProperty(_assertThisInitialized(_this), "onColorClick", function (color) {
119
- var _this$state = _this.state,
120
- text = _this$state.text,
121
- localId = _this$state.localId;
122
- if (color === _this.state.color) {
123
- _this.createStatusAnalyticsAndFireFunc({
124
- action: 'clicked',
125
- actionSubject: 'statusColorPicker',
126
- attributes: {
127
- color: color,
128
- localId: localId,
129
- state: analyticsState(_this.props.isNew)
130
- }
131
- });
132
- // closes status box and commits colour
133
- _this.onEnter();
134
- } else {
135
- _this.setState({
136
- color: color
137
- });
138
- _this.props.onSelect({
139
- text: text,
140
- color: color,
141
- localId: localId
142
- });
143
- }
144
- });
145
- _defineProperty(_assertThisInitialized(_this), "onTextChanged", function (text) {
146
- var _this$state2 = _this.state,
147
- color = _this$state2.color,
148
- localId = _this$state2.localId;
149
- _this.setState({
150
- text: text
151
- });
152
- _this.props.onTextChanged({
153
- text: text,
154
- color: color,
155
- localId: localId
156
- }, !!_this.props.isNew);
157
- });
158
- _defineProperty(_assertThisInitialized(_this), "onEnter", function () {
159
- _this.inputMethod = InputMethod.enterKey;
160
- _this.props.onEnter(_this.state);
161
- });
162
- // cancel bubbling to fix clickOutside logic:
163
- // popup re-renders its content before the click event bubbles up to the document
164
- // therefore click target element would be different from the popup content
165
- _defineProperty(_assertThisInitialized(_this), "handlePopupClick", function (event) {
166
- return event.nativeEvent.stopImmediatePropagation();
167
- });
168
- _this.state = _this.extractStateFromProps(props);
169
- _this.createStatusAnalyticsAndFireFunc = createStatusAnalyticsAndFire(props.createAnalyticsEvent);
170
- _this.popupBodyWrapper = /*#__PURE__*/React.createRef();
171
- return _this;
172
- }
173
- _createClass(StatusPickerWithoutAnalytcs, [{
174
- key: "fireStatusPopupOpenedAnalytics",
175
- value: function fireStatusPopupOpenedAnalytics(state) {
176
- var color = state.color,
177
- text = state.text,
178
- localId = state.localId,
179
- isNew = state.isNew;
180
- this.startTime = Date.now();
181
- this.createStatusAnalyticsAndFireFunc({
182
- action: 'opened',
183
- actionSubject: 'statusPopup',
184
- attributes: {
185
- textLength: text ? text.length : 0,
186
- selectedColor: color,
187
- localId: localId,
188
- state: analyticsState(isNew)
189
- }
190
- });
191
- }
192
- }, {
193
- key: "fireStatusPopupClosedAnalytics",
194
- value: function fireStatusPopupClosedAnalytics(state) {
195
- var color = state.color,
196
- text = state.text,
197
- localId = state.localId,
198
- isNew = state.isNew;
199
- this.createStatusAnalyticsAndFireFunc({
200
- action: 'closed',
201
- actionSubject: 'statusPopup',
202
- attributes: {
203
- inputMethod: this.inputMethod,
204
- duration: Date.now() - this.startTime,
205
- textLength: text ? text.length : 0,
206
- selectedColor: color,
207
- localId: localId,
208
- state: analyticsState(isNew)
209
- }
210
- });
211
- }
212
- }, {
213
- key: "reset",
214
- value: function reset() {
215
- this.startTime = Date.now();
216
- this.inputMethod = InputMethod.blur;
217
- }
218
- }, {
219
- key: "componentDidMount",
220
- value: function componentDidMount() {
221
- var _this2 = this;
222
- this.reset();
223
- this.fireStatusPopupOpenedAnalytics(this.state);
224
- if (typeof this.props.isNew === 'boolean' && this.props.isNew === false) {
225
- // Wrapper should be focused only if status already exists otherwise input field will receive focus
226
- this.focusTimeout = requestAnimationFrame(function () {
227
- var _this2$popupBodyWrapp;
228
- // Defer to prevent editor scrolling to top. See https://product-fabric.atlassian.net/browse/DTR-1952
229
- (_this2$popupBodyWrapp = _this2.popupBodyWrapper) === null || _this2$popupBodyWrapp === void 0 || (_this2$popupBodyWrapp = _this2$popupBodyWrapp.current) === null || _this2$popupBodyWrapp === void 0 || _this2$popupBodyWrapp.focus();
230
- });
231
- }
232
- }
233
- }, {
234
- key: "componentWillUnmount",
235
- value: function componentWillUnmount() {
236
- this.focusTimeout && cancelAnimationFrame(this.focusTimeout);
237
- this.fireStatusPopupClosedAnalytics(this.state);
238
- this.startTime = 0;
239
- }
240
- }, {
241
- key: "componentDidUpdate",
242
- value: function componentDidUpdate(prevProps, prevState, _snapshot) {
243
- var element = this.props.target;
244
- if (prevProps.target !== element) {
245
- var newState = this.extractStateFromProps(this.props);
246
- this.setState(newState);
247
- this.fireStatusPopupClosedAnalytics(prevState);
248
- this.reset();
249
- this.fireStatusPopupOpenedAnalytics(newState);
250
- }
251
- }
252
- }, {
253
- key: "extractStateFromProps",
254
- value: function extractStateFromProps(props) {
255
- var defaultColor = props.defaultColor,
256
- defaultText = props.defaultText,
257
- defaultLocalId = props.defaultLocalId,
258
- isNew = props.isNew;
259
- return {
260
- color: defaultColor || DEFAULT_STATUS.color,
261
- text: defaultText || DEFAULT_STATUS.text,
262
- localId: defaultLocalId,
263
- isNew: isNew
264
- };
265
- }
266
- }, {
267
- key: "render",
268
- value: function render() {
269
- var _this$props = this.props,
270
- isNew = _this$props.isNew,
271
- target = _this$props.target,
272
- mountTo = _this$props.mountTo,
273
- boundariesElement = _this$props.boundariesElement,
274
- scrollableElement = _this$props.scrollableElement;
275
- var _this$state3 = this.state,
276
- color = _this$state3.color,
277
- text = _this$state3.text;
278
- return target && jsx(PopupWithListeners, {
279
- target: target,
280
- offset: [0, 8],
281
- handleClickOutside: this.handleClickOutside,
282
- handleEscapeKeydown: this.handleEscapeKeydown,
283
- zIndex: akEditorFloatingDialogZIndex,
284
- fitHeight: 40,
285
- mountTo: mountTo,
286
- boundariesElement: boundariesElement,
287
- scrollableElement: scrollableElement,
288
- closeOnTab: false
289
- }, jsx("div", {
290
- css: pickerContainer,
291
- tabIndex: -1,
292
- ref: this.popupBodyWrapper,
293
- onClick: this.handlePopupClick,
294
- onKeyDown: this.onKeyDown
295
- }, jsx(AkStatusPicker, {
296
- autoFocus: isNew,
297
- selectedColor: color,
298
- text: text,
299
- onColorClick: this.onColorClick,
300
- onColorHover: this.onColorHover,
301
- onTextChanged: this.onTextChanged,
302
- onEnter: this.onEnter
303
- })));
304
- }
305
- }]);
306
- return StatusPickerWithoutAnalytcs;
307
- }(React.Component);
308
- export default withAnalyticsEvents()(StatusPickerWithoutAnalytcs);
@@ -1,16 +0,0 @@
1
- import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
2
- export var mayGetStatusAtSelection = function mayGetStatusAtSelection(selection) {
3
- if (selection && selection instanceof NodeSelection) {
4
- var nodeSelection = selection;
5
- if (nodeSelection.node.type.name === 'status') {
6
- return selection.node.attrs || null;
7
- }
8
- }
9
- return null;
10
- };
11
- export var isEmptyStatus = function isEmptyStatus(node) {
12
- return node && (node.text && node.text.trim().length === 0 || node.text === '');
13
- };
14
- export var setNodeSelectionNearPos = function setNodeSelectionNearPos(tr, pos) {
15
- return tr.setSelection(NodeSelection.create(tr.doc, tr.mapping.map(pos)));
16
- };
@@ -1,119 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { EditorState } from '@atlaskit/editor-prosemirror/state';
4
- import type { DirectEditorProps } from '@atlaskit/editor-prosemirror/view';
5
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
6
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
7
- import type { WrappedComponentProps } from 'react-intl-next';
8
- import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
9
- import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
10
- import type { ErrorReporter, SEVERITY } from '@atlaskit/editor-common/utils';
11
- import { ExperienceStore } from '@atlaskit/editor-common/ufo';
12
- import type { Transformer, AllEditorPresetPluginTypes } from '@atlaskit/editor-common/types';
13
- import type { Dispatch } from '../event-dispatcher';
14
- import { EventDispatcher } from '../event-dispatcher';
15
- import { FULL_WIDTH_MODE } from '@atlaskit/editor-common/analytics';
16
- import type { EditorAppearance, EditorConfig, EditorReactContext, EditorPlugin, EditorProps } from '../types';
17
- import type { EditorNextProps } from '../types/editor-props';
18
- import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
19
- import type { SetEditorAPI } from '../presets/context';
20
- import { TransactionTracker } from '../utils/performance/track-transactions';
21
- import type { FireAnalyticsCallback, AnalyticsEventPayload, DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
22
- import type { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
23
- export interface EditorViewProps {
24
- editorProps: EditorProps | EditorNextProps;
25
- createAnalyticsEvent?: CreateUIAnalyticsEvent;
26
- providerFactory: ProviderFactory;
27
- portalProviderAPI: PortalProviderAPI;
28
- disabled?: boolean;
29
- experienceStore?: ExperienceStore;
30
- setEditorApi?: SetEditorAPI;
31
- render?: (props: {
32
- editor: JSX.Element;
33
- view?: EditorView;
34
- config: EditorConfig;
35
- eventDispatcher: EventDispatcher;
36
- transformer?: Transformer<string>;
37
- dispatchAnalyticsEvent: DispatchAnalyticsEvent;
38
- editorRef: React.RefObject<HTMLDivElement>;
39
- }) => JSX.Element;
40
- onEditorCreated: (instance: {
41
- view: EditorView;
42
- config: EditorConfig;
43
- eventDispatcher: EventDispatcher;
44
- transformer?: Transformer<string>;
45
- }) => void;
46
- onEditorDestroyed: (instance: {
47
- view: EditorView;
48
- config: EditorConfig;
49
- eventDispatcher: EventDispatcher;
50
- transformer?: Transformer<string>;
51
- }) => void;
52
- preset: EditorPresetBuilder<string[], AllEditorPresetPluginTypes[]>;
53
- }
54
- interface CreateEditorStateOptions {
55
- props: EditorViewProps;
56
- context: EditorReactContext;
57
- doc?: string | Object | PMNode;
58
- resetting?: boolean;
59
- selectionAtStart?: boolean;
60
- }
61
- export declare class ReactEditorView<T = {}> extends React.Component<EditorViewProps & WrappedComponentProps & T, {}, EditorReactContext> {
62
- view?: EditorView;
63
- eventDispatcher: EventDispatcher;
64
- contentTransformer?: Transformer<string>;
65
- config: EditorConfig;
66
- editorState: EditorState;
67
- errorReporter: ErrorReporter;
68
- dispatch: Dispatch;
69
- proseMirrorRenderedSeverity?: SEVERITY;
70
- transactionTracker: TransactionTracker;
71
- validTransactionCount: number;
72
- experienceStore?: ExperienceStore;
73
- editorRef: React.RefObject<HTMLDivElement>;
74
- static contextTypes: {
75
- getAtlaskitAnalyticsEventHandlers: PropTypes.Requireable<(...args: any[]) => any>;
76
- };
77
- private canDispatchTransactions;
78
- private focusTimeoutId?;
79
- private reliabilityInterval?;
80
- private pluginPerformanceObserver;
81
- private featureFlags;
82
- private pluginInjectionAPI;
83
- private onPluginObservation;
84
- get transactionTracking(): import("@atlaskit/editor-common/types").TransactionTracking;
85
- private getPluginNames;
86
- private countNodes;
87
- private isTransactionTrackingExplicitlyDisabled;
88
- constructor(props: EditorViewProps & WrappedComponentProps & T, context: EditorReactContext);
89
- getEditorState: () => EditorState | undefined;
90
- getEditorView: () => EditorView | undefined;
91
- UNSAFE_componentWillReceiveProps(nextProps: EditorViewProps): void;
92
- formatFullWidthAppearance: (appearance: EditorAppearance | undefined) => FULL_WIDTH_MODE;
93
- resetEditorState: ({ doc, shouldScrollToBottom, }: {
94
- doc: string;
95
- shouldScrollToBottom: boolean;
96
- }) => void;
97
- blur: () => void;
98
- reconfigureState(props: EditorViewProps): void;
99
- handleAnalyticsEvent: FireAnalyticsCallback;
100
- componentDidMount(): void;
101
- /**
102
- * Clean up any non-PM resources when the editor is unmounted
103
- */
104
- componentWillUnmount(): void;
105
- private editorPlugins;
106
- getPlugins(preset: EditorPresetBuilder<string[], AllEditorPresetPluginTypes[]>): EditorPlugin[];
107
- createEditorState: (options: CreateEditorStateOptions) => EditorState;
108
- private onEditorViewStateUpdated;
109
- private trackValidTransactions;
110
- private dispatchTransaction;
111
- getDirectEditorProps: (state?: EditorState) => DirectEditorProps;
112
- private createEditorView;
113
- handleEditorViewRef: (node: HTMLDivElement) => void;
114
- dispatchAnalyticsEvent: (payload: AnalyticsEventPayload) => void;
115
- private createEditor;
116
- private editor;
117
- render(): JSX.Element;
118
- }
119
- export {};
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import { EditorViewProps } from './ReactEditorViewInternal';
3
- import { WrappedComponentProps } from 'react-intl-next';
4
- export declare function ReactEditorViewEditor<T = {}>(props: EditorViewProps & WrappedComponentProps & T): JSX.Element;
5
- declare const _default: React.FC<import("react-intl-next").WithIntlProps<EditorViewProps & WrappedComponentProps<"intl">>> & {
6
- WrappedComponent: React.ComponentType<EditorViewProps & WrappedComponentProps<"intl">>;
7
- };
8
- export default _default;
@@ -1,10 +0,0 @@
1
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- import type { Dispatch } from '../../event-dispatcher';
4
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
5
- export declare function createPlugin(eventDispatch: Dispatch, onSave?: (editorView: EditorView) => void): SafePlugin | undefined;
6
- type Config = (editorView: EditorView) => void;
7
- declare const saveOnEnterPlugin: NextEditorPlugin<'saveOnEnter', {
8
- pluginConfiguration: Config | undefined;
9
- }>;
10
- export default saveOnEnterPlugin;
@@ -1,14 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
3
- /**
4
- * Plugin to scroll the user's selection into view whenever the user updates
5
- * the document eg. inserting, deleting, formatting
6
- *
7
- * Behaviour is on by default, can be explicitly opted out of for a transaction by
8
- * setting scrollIntoView=false meta
9
- * We ignore collab transactions, appended transactions, transactions without steps,
10
- * transactions with addToHistory=false meta and typeahead trigger transactions
11
- */
12
- export declare const scrollIntoViewPluginKey: PluginKey<any>;
13
- declare const scrollIntoViewPlugin: NextEditorPlugin<'scrollIntoView'>;
14
- export default scrollIntoViewPlugin;
@@ -1,16 +0,0 @@
1
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
2
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- import type { Command } from '@atlaskit/editor-common/types';
4
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
5
- import type { TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
6
- import type { StatusType, ClosingPayload } from './types';
7
- export declare const DEFAULT_STATUS: StatusType;
8
- export declare const createStatus: (showStatusPickerAtOffset?: number) => (insert: (node: Node | Object | string, opts: {
9
- selectInlineNode: boolean;
10
- }) => Transaction, state: EditorState) => Transaction;
11
- export declare const updateStatus: (status?: StatusType) => Command;
12
- export type UpdateStatus = (inputMethod: TOOLBAR_MENU_TYPE, status?: StatusType) => Command;
13
- export declare const updateStatusWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: TOOLBAR_MENU_TYPE, status?: StatusType) => Command;
14
- export declare const setStatusPickerAt: (showStatusPickerAt: number | null) => (state: EditorState, dispatch: (tr: Transaction) => void) => boolean;
15
- export declare const removeStatus: (showStatusPickerAt: number) => Command;
16
- export declare const commitStatusPicker: (closingPayload?: ClosingPayload) => (editorView: EditorView) => void;
@@ -1,4 +0,0 @@
1
- import type { AnalyticsEventPayload, CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
- export declare const FABRIC_CHANNEL = "fabric-elements";
3
- export declare const createStatusAnalyticsAndFire: (createAnalyticsEvent?: CreateUIAnalyticsEvent) => (payload: AnalyticsEventPayload) => void;
4
- export declare const analyticsState: (isNew: boolean | undefined) => "update" | "new";
@@ -1,15 +0,0 @@
1
- import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
- import type { UpdateStatus } from './actions';
3
- import { commitStatusPicker } from './actions';
4
- import type { StatusPluginOptions } from './types';
5
- import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
6
- export type StatusPlugin = NextEditorPlugin<'status', {
7
- dependencies: [OptionalPlugin<AnalyticsPlugin>];
8
- pluginConfiguration: StatusPluginOptions | undefined;
9
- actions: {
10
- commitStatusPicker: typeof commitStatusPicker;
11
- updateStatus: UpdateStatus;
12
- };
13
- }>;
14
- declare const statusPlugin: StatusPlugin;
15
- export default statusPlugin;
@@ -1,3 +0,0 @@
1
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- export declare function keymapPlugin(): SafePlugin;
3
- export default keymapPlugin;
@@ -1,25 +0,0 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
- import { jsx } from '@emotion/react';
4
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
- import type { IntlShape } from 'react-intl-next';
6
- import type { Color, StatusStyle } from '@atlaskit/status/element';
7
- import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
8
- import type { InlineNodeViewComponentProps } from '@atlaskit/editor-common/react-node-view';
9
- import type { StatusPluginOptions } from '../types';
10
- export interface ContainerProps {
11
- view: EditorView;
12
- intl: IntlShape;
13
- text?: string;
14
- color: Color;
15
- style?: StatusStyle;
16
- localId?: string;
17
- eventDispatcher?: EventDispatcher;
18
- }
19
- export declare const IntlStatusContainerView: React.FC<import("react-intl-next").WithIntlProps<ContainerProps>> & {
20
- WrappedComponent: React.ComponentType<ContainerProps>;
21
- };
22
- export type Props = InlineNodeViewComponentProps & {
23
- options: StatusPluginOptions | undefined;
24
- };
25
- export declare const StatusNodeView: (props: Props) => jsx.JSX.Element;
@@ -1,4 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- import type { StatusState } from './types';
3
- export declare const pluginKeyName = "statusPlugin";
4
- export declare const pluginKey: PluginKey<StatusState>;
@@ -1,7 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
3
- import type { StatusPluginOptions } from './types';
4
- export { pluginKey, pluginKeyName } from './plugin-key';
5
- export type { StatusState, StatusType, ClosingPayload } from './types';
6
- declare const createPlugin: (pmPluginFactoryParams: PMPluginFactoryParams, options?: StatusPluginOptions) => SafePlugin<any>;
7
- export default createPlugin;
@@ -1,18 +0,0 @@
1
- import type { Color as ColorType } from '@atlaskit/status/element';
2
- import type { closingMethods } from './ui/statusPicker';
3
- export type StatusType = {
4
- color: ColorType;
5
- text: string;
6
- localId?: string;
7
- };
8
- export type StatusState = {
9
- isNew: boolean;
10
- showStatusPickerAt: number | null;
11
- };
12
- export interface StatusPluginOptions {
13
- menuDisabled: boolean;
14
- allowZeroWidthSpaceAfter?: boolean;
15
- }
16
- export type ClosingPayload = {
17
- closingMethod: closingMethods;
18
- };
@@ -1,63 +0,0 @@
1
- import React from 'react';
2
- import { jsx } from '@emotion/react';
3
- import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
4
- import type { ColorType as Color } from '@atlaskit/status/picker';
5
- import type { StatusType, ClosingPayload } from '../plugin';
6
- export declare enum InputMethod {
7
- blur = "blur",
8
- escKey = "escKey",
9
- enterKey = "enterKey"
10
- }
11
- export declare enum closingMethods {
12
- ArrowLeft = "arrowLeft",
13
- ArrowRight = "arrowRight"
14
- }
15
- export interface Props {
16
- target: HTMLElement | null;
17
- closeStatusPicker: (closingPayload?: ClosingPayload) => void;
18
- onSelect: (status: StatusType) => void;
19
- onTextChanged: (status: StatusType, isNew: boolean) => void;
20
- onEnter: (status: StatusType) => void;
21
- isNew?: boolean;
22
- defaultText?: string;
23
- defaultColor?: Color;
24
- defaultLocalId?: string;
25
- createAnalyticsEvent?: CreateUIAnalyticsEvent;
26
- mountTo?: HTMLElement;
27
- boundariesElement?: HTMLElement;
28
- scrollableElement?: HTMLElement;
29
- }
30
- export interface State {
31
- color: Color;
32
- text: string;
33
- localId?: string;
34
- isNew?: boolean;
35
- }
36
- export declare class StatusPickerWithoutAnalytcs extends React.Component<Props, State> {
37
- private startTime;
38
- private inputMethod?;
39
- private createStatusAnalyticsAndFireFunc;
40
- private popupBodyWrapper;
41
- private focusTimeout;
42
- constructor(props: Props);
43
- private fireStatusPopupOpenedAnalytics;
44
- private fireStatusPopupClosedAnalytics;
45
- private reset;
46
- componentDidMount(): void;
47
- componentWillUnmount(): void;
48
- componentDidUpdate(prevProps: Readonly<Props>, prevState: Readonly<State>, _snapshot?: any): void;
49
- private extractStateFromProps;
50
- handleClickOutside: (event: Event) => void;
51
- private handleEscapeKeydown;
52
- private handleTabPress;
53
- private handleArrow;
54
- private onKeyDown;
55
- render(): jsx.JSX.Element | null;
56
- private onColorHover;
57
- private onColorClick;
58
- private onTextChanged;
59
- private onEnter;
60
- private handlePopupClick;
61
- }
62
- declare const _default: React.ForwardRefExoticComponent<Omit<Props, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any>>;
63
- export default _default;
@@ -1,5 +0,0 @@
1
- import type { Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
2
- import type { StatusType } from './types';
3
- export declare const mayGetStatusAtSelection: (selection: Selection) => StatusType | null;
4
- export declare const isEmptyStatus: (node: StatusType) => boolean;
5
- export declare const setNodeSelectionNearPos: (tr: Transaction, pos: number) => Transaction;