@atlaskit/editor-common 99.6.0 → 99.7.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 +24 -0
- package/dist/cjs/link/LinkSearch/index.js +1 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/react-node-view/getInlineNodeViewProducer.js +75 -19
- package/dist/cjs/react-node-view/onVisibleObserverFactory.js +48 -0
- package/dist/cjs/safe-plugin/index.js +1 -2
- package/dist/cjs/styles/shared/table.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/WithCreateAnalyticsEvent/index.js +1 -0
- package/dist/cjs/utils/compare-props.js +2 -2
- package/dist/cjs/utils/compareNodes.js +2 -2
- package/dist/cjs/utils/filter/privacy-filter.js +3 -3
- package/dist/cjs/utils/index.js +6 -6
- package/dist/cjs/utils/performance/measure-tti.js +3 -3
- package/dist/cjs/utils/track-unsupported-content.js +2 -2
- package/dist/cjs/utils/validator.js +3 -3
- package/dist/cjs/with-plugin-state/index.js +1 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/react-node-view/getInlineNodeViewProducer.js +79 -20
- package/dist/es2019/react-node-view/onVisibleObserverFactory.js +31 -0
- package/dist/es2019/safe-plugin/index.js +1 -2
- package/dist/es2019/styles/shared/table.js +2 -2
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/link/LinkSearch/index.js +1 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/react-node-view/getInlineNodeViewProducer.js +75 -19
- package/dist/esm/react-node-view/onVisibleObserverFactory.js +41 -0
- package/dist/esm/safe-plugin/index.js +1 -2
- package/dist/esm/styles/shared/table.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/WithCreateAnalyticsEvent/index.js +1 -0
- package/dist/esm/utils/compare-props.js +3 -2
- package/dist/esm/utils/compareNodes.js +2 -2
- package/dist/esm/utils/filter/privacy-filter.js +3 -3
- package/dist/esm/utils/index.js +6 -6
- package/dist/esm/utils/performance/measure-tti.js +3 -3
- package/dist/esm/utils/track-unsupported-content.js +3 -2
- package/dist/esm/utils/validator.js +3 -3
- package/dist/esm/with-plugin-state/index.js +1 -0
- package/dist/types/react-node-view/onVisibleObserverFactory.d.ts +8 -0
- package/dist/types-ts4.5/react-node-view/onVisibleObserverFactory.d.ts +8 -0
- package/package.json +8 -5
|
@@ -7,12 +7,18 @@ import React from 'react';
|
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { jsx } from '@emotion/react';
|
|
10
|
+
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
12
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
|
|
11
13
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
12
14
|
import { analyticsEventKey, browser, getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from '../utils';
|
|
13
15
|
import { ZERO_WIDTH_SPACE } from '../whitespace';
|
|
14
16
|
import { generateUniqueNodeKey } from './generateUniqueNodeKey';
|
|
17
|
+
import { getOrCreateOnVisibleObserver } from './onVisibleObserverFactory';
|
|
15
18
|
export const inlineNodeViewClassname = 'inlineNodeView';
|
|
19
|
+
const canRenderFallback = node => {
|
|
20
|
+
return node.type.isInline && node.type.isAtom && node.type.isLeaf;
|
|
21
|
+
};
|
|
16
22
|
function createNodeView({
|
|
17
23
|
nodeViewParams,
|
|
18
24
|
pmPluginFactoryParams,
|
|
@@ -20,6 +26,7 @@ function createNodeView({
|
|
|
20
26
|
extraComponentProps,
|
|
21
27
|
extraNodeViewProps
|
|
22
28
|
}) {
|
|
29
|
+
const shouldVirtualize = fg('platform_editor_lego__inline_node_virtualization');
|
|
23
30
|
// We set a variable for the current node which is
|
|
24
31
|
// used for comparisions when doing updates, before being
|
|
25
32
|
// overwritten to the updated node.
|
|
@@ -63,23 +70,62 @@ function createNodeView({
|
|
|
63
70
|
extraComponentProps
|
|
64
71
|
}), domRef, key);
|
|
65
72
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
let didRenderComponentWithIntersectionObserver = false;
|
|
74
|
+
let destroyed = false;
|
|
75
|
+
let removeIntersectionObserver = () => {};
|
|
76
|
+
function renderFallback() {
|
|
77
|
+
var _currentNode$type, _currentNode$type$spe;
|
|
78
|
+
if (canRenderFallback(currentNode) && typeof ((_currentNode$type = currentNode.type) === null || _currentNode$type === void 0 ? void 0 : (_currentNode$type$spe = _currentNode$type.spec) === null || _currentNode$type$spe === void 0 ? void 0 : _currentNode$type$spe.toDOM) === 'function') {
|
|
79
|
+
const fallback = DOMSerializer.renderSpec(document, currentNode.type.spec.toDOM(currentNode));
|
|
80
|
+
domRef.replaceChildren(fallback.dom);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function attachNodeViewObserver() {
|
|
84
|
+
const observer = getOrCreateOnVisibleObserver(nodeViewParams.view);
|
|
85
|
+
removeIntersectionObserver = observer.observe(domRef, () => {
|
|
86
|
+
if (!didRenderComponentWithIntersectionObserver && !destroyed) {
|
|
87
|
+
domRef.replaceChildren();
|
|
88
|
+
renderComponent();
|
|
89
|
+
didRenderComponentWithIntersectionObserver = true;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if (shouldVirtualize) {
|
|
94
|
+
renderFallback();
|
|
95
|
+
attachNodeViewObserver();
|
|
96
|
+
} else {
|
|
97
|
+
const {
|
|
98
|
+
samplingRate,
|
|
99
|
+
slowThreshold,
|
|
100
|
+
trackingEnabled
|
|
101
|
+
} = getPerformanceOptions(nodeViewParams.view);
|
|
102
|
+
trackingEnabled && startMeasureReactNodeViewRendered({
|
|
103
|
+
nodeTypeName: currentNode.type.name
|
|
104
|
+
});
|
|
74
105
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
106
|
+
// We render the component while creating the node view
|
|
107
|
+
renderComponent();
|
|
108
|
+
trackingEnabled && stopMeasureReactNodeViewRendered({
|
|
109
|
+
nodeTypeName: currentNode.type.name,
|
|
110
|
+
dispatchAnalyticsEvent,
|
|
111
|
+
samplingRate,
|
|
112
|
+
slowThreshold
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
const extraNodeViewPropsWithStopEvent = {
|
|
116
|
+
...extraNodeViewProps,
|
|
117
|
+
...(fg('platform_editor_lego__inline_node_virtualization') ? {
|
|
118
|
+
// This is not related to virtualization, but it's something we should fix/handle
|
|
119
|
+
// Remove this comment when `platform_editor_lego__inline_node_virtualization` FF is cleaned up
|
|
120
|
+
stopEvent(event) {
|
|
121
|
+
const maybeStopEvent = extraNodeViewProps === null || extraNodeViewProps === void 0 ? void 0 : extraNodeViewProps.stopEvent;
|
|
122
|
+
if (typeof maybeStopEvent === 'function') {
|
|
123
|
+
return maybeStopEvent(event);
|
|
124
|
+
}
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
} : {})
|
|
128
|
+
};
|
|
83
129
|
|
|
84
130
|
// https://prosemirror.net/docs/ref/#view.NodeView
|
|
85
131
|
const nodeView = {
|
|
@@ -111,10 +157,20 @@ function createNodeView({
|
|
|
111
157
|
setDomAttrs(nextNode, domRef);
|
|
112
158
|
}
|
|
113
159
|
currentNode = nextNode;
|
|
114
|
-
|
|
160
|
+
if (shouldVirtualize) {
|
|
161
|
+
if (didRenderComponentWithIntersectionObserver) {
|
|
162
|
+
renderComponent();
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
renderComponent();
|
|
166
|
+
}
|
|
115
167
|
return true;
|
|
116
168
|
},
|
|
117
169
|
destroy() {
|
|
170
|
+
if (shouldVirtualize) {
|
|
171
|
+
removeIntersectionObserver();
|
|
172
|
+
}
|
|
173
|
+
|
|
118
174
|
// When prosemirror destroys the node view, we need to clean up
|
|
119
175
|
// what we have previously rendered using the editor portal
|
|
120
176
|
// provider api.
|
|
@@ -123,8 +179,11 @@ function createNodeView({
|
|
|
123
179
|
// of HTMLSpanElement type however once the node view has
|
|
124
180
|
// been destroyed no other consumers should still be using it.
|
|
125
181
|
domRef = undefined;
|
|
182
|
+
if (shouldVirtualize) {
|
|
183
|
+
destroyed = true;
|
|
184
|
+
}
|
|
126
185
|
},
|
|
127
|
-
...
|
|
186
|
+
...extraNodeViewPropsWithStopEvent
|
|
128
187
|
};
|
|
129
188
|
return nodeView;
|
|
130
189
|
}
|
|
@@ -146,7 +205,7 @@ function getPortalChildren({
|
|
|
146
205
|
extraComponentProps
|
|
147
206
|
}) {
|
|
148
207
|
return function portalChildren() {
|
|
149
|
-
var _currentNode$type$nam, _currentNode$
|
|
208
|
+
var _currentNode$type$nam, _currentNode$type2;
|
|
150
209
|
// All inline nodes use `display: inline` to allow for multi-line
|
|
151
210
|
// wrapping. This does produce an issue in Chrome where it is not
|
|
152
211
|
// possible to click select the position after the node,
|
|
@@ -170,7 +229,7 @@ function getPortalChildren({
|
|
|
170
229
|
|
|
171
230
|
return jsx(ErrorBoundary, {
|
|
172
231
|
component: ACTION_SUBJECT.REACT_NODE_VIEW,
|
|
173
|
-
componentId: (_currentNode$type$nam = currentNode === null || currentNode === void 0 ? void 0 : (_currentNode$
|
|
232
|
+
componentId: (_currentNode$type$nam = currentNode === null || currentNode === void 0 ? void 0 : (_currentNode$type2 = currentNode.type) === null || _currentNode$type2 === void 0 ? void 0 : _currentNode$type2.name) !== null && _currentNode$type$nam !== void 0 ? _currentNode$type$nam : ACTION_SUBJECT_ID.UNKNOWN_NODE,
|
|
174
233
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
175
234
|
}, jsx("span", {
|
|
176
235
|
className: `zeroWidthSpaceContainer`
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import memoize from 'lodash/memoize';
|
|
2
|
+
// Use this selector to set the intersection observer boundary for editor's inline node views
|
|
3
|
+
// If this does not exist, it will use the IntersectionObserver's default root
|
|
4
|
+
const INTERSECTION_OBSERVER_ROOT_SELECTOR = '[data-editor-scroll-container="true"]';
|
|
5
|
+
const INTERSECTION_OBSERVER_OPTIONS = {
|
|
6
|
+
rootMargin: '0px 0px 100px 0px',
|
|
7
|
+
threshold: 0
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// Parameterized singleton
|
|
11
|
+
export const getOrCreateOnVisibleObserver = memoize(view => {
|
|
12
|
+
const intersectionObserverOptions = {
|
|
13
|
+
root: view.dom.closest(INTERSECTION_OBSERVER_ROOT_SELECTOR),
|
|
14
|
+
...INTERSECTION_OBSERVER_OPTIONS
|
|
15
|
+
};
|
|
16
|
+
const callbackMap = new WeakMap();
|
|
17
|
+
const observer = new IntersectionObserver(entries => {
|
|
18
|
+
entries.filter(entry => entry.isIntersecting) // Only process visible entries
|
|
19
|
+
.map(entry => callbackMap.get(entry.target))
|
|
20
|
+
// Invoke callbacks together to group browser rendering
|
|
21
|
+
// Avoiding requestAnimationFrame to reduce visual flickering
|
|
22
|
+
.forEach(cb => cb === null || cb === void 0 ? void 0 : cb());
|
|
23
|
+
}, intersectionObserverOptions);
|
|
24
|
+
return {
|
|
25
|
+
observe: (el, callback) => {
|
|
26
|
+
callbackMap.set(el, callback);
|
|
27
|
+
observer.observe(el);
|
|
28
|
+
return () => observer.unobserve(el);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Plugin } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { createProseMirrorMetadata } from '../prosemirror-dom-metadata';
|
|
4
3
|
/**
|
|
5
4
|
* 🧱 Internal Helper Function: Editor FE Platform
|
|
@@ -46,7 +45,7 @@ const wrapGetPosExceptions = spec => {
|
|
|
46
45
|
// eslint-disable-next-line no-extra-bind
|
|
47
46
|
}).bind(thisArg);
|
|
48
47
|
const result = Reflect.apply(target, thisArg, [node, view, safeGetPos, ...more]);
|
|
49
|
-
if ((result === null || result === void 0 ? void 0 : result.dom) instanceof HTMLElement
|
|
48
|
+
if ((result === null || result === void 0 ? void 0 : result.dom) instanceof HTMLElement) {
|
|
50
49
|
attachGenericProseMirrorMetadata({
|
|
51
50
|
nodeOrMark: node,
|
|
52
51
|
dom: result.dom
|
|
@@ -133,8 +133,8 @@ const tableSharedStyle = () => css`
|
|
|
133
133
|
th td {
|
|
134
134
|
background-color: ${"var(--ds-background-neutral-subtle, white)"};
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
td {
|
|
136
|
+
|
|
137
|
+
${fg('platform_editor_renderer_table_header_styles') ? `> tbody > tr > th, > tbody > tr > td` : 'th, td'} {
|
|
138
138
|
min-width: ${tableCellMinWidth}px;
|
|
139
139
|
font-weight: ${"var(--ds-font-weight-regular, 400)"};
|
|
140
140
|
vertical-align: top;
|
|
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
13
13
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
14
14
|
import Layer from '../Layer';
|
|
15
15
|
const packageName = "@atlaskit/editor-common";
|
|
16
|
-
const packageVersion = "99.
|
|
16
|
+
const packageVersion = "99.7.0";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
// Ignored via go/ees005
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _readOnlyError from "@babel/runtime/helpers/readOnlyError";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
import { isFedRamp } from './environment';
|
|
8
8
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
9
9
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
10
|
-
var packageVersion = "99.
|
|
10
|
+
var packageVersion = "99.7.0";
|
|
11
11
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
12
12
|
// Remove URL as it has UGC
|
|
13
13
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -10,18 +10,25 @@ import React from 'react';
|
|
|
10
10
|
|
|
11
11
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
12
12
|
import { jsx } from '@emotion/react';
|
|
13
|
+
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
15
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
|
|
14
16
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
15
17
|
import { analyticsEventKey, browser, getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from '../utils';
|
|
16
18
|
import { ZERO_WIDTH_SPACE } from '../whitespace';
|
|
17
19
|
import { generateUniqueNodeKey } from './generateUniqueNodeKey';
|
|
20
|
+
import { getOrCreateOnVisibleObserver } from './onVisibleObserverFactory';
|
|
18
21
|
export var inlineNodeViewClassname = 'inlineNodeView';
|
|
22
|
+
var canRenderFallback = function canRenderFallback(node) {
|
|
23
|
+
return node.type.isInline && node.type.isAtom && node.type.isLeaf;
|
|
24
|
+
};
|
|
19
25
|
function createNodeView(_ref) {
|
|
20
26
|
var nodeViewParams = _ref.nodeViewParams,
|
|
21
27
|
pmPluginFactoryParams = _ref.pmPluginFactoryParams,
|
|
22
28
|
Component = _ref.Component,
|
|
23
29
|
extraComponentProps = _ref.extraComponentProps,
|
|
24
30
|
extraNodeViewProps = _ref.extraNodeViewProps;
|
|
31
|
+
var shouldVirtualize = fg('platform_editor_lego__inline_node_virtualization');
|
|
25
32
|
// We set a variable for the current node which is
|
|
26
33
|
// used for comparisions when doing updates, before being
|
|
27
34
|
// overwritten to the updated node.
|
|
@@ -65,22 +72,58 @@ function createNodeView(_ref) {
|
|
|
65
72
|
extraComponentProps: extraComponentProps
|
|
66
73
|
}), domRef, key);
|
|
67
74
|
}
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
var didRenderComponentWithIntersectionObserver = false;
|
|
76
|
+
var destroyed = false;
|
|
77
|
+
var removeIntersectionObserver = function removeIntersectionObserver() {};
|
|
78
|
+
function renderFallback() {
|
|
79
|
+
var _currentNode$type;
|
|
80
|
+
if (canRenderFallback(currentNode) && typeof ((_currentNode$type = currentNode.type) === null || _currentNode$type === void 0 || (_currentNode$type = _currentNode$type.spec) === null || _currentNode$type === void 0 ? void 0 : _currentNode$type.toDOM) === 'function') {
|
|
81
|
+
var fallback = DOMSerializer.renderSpec(document, currentNode.type.spec.toDOM(currentNode));
|
|
82
|
+
domRef.replaceChildren(fallback.dom);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function attachNodeViewObserver() {
|
|
86
|
+
var observer = getOrCreateOnVisibleObserver(nodeViewParams.view);
|
|
87
|
+
removeIntersectionObserver = observer.observe(domRef, function () {
|
|
88
|
+
if (!didRenderComponentWithIntersectionObserver && !destroyed) {
|
|
89
|
+
domRef.replaceChildren();
|
|
90
|
+
renderComponent();
|
|
91
|
+
didRenderComponentWithIntersectionObserver = true;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
if (shouldVirtualize) {
|
|
96
|
+
renderFallback();
|
|
97
|
+
attachNodeViewObserver();
|
|
98
|
+
} else {
|
|
99
|
+
var _getPerformanceOption = getPerformanceOptions(nodeViewParams.view),
|
|
100
|
+
samplingRate = _getPerformanceOption.samplingRate,
|
|
101
|
+
slowThreshold = _getPerformanceOption.slowThreshold,
|
|
102
|
+
trackingEnabled = _getPerformanceOption.trackingEnabled;
|
|
103
|
+
trackingEnabled && startMeasureReactNodeViewRendered({
|
|
104
|
+
nodeTypeName: currentNode.type.name
|
|
105
|
+
});
|
|
75
106
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
107
|
+
// We render the component while creating the node view
|
|
108
|
+
renderComponent();
|
|
109
|
+
trackingEnabled && stopMeasureReactNodeViewRendered({
|
|
110
|
+
nodeTypeName: currentNode.type.name,
|
|
111
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
112
|
+
samplingRate: samplingRate,
|
|
113
|
+
slowThreshold: slowThreshold
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
var extraNodeViewPropsWithStopEvent = _objectSpread(_objectSpread({}, extraNodeViewProps), fg('platform_editor_lego__inline_node_virtualization') ? {
|
|
117
|
+
// This is not related to virtualization, but it's something we should fix/handle
|
|
118
|
+
// Remove this comment when `platform_editor_lego__inline_node_virtualization` FF is cleaned up
|
|
119
|
+
stopEvent: function stopEvent(event) {
|
|
120
|
+
var maybeStopEvent = extraNodeViewProps === null || extraNodeViewProps === void 0 ? void 0 : extraNodeViewProps.stopEvent;
|
|
121
|
+
if (typeof maybeStopEvent === 'function') {
|
|
122
|
+
return maybeStopEvent(event);
|
|
123
|
+
}
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
} : {});
|
|
84
127
|
|
|
85
128
|
// https://prosemirror.net/docs/ref/#view.NodeView
|
|
86
129
|
var nodeView = _objectSpread({
|
|
@@ -112,10 +155,20 @@ function createNodeView(_ref) {
|
|
|
112
155
|
setDomAttrs(nextNode, domRef);
|
|
113
156
|
}
|
|
114
157
|
currentNode = nextNode;
|
|
115
|
-
|
|
158
|
+
if (shouldVirtualize) {
|
|
159
|
+
if (didRenderComponentWithIntersectionObserver) {
|
|
160
|
+
renderComponent();
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
renderComponent();
|
|
164
|
+
}
|
|
116
165
|
return true;
|
|
117
166
|
},
|
|
118
167
|
destroy: function destroy() {
|
|
168
|
+
if (shouldVirtualize) {
|
|
169
|
+
removeIntersectionObserver();
|
|
170
|
+
}
|
|
171
|
+
|
|
119
172
|
// When prosemirror destroys the node view, we need to clean up
|
|
120
173
|
// what we have previously rendered using the editor portal
|
|
121
174
|
// provider api.
|
|
@@ -124,8 +177,11 @@ function createNodeView(_ref) {
|
|
|
124
177
|
// of HTMLSpanElement type however once the node view has
|
|
125
178
|
// been destroyed no other consumers should still be using it.
|
|
126
179
|
domRef = undefined;
|
|
180
|
+
if (shouldVirtualize) {
|
|
181
|
+
destroyed = true;
|
|
182
|
+
}
|
|
127
183
|
}
|
|
128
|
-
},
|
|
184
|
+
}, extraNodeViewPropsWithStopEvent);
|
|
129
185
|
return nodeView;
|
|
130
186
|
}
|
|
131
187
|
|
|
@@ -145,7 +201,7 @@ function getPortalChildren(_ref2) {
|
|
|
145
201
|
Component = _ref2.Component,
|
|
146
202
|
extraComponentProps = _ref2.extraComponentProps;
|
|
147
203
|
return function portalChildren() {
|
|
148
|
-
var _currentNode$type$nam, _currentNode$
|
|
204
|
+
var _currentNode$type$nam, _currentNode$type2;
|
|
149
205
|
// All inline nodes use `display: inline` to allow for multi-line
|
|
150
206
|
// wrapping. This does produce an issue in Chrome where it is not
|
|
151
207
|
// possible to click select the position after the node,
|
|
@@ -169,7 +225,7 @@ function getPortalChildren(_ref2) {
|
|
|
169
225
|
|
|
170
226
|
return jsx(ErrorBoundary, {
|
|
171
227
|
component: ACTION_SUBJECT.REACT_NODE_VIEW,
|
|
172
|
-
componentId: (_currentNode$type$nam = currentNode === null || currentNode === void 0 || (_currentNode$
|
|
228
|
+
componentId: (_currentNode$type$nam = currentNode === null || currentNode === void 0 || (_currentNode$type2 = currentNode.type) === null || _currentNode$type2 === void 0 ? void 0 : _currentNode$type2.name) !== null && _currentNode$type$nam !== void 0 ? _currentNode$type$nam : ACTION_SUBJECT_ID.UNKNOWN_NODE,
|
|
173
229
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
174
230
|
}, jsx("span", {
|
|
175
231
|
className: "zeroWidthSpaceContainer"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import memoize from 'lodash/memoize';
|
|
5
|
+
// Use this selector to set the intersection observer boundary for editor's inline node views
|
|
6
|
+
// If this does not exist, it will use the IntersectionObserver's default root
|
|
7
|
+
var INTERSECTION_OBSERVER_ROOT_SELECTOR = '[data-editor-scroll-container="true"]';
|
|
8
|
+
var INTERSECTION_OBSERVER_OPTIONS = {
|
|
9
|
+
rootMargin: '0px 0px 100px 0px',
|
|
10
|
+
threshold: 0
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// Parameterized singleton
|
|
14
|
+
export var getOrCreateOnVisibleObserver = memoize(function (view) {
|
|
15
|
+
var intersectionObserverOptions = _objectSpread({
|
|
16
|
+
root: view.dom.closest(INTERSECTION_OBSERVER_ROOT_SELECTOR)
|
|
17
|
+
}, INTERSECTION_OBSERVER_OPTIONS);
|
|
18
|
+
var callbackMap = new WeakMap();
|
|
19
|
+
var observer = new IntersectionObserver(function (entries) {
|
|
20
|
+
entries.filter(function (entry) {
|
|
21
|
+
return entry.isIntersecting;
|
|
22
|
+
}) // Only process visible entries
|
|
23
|
+
.map(function (entry) {
|
|
24
|
+
return callbackMap.get(entry.target);
|
|
25
|
+
})
|
|
26
|
+
// Invoke callbacks together to group browser rendering
|
|
27
|
+
// Avoiding requestAnimationFrame to reduce visual flickering
|
|
28
|
+
.forEach(function (cb) {
|
|
29
|
+
return cb === null || cb === void 0 ? void 0 : cb();
|
|
30
|
+
});
|
|
31
|
+
}, intersectionObserverOptions);
|
|
32
|
+
return {
|
|
33
|
+
observe: function observe(el, callback) {
|
|
34
|
+
callbackMap.set(el, callback);
|
|
35
|
+
observer.observe(el);
|
|
36
|
+
return function () {
|
|
37
|
+
return observer.unobserve(el);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
});
|
|
@@ -9,7 +9,6 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
9
9
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
10
10
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
11
|
import { Plugin } from '@atlaskit/editor-prosemirror/state';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import { createProseMirrorMetadata } from '../prosemirror-dom-metadata';
|
|
14
13
|
/**
|
|
15
14
|
* 🧱 Internal Helper Function: Editor FE Platform
|
|
@@ -62,7 +61,7 @@ var wrapGetPosExceptions = function wrapGetPosExceptions(spec) {
|
|
|
62
61
|
// eslint-disable-next-line no-extra-bind
|
|
63
62
|
}.bind(thisArg);
|
|
64
63
|
var result = Reflect.apply(target, thisArg, [node, view, safeGetPos].concat(_toConsumableArray(more)));
|
|
65
|
-
if ((result === null || result === void 0 ? void 0 : result.dom) instanceof HTMLElement
|
|
64
|
+
if ((result === null || result === void 0 ? void 0 : result.dom) instanceof HTMLElement) {
|
|
66
65
|
attachGenericProseMirrorMetadata({
|
|
67
66
|
nodeOrMark: node,
|
|
68
67
|
dom: result.dom
|
|
@@ -52,7 +52,7 @@ var firstNodeWithNotMarginTop = function firstNodeWithNotMarginTop() {
|
|
|
52
52
|
|
|
53
53
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Appears safe to auto-fix, but leaving it up to the team to remediate as the readability only gets worse with autofixing
|
|
54
54
|
var tableSharedStyle = function tableSharedStyle() {
|
|
55
|
-
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n\t", "\n\t.", " {\n\t\tposition: relative;\n\t\tmargin: 0 auto ", ";\n\t\tbox-sizing: border-box;\n\n\t\t/**\n * Fix block top alignment inside table cells.\n */\n\t\t.decisionItemView-content-wrap:first-of-type > div {\n\t\t\tmargin-top: 0;\n\t\t}\n\t}\n\t.", "[data-number-column='true'] {\n\t\tpadding-left: ", "px;\n\t\tclear: both;\n\t}\n\n\t.", " {\n\t\twill-change: width, margin-left;\n\t}\n\n\t.", " table {\n\t\twill-change: width;\n\t}\n\n\t.", " > table {\n\t\tmargin: ", " 0 0 0;\n\t}\n\n\t.", " > table,\n\t.", " > table {\n\t\tmargin: ", " ", " 0 0;\n\t}\n\n\t/* avoid applying styles to nested tables (possible via extensions) */\n\t.", " > table,\n\t.", " > table,\n\t.", " > table {\n\t\tborder-collapse: collapse;\n\t\tborder: ", "px solid\n\t\t\t", ";\n\t\ttable-layout: fixed;\n\t\tfont-size: 1em;\n\t\twidth: 100%;\n\n\t\t&[data-autosize='true'] {\n\t\t\ttable-layout: auto;\n\t\t}\n\n\t\t& {\n\t\t\t* {\n\t\t\t\tbox-sizing: border-box;\n\t\t\t}\n\t\t\thr {\n\t\t\t\tbox-sizing: content-box;\n\t\t\t}\n\n\t\t\ttbody {\n\t\t\t\tborder-bottom: none;\n\t\t\t}\n\t\t\tth td {\n\t\t\t\tbackground-color: ", ";\n\t\t\t}\n\
|
|
55
|
+
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n\t", "\n\t.", " {\n\t\tposition: relative;\n\t\tmargin: 0 auto ", ";\n\t\tbox-sizing: border-box;\n\n\t\t/**\n * Fix block top alignment inside table cells.\n */\n\t\t.decisionItemView-content-wrap:first-of-type > div {\n\t\t\tmargin-top: 0;\n\t\t}\n\t}\n\t.", "[data-number-column='true'] {\n\t\tpadding-left: ", "px;\n\t\tclear: both;\n\t}\n\n\t.", " {\n\t\twill-change: width, margin-left;\n\t}\n\n\t.", " table {\n\t\twill-change: width;\n\t}\n\n\t.", " > table {\n\t\tmargin: ", " 0 0 0;\n\t}\n\n\t.", " > table,\n\t.", " > table {\n\t\tmargin: ", " ", " 0 0;\n\t}\n\n\t/* avoid applying styles to nested tables (possible via extensions) */\n\t.", " > table,\n\t.", " > table,\n\t.", " > table {\n\t\tborder-collapse: collapse;\n\t\tborder: ", "px solid\n\t\t\t", ";\n\t\ttable-layout: fixed;\n\t\tfont-size: 1em;\n\t\twidth: 100%;\n\n\t\t&[data-autosize='true'] {\n\t\t\ttable-layout: auto;\n\t\t}\n\n\t\t& {\n\t\t\t* {\n\t\t\t\tbox-sizing: border-box;\n\t\t\t}\n\t\t\thr {\n\t\t\t\tbox-sizing: content-box;\n\t\t\t}\n\n\t\t\ttbody {\n\t\t\t\tborder-bottom: none;\n\t\t\t}\n\t\t\tth td {\n\t\t\t\tbackground-color: ", ";\n\t\t\t}\n\n\t\t\t", " {\n\t\t\t\tmin-width: ", "px;\n\t\t\t\tfont-weight: ", ";\n\t\t\t\tvertical-align: top;\n\t\t\t\tborder: 1px solid ", ";\n\t\t\t\tborder-right-width: 0;\n\t\t\t\tborder-bottom-width: 0;\n\n\t\t\t\tpadding: ", ";\n\t\t\t\t/* https://stackoverflow.com/questions/7517127/borders-not-shown-in-firefox-with-border-collapse-on-table-position-relative-o */\n\t\t\t\t", "\n\n\t\t\t\t", "\n\n\t\t\t\tth p:not(:first-of-type),\n\t\t\t\ttd p:not(:first-of-type) {\n\t\t\t\t\tmargin-top: ", ";\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t", "\n\t\t\tth {\n\t\t\t\tbackground-color: ", ";\n\t\t\t\ttext-align: left;\n\n\t\t\t\t/* only apply this styling to codeblocks in default background headercells */\n\t\t\t\t/* TODO this needs to be overhauled as it relies on unsafe selectors */\n\t\t\t\t&:not([style]):not(.danger) {\n\t\t\t\t\t.", ":not(.danger) {\n\t\t\t\t\t\tbackground-color: ", ";\n\n\t\t\t\t\t\t:not(.", ") {\n\t\t\t\t\t\t\tbox-shadow: 0px 0px 0px 1px ", ";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\tbackground-image: ", ";\n\n\t\t\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/* this is only relevant to the element taken care of by renderer */\n\t\t\t\t\t\t> [data-ds--code--code-block] {\n\t\t\t\t\t\t\tbackground-image: ", "!important;\n\n\t\t\t\t\t\t\tbackground-color: ", "!important;\n\n\t\t\t\t\t\t\t// selector lives inside @atlaskit/code\n\t\t\t\t\t\t\t--ds--code--line-number-bg-color: ", ";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n"])), tableCellBackgroundStyleOverride(), TableSharedCssClassName.TABLE_CONTAINER, "var(--ds-space-200, 16px)", TableSharedCssClassName.TABLE_CONTAINER, akEditorTableNumberColumnWidth - 1, TableSharedCssClassName.TABLE_RESIZER_CONTAINER, TableSharedCssClassName.TABLE_RESIZER_CONTAINER, TableSharedCssClassName.TABLE_NODE_WRAPPER, "var(--ds-space-300, 24px)", TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, "var(--ds-space-300, 24px)", "var(--ds-space-100, 8px)", TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_NODE_WRAPPER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableCellBorderWidth, "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorder, ")"), "var(--ds-background-neutral-subtle, white)", fg('platform_editor_renderer_table_header_styles') ? "> tbody > tr > th, > tbody > tr > td" : 'th, td', tableCellMinWidth, "var(--ds-font-weight-regular, 400)", "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorder, ")"), "var(--ds-space-100, 8px)", browser.gecko || browser.ie || browser.mac && browser.chrome ? 'background-clip: padding-box;' : '', firstNodeWithNotMarginTop(), "var(--ds-space-150, 12px)", fg('platform_editor_nested_tables_renderer_styles') ? "// Ensures nested tables are compatible with parent table background color - uses specificity to ensure tables nested by extensions are not affected\n\t\t\t> tbody > tr > td {\n\t\t\t\tbackground-color: ".concat("var(--ds-surface, #FFFFFF)", ";\n\t\t\t}") : '', "var(--ds-background-accent-gray-subtlest, ".concat(akEditorTableToolbar, ")"), CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER, "var(--ds-surface-raised, rgb(235, 237, 240))", akEditorSelectedNodeClassName, "var(--ds-border, transparent)", CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER, overflowShadow({
|
|
56
56
|
leftCoverWidth: "var(--ds-space-300, 24px)"
|
|
57
57
|
}), "var(--ds-background-neutral, rgb(235, 237, 240))", CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER, "var(--ds-background-neutral, rgb(226, 229, 233))", overflowShadow({
|
|
58
58
|
leftCoverWidth: "var(--ds-space-300, 24px)"
|
|
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
20
20
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
21
21
|
import Layer from '../Layer';
|
|
22
22
|
var packageName = "@atlaskit/editor-common";
|
|
23
|
-
var packageVersion = "99.
|
|
23
|
+
var packageVersion = "99.7.0";
|
|
24
24
|
var halfFocusRing = 1;
|
|
25
25
|
var dropOffset = '0, 8';
|
|
26
26
|
// Ignored via go/ees005
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _readOnlyError from "@babel/runtime/helpers/readOnlyError";
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
@@ -41,7 +41,7 @@ export var serializeValue = function serializeValue(value) {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
|
|
44
|
+
var _getPropsDifference = function getPropsDifference(object1, object2) {
|
|
45
45
|
var curDepth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
46
46
|
var maxDepth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 2;
|
|
47
47
|
var keysToIgnore = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
|
|
@@ -68,7 +68,7 @@ export var getPropsDifference = function getPropsDifference(object1, object2) {
|
|
|
68
68
|
});
|
|
69
69
|
} else if (value1Type === 'object' && value2Type === 'object') {
|
|
70
70
|
if (curDepth <= maxDepth) {
|
|
71
|
-
var difference =
|
|
71
|
+
var difference = _getPropsDifference(value1, value2, curDepth + 1, maxDepth);
|
|
72
72
|
changed.push({
|
|
73
73
|
key: key,
|
|
74
74
|
difference: difference
|
|
@@ -94,6 +94,7 @@ export var getPropsDifference = function getPropsDifference(object1, object2) {
|
|
|
94
94
|
removed: removed
|
|
95
95
|
};
|
|
96
96
|
};
|
|
97
|
+
export { _getPropsDifference as getPropsDifference };
|
|
97
98
|
export var getShallowPropsDifference = function getShallowPropsDifference(object1, object2) {
|
|
98
99
|
var _getKeysAddedRemovedC2 = getKeysAddedRemovedCommon(object1, object2),
|
|
99
100
|
added = _getKeysAddedRemovedC2.added,
|
|
@@ -30,8 +30,8 @@ function parseLocaleNumber(stringNumber, groupPattern, fractionPattern) {
|
|
|
30
30
|
export function createNormalizeTextParser() {
|
|
31
31
|
// Source: https://stackoverflow.com/questions/12004808/does-javascript-take-local-decimal-separators-into-account
|
|
32
32
|
var locale = window.navigator.language;
|
|
33
|
-
var thousandSeparator = Intl.NumberFormat(locale).format(11111).replace(/(?:[0-9\xB2\xB3\xB9\xBC-\xBE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D58-\u0D5E\u0D66-\u0D78\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]|\uD800[\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23\uDF41\uDF4A\uDFD1-\uDFD5]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE48\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD803[\uDCFA-\uDCFF\uDD30-\uDD39\uDE60-\uDE7E\uDF1D-\uDF26\uDF51-\uDF54\uDFC5-\uDFCB]|\uD804[\uDC52-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDDE1-\uDDF4\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF3B]|\uD806[\uDCE0-\uDCF2\uDD50-\uDD59]|\uD807[\uDC50-\uDC6C\uDD50-\uDD59\uDDA0-\uDDA9\uDF50-\uDF59\uDFC0-\uDFD4]|\uD809[\uDC00-\uDC6E]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDF50-\uDF59\uDF5B-\uDF61]|\uD81B[\uDE80-\uDE96]|\uD834[\uDEC0-\uDED3\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDFCE-\uDFFF]|\uD838[\uDD40-\uDD49\uDEF0-\uDEF9]|\uD839[\uDCF0-\uDCF9]|\uD83A[\uDCC7-\uDCCF\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9])/g, '');
|
|
34
|
-
var decimalSeparator = Intl.NumberFormat(locale).format(1.1).replace(/(?:[0-9\xB2\xB3\xB9\xBC-\xBE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D58-\u0D5E\u0D66-\u0D78\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]|\uD800[\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23\uDF41\uDF4A\uDFD1-\uDFD5]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE48\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD803[\uDCFA-\uDCFF\uDD30-\uDD39\uDE60-\uDE7E\uDF1D-\uDF26\uDF51-\uDF54\uDFC5-\uDFCB]|\uD804[\uDC52-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDDE1-\uDDF4\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF3B]|\uD806[\uDCE0-\uDCF2\uDD50-\uDD59]|\uD807[\uDC50-\uDC6C\uDD50-\uDD59\uDDA0-\uDDA9\uDF50-\uDF59\uDFC0-\uDFD4]|\uD809[\uDC00-\uDC6E]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDF50-\uDF59\uDF5B-\uDF61]|\uD81B[\uDE80-\uDE96]|\uD834[\uDEC0-\uDED3\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDFCE-\uDFFF]|\uD838[\uDD40-\uDD49\uDEF0-\uDEF9]|\uD839[\uDCF0-\uDCF9]|\uD83A[\uDCC7-\uDCCF\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9])/g, '');
|
|
33
|
+
var thousandSeparator = Intl.NumberFormat(locale).format(11111).replace(/(?:[0-9\xB2\xB3\xB9\xBC-\xBE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D58-\u0D5E\u0D66-\u0D78\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]|\uD800[\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23\uDF41\uDF4A\uDFD1-\uDFD5]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE48\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD803[\uDCFA-\uDCFF\uDD30-\uDD39\uDD40-\uDD49\uDE60-\uDE7E\uDF1D-\uDF26\uDF51-\uDF54\uDFC5-\uDFCB]|\uD804[\uDC52-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDDE1-\uDDF4\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDED0-\uDEE3\uDF30-\uDF3B]|\uD806[\uDCE0-\uDCF2\uDD50-\uDD59\uDFF0-\uDFF9]|\uD807[\uDC50-\uDC6C\uDD50-\uDD59\uDDA0-\uDDA9\uDF50-\uDF59\uDFC0-\uDFD4]|\uD809[\uDC00-\uDC6E]|\uD818[\uDD30-\uDD39]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDF50-\uDF59\uDF5B-\uDF61]|\uD81B[\uDD70-\uDD79\uDE80-\uDE96]|\uD833[\uDCF0-\uDCF9]|\uD834[\uDEC0-\uDED3\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDFCE-\uDFFF]|\uD838[\uDD40-\uDD49\uDEF0-\uDEF9]|\uD839[\uDCF0-\uDCF9\uDDF1-\uDDFA]|\uD83A[\uDCC7-\uDCCF\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9])/g, '');
|
|
34
|
+
var decimalSeparator = Intl.NumberFormat(locale).format(1.1).replace(/(?:[0-9\xB2\xB3\xB9\xBC-\xBE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D58-\u0D5E\u0D66-\u0D78\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]|\uD800[\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23\uDF41\uDF4A\uDFD1-\uDFD5]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE48\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD803[\uDCFA-\uDCFF\uDD30-\uDD39\uDD40-\uDD49\uDE60-\uDE7E\uDF1D-\uDF26\uDF51-\uDF54\uDFC5-\uDFCB]|\uD804[\uDC52-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDDE1-\uDDF4\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDED0-\uDEE3\uDF30-\uDF3B]|\uD806[\uDCE0-\uDCF2\uDD50-\uDD59\uDFF0-\uDFF9]|\uD807[\uDC50-\uDC6C\uDD50-\uDD59\uDDA0-\uDDA9\uDF50-\uDF59\uDFC0-\uDFD4]|\uD809[\uDC00-\uDC6E]|\uD818[\uDD30-\uDD39]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDF50-\uDF59\uDF5B-\uDF61]|\uD81B[\uDD70-\uDD79\uDE80-\uDE96]|\uD833[\uDCF0-\uDCF9]|\uD834[\uDEC0-\uDED3\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDFCE-\uDFFF]|\uD838[\uDD40-\uDD49\uDEF0-\uDEF9]|\uD839[\uDCF0-\uDCF9\uDDF1-\uDDFA]|\uD83A[\uDCC7-\uDCCF\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9])/g, '');
|
|
35
35
|
|
|
36
36
|
// Ignored via go/ees005
|
|
37
37
|
// eslint-disable-next-line require-unicode-regexp
|
|
@@ -31,7 +31,7 @@ export function sanitizeNodeForPrivacy(json, providerFactory) {
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
if (hasCacheableMentions && providerFactory) {
|
|
34
|
-
var
|
|
34
|
+
var _handler = function handler(_name, providerPromise) {
|
|
35
35
|
if (providerPromise) {
|
|
36
36
|
providerPromise.then(function (provider) {
|
|
37
37
|
if (isResolvingMentionProvider(provider)) {
|
|
@@ -39,12 +39,12 @@ export function sanitizeNodeForPrivacy(json, providerFactory) {
|
|
|
39
39
|
provider.cacheMentionName(id, name);
|
|
40
40
|
});
|
|
41
41
|
mentionNames.clear();
|
|
42
|
-
providerFactory.unsubscribe('mentionProvider',
|
|
42
|
+
providerFactory.unsubscribe('mentionProvider', _handler);
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
-
providerFactory.subscribe('mentionProvider',
|
|
47
|
+
providerFactory.subscribe('mentionProvider', _handler);
|
|
48
48
|
}
|
|
49
49
|
return sanitizedJSON;
|
|
50
50
|
}
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -284,7 +284,7 @@ export var isEmptyNode = function isEmptyNode(schema) {
|
|
|
284
284
|
media = _schema$nodes.media,
|
|
285
285
|
mediaGroup = _schema$nodes.mediaGroup,
|
|
286
286
|
mediaSingle = _schema$nodes.mediaSingle;
|
|
287
|
-
var
|
|
287
|
+
var _innerIsEmptyNode = function innerIsEmptyNode(node) {
|
|
288
288
|
switch (node.type) {
|
|
289
289
|
case media:
|
|
290
290
|
case mediaGroup:
|
|
@@ -302,28 +302,28 @@ export var isEmptyNode = function isEmptyNode(schema) {
|
|
|
302
302
|
case listItem:
|
|
303
303
|
// Ignored via go/ees005
|
|
304
304
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
305
|
-
return node.content.size === 2 &&
|
|
305
|
+
return node.content.size === 2 && _innerIsEmptyNode(node.content.firstChild);
|
|
306
306
|
case bulletList:
|
|
307
307
|
case orderedList:
|
|
308
308
|
// Ignored via go/ees005
|
|
309
309
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
310
|
-
return node.content.size === 4 &&
|
|
310
|
+
return node.content.size === 4 && _innerIsEmptyNode(node.content.firstChild);
|
|
311
311
|
case taskList:
|
|
312
312
|
case decisionList:
|
|
313
313
|
// Ignored via go/ees005
|
|
314
314
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
315
|
-
return node.content.size === 2 &&
|
|
315
|
+
return node.content.size === 2 && _innerIsEmptyNode(node.content.firstChild);
|
|
316
316
|
case doc:
|
|
317
317
|
var isEmpty = true;
|
|
318
318
|
node.content.forEach(function (child) {
|
|
319
|
-
isEmpty = isEmpty &&
|
|
319
|
+
isEmpty = isEmpty && _innerIsEmptyNode(child);
|
|
320
320
|
});
|
|
321
321
|
return isEmpty;
|
|
322
322
|
default:
|
|
323
323
|
return isNodeEmpty(node);
|
|
324
324
|
}
|
|
325
325
|
};
|
|
326
|
-
return
|
|
326
|
+
return _innerIsEmptyNode;
|
|
327
327
|
};
|
|
328
328
|
|
|
329
329
|
/**
|