@atlaskit/editor-core 185.2.25 → 185.2.26

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 (154) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/editor-next/editor-internal.js +3 -3
  3. package/dist/cjs/index.js +4 -4
  4. package/dist/cjs/labs/next/Editor.js +3 -3
  5. package/dist/cjs/nodeviews/index.js +1 -16
  6. package/dist/cjs/plugins/annotation/index.js +31 -21
  7. package/dist/cjs/plugins/annotation/nodeviews/index.js +2 -2
  8. package/dist/cjs/plugins/base/index.js +0 -6
  9. package/dist/cjs/plugins/caption/index.js +1 -2
  10. package/dist/cjs/plugins/caption/nodeviews/index.js +3 -3
  11. package/dist/cjs/plugins/caption/pm-plugins/main.js +4 -2
  12. package/dist/cjs/plugins/card/nodeviews/embedCard.js +4 -4
  13. package/dist/cjs/plugins/extension/nodeviews/extension.js +2 -2
  14. package/dist/cjs/plugins/jira-issue/index.js +2 -2
  15. package/dist/cjs/plugins/media/index.js +2 -2
  16. package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +25 -19
  17. package/dist/cjs/plugins/media/nodeviews/mediaInline.js +3 -3
  18. package/dist/cjs/plugins/media/nodeviews/mediaNodeView/index.js +16 -10
  19. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -2
  20. package/dist/cjs/plugins/media/pm-plugins/main.js +25 -8
  21. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/decisionItem.js +2 -2
  22. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +2 -2
  23. package/dist/cjs/plugins/unsupported-content/index.js +6 -4
  24. package/dist/cjs/test-utils.js +0 -7
  25. package/dist/cjs/version-wrapper.js +1 -1
  26. package/dist/cjs/version.json +1 -1
  27. package/dist/es2019/editor-next/editor-internal.js +1 -1
  28. package/dist/es2019/index.js +1 -1
  29. package/dist/es2019/labs/next/Editor.js +1 -1
  30. package/dist/es2019/nodeviews/index.js +1 -2
  31. package/dist/es2019/plugins/annotation/index.js +34 -23
  32. package/dist/es2019/plugins/annotation/nodeviews/index.js +1 -1
  33. package/dist/es2019/plugins/base/index.js +0 -4
  34. package/dist/es2019/plugins/caption/index.js +1 -4
  35. package/dist/es2019/plugins/caption/nodeviews/index.js +2 -2
  36. package/dist/es2019/plugins/caption/pm-plugins/main.js +4 -2
  37. package/dist/es2019/plugins/card/nodeviews/embedCard.js +2 -2
  38. package/dist/es2019/plugins/extension/nodeviews/extension.js +1 -1
  39. package/dist/es2019/plugins/jira-issue/index.js +1 -1
  40. package/dist/es2019/plugins/media/index.js +2 -2
  41. package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +21 -14
  42. package/dist/es2019/plugins/media/nodeviews/mediaInline.js +2 -2
  43. package/dist/es2019/plugins/media/nodeviews/mediaNodeView/index.js +13 -9
  44. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
  45. package/dist/es2019/plugins/media/pm-plugins/main.js +28 -11
  46. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
  47. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
  48. package/dist/es2019/plugins/unsupported-content/index.js +1 -1
  49. package/dist/es2019/test-utils.js +0 -1
  50. package/dist/es2019/version-wrapper.js +1 -1
  51. package/dist/es2019/version.json +1 -1
  52. package/dist/esm/editor-next/editor-internal.js +1 -1
  53. package/dist/esm/index.js +1 -1
  54. package/dist/esm/labs/next/Editor.js +1 -1
  55. package/dist/esm/nodeviews/index.js +1 -2
  56. package/dist/esm/plugins/annotation/index.js +32 -22
  57. package/dist/esm/plugins/annotation/nodeviews/index.js +1 -1
  58. package/dist/esm/plugins/base/index.js +0 -6
  59. package/dist/esm/plugins/caption/index.js +1 -2
  60. package/dist/esm/plugins/caption/nodeviews/index.js +2 -2
  61. package/dist/esm/plugins/caption/pm-plugins/main.js +4 -2
  62. package/dist/esm/plugins/card/nodeviews/embedCard.js +4 -4
  63. package/dist/esm/plugins/extension/nodeviews/extension.js +1 -1
  64. package/dist/esm/plugins/jira-issue/index.js +1 -1
  65. package/dist/esm/plugins/media/index.js +2 -2
  66. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +24 -18
  67. package/dist/esm/plugins/media/nodeviews/mediaInline.js +2 -2
  68. package/dist/esm/plugins/media/nodeviews/mediaNodeView/index.js +15 -9
  69. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
  70. package/dist/esm/plugins/media/pm-plugins/main.js +26 -9
  71. package/dist/esm/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
  72. package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
  73. package/dist/esm/plugins/unsupported-content/index.js +1 -1
  74. package/dist/esm/test-utils.js +0 -1
  75. package/dist/esm/version-wrapper.js +1 -1
  76. package/dist/esm/version.json +1 -1
  77. package/dist/types/create-editor/ReactEditorViewInternal.d.ts +1 -1
  78. package/dist/types/index.d.ts +1 -1
  79. package/dist/types/labs/next/internal/components/EditorInternal.d.ts +2 -2
  80. package/dist/types/labs/next/internal/editor-props-type.d.ts +1 -1
  81. package/dist/types/labs/next/internal/hooks/use-editor/create-editor.d.ts +1 -1
  82. package/dist/types/nodeviews/index.d.ts +0 -2
  83. package/dist/types/plugins/annotation/index.d.ts +3 -1
  84. package/dist/types/plugins/annotation/nodeviews/index.d.ts +2 -1
  85. package/dist/types/plugins/annotation/pm-plugins/types.d.ts +2 -2
  86. package/dist/types/plugins/caption/index.d.ts +1 -1
  87. package/dist/types/plugins/caption/nodeviews/index.d.ts +7 -4
  88. package/dist/types/plugins/caption/pm-plugins/main.d.ts +5 -4
  89. package/dist/types/plugins/card/nodeviews/embedCard.d.ts +2 -2
  90. package/dist/types/plugins/extension/nodeviews/extension.d.ts +3 -2
  91. package/dist/types/plugins/extension/pm-plugins/main.d.ts +2 -2
  92. package/dist/types/plugins/media/index.d.ts +3 -1
  93. package/dist/types/plugins/media/nodeviews/mediaGroup.d.ts +5 -3
  94. package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +6 -3
  95. package/dist/types/plugins/media/nodeviews/mediaNodeView/index.d.ts +6 -4
  96. package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +2 -2
  97. package/dist/types/plugins/media/types.d.ts +4 -0
  98. package/dist/types/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +1 -1
  99. package/dist/types/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +1 -1
  100. package/dist/types/plugins/tasks-and-decisions/pm-plugins/main.d.ts +1 -1
  101. package/dist/types/test-utils.d.ts +0 -1
  102. package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +1 -1
  103. package/dist/types-ts4.5/index.d.ts +1 -1
  104. package/dist/types-ts4.5/labs/next/internal/components/EditorInternal.d.ts +2 -2
  105. package/dist/types-ts4.5/labs/next/internal/editor-props-type.d.ts +1 -1
  106. package/dist/types-ts4.5/labs/next/internal/hooks/use-editor/create-editor.d.ts +1 -1
  107. package/dist/types-ts4.5/nodeviews/index.d.ts +0 -2
  108. package/dist/types-ts4.5/plugins/annotation/index.d.ts +3 -1
  109. package/dist/types-ts4.5/plugins/annotation/nodeviews/index.d.ts +2 -1
  110. package/dist/types-ts4.5/plugins/annotation/pm-plugins/types.d.ts +2 -2
  111. package/dist/types-ts4.5/plugins/caption/index.d.ts +1 -1
  112. package/dist/types-ts4.5/plugins/caption/nodeviews/index.d.ts +7 -4
  113. package/dist/types-ts4.5/plugins/caption/pm-plugins/main.d.ts +5 -4
  114. package/dist/types-ts4.5/plugins/card/nodeviews/embedCard.d.ts +2 -2
  115. package/dist/types-ts4.5/plugins/extension/nodeviews/extension.d.ts +3 -2
  116. package/dist/types-ts4.5/plugins/extension/pm-plugins/main.d.ts +2 -2
  117. package/dist/types-ts4.5/plugins/media/index.d.ts +3 -1
  118. package/dist/types-ts4.5/plugins/media/nodeviews/mediaGroup.d.ts +5 -3
  119. package/dist/types-ts4.5/plugins/media/nodeviews/mediaInline.d.ts +6 -3
  120. package/dist/types-ts4.5/plugins/media/nodeviews/mediaNodeView/index.d.ts +6 -4
  121. package/dist/types-ts4.5/plugins/media/nodeviews/mediaSingle.d.ts +2 -2
  122. package/dist/types-ts4.5/plugins/media/types.d.ts +4 -0
  123. package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +1 -1
  124. package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +1 -1
  125. package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/main.d.ts +1 -1
  126. package/dist/types-ts4.5/test-utils.d.ts +0 -1
  127. package/package.json +2 -2
  128. package/report.api.md +20 -85
  129. package/tmp/api-report-tmp.d.ts +18 -68
  130. package/dist/cjs/nodeviews/ReactNodeView.js +0 -224
  131. package/dist/cjs/nodeviews/SelectionBasedNodeView.js +0 -169
  132. package/dist/cjs/plugins/base/pm-plugins/react-nodeview.js +0 -72
  133. package/dist/cjs/ui/PortalProvider/PortalProviderThemesProvider.js +0 -43
  134. package/dist/cjs/ui/PortalProvider/index.js +0 -252
  135. package/dist/es2019/nodeviews/ReactNodeView.js +0 -170
  136. package/dist/es2019/nodeviews/SelectionBasedNodeView.js +0 -158
  137. package/dist/es2019/plugins/base/pm-plugins/react-nodeview.js +0 -48
  138. package/dist/es2019/ui/PortalProvider/PortalProviderThemesProvider.js +0 -37
  139. package/dist/es2019/ui/PortalProvider/index.js +0 -184
  140. package/dist/esm/nodeviews/ReactNodeView.js +0 -217
  141. package/dist/esm/nodeviews/SelectionBasedNodeView.js +0 -163
  142. package/dist/esm/plugins/base/pm-plugins/react-nodeview.js +0 -62
  143. package/dist/esm/ui/PortalProvider/PortalProviderThemesProvider.js +0 -36
  144. package/dist/esm/ui/PortalProvider/index.js +0 -242
  145. package/dist/types/nodeviews/ReactNodeView.d.ts +0 -52
  146. package/dist/types/nodeviews/SelectionBasedNodeView.d.ts +0 -53
  147. package/dist/types/plugins/base/pm-plugins/react-nodeview.d.ts +0 -13
  148. package/dist/types/ui/PortalProvider/PortalProviderThemesProvider.d.ts +0 -6
  149. package/dist/types/ui/PortalProvider/index.d.ts +0 -51
  150. package/dist/types-ts4.5/nodeviews/ReactNodeView.d.ts +0 -52
  151. package/dist/types-ts4.5/nodeviews/SelectionBasedNodeView.d.ts +0 -53
  152. package/dist/types-ts4.5/plugins/base/pm-plugins/react-nodeview.d.ts +0 -13
  153. package/dist/types-ts4.5/ui/PortalProvider/PortalProviderThemesProvider.d.ts +0 -6
  154. package/dist/types-ts4.5/ui/PortalProvider/index.d.ts +0 -51
@@ -1,242 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- var _class;
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
- import React from 'react';
13
- import { createPortal, unstable_renderSubtreeIntoContainer, unmountComponentAtNode } from 'react-dom';
14
- import PropTypes from 'prop-types';
15
- import { default as AnalyticsReactContext } from '@atlaskit/analytics-next-stable-react-context';
16
- import { EventDispatcher } from '../../event-dispatcher';
17
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
18
- import { useIntl, RawIntlProvider, injectIntl } from 'react-intl-next';
19
- import { useGlobalTheme } from '@atlaskit/theme/components';
20
- import { PortalProviderThemeProviders } from './PortalProviderThemesProvider';
21
- import { IntlProviderIfMissingWrapper } from '@atlaskit/editor-common/ui';
22
- export var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
23
- _inherits(PortalProviderAPI, _EventDispatcher);
24
- var _super = _createSuper(PortalProviderAPI);
25
- function PortalProviderAPI(intl, onAnalyticsEvent, analyticsContext, themeMode) {
26
- var _this;
27
- _classCallCheck(this, PortalProviderAPI);
28
- _this = _super.call(this);
29
- _defineProperty(_assertThisInitialized(_this), "portals", new Map());
30
- _defineProperty(_assertThisInitialized(_this), "setContext", function (context) {
31
- _this.context = context;
32
- });
33
- _this.intl = intl;
34
- _this.onAnalyticsEvent = onAnalyticsEvent;
35
- _this.useAnalyticsContext = analyticsContext;
36
- _this.themeMode = themeMode;
37
- return _this;
38
- }
39
- _createClass(PortalProviderAPI, [{
40
- key: "render",
41
- value: function render(children, container) {
42
- var hasAnalyticsContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
43
- var hasIntlContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
44
- this.portals.set(container, {
45
- children: children,
46
- hasAnalyticsContext: hasAnalyticsContext,
47
- hasIntlContext: hasIntlContext
48
- });
49
- var childrenWithThemeProviders = /*#__PURE__*/React.createElement(PortalProviderThemeProviders, {
50
- mode: this.themeMode
51
- }, children());
52
- var wrappedChildren = this.useAnalyticsContext ? /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders) : childrenWithThemeProviders;
53
- if (hasIntlContext) {
54
- wrappedChildren = /*#__PURE__*/React.createElement(RawIntlProvider, {
55
- value: this.intl
56
- }, wrappedChildren);
57
- }
58
- unstable_renderSubtreeIntoContainer(this.context, wrappedChildren, container);
59
- }
60
-
61
- // TODO: until https://product-fabric.atlassian.net/browse/ED-5013
62
- // we (unfortunately) need to re-render to pass down any updated context.
63
- // selectively do this for nodeviews that opt-in via `hasAnalyticsContext`
64
- }, {
65
- key: "forceUpdate",
66
- value: function forceUpdate(_ref) {
67
- var _this2 = this;
68
- var intl = _ref.intl,
69
- themeMode = _ref.themeMode;
70
- this.intl = intl;
71
- this.themeMode = themeMode;
72
- this.portals.forEach(function (portal, container) {
73
- if (!portal.hasAnalyticsContext && !_this2.useAnalyticsContext && !portal.hasIntlContext) {
74
- return;
75
- }
76
- var wrappedChildren = portal.children();
77
- var childrenWithThemeProviders = /*#__PURE__*/React.createElement(PortalProviderThemeProviders, {
78
- mode: themeMode
79
- }, wrappedChildren);
80
- if (portal.hasAnalyticsContext && _this2.useAnalyticsContext) {
81
- wrappedChildren = /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders);
82
- }
83
- if (portal.hasIntlContext) {
84
- wrappedChildren = /*#__PURE__*/React.createElement(RawIntlProvider, {
85
- value: _this2.intl
86
- }, childrenWithThemeProviders);
87
- }
88
- unstable_renderSubtreeIntoContainer(_this2.context, wrappedChildren, container);
89
- });
90
- }
91
- }, {
92
- key: "remove",
93
- value: function remove(container) {
94
- this.portals.delete(container);
95
-
96
- // There is a race condition that can happen caused by Prosemirror vs React,
97
- // where Prosemirror removes the container from the DOM before React gets
98
- // around to removing the child from the container
99
- // This will throw a NotFoundError: The node to be removed is not a child of this node
100
- // Both Prosemirror and React remove the elements asynchronously, and in edge
101
- // cases Prosemirror beats React
102
- try {
103
- unmountComponentAtNode(container);
104
- } catch (error) {
105
- if (this.onAnalyticsEvent) {
106
- this.onAnalyticsEvent({
107
- payload: {
108
- action: ACTION.FAILED_TO_UNMOUNT,
109
- actionSubject: ACTION_SUBJECT.EDITOR,
110
- actionSubjectId: ACTION_SUBJECT_ID.REACT_NODE_VIEW,
111
- attributes: {
112
- error: error,
113
- domNodes: {
114
- container: container ? container.className : undefined,
115
- child: container.firstElementChild ? container.firstElementChild.className : undefined
116
- }
117
- },
118
- eventType: EVENT_TYPE.OPERATIONAL
119
- }
120
- });
121
- }
122
- }
123
- }
124
- }]);
125
- return PortalProviderAPI;
126
- }(EventDispatcher);
127
- var BasePortalProvider = /*#__PURE__*/function (_React$Component) {
128
- _inherits(BasePortalProvider, _React$Component);
129
- var _super2 = _createSuper(BasePortalProvider);
130
- function BasePortalProvider(props) {
131
- var _this3;
132
- _classCallCheck(this, BasePortalProvider);
133
- _this3 = _super2.call(this, props);
134
- _this3.portalProviderAPI = new PortalProviderAPI(props.intl, props.onAnalyticsEvent, props.useAnalyticsContext, props.themeMode);
135
- return _this3;
136
- }
137
- _createClass(BasePortalProvider, [{
138
- key: "render",
139
- value: function render() {
140
- return this.props.render(this.portalProviderAPI);
141
- }
142
- }, {
143
- key: "componentDidUpdate",
144
- value: function componentDidUpdate() {
145
- this.portalProviderAPI.forceUpdate({
146
- intl: this.props.intl,
147
- themeMode: this.props.themeMode
148
- });
149
- }
150
- }]);
151
- return BasePortalProvider;
152
- }(React.Component);
153
- _defineProperty(BasePortalProvider, "displayName", 'PortalProvider');
154
- export var PortalProvider = injectIntl(BasePortalProvider);
155
- export var PortalProviderWithThemeProviders = function PortalProviderWithThemeProviders(_ref2) {
156
- var onAnalyticsEvent = _ref2.onAnalyticsEvent,
157
- useAnalyticsContext = _ref2.useAnalyticsContext,
158
- render = _ref2.render;
159
- return /*#__PURE__*/React.createElement(IntlProviderIfMissingWrapper, null, /*#__PURE__*/React.createElement(PortalProviderWithThemeAndIntlProviders, {
160
- onAnalyticsEvent: onAnalyticsEvent,
161
- useAnalyticsContext: useAnalyticsContext,
162
- render: render
163
- }));
164
- };
165
- var PortalProviderWithThemeAndIntlProviders = function PortalProviderWithThemeAndIntlProviders(_ref3) {
166
- var onAnalyticsEvent = _ref3.onAnalyticsEvent,
167
- useAnalyticsContext = _ref3.useAnalyticsContext,
168
- render = _ref3.render;
169
- var intl = useIntl();
170
- var globalTheme = useGlobalTheme();
171
- return /*#__PURE__*/React.createElement(BasePortalProvider, {
172
- intl: intl,
173
- themeMode: globalTheme.mode,
174
- onAnalyticsEvent: onAnalyticsEvent,
175
- useAnalyticsContext: useAnalyticsContext,
176
- render: render
177
- });
178
- };
179
- export var PortalRenderer = /*#__PURE__*/function (_React$Component2) {
180
- _inherits(PortalRenderer, _React$Component2);
181
- var _super3 = _createSuper(PortalRenderer);
182
- function PortalRenderer(props) {
183
- var _this4;
184
- _classCallCheck(this, PortalRenderer);
185
- _this4 = _super3.call(this, props);
186
- _defineProperty(_assertThisInitialized(_this4), "handleUpdate", function (portals) {
187
- return _this4.setState({
188
- portals: portals
189
- });
190
- });
191
- props.portalProviderAPI.setContext(_assertThisInitialized(_this4));
192
- props.portalProviderAPI.on('update', _this4.handleUpdate);
193
- _this4.state = {
194
- portals: new Map()
195
- };
196
- return _this4;
197
- }
198
- _createClass(PortalRenderer, [{
199
- key: "render",
200
- value: function render() {
201
- var portals = this.state.portals;
202
- return /*#__PURE__*/React.createElement(React.Fragment, null, Array.from(portals.entries()).map(function (_ref4) {
203
- var _ref5 = _slicedToArray(_ref4, 2),
204
- container = _ref5[0],
205
- children = _ref5[1];
206
- return /*#__PURE__*/createPortal(children, container);
207
- }));
208
- }
209
- }]);
210
- return PortalRenderer;
211
- }(React.Component);
212
-
213
- /**
214
- * Wrapper to re-provide modern analytics context to ReactNodeViews.
215
- */
216
- var dummyAnalyticsContext = {
217
- getAtlaskitAnalyticsContext: function getAtlaskitAnalyticsContext() {},
218
- getAtlaskitAnalyticsEventHandlers: function getAtlaskitAnalyticsEventHandlers() {}
219
- };
220
- var AnalyticsContextWrapper = (_class = /*#__PURE__*/function (_React$Component3) {
221
- _inherits(AnalyticsContextWrapper, _React$Component3);
222
- var _super4 = _createSuper(AnalyticsContextWrapper);
223
- function AnalyticsContextWrapper() {
224
- _classCallCheck(this, AnalyticsContextWrapper);
225
- return _super4.apply(this, arguments);
226
- }
227
- _createClass(AnalyticsContextWrapper, [{
228
- key: "render",
229
- value: function render() {
230
- var _ref6 = this.context.contextAdapter.analytics || {
231
- value: dummyAnalyticsContext
232
- },
233
- value = _ref6.value;
234
- return /*#__PURE__*/React.createElement(AnalyticsReactContext.Provider, {
235
- value: value
236
- }, this.props.children);
237
- }
238
- }]);
239
- return AnalyticsContextWrapper;
240
- }(React.Component), _defineProperty(_class, "contextTypes", {
241
- contextAdapter: PropTypes.object
242
- }), _class);
@@ -1,52 +0,0 @@
1
- import React from 'react';
2
- import { NodeView, EditorView, Decoration } from 'prosemirror-view';
3
- import { Node as PMNode } from 'prosemirror-model';
4
- import { PortalProviderAPI } from '../ui/PortalProvider';
5
- import { EventDispatcher } from '../event-dispatcher';
6
- import { ReactComponentProps, shouldUpdate, getPosHandler, ForwardRef } from './types';
7
- export default class ReactNodeView<P = ReactComponentProps> implements NodeView {
8
- private domRef?;
9
- private contentDOMWrapper?;
10
- private reactComponent?;
11
- private portalProviderAPI;
12
- private hasAnalyticsContext;
13
- private _viewShouldUpdate?;
14
- protected eventDispatcher?: EventDispatcher;
15
- private hasIntlContext;
16
- reactComponentProps: P;
17
- view: EditorView;
18
- getPos: getPosHandler;
19
- contentDOM: Node | undefined;
20
- node: PMNode;
21
- constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps?: P, reactComponent?: React.ComponentType<any>, hasAnalyticsContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean);
22
- /**
23
- * This method exists to move initialization logic out of the constructor,
24
- * so object can be initialized properly before calling render first time.
25
- *
26
- * Example:
27
- * Instance properties get added to an object only after super call in
28
- * constructor, which leads to some methods being undefined during the
29
- * first render.
30
- */
31
- init(): this;
32
- private renderReactComponent;
33
- createDomRef(): HTMLElement;
34
- getContentDOM(): {
35
- dom: Node;
36
- contentDOM?: Node | null | undefined;
37
- } | undefined;
38
- handleRef: (node: HTMLElement | null) => void;
39
- private _handleRef;
40
- render(props: P, forwardRef?: ForwardRef): React.ReactElement<any> | null;
41
- update(node: PMNode, _decorations: Array<Decoration>, _innerDecorations?: Array<Decoration>, validUpdate?: (currentNode: PMNode, newNode: PMNode) => boolean): boolean;
42
- viewShouldUpdate(nextNode: PMNode): boolean;
43
- /**
44
- * Copies the attributes from a ProseMirror Node to a DOM node.
45
- * @param node The Prosemirror Node from which to source the attributes
46
- */
47
- setDomAttrs(node: PMNode, element: HTMLElement): void;
48
- get dom(): HTMLElement | undefined;
49
- destroy(): void;
50
- private dispatchAnalyticsEvent;
51
- static fromComponent(component: React.ComponentType<any>, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, props?: ReactComponentProps, viewShouldUpdate?: (nextNode: PMNode) => boolean, hasIntlContext?: boolean): (node: PMNode, view: EditorView, getPos: getPosHandler) => ReactNodeView<ReactComponentProps>;
52
- }
@@ -1,53 +0,0 @@
1
- import React from 'react';
2
- import { EditorView } from 'prosemirror-view';
3
- import { Node as PMNode } from 'prosemirror-model';
4
- import { PortalProviderAPI } from '../ui/PortalProvider';
5
- import { EventDispatcher } from '../event-dispatcher';
6
- import { ReactComponentProps, shouldUpdate, getPosHandler } from './types';
7
- import ReactNodeView from './ReactNodeView';
8
- /**
9
- * A ReactNodeView that handles React components sensitive
10
- * to selection changes.
11
- *
12
- * If the selection changes, it will attempt to re-render the
13
- * React component. Otherwise it does nothing.
14
- *
15
- * You can subclass `viewShouldUpdate` to include other
16
- * props that your component might want to consider before
17
- * entering the React lifecycle. These are usually props you
18
- * compare in `shouldComponentUpdate`.
19
- *
20
- * An example:
21
- *
22
- * ```
23
- * viewShouldUpdate(nextNode) {
24
- * if (nextNode.attrs !== this.node.attrs) {
25
- * return true;
26
- * }
27
- *
28
- * return super.viewShouldUpdate(nextNode);
29
- * }```
30
- */
31
- export declare class SelectionBasedNodeView<P = ReactComponentProps> extends ReactNodeView<P> {
32
- private oldSelection;
33
- private selectionChangeState;
34
- pos: number | undefined;
35
- posEnd: number | undefined;
36
- constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps: P, reactComponent?: React.ComponentType<any>, hasContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean);
37
- /**
38
- * Update current node's start and end positions.
39
- *
40
- * Prefer `this.pos` rather than getPos(), because calling getPos is
41
- * expensive, unless you know you're definitely going to render.
42
- */
43
- private updatePos;
44
- private getPositionsWithDefault;
45
- isNodeInsideSelection: (from: number, to: number, pos?: number, posEnd?: number) => boolean;
46
- isSelectionInsideNode: (from: number, to: number, pos?: number, posEnd?: number) => boolean;
47
- private isSelectedNode;
48
- insideSelection: () => boolean;
49
- nodeInsideSelection: () => boolean;
50
- viewShouldUpdate(_nextNode: PMNode): boolean;
51
- destroy(): void;
52
- private onSelectionChange;
53
- }
@@ -1,13 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from 'prosemirror-state';
3
- type StateChangeHandler = (fromPos: number, toPos: number) => any;
4
- export declare class ReactNodeViewState {
5
- private changeHandlers;
6
- constructor();
7
- subscribe(cb: StateChangeHandler): void;
8
- unsubscribe(cb: StateChangeHandler): void;
9
- notifyNewSelection(fromPos: number, toPos: number): void;
10
- }
11
- export declare const stateKey: PluginKey<ReactNodeViewState, any>;
12
- export declare const plugin: SafePlugin<ReactNodeViewState, any>;
13
- export {};
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import type { ThemeModes } from '@atlaskit/theme/types';
3
- export declare function PortalProviderThemeProviders(props: {
4
- mode: ThemeModes;
5
- children: React.ReactNode;
6
- }): JSX.Element;
@@ -1,51 +0,0 @@
1
- import React from 'react';
2
- import { EventDispatcher } from '../../event-dispatcher';
3
- import { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
4
- import { IntlShape, WrappedComponentProps } from 'react-intl-next';
5
- import type { ThemeModes } from '@atlaskit/theme/types';
6
- export type BasePortalProviderProps = {
7
- render: (portalProviderAPI: PortalProviderAPI) => React.ReactChild | JSX.Element | null;
8
- onAnalyticsEvent?: FireAnalyticsCallback;
9
- useAnalyticsContext?: boolean;
10
- themeMode?: ThemeModes;
11
- } & WrappedComponentProps;
12
- export type Portals = Map<HTMLElement, React.ReactChild>;
13
- export type PortalRendererState = {
14
- portals: Portals;
15
- };
16
- type MountedPortal = {
17
- children: () => React.ReactChild | null;
18
- hasAnalyticsContext: boolean;
19
- hasIntlContext: boolean;
20
- };
21
- export declare class PortalProviderAPI extends EventDispatcher {
22
- portals: Map<HTMLElement, MountedPortal>;
23
- context: any;
24
- intl: IntlShape;
25
- onAnalyticsEvent?: FireAnalyticsCallback;
26
- useAnalyticsContext?: boolean;
27
- themeMode?: ThemeModes;
28
- constructor(intl: IntlShape, onAnalyticsEvent?: FireAnalyticsCallback, analyticsContext?: boolean, themeMode?: ThemeModes);
29
- setContext: (context: any) => void;
30
- render(children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, hasAnalyticsContext?: boolean, hasIntlContext?: boolean): void;
31
- forceUpdate({ intl, themeMode, }: {
32
- intl: IntlShape;
33
- themeMode: ThemeModes | undefined;
34
- }): void;
35
- remove(container: HTMLElement): void;
36
- }
37
- export declare const PortalProvider: React.FC<import("react-intl-next").WithIntlProps<BasePortalProviderProps>> & {
38
- WrappedComponent: React.ComponentType<BasePortalProviderProps>;
39
- };
40
- type PortalProviderWithThemeProvidersProps = Omit<BasePortalProviderProps, 'intl' | 'themeMode'>;
41
- export declare const PortalProviderWithThemeProviders: ({ onAnalyticsEvent, useAnalyticsContext, render, }: PortalProviderWithThemeProvidersProps) => JSX.Element;
42
- export declare class PortalRenderer extends React.Component<{
43
- portalProviderAPI: PortalProviderAPI;
44
- }, PortalRendererState> {
45
- constructor(props: {
46
- portalProviderAPI: PortalProviderAPI;
47
- });
48
- handleUpdate: (portals: Portals) => void;
49
- render(): JSX.Element;
50
- }
51
- export {};
@@ -1,52 +0,0 @@
1
- import React from 'react';
2
- import { NodeView, EditorView, Decoration } from 'prosemirror-view';
3
- import { Node as PMNode } from 'prosemirror-model';
4
- import { PortalProviderAPI } from '../ui/PortalProvider';
5
- import { EventDispatcher } from '../event-dispatcher';
6
- import { ReactComponentProps, shouldUpdate, getPosHandler, ForwardRef } from './types';
7
- export default class ReactNodeView<P = ReactComponentProps> implements NodeView {
8
- private domRef?;
9
- private contentDOMWrapper?;
10
- private reactComponent?;
11
- private portalProviderAPI;
12
- private hasAnalyticsContext;
13
- private _viewShouldUpdate?;
14
- protected eventDispatcher?: EventDispatcher;
15
- private hasIntlContext;
16
- reactComponentProps: P;
17
- view: EditorView;
18
- getPos: getPosHandler;
19
- contentDOM: Node | undefined;
20
- node: PMNode;
21
- constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps?: P, reactComponent?: React.ComponentType<any>, hasAnalyticsContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean);
22
- /**
23
- * This method exists to move initialization logic out of the constructor,
24
- * so object can be initialized properly before calling render first time.
25
- *
26
- * Example:
27
- * Instance properties get added to an object only after super call in
28
- * constructor, which leads to some methods being undefined during the
29
- * first render.
30
- */
31
- init(): this;
32
- private renderReactComponent;
33
- createDomRef(): HTMLElement;
34
- getContentDOM(): {
35
- dom: Node;
36
- contentDOM?: Node | null | undefined;
37
- } | undefined;
38
- handleRef: (node: HTMLElement | null) => void;
39
- private _handleRef;
40
- render(props: P, forwardRef?: ForwardRef): React.ReactElement<any> | null;
41
- update(node: PMNode, _decorations: Array<Decoration>, _innerDecorations?: Array<Decoration>, validUpdate?: (currentNode: PMNode, newNode: PMNode) => boolean): boolean;
42
- viewShouldUpdate(nextNode: PMNode): boolean;
43
- /**
44
- * Copies the attributes from a ProseMirror Node to a DOM node.
45
- * @param node The Prosemirror Node from which to source the attributes
46
- */
47
- setDomAttrs(node: PMNode, element: HTMLElement): void;
48
- get dom(): HTMLElement | undefined;
49
- destroy(): void;
50
- private dispatchAnalyticsEvent;
51
- static fromComponent(component: React.ComponentType<any>, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, props?: ReactComponentProps, viewShouldUpdate?: (nextNode: PMNode) => boolean, hasIntlContext?: boolean): (node: PMNode, view: EditorView, getPos: getPosHandler) => ReactNodeView<ReactComponentProps>;
52
- }
@@ -1,53 +0,0 @@
1
- import React from 'react';
2
- import { EditorView } from 'prosemirror-view';
3
- import { Node as PMNode } from 'prosemirror-model';
4
- import { PortalProviderAPI } from '../ui/PortalProvider';
5
- import { EventDispatcher } from '../event-dispatcher';
6
- import { ReactComponentProps, shouldUpdate, getPosHandler } from './types';
7
- import ReactNodeView from './ReactNodeView';
8
- /**
9
- * A ReactNodeView that handles React components sensitive
10
- * to selection changes.
11
- *
12
- * If the selection changes, it will attempt to re-render the
13
- * React component. Otherwise it does nothing.
14
- *
15
- * You can subclass `viewShouldUpdate` to include other
16
- * props that your component might want to consider before
17
- * entering the React lifecycle. These are usually props you
18
- * compare in `shouldComponentUpdate`.
19
- *
20
- * An example:
21
- *
22
- * ```
23
- * viewShouldUpdate(nextNode) {
24
- * if (nextNode.attrs !== this.node.attrs) {
25
- * return true;
26
- * }
27
- *
28
- * return super.viewShouldUpdate(nextNode);
29
- * }```
30
- */
31
- export declare class SelectionBasedNodeView<P = ReactComponentProps> extends ReactNodeView<P> {
32
- private oldSelection;
33
- private selectionChangeState;
34
- pos: number | undefined;
35
- posEnd: number | undefined;
36
- constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps: P, reactComponent?: React.ComponentType<any>, hasContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean);
37
- /**
38
- * Update current node's start and end positions.
39
- *
40
- * Prefer `this.pos` rather than getPos(), because calling getPos is
41
- * expensive, unless you know you're definitely going to render.
42
- */
43
- private updatePos;
44
- private getPositionsWithDefault;
45
- isNodeInsideSelection: (from: number, to: number, pos?: number, posEnd?: number) => boolean;
46
- isSelectionInsideNode: (from: number, to: number, pos?: number, posEnd?: number) => boolean;
47
- private isSelectedNode;
48
- insideSelection: () => boolean;
49
- nodeInsideSelection: () => boolean;
50
- viewShouldUpdate(_nextNode: PMNode): boolean;
51
- destroy(): void;
52
- private onSelectionChange;
53
- }
@@ -1,13 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from 'prosemirror-state';
3
- type StateChangeHandler = (fromPos: number, toPos: number) => any;
4
- export declare class ReactNodeViewState {
5
- private changeHandlers;
6
- constructor();
7
- subscribe(cb: StateChangeHandler): void;
8
- unsubscribe(cb: StateChangeHandler): void;
9
- notifyNewSelection(fromPos: number, toPos: number): void;
10
- }
11
- export declare const stateKey: PluginKey<ReactNodeViewState, any>;
12
- export declare const plugin: SafePlugin<ReactNodeViewState, any>;
13
- export {};
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import type { ThemeModes } from '@atlaskit/theme/types';
3
- export declare function PortalProviderThemeProviders(props: {
4
- mode: ThemeModes;
5
- children: React.ReactNode;
6
- }): JSX.Element;
@@ -1,51 +0,0 @@
1
- import React from 'react';
2
- import { EventDispatcher } from '../../event-dispatcher';
3
- import { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
4
- import { IntlShape, WrappedComponentProps } from 'react-intl-next';
5
- import type { ThemeModes } from '@atlaskit/theme/types';
6
- export type BasePortalProviderProps = {
7
- render: (portalProviderAPI: PortalProviderAPI) => React.ReactChild | JSX.Element | null;
8
- onAnalyticsEvent?: FireAnalyticsCallback;
9
- useAnalyticsContext?: boolean;
10
- themeMode?: ThemeModes;
11
- } & WrappedComponentProps;
12
- export type Portals = Map<HTMLElement, React.ReactChild>;
13
- export type PortalRendererState = {
14
- portals: Portals;
15
- };
16
- type MountedPortal = {
17
- children: () => React.ReactChild | null;
18
- hasAnalyticsContext: boolean;
19
- hasIntlContext: boolean;
20
- };
21
- export declare class PortalProviderAPI extends EventDispatcher {
22
- portals: Map<HTMLElement, MountedPortal>;
23
- context: any;
24
- intl: IntlShape;
25
- onAnalyticsEvent?: FireAnalyticsCallback;
26
- useAnalyticsContext?: boolean;
27
- themeMode?: ThemeModes;
28
- constructor(intl: IntlShape, onAnalyticsEvent?: FireAnalyticsCallback, analyticsContext?: boolean, themeMode?: ThemeModes);
29
- setContext: (context: any) => void;
30
- render(children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, hasAnalyticsContext?: boolean, hasIntlContext?: boolean): void;
31
- forceUpdate({ intl, themeMode, }: {
32
- intl: IntlShape;
33
- themeMode: ThemeModes | undefined;
34
- }): void;
35
- remove(container: HTMLElement): void;
36
- }
37
- export declare const PortalProvider: React.FC<import("react-intl-next").WithIntlProps<BasePortalProviderProps>> & {
38
- WrappedComponent: React.ComponentType<BasePortalProviderProps>;
39
- };
40
- type PortalProviderWithThemeProvidersProps = Omit<BasePortalProviderProps, 'intl' | 'themeMode'>;
41
- export declare const PortalProviderWithThemeProviders: ({ onAnalyticsEvent, useAnalyticsContext, render, }: PortalProviderWithThemeProvidersProps) => JSX.Element;
42
- export declare class PortalRenderer extends React.Component<{
43
- portalProviderAPI: PortalProviderAPI;
44
- }, PortalRendererState> {
45
- constructor(props: {
46
- portalProviderAPI: PortalProviderAPI;
47
- });
48
- handleUpdate: (portals: Portals) => void;
49
- render(): JSX.Element;
50
- }
51
- export {};