@atlaskit/editor-core 164.0.3 → 166.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 +43 -0
- package/dist/cjs/actions/index.js +9 -0
- package/dist/cjs/create-editor/ReactEditorView.js +14 -6
- package/dist/cjs/create-editor/create-plugins-list.js +1 -2
- package/dist/cjs/editor.js +32 -1
- package/dist/cjs/event-dispatcher/index.js +9 -0
- package/dist/cjs/nodeviews/ReactNodeView.js +1 -11
- package/dist/cjs/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
- package/dist/cjs/nodeviews/getPerformanceOptions.js +1 -1
- package/dist/cjs/plugins/analytics/types/enums.js +1 -0
- package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +128 -79
- package/dist/cjs/plugins/base/utils/input-latency-tracking.js +157 -0
- package/dist/cjs/plugins/card/styles.js +3 -1
- package/dist/cjs/plugins/code-block/styles.js +6 -4
- package/dist/cjs/plugins/collab-edit/plugin-state.js +23 -5
- package/dist/cjs/plugins/date/styles.js +3 -1
- package/dist/cjs/plugins/emoji/index.js +30 -34
- package/dist/cjs/plugins/emoji/nodeviews/emoji.js +12 -66
- package/dist/cjs/plugins/emoji/styles.js +3 -17
- package/dist/cjs/plugins/expand/ui/styles.js +2 -2
- package/dist/cjs/plugins/extension/ui/styles.js +3 -1
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +20 -22
- package/dist/cjs/plugins/hyperlink/pm-plugins/input-rule.js +1 -9
- package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +1 -9
- package/dist/cjs/plugins/layout/styles.js +3 -1
- package/dist/cjs/plugins/list/commands/indent-list.js +5 -1
- package/dist/cjs/plugins/list/commands/outdent-list.js +5 -1
- package/dist/cjs/plugins/list/transforms.js +11 -3
- package/dist/cjs/plugins/media/styles.js +3 -1
- package/dist/cjs/plugins/mentions/index.js +10 -14
- package/dist/cjs/plugins/mentions/nodeviews/mention.js +15 -67
- package/dist/cjs/plugins/mentions/pm-plugins/main.js +19 -10
- package/dist/cjs/plugins/mentions/type-ahead/index.js +7 -2
- package/dist/cjs/plugins/panel/styles.js +3 -1
- package/dist/cjs/plugins/placeholder-text/placeholder-text-nodeview.js +3 -1
- package/dist/cjs/plugins/rule/styles.js +3 -1
- package/dist/cjs/plugins/selection/utils.js +39 -23
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +24 -0
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/ui/consts.js +6 -4
- package/dist/cjs/plugins/tasks-and-decisions/styles.js +3 -1
- package/dist/cjs/plugins/type-ahead/index.js +6 -2
- package/dist/cjs/plugins/unsupported-content/index.js +22 -10
- package/dist/cjs/plugins/unsupported-content/styles.js +4 -2
- package/dist/cjs/plugins/unsupported-content/unsupported-inline-node-view.js +21 -0
- package/dist/cjs/ui/Appearance/Chromeless.js +6 -3
- package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -4
- package/dist/cjs/ui/ChromeCollapsed/styles.js +3 -1
- package/dist/cjs/ui/ContentStyles/index.js +2 -2
- package/dist/cjs/ui/PortalProvider/PortalProviderThemesProvider.js +57 -0
- package/dist/cjs/ui/PortalProvider/index.js +66 -19
- package/dist/cjs/utils/check-if-mobile-bridge.js +19 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +12 -1
- package/dist/es2019/create-editor/ReactEditorView.js +14 -6
- package/dist/es2019/create-editor/create-plugins-list.js +1 -2
- package/dist/es2019/editor.js +33 -2
- package/dist/es2019/event-dispatcher/index.js +8 -0
- package/dist/es2019/nodeviews/ReactNodeView.js +1 -10
- package/dist/es2019/nodeviews/getInlineNodeViewProducer.styles.js +9 -0
- package/dist/es2019/plugins/analytics/types/enums.js +1 -0
- package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +138 -80
- package/dist/es2019/plugins/base/utils/input-latency-tracking.js +128 -0
- package/dist/es2019/plugins/card/styles.js +9 -5
- package/dist/es2019/plugins/code-block/styles.js +11 -8
- package/dist/es2019/plugins/collab-edit/plugin-state.js +23 -8
- package/dist/es2019/plugins/date/styles.js +3 -1
- package/dist/es2019/plugins/emoji/index.js +16 -21
- package/dist/es2019/plugins/emoji/nodeviews/emoji.js +12 -31
- package/dist/es2019/plugins/emoji/styles.js +1 -82
- package/dist/es2019/plugins/expand/ui/styles.js +2 -2
- package/dist/es2019/plugins/extension/ui/styles.js +4 -2
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +20 -22
- package/dist/es2019/plugins/hyperlink/pm-plugins/input-rule.js +1 -8
- package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -8
- package/dist/es2019/plugins/layout/styles.js +3 -2
- package/dist/es2019/plugins/list/commands/indent-list.js +4 -1
- package/dist/es2019/plugins/list/commands/outdent-list.js +4 -1
- package/dist/es2019/plugins/list/transforms.js +9 -4
- package/dist/es2019/plugins/media/styles.js +9 -7
- package/dist/es2019/plugins/mentions/index.js +1 -6
- package/dist/es2019/plugins/mentions/nodeviews/mention.js +16 -35
- package/dist/es2019/plugins/mentions/pm-plugins/main.js +18 -10
- package/dist/es2019/plugins/mentions/type-ahead/index.js +7 -2
- package/dist/es2019/plugins/panel/styles.js +5 -4
- package/dist/es2019/plugins/placeholder-text/placeholder-text-nodeview.js +3 -1
- package/dist/es2019/plugins/rule/styles.js +2 -1
- package/dist/es2019/plugins/selection/utils.js +35 -20
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +22 -0
- package/dist/es2019/plugins/table/ui/common-styles.js +4 -0
- package/dist/es2019/plugins/table/ui/consts.js +5 -4
- package/dist/es2019/plugins/tasks-and-decisions/styles.js +4 -2
- package/dist/es2019/plugins/type-ahead/index.js +5 -1
- package/dist/es2019/plugins/unsupported-content/index.js +23 -12
- package/dist/es2019/plugins/unsupported-content/styles.js +5 -3
- package/dist/es2019/plugins/unsupported-content/unsupported-inline-node-view.js +7 -0
- package/dist/es2019/ui/Appearance/Chromeless.js +5 -2
- package/dist/es2019/ui/Appearance/Comment/Comment.js +5 -2
- package/dist/es2019/ui/ChromeCollapsed/styles.js +2 -1
- package/dist/es2019/ui/ContentStyles/index.js +3 -3
- package/dist/es2019/ui/PortalProvider/PortalProviderThemesProvider.js +39 -0
- package/dist/es2019/ui/PortalProvider/index.js +39 -3
- package/dist/es2019/utils/check-if-mobile-bridge.js +12 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +8 -0
- package/dist/esm/create-editor/ReactEditorView.js +14 -6
- package/dist/esm/create-editor/create-plugins-list.js +1 -2
- package/dist/esm/editor.js +33 -2
- package/dist/esm/event-dispatcher/index.js +9 -0
- package/dist/esm/nodeviews/ReactNodeView.js +1 -10
- package/dist/esm/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
- package/dist/esm/plugins/analytics/types/enums.js +1 -0
- package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +128 -79
- package/dist/esm/plugins/base/utils/input-latency-tracking.js +149 -0
- package/dist/esm/plugins/card/styles.js +2 -1
- package/dist/esm/plugins/code-block/styles.js +5 -4
- package/dist/esm/plugins/collab-edit/plugin-state.js +21 -6
- package/dist/esm/plugins/date/styles.js +2 -1
- package/dist/esm/plugins/emoji/index.js +26 -29
- package/dist/esm/plugins/emoji/nodeviews/emoji.js +11 -56
- package/dist/esm/plugins/emoji/styles.js +3 -14
- package/dist/esm/plugins/expand/ui/styles.js +2 -2
- package/dist/esm/plugins/extension/ui/styles.js +2 -1
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +20 -22
- package/dist/esm/plugins/hyperlink/pm-plugins/input-rule.js +1 -8
- package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -8
- package/dist/esm/plugins/layout/styles.js +2 -1
- package/dist/esm/plugins/list/commands/indent-list.js +4 -1
- package/dist/esm/plugins/list/commands/outdent-list.js +4 -1
- package/dist/esm/plugins/list/transforms.js +9 -4
- package/dist/esm/plugins/media/styles.js +2 -1
- package/dist/esm/plugins/mentions/index.js +10 -14
- package/dist/esm/plugins/mentions/nodeviews/mention.js +13 -58
- package/dist/esm/plugins/mentions/pm-plugins/main.js +18 -10
- package/dist/esm/plugins/mentions/type-ahead/index.js +7 -2
- package/dist/esm/plugins/panel/styles.js +2 -1
- package/dist/esm/plugins/placeholder-text/placeholder-text-nodeview.js +3 -1
- package/dist/esm/plugins/rule/styles.js +2 -1
- package/dist/esm/plugins/selection/utils.js +35 -20
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +23 -0
- package/dist/esm/plugins/table/ui/common-styles.js +1 -1
- package/dist/esm/plugins/table/ui/consts.js +5 -4
- package/dist/esm/plugins/tasks-and-decisions/styles.js +2 -1
- package/dist/esm/plugins/type-ahead/index.js +6 -2
- package/dist/esm/plugins/unsupported-content/index.js +21 -11
- package/dist/esm/plugins/unsupported-content/styles.js +3 -2
- package/dist/esm/plugins/unsupported-content/unsupported-inline-node-view.js +7 -0
- package/dist/esm/ui/Appearance/Chromeless.js +6 -3
- package/dist/esm/ui/Appearance/Comment/Comment.js +6 -4
- package/dist/esm/ui/ChromeCollapsed/styles.js +2 -1
- package/dist/esm/ui/ContentStyles/index.js +3 -3
- package/dist/esm/ui/PortalProvider/PortalProviderThemesProvider.js +39 -0
- package/dist/esm/ui/PortalProvider/index.js +61 -19
- package/dist/esm/utils/check-if-mobile-bridge.js +12 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +3 -1
- package/dist/types/editor.d.ts +3 -0
- package/dist/types/event-dispatcher/index.d.ts +1 -0
- package/dist/types/nodeviews/ReactNodeView.d.ts +1 -5
- package/dist/types/plugins/analytics/types/enums.d.ts +1 -0
- package/dist/types/plugins/analytics/types/events.d.ts +2 -2
- package/dist/types/plugins/analytics/types/general-events.d.ts +10 -1
- package/dist/types/plugins/base/utils/input-latency-tracking.d.ts +44 -0
- package/dist/types/plugins/collab-edit/plugin-state.d.ts +4 -0
- package/dist/types/plugins/emoji/index.d.ts +2 -6
- package/dist/types/plugins/emoji/nodeviews/emoji.d.ts +4 -14
- package/dist/types/plugins/emoji/styles.d.ts +0 -1
- package/dist/types/plugins/emoji/types.d.ts +0 -1
- package/dist/types/plugins/list/transforms.d.ts +10 -1
- package/dist/types/plugins/mentions/nodeviews/mention.d.ts +6 -14
- package/dist/types/plugins/mentions/pm-plugins/main.d.ts +2 -5
- package/dist/types/plugins/selection/utils.d.ts +7 -15
- package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +3 -0
- package/dist/types/plugins/table/ui/consts.d.ts +2 -2
- package/dist/types/plugins/type-ahead/types.d.ts +1 -0
- package/dist/types/plugins/unsupported-content/unsupported-inline-node-view.d.ts +11 -0
- package/dist/types/types/editor-appearance-component.d.ts +1 -0
- package/dist/types/types/editor-props.d.ts +1 -0
- package/dist/types/types/feature-flags.d.ts +0 -14
- package/dist/types/ui/Appearance/Chromeless.d.ts +1 -0
- package/dist/types/ui/Appearance/Comment/Comment.d.ts +1 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +5 -5
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/PortalProvider/PortalProviderThemesProvider.d.ts +6 -0
- package/dist/types/ui/PortalProvider/index.d.ts +5 -1
- package/dist/types/utils/check-if-mobile-bridge.d.ts +1 -0
- package/package.json +24 -23
- package/dist/cjs/plugins/emoji/nodeviews/emoji-next.js +0 -250
- package/dist/es2019/plugins/emoji/nodeviews/emoji-next.js +0 -177
- package/dist/esm/plugins/emoji/nodeviews/emoji-next.js +0 -234
- package/dist/types/plugins/emoji/nodeviews/emoji-next.d.ts +0 -31
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.PortalRenderer = exports.PortalProviderAPI = exports.PortalProvider = void 0;
|
|
8
|
+
exports.PortalRenderer = exports.PortalProviderWithThemeProviders = exports.PortalProviderAPI = exports.PortalProvider = void 0;
|
|
9
9
|
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
|
|
@@ -37,6 +37,10 @@ var _enums = require("../../plugins/analytics/types/enums");
|
|
|
37
37
|
|
|
38
38
|
var _reactIntlNext = require("react-intl-next");
|
|
39
39
|
|
|
40
|
+
var _components = require("@atlaskit/theme/components");
|
|
41
|
+
|
|
42
|
+
var _PortalProviderThemesProvider = require("./PortalProviderThemesProvider");
|
|
43
|
+
|
|
40
44
|
var _class;
|
|
41
45
|
|
|
42
46
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
@@ -48,7 +52,7 @@ var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
48
52
|
|
|
49
53
|
var _super = _createSuper(PortalProviderAPI);
|
|
50
54
|
|
|
51
|
-
function PortalProviderAPI(intl, onAnalyticsEvent, analyticsContext) {
|
|
55
|
+
function PortalProviderAPI(intl, onAnalyticsEvent, analyticsContext, themeMode) {
|
|
52
56
|
var _this;
|
|
53
57
|
|
|
54
58
|
(0, _classCallCheck2.default)(this, PortalProviderAPI);
|
|
@@ -60,14 +64,43 @@ var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
60
64
|
_this.intl = intl;
|
|
61
65
|
_this.onAnalyticsEvent = onAnalyticsEvent;
|
|
62
66
|
_this.useAnalyticsContext = analyticsContext;
|
|
67
|
+
_this.themeMode = themeMode;
|
|
63
68
|
return _this;
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
(0, _createClass2.default)(PortalProviderAPI, [{
|
|
67
72
|
key: "render",
|
|
68
73
|
value: function render(children, container) {
|
|
74
|
+
var _this2 = this;
|
|
75
|
+
|
|
69
76
|
var hasAnalyticsContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
70
77
|
var hasIntlContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
78
|
+
|
|
79
|
+
if (this.themeMode) {
|
|
80
|
+
var childrenWithThemeProviders = function childrenWithThemeProviders() {
|
|
81
|
+
return /*#__PURE__*/_react.default.createElement(_PortalProviderThemesProvider.PortalProviderThemeProviders, {
|
|
82
|
+
mode: _this2.themeMode
|
|
83
|
+
}, children());
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
this.portals.set(container, {
|
|
87
|
+
children: childrenWithThemeProviders,
|
|
88
|
+
hasAnalyticsContext: hasAnalyticsContext,
|
|
89
|
+
hasIntlContext: hasIntlContext
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
var _wrappedChildren = this.useAnalyticsContext ? /*#__PURE__*/_react.default.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders()) : childrenWithThemeProviders();
|
|
93
|
+
|
|
94
|
+
if (hasIntlContext) {
|
|
95
|
+
_wrappedChildren = /*#__PURE__*/_react.default.createElement(_reactIntlNext.RawIntlProvider, {
|
|
96
|
+
value: this.intl
|
|
97
|
+
}, _wrappedChildren);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
(0, _reactDom.unstable_renderSubtreeIntoContainer)(this.context, _wrappedChildren, container);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
71
104
|
this.portals.set(container, {
|
|
72
105
|
children: children,
|
|
73
106
|
hasAnalyticsContext: hasAnalyticsContext,
|
|
@@ -89,28 +122,28 @@ var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
89
122
|
}, {
|
|
90
123
|
key: "forceUpdate",
|
|
91
124
|
value: function forceUpdate(_ref) {
|
|
92
|
-
var
|
|
125
|
+
var _this3 = this;
|
|
93
126
|
|
|
94
127
|
var intl = _ref.intl;
|
|
95
128
|
this.intl = intl;
|
|
96
129
|
this.portals.forEach(function (portal, container) {
|
|
97
|
-
if (!portal.hasAnalyticsContext && !
|
|
130
|
+
if (!portal.hasAnalyticsContext && !_this3.useAnalyticsContext && !portal.hasIntlContext) {
|
|
98
131
|
return;
|
|
99
132
|
}
|
|
100
133
|
|
|
101
134
|
var wrappedChildren = portal.children();
|
|
102
135
|
|
|
103
|
-
if (portal.hasAnalyticsContext &&
|
|
136
|
+
if (portal.hasAnalyticsContext && _this3.useAnalyticsContext) {
|
|
104
137
|
wrappedChildren = /*#__PURE__*/_react.default.createElement(AnalyticsContextWrapper, null, wrappedChildren);
|
|
105
138
|
}
|
|
106
139
|
|
|
107
140
|
if (portal.hasIntlContext) {
|
|
108
141
|
wrappedChildren = /*#__PURE__*/_react.default.createElement(_reactIntlNext.RawIntlProvider, {
|
|
109
|
-
value:
|
|
142
|
+
value: _this3.intl
|
|
110
143
|
}, wrappedChildren);
|
|
111
144
|
}
|
|
112
145
|
|
|
113
|
-
(0, _reactDom.unstable_renderSubtreeIntoContainer)(
|
|
146
|
+
(0, _reactDom.unstable_renderSubtreeIntoContainer)(_this3.context, wrappedChildren, container);
|
|
114
147
|
});
|
|
115
148
|
}
|
|
116
149
|
}, {
|
|
@@ -157,12 +190,12 @@ var BasePortalProvider = /*#__PURE__*/function (_React$Component) {
|
|
|
157
190
|
var _super2 = _createSuper(BasePortalProvider);
|
|
158
191
|
|
|
159
192
|
function BasePortalProvider(props) {
|
|
160
|
-
var
|
|
193
|
+
var _this4;
|
|
161
194
|
|
|
162
195
|
(0, _classCallCheck2.default)(this, BasePortalProvider);
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return
|
|
196
|
+
_this4 = _super2.call(this, props);
|
|
197
|
+
_this4.portalProviderAPI = new PortalProviderAPI(props.intl, props.onAnalyticsEvent, props.useAnalyticsContext, props.themeMode);
|
|
198
|
+
return _this4;
|
|
166
199
|
}
|
|
167
200
|
|
|
168
201
|
(0, _createClass2.default)(BasePortalProvider, [{
|
|
@@ -185,27 +218,41 @@ var BasePortalProvider = /*#__PURE__*/function (_React$Component) {
|
|
|
185
218
|
var PortalProvider = (0, _reactIntlNext.injectIntl)(BasePortalProvider);
|
|
186
219
|
exports.PortalProvider = PortalProvider;
|
|
187
220
|
|
|
221
|
+
var PortalProviderWithThemeProviders = function PortalProviderWithThemeProviders(props) {
|
|
222
|
+
var intl = (0, _reactIntlNext.useIntl)();
|
|
223
|
+
var globalTheme = (0, _components.useGlobalTheme)();
|
|
224
|
+
return /*#__PURE__*/_react.default.createElement(BasePortalProvider, {
|
|
225
|
+
intl: intl,
|
|
226
|
+
themeMode: globalTheme.mode,
|
|
227
|
+
onAnalyticsEvent: props.onAnalyticsEvent,
|
|
228
|
+
useAnalyticsContext: props.useAnalyticsContext,
|
|
229
|
+
render: props.render
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
exports.PortalProviderWithThemeProviders = PortalProviderWithThemeProviders;
|
|
234
|
+
|
|
188
235
|
var PortalRenderer = /*#__PURE__*/function (_React$Component2) {
|
|
189
236
|
(0, _inherits2.default)(PortalRenderer, _React$Component2);
|
|
190
237
|
|
|
191
238
|
var _super3 = _createSuper(PortalRenderer);
|
|
192
239
|
|
|
193
240
|
function PortalRenderer(props) {
|
|
194
|
-
var
|
|
241
|
+
var _this5;
|
|
195
242
|
|
|
196
243
|
(0, _classCallCheck2.default)(this, PortalRenderer);
|
|
197
|
-
|
|
198
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(
|
|
199
|
-
return
|
|
244
|
+
_this5 = _super3.call(this, props);
|
|
245
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this5), "handleUpdate", function (portals) {
|
|
246
|
+
return _this5.setState({
|
|
200
247
|
portals: portals
|
|
201
248
|
});
|
|
202
249
|
});
|
|
203
|
-
props.portalProviderAPI.setContext((0, _assertThisInitialized2.default)(
|
|
204
|
-
props.portalProviderAPI.on('update',
|
|
205
|
-
|
|
250
|
+
props.portalProviderAPI.setContext((0, _assertThisInitialized2.default)(_this5));
|
|
251
|
+
props.portalProviderAPI.on('update', _this5.handleUpdate);
|
|
252
|
+
_this5.state = {
|
|
206
253
|
portals: new Map()
|
|
207
254
|
};
|
|
208
|
-
return
|
|
255
|
+
return _this5;
|
|
209
256
|
}
|
|
210
257
|
|
|
211
258
|
(0, _createClass2.default)(PortalRenderer, [{
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.checkIfMobileBridge = checkIfMobileBridge;
|
|
7
|
+
|
|
8
|
+
function checkIfMobileBridge() {
|
|
9
|
+
/**
|
|
10
|
+
* This variable is setup on mobile prior to the editor being
|
|
11
|
+
* rendered.
|
|
12
|
+
*
|
|
13
|
+
* -- packages/editor/editor-mobile-bridge/src/editor/native-to-web/bridge-initialiser.ts
|
|
14
|
+
* - packages/editor/editor-mobile-bridge/src/__tests__/integration-webview/_mocks/editor-component.tsx
|
|
15
|
+
*/
|
|
16
|
+
var isMobileBridge = typeof window !== 'undefined' && 'bridge' in window && // @ts-ignore
|
|
17
|
+
'mediaMap' in window.bridge;
|
|
18
|
+
return isMobileBridge;
|
|
19
|
+
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "
|
|
9
|
+
var version = "166.0.0";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
|
|
12
12
|
var nextMajorVersion = function nextMajorVersion() {
|
package/dist/cjs/version.json
CHANGED
|
@@ -10,6 +10,7 @@ import { analyticsEventKey } from '@atlaskit/editor-common/utils';
|
|
|
10
10
|
import { findNodePosWithLocalId } from '../plugins/extension/utils';
|
|
11
11
|
import { getFeatureFlags } from '../plugins/feature-flags-context/get-feature-flags';
|
|
12
12
|
import { getCollabProvider } from '../plugins/collab-edit/native-collab-provider-plugin';
|
|
13
|
+
import deprecationWarnings from '../utils/deprecation-warnings';
|
|
13
14
|
export default class EditorActions {
|
|
14
15
|
constructor() {
|
|
15
16
|
_defineProperty(this, "listeners", []);
|
|
@@ -196,7 +197,17 @@ export default class EditorActions {
|
|
|
196
197
|
return isEmptyDocument(this.editorView.state.doc);
|
|
197
198
|
}
|
|
198
199
|
|
|
199
|
-
replaceDocument(rawValue, shouldScrollToBottom = true,
|
|
200
|
+
replaceDocument(rawValue, shouldScrollToBottom = true,
|
|
201
|
+
/** @deprecated [ED-14158] shouldAddToHistory is not being used in this function */
|
|
202
|
+
shouldAddToHistory = true) {
|
|
203
|
+
deprecationWarnings('EditorActions.replaceDocument', {
|
|
204
|
+
shouldAddToHistory
|
|
205
|
+
}, [{
|
|
206
|
+
property: 'shouldAddToHistory',
|
|
207
|
+
description: '[ED-14158] EditorActions.replaceDocument does not use the shouldAddToHistory arg',
|
|
208
|
+
type: 'removed'
|
|
209
|
+
}]);
|
|
210
|
+
|
|
200
211
|
if (!this.editorView || rawValue === undefined || rawValue === null) {
|
|
201
212
|
return false;
|
|
202
213
|
}
|
|
@@ -534,9 +534,20 @@ export class ReactEditorView extends React.Component {
|
|
|
534
534
|
config: this.config,
|
|
535
535
|
eventDispatcher: this.eventDispatcher,
|
|
536
536
|
transformer: this.contentTransformer
|
|
537
|
-
});
|
|
537
|
+
}); // Allows us to dispatch analytics within the plugin view.destory methods
|
|
538
|
+
|
|
539
|
+
const analyticsConnected = this.eventDispatcher.has(analyticsEventKey, this.handleAnalyticsEvent);
|
|
540
|
+
|
|
541
|
+
if (!analyticsConnected) {
|
|
542
|
+
this.eventDispatcher.on(analyticsEventKey, this.handleAnalyticsEvent);
|
|
543
|
+
}
|
|
544
|
+
|
|
538
545
|
this.view.destroy(); // Destroys the dom node & all node views
|
|
539
546
|
|
|
547
|
+
if (!analyticsConnected) {
|
|
548
|
+
this.eventDispatcher.off(analyticsEventKey, this.handleAnalyticsEvent);
|
|
549
|
+
}
|
|
550
|
+
|
|
540
551
|
this.view = undefined;
|
|
541
552
|
}
|
|
542
553
|
});
|
|
@@ -667,7 +678,6 @@ export class ReactEditorView extends React.Component {
|
|
|
667
678
|
// This serves to avoid potential runtime exceptions which could arise
|
|
668
679
|
// from an async dispatched transaction after it's unmounted.
|
|
669
680
|
this.canDispatchTransactions = false;
|
|
670
|
-
this.eventDispatcher.destroy();
|
|
671
681
|
clearTimeout(this.focusTimeoutId);
|
|
672
682
|
|
|
673
683
|
if (this.reliabilityInterval) {
|
|
@@ -686,11 +696,9 @@ export class ReactEditorView extends React.Component {
|
|
|
686
696
|
state.destroy();
|
|
687
697
|
}
|
|
688
698
|
});
|
|
689
|
-
}
|
|
690
|
-
|
|
699
|
+
}
|
|
691
700
|
|
|
692
|
-
this.eventDispatcher.
|
|
693
|
-
this.eventDispatcher.off('resetEditorState', this.resetEditorState);
|
|
701
|
+
this.eventDispatcher.destroy(); // this.view will be destroyed when React unmounts in handleEditorViewRef
|
|
694
702
|
} // Helper to allow tests to inject plugins directly
|
|
695
703
|
|
|
696
704
|
|
|
@@ -192,8 +192,7 @@ export default function createPluginsList(props, prevProps, createAnalyticsEvent
|
|
|
192
192
|
|
|
193
193
|
if (props.emojiProvider) {
|
|
194
194
|
preset.add([emojiPlugin, {
|
|
195
|
-
createAnalyticsEvent
|
|
196
|
-
allowZeroWidthSpaceAfter: !isMobile
|
|
195
|
+
createAnalyticsEvent
|
|
197
196
|
}]);
|
|
198
197
|
}
|
|
199
198
|
|
package/dist/es2019/editor.js
CHANGED
|
@@ -18,7 +18,7 @@ import { getUiComponent } from './create-editor';
|
|
|
18
18
|
import EditorActions from './actions';
|
|
19
19
|
import { ReactEditorView } from './create-editor';
|
|
20
20
|
import EditorContext from './ui/EditorContext';
|
|
21
|
-
import { PortalProvider, PortalRenderer } from './ui/PortalProvider';
|
|
21
|
+
import { PortalProvider, PortalProviderWithThemeProviders, PortalRenderer } from './ui/PortalProvider';
|
|
22
22
|
import { nextMajorVersion } from './version-wrapper';
|
|
23
23
|
import { ContextAdapter } from './nodeviews/context-adapter';
|
|
24
24
|
import measurements from './utils/performance/measure-enum';
|
|
@@ -27,6 +27,7 @@ import { fireAnalyticsEvent, EVENT_TYPE, ACTION_SUBJECT, ACTION } from './plugin
|
|
|
27
27
|
import ErrorBoundary from './create-editor/ErrorBoundary';
|
|
28
28
|
import { createFeatureFlagsFromProps } from './plugins/feature-flags-context/feature-flags-from-props';
|
|
29
29
|
import { RenderTracking } from './utils/performance/components/RenderTracking';
|
|
30
|
+
import { checkIfMobileBridge } from './utils/check-if-mobile-bridge';
|
|
30
31
|
const fullHeight = css`
|
|
31
32
|
height: 100%;
|
|
32
33
|
`;
|
|
@@ -423,6 +424,22 @@ export default class Editor extends React.Component {
|
|
|
423
424
|
const renderTracking = (_this$props$performan3 = this.props.performanceTracking) === null || _this$props$performan3 === void 0 ? void 0 : (_this$props$performan4 = _this$props$performan3.renderTracking) === null || _this$props$performan4 === void 0 ? void 0 : _this$props$performan4.editor;
|
|
424
425
|
const renderTrackingEnabled = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.enabled;
|
|
425
426
|
const useShallow = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.useShallow;
|
|
427
|
+
/**
|
|
428
|
+
* The PortalProviderWithThemeProviders renders portals with atlaskit
|
|
429
|
+
* and the deprecated styled components theme providers.
|
|
430
|
+
*
|
|
431
|
+
* Without this the node views react trees;
|
|
432
|
+
* - do not have access to the atlaskit theme via the `useGlobalTheme` hook
|
|
433
|
+
* - do not have access to the theme when using the `styled`${({theme}) => theme.}` api.
|
|
434
|
+
*
|
|
435
|
+
* Added for a mobile regression, which needed to be fixed on master.
|
|
436
|
+
* Once this makes it's way to develop, we should consider making it the default
|
|
437
|
+
* behaviour.
|
|
438
|
+
*
|
|
439
|
+
* https://product-fabric.atlassian.net/browse/ED-14204
|
|
440
|
+
*/
|
|
441
|
+
|
|
442
|
+
const EnvironmentDrivenPortalProvider = checkIfMobileBridge() ? PortalProviderWithThemeProviders : PortalProvider;
|
|
426
443
|
return jsx(FabricEditorAnalyticsContext, {
|
|
427
444
|
data: {
|
|
428
445
|
packageName: name,
|
|
@@ -446,7 +463,7 @@ export default class Editor extends React.Component {
|
|
|
446
463
|
css: fullHeight
|
|
447
464
|
}, jsx(EditorContext, {
|
|
448
465
|
editorActions: this.editorActions
|
|
449
|
-
}, jsx(ContextAdapter, null, jsx(
|
|
466
|
+
}, jsx(ContextAdapter, null, jsx(EnvironmentDrivenPortalProvider, {
|
|
450
467
|
onAnalyticsEvent: this.handleAnalyticsEvent,
|
|
451
468
|
useAnalyticsContext: this.props.UNSAFE_useAnalyticsContext,
|
|
452
469
|
render: portalProviderAPI => jsx(Fragment, null, jsx(ReactEditorView, {
|
|
@@ -480,6 +497,7 @@ export default class Editor extends React.Component {
|
|
|
480
497
|
eventDispatcher: eventDispatcher,
|
|
481
498
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
482
499
|
maxHeight: this.props.maxHeight,
|
|
500
|
+
minHeight: this.props.minHeight,
|
|
483
501
|
onSave: this.props.onSave ? this.handleSave : undefined,
|
|
484
502
|
onCancel: this.props.onCancel,
|
|
485
503
|
popupsMountPoint: this.props.popupsMountPoint,
|
|
@@ -519,6 +537,19 @@ _defineProperty(Editor, "defaultProps", {
|
|
|
519
537
|
quickInsert: true
|
|
520
538
|
});
|
|
521
539
|
|
|
540
|
+
_defineProperty(Editor, "propTypes", {
|
|
541
|
+
minHeight: ({
|
|
542
|
+
appearance,
|
|
543
|
+
minHeight
|
|
544
|
+
}) => {
|
|
545
|
+
if (minHeight && appearance && !['comment', 'chromeless'].includes(appearance)) {
|
|
546
|
+
return new Error('minHeight only supports editor appearance chromeless and comment');
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
return null;
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
|
|
522
553
|
_defineProperty(Editor, "contextTypes", {
|
|
523
554
|
editorActions: PropTypes.object
|
|
524
555
|
});
|
|
@@ -12,6 +12,14 @@ export class EventDispatcher {
|
|
|
12
12
|
this.listeners[event].add(cb);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
has(event, cb) {
|
|
16
|
+
if (!this.listeners[event]) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return this.listeners[event].has(cb);
|
|
21
|
+
}
|
|
22
|
+
|
|
15
23
|
off(event, cb) {
|
|
16
24
|
if (!this.listeners[event]) {
|
|
17
25
|
return;
|
|
@@ -4,7 +4,6 @@ import React from 'react';
|
|
|
4
4
|
import { createDispatch } from '../event-dispatcher';
|
|
5
5
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../plugins/analytics';
|
|
6
6
|
import { analyticsEventKey } from '../plugins/analytics/consts';
|
|
7
|
-
import { getFeatureFlags } from '../plugins/feature-flags-context';
|
|
8
7
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
9
8
|
import { getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from './getPerformanceOptions';
|
|
10
9
|
export default class ReactNodeView {
|
|
@@ -101,20 +100,12 @@ export default class ReactNodeView {
|
|
|
101
100
|
this.portalProviderAPI.render(componentWithErrorBoundary, this.domRef, this.hasAnalyticsContext, this.hasIntlContext);
|
|
102
101
|
}
|
|
103
102
|
|
|
104
|
-
createDomRef(
|
|
103
|
+
createDomRef() {
|
|
105
104
|
if (!this.node.isInline) {
|
|
106
105
|
return document.createElement('div');
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
const htmlElement = document.createElement('span');
|
|
110
|
-
const state = this.view.state;
|
|
111
|
-
const featureFlags = getFeatureFlags(state);
|
|
112
|
-
|
|
113
|
-
if (featureFlags && featureFlags.displayInlineBlockForInlineNodes && (options === null || options === void 0 ? void 0 : options.displayInlineBlockForInlineNodes) !== false) {
|
|
114
|
-
htmlElement.style.display = 'inline-block';
|
|
115
|
-
htmlElement.style.userSelect = 'all';
|
|
116
|
-
}
|
|
117
|
-
|
|
118
109
|
return htmlElement;
|
|
119
110
|
}
|
|
120
111
|
|
|
@@ -6,6 +6,15 @@ export const InlineNodeViewSharedStyles = css`
|
|
|
6
6
|
.inlineNodeView {
|
|
7
7
|
display: inline;
|
|
8
8
|
user-select: all;
|
|
9
|
+
/* Collapses zero width spaces inside the inline node view
|
|
10
|
+
to prevent the node from line breaking too early.
|
|
11
|
+
*/
|
|
12
|
+
white-space: nowrap;
|
|
13
|
+
/* Then reset to the Editor default so we don't interfere
|
|
14
|
+
with any component styling. */
|
|
15
|
+
& > * {
|
|
16
|
+
white-space: pre-wrap;
|
|
17
|
+
}
|
|
9
18
|
}
|
|
10
19
|
|
|
11
20
|
&.ua-chrome .inlineNodeView > span {
|
|
@@ -55,6 +55,7 @@ export let ACTION;
|
|
|
55
55
|
ACTION["INDENTED"] = "indented";
|
|
56
56
|
ACTION["INITIALISED"] = "initialised";
|
|
57
57
|
ACTION["INPUT_PERF_SAMPLING"] = "inputPerfSampling";
|
|
58
|
+
ACTION["INPUT_PERF_SAMPLING_AVG"] = "inputPerfSamplingAvg";
|
|
58
59
|
ACTION["INSERTED"] = "inserted";
|
|
59
60
|
ACTION["INVALID_DOCUMENT_ENCOUNTERED"] = "invalidDocumentEncountered";
|
|
60
61
|
ACTION["INVOKED"] = "invoked";
|