@atlaskit/editor-common 70.1.2 → 70.2.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 +40 -0
- package/dist/cjs/__tests_external__/index.js +1 -9
- package/dist/cjs/__tests_external__/page-objects/Editor.js +0 -7
- package/dist/cjs/__tests_external__/page-objects/EditorSmartLink.js +7 -1
- package/dist/cjs/__tests_external__/page-objects/Renderer.js +0 -9
- package/dist/cjs/in-product.js +0 -6
- package/dist/cjs/react-node-view/index.js +19 -17
- package/dist/cjs/styles/index.js +12 -0
- package/dist/cjs/styles/shared/code-block.js +5 -3
- package/dist/cjs/styles/shared/lists.js +4 -2
- package/dist/cjs/styles/shared/table.js +1 -1
- package/dist/cjs/{__tests_external__/cases/media/test-cases/types.js → types/copy-button.js} +0 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/Expand/index.js +2 -2
- package/dist/cjs/ui/IntlProviderIfMissingWrapper/index.js +33 -0
- package/dist/cjs/ui/Popup/index.js +2 -2
- package/dist/cjs/ui/PortalProvider/index.js +62 -47
- package/dist/cjs/ui/index.js +8 -0
- package/dist/cjs/utils/breakout.js +53 -2
- package/dist/cjs/utils/collab.js +22 -0
- package/dist/cjs/utils/dom.js +16 -0
- package/dist/cjs/utils/get-performance-options.js +70 -0
- package/dist/cjs/utils/index.js +57 -1
- package/dist/cjs/utils/outdated-browsers.js +41 -0
- package/dist/cjs/utils/referentiality.js +49 -0
- package/dist/cjs/utils/sendLogs.js +19 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/with-plugin-state/index.js +61 -54
- package/dist/es2019/__tests_external__/index.js +1 -2
- package/dist/es2019/__tests_external__/page-objects/Editor.js +0 -6
- package/dist/es2019/__tests_external__/page-objects/EditorSmartLink.js +4 -1
- package/dist/es2019/__tests_external__/page-objects/Renderer.js +0 -6
- package/dist/es2019/in-product.js +1 -1
- package/dist/es2019/react-node-view/index.js +19 -24
- package/dist/es2019/styles/index.js +2 -2
- package/dist/es2019/styles/shared/code-block.js +13 -1
- package/dist/es2019/styles/shared/lists.js +2 -1
- package/dist/es2019/styles/shared/table.js +4 -2
- package/dist/es2019/{__tests_external__/cases/media/test-cases/types.js → types/copy-button.js} +0 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/Expand/index.js +17 -15
- package/dist/es2019/ui/IntlProviderIfMissingWrapper/index.js +18 -0
- package/dist/es2019/ui/Popup/index.js +2 -1
- package/dist/es2019/ui/PortalProvider/index.js +33 -14
- package/dist/es2019/ui/index.js +2 -1
- package/dist/es2019/utils/breakout.js +47 -1
- package/dist/es2019/utils/collab.js +13 -0
- package/dist/es2019/utils/dom.js +16 -0
- package/dist/es2019/utils/get-performance-options.js +57 -0
- package/dist/es2019/utils/index.js +6 -2
- package/dist/es2019/utils/outdated-browsers.js +32 -0
- package/dist/es2019/utils/referentiality.js +34 -0
- package/dist/es2019/utils/sendLogs.js +8 -0
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/with-plugin-state/index.js +55 -52
- package/dist/esm/__tests_external__/index.js +1 -2
- package/dist/esm/__tests_external__/page-objects/Editor.js +0 -7
- package/dist/esm/__tests_external__/page-objects/EditorSmartLink.js +7 -1
- package/dist/esm/__tests_external__/page-objects/Renderer.js +0 -9
- package/dist/esm/in-product.js +1 -1
- package/dist/esm/react-node-view/index.js +19 -22
- package/dist/esm/styles/index.js +2 -2
- package/dist/esm/styles/shared/code-block.js +4 -3
- package/dist/esm/styles/shared/lists.js +2 -1
- package/dist/esm/styles/shared/table.js +1 -1
- package/dist/esm/{__tests_external__/cases/media/test-cases/types.js → types/copy-button.js} +0 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/Expand/index.js +2 -2
- package/dist/esm/ui/IntlProviderIfMissingWrapper/index.js +19 -0
- package/dist/esm/ui/Popup/index.js +2 -2
- package/dist/esm/ui/PortalProvider/index.js +59 -48
- package/dist/esm/ui/index.js +2 -1
- package/dist/esm/utils/breakout.js +46 -1
- package/dist/esm/utils/collab.js +13 -0
- package/dist/esm/utils/dom.js +16 -0
- package/dist/esm/utils/get-performance-options.js +55 -0
- package/dist/esm/utils/index.js +6 -2
- package/dist/esm/utils/outdated-browsers.js +32 -0
- package/dist/esm/utils/referentiality.js +40 -0
- package/dist/esm/utils/sendLogs.js +10 -0
- package/dist/esm/version.json +1 -1
- package/dist/esm/with-plugin-state/index.js +59 -54
- package/dist/types/__tests_external__/index.d.ts +0 -1
- package/dist/types/__tests_external__/page-objects/Editor.d.ts +0 -1
- package/dist/types/__tests_external__/page-objects/Renderer.d.ts +0 -1
- package/dist/types/analytics/types/events.d.ts +1 -0
- package/dist/types/extensions/types/extension-handler.d.ts +1 -0
- package/dist/types/in-product.d.ts +1 -1
- package/dist/types/styles/index.d.ts +2 -2
- package/dist/types/styles/shared/code-block.d.ts +1 -0
- package/dist/types/styles/shared/lists.d.ts +1 -0
- package/dist/types/types/copy-button.d.ts +20 -0
- package/dist/types/types/editor-actions.d.ts +1 -0
- package/dist/types/types/editor-container-width.d.ts +14 -0
- package/dist/types/types/feature-flags.d.ts +0 -6
- package/dist/types/types/floating-toolbar.d.ts +23 -2
- package/dist/types/types/index.d.ts +2 -1
- package/dist/types/ui/IntlProviderIfMissingWrapper/index.d.ts +6 -0
- package/dist/types/ui/Popup/index.d.ts +1 -0
- package/dist/types/ui/PortalProvider/index.d.ts +2 -1
- package/dist/types/ui/index.d.ts +1 -0
- package/dist/types/ui-menu/ToolbarButton/index.d.ts +1 -1
- package/dist/types/utils/breakout.d.ts +25 -0
- package/dist/types/utils/collab.d.ts +2 -0
- package/dist/types/utils/dom.d.ts +15 -1
- package/dist/types/utils/get-performance-options.d.ts +18 -0
- package/dist/types/utils/getModeFromTheme.d.ts +1 -1
- package/dist/types/utils/index.d.ts +5 -1
- package/dist/types/utils/outdated-browsers.d.ts +1 -0
- package/dist/types/utils/referentiality.d.ts +3 -0
- package/dist/types/utils/sendLogs.d.ts +1 -0
- package/dist/types/with-plugin-state/index.d.ts +4 -2
- package/dist/types-ts4.0/__tests_external__/index.d.ts +0 -1
- package/dist/types-ts4.0/__tests_external__/page-objects/Editor.d.ts +0 -1
- package/dist/types-ts4.0/__tests_external__/page-objects/Renderer.d.ts +0 -1
- package/dist/types-ts4.0/analytics/types/events.d.ts +1 -0
- package/dist/types-ts4.0/extensions/types/extension-handler.d.ts +1 -0
- package/dist/types-ts4.0/in-product.d.ts +1 -1
- package/dist/types-ts4.0/styles/index.d.ts +2 -2
- package/dist/types-ts4.0/styles/shared/code-block.d.ts +1 -0
- package/dist/types-ts4.0/styles/shared/lists.d.ts +1 -0
- package/dist/types-ts4.0/types/copy-button.d.ts +20 -0
- package/dist/types-ts4.0/types/editor-actions.d.ts +1 -0
- package/dist/types-ts4.0/types/editor-container-width.d.ts +14 -0
- package/dist/types-ts4.0/types/feature-flags.d.ts +0 -6
- package/dist/types-ts4.0/types/floating-toolbar.d.ts +23 -2
- package/dist/types-ts4.0/types/index.d.ts +2 -1
- package/dist/types-ts4.0/ui/IntlProviderIfMissingWrapper/index.d.ts +6 -0
- package/dist/types-ts4.0/ui/Popup/index.d.ts +1 -0
- package/dist/types-ts4.0/ui/PortalProvider/index.d.ts +2 -1
- package/dist/types-ts4.0/ui/index.d.ts +1 -0
- package/dist/types-ts4.0/ui-menu/ToolbarButton/index.d.ts +1 -1
- package/dist/types-ts4.0/utils/breakout.d.ts +25 -0
- package/dist/types-ts4.0/utils/collab.d.ts +2 -0
- package/dist/types-ts4.0/utils/dom.d.ts +15 -1
- package/dist/types-ts4.0/utils/get-performance-options.d.ts +18 -0
- package/dist/types-ts4.0/utils/getModeFromTheme.d.ts +1 -1
- package/dist/types-ts4.0/utils/index.d.ts +5 -1
- package/dist/types-ts4.0/utils/outdated-browsers.d.ts +1 -0
- package/dist/types-ts4.0/utils/referentiality.d.ts +3 -0
- package/dist/types-ts4.0/utils/sendLogs.d.ts +1 -0
- package/dist/types-ts4.0/with-plugin-state/index.d.ts +4 -2
- package/package.json +12 -10
- package/report.api.md +7 -3
- package/tsconfig.json +2 -1
- package/dist/cjs/__tests_external__/cases/media/test-cases/alt-text.js +0 -45
- package/dist/cjs/__tests_external__/cases/media/test-cases/caption.js +0 -44
- package/dist/cjs/__tests_external__/cases/media/test-cases/index.js +0 -23
- package/dist/cjs/__tests_external__/cases/media/test-cases/upload.js +0 -38
- package/dist/cjs/__tests_external__/page-objects/EditorMedia.js +0 -98
- package/dist/cjs/cypress-config.js +0 -3
- package/dist/es2019/__tests_external__/cases/media/test-cases/alt-text.js +0 -29
- package/dist/es2019/__tests_external__/cases/media/test-cases/caption.js +0 -28
- package/dist/es2019/__tests_external__/cases/media/test-cases/index.js +0 -8
- package/dist/es2019/__tests_external__/cases/media/test-cases/upload.js +0 -23
- package/dist/es2019/__tests_external__/page-objects/EditorMedia.js +0 -51
- package/dist/es2019/cypress-config.js +0 -1
- package/dist/esm/__tests_external__/cases/media/test-cases/alt-text.js +0 -32
- package/dist/esm/__tests_external__/cases/media/test-cases/caption.js +0 -31
- package/dist/esm/__tests_external__/cases/media/test-cases/index.js +0 -10
- package/dist/esm/__tests_external__/cases/media/test-cases/upload.js +0 -26
- package/dist/esm/__tests_external__/page-objects/EditorMedia.js +0 -83
- package/dist/esm/cypress-config.js +0 -1
- package/dist/types/__tests_external__/cases/media/test-cases/alt-text.d.ts +0 -3
- package/dist/types/__tests_external__/cases/media/test-cases/caption.d.ts +0 -3
- package/dist/types/__tests_external__/cases/media/test-cases/index.d.ts +0 -3
- package/dist/types/__tests_external__/cases/media/test-cases/types.d.ts +0 -4
- package/dist/types/__tests_external__/cases/media/test-cases/upload.d.ts +0 -7
- package/dist/types/__tests_external__/page-objects/EditorMedia.d.ts +0 -19
- package/dist/types/cypress-config.d.ts +0 -1
- package/dist/types-ts4.0/__tests_external__/cases/media/test-cases/alt-text.d.ts +0 -3
- package/dist/types-ts4.0/__tests_external__/cases/media/test-cases/caption.d.ts +0 -3
- package/dist/types-ts4.0/__tests_external__/cases/media/test-cases/index.d.ts +0 -3
- package/dist/types-ts4.0/__tests_external__/cases/media/test-cases/types.d.ts +0 -4
- package/dist/types-ts4.0/__tests_external__/cases/media/test-cases/upload.d.ts +0 -7
- package/dist/types-ts4.0/__tests_external__/page-objects/EditorMedia.d.ts +0 -19
- package/dist/types-ts4.0/cypress-config.d.ts +0 -1
|
@@ -4,12 +4,8 @@ import React from 'react';
|
|
|
4
4
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
|
|
5
5
|
import { createDispatch } from '../event-dispatcher';
|
|
6
6
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
// startMeasureReactNodeViewRendered,
|
|
10
|
-
// stopMeasureReactNodeViewRendered,
|
|
11
|
-
//} from './get-performance-options';
|
|
12
|
-
|
|
7
|
+
import { getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from '../utils';
|
|
8
|
+
import { analyticsEventKey } from '../utils/analytics';
|
|
13
9
|
export default class ReactNodeView {
|
|
14
10
|
constructor(_node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, hasAnalyticsContext = false, viewShouldUpdate, hasIntlContext = false) {
|
|
15
11
|
_defineProperty(this, "handleRef", node => this._handleRef(node));
|
|
@@ -66,24 +62,23 @@ export default class ReactNodeView {
|
|
|
66
62
|
// difference between them and it kills the nodeView
|
|
67
63
|
|
|
68
64
|
|
|
69
|
-
this.domRef.classList.add(`${this.node.type.name}View-content-wrap`);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
this.renderReactComponent(() => this.render(this.reactComponentProps, this.handleRef));
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
65
|
+
this.domRef.classList.add(`${this.node.type.name}View-content-wrap`);
|
|
66
|
+
const {
|
|
67
|
+
samplingRate,
|
|
68
|
+
slowThreshold,
|
|
69
|
+
trackingEnabled
|
|
70
|
+
} = getPerformanceOptions(this.view);
|
|
71
|
+
trackingEnabled && startMeasureReactNodeViewRendered({
|
|
72
|
+
nodeTypeName: this.node.type.name
|
|
73
|
+
});
|
|
74
|
+
this.renderReactComponent(() => this.render(this.reactComponentProps, this.handleRef));
|
|
75
|
+
trackingEnabled && stopMeasureReactNodeViewRendered({
|
|
76
|
+
nodeTypeName: this.node.type.name,
|
|
77
|
+
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
78
|
+
editorState: this.view.state,
|
|
79
|
+
samplingRate,
|
|
80
|
+
slowThreshold
|
|
81
|
+
});
|
|
87
82
|
return this;
|
|
88
83
|
}
|
|
89
84
|
|
|
@@ -9,7 +9,7 @@ export { ruleSharedStyles } from './shared/rule';
|
|
|
9
9
|
export { whitespaceSharedStyles } from './shared/whitespace';
|
|
10
10
|
export { paragraphSharedStyles } from './shared/paragraph';
|
|
11
11
|
export { linkSharedStyle } from './shared/link';
|
|
12
|
-
export { listsSharedStyles } from './shared/lists';
|
|
12
|
+
export { listsSharedStyles, listPaddingLeftMarkerSpace } from './shared/lists';
|
|
13
13
|
export { indentationSharedStyles } from './shared/indentation';
|
|
14
14
|
export { blockMarksSharedStyles } from './shared/block-marks';
|
|
15
15
|
export { codeMarkSharedStyles } from './shared/code-mark';
|
|
@@ -18,6 +18,6 @@ export { dateSharedStyle, DateSharedCssClassName } from './shared/date';
|
|
|
18
18
|
export { tasksAndDecisionsStyles, TaskDecisionSharedCssClassName } from './shared/task-decision';
|
|
19
19
|
export { StatusSharedCssClassName } from './shared/status';
|
|
20
20
|
export { smartCardSharedStyles, SmartCardSharedCssClassName } from './shared/smart-card';
|
|
21
|
-
export { CodeBlockSharedCssClassName, codeBlockSharedStyles } from './shared/code-block';
|
|
21
|
+
export { CodeBlockSharedCssClassName, codeBlockSharedStyles, codeBlockInListSafariFix } from './shared/code-block';
|
|
22
22
|
export { LAYOUT_SECTION_MARGIN, LAYOUT_COLUMN_PADDING } from './shared/layout';
|
|
23
23
|
export { EXTENSION_PADDING, BODIED_EXT_PADDING } from './shared/extension';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
|
-
import { akEditorCodeFontFamily, akEditorTableCellMinWidth, blockNodesVerticalMargin, overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
2
|
+
import { akEditorCodeFontFamily, akEditorLineHeight, akEditorTableCellMinWidth, blockNodesVerticalMargin, overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
3
3
|
import { DN20, DN400, DN50, DN800, N20, N30, N400, N800 } from '@atlaskit/theme/colors';
|
|
4
4
|
import { themed } from '@atlaskit/theme/components';
|
|
5
5
|
import { borderRadius, fontSize, gridSize } from '@atlaskit/theme/constants';
|
|
@@ -109,4 +109,16 @@ export const codeBlockSharedStyles = props => css`
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
+
`;
|
|
113
|
+
export const codeBlockInListSafariFix = css`
|
|
114
|
+
::before {
|
|
115
|
+
content: ' ';
|
|
116
|
+
line-height: ${akEditorLineHeight};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
> p:first-child,
|
|
120
|
+
> .code-block:first-child,
|
|
121
|
+
> .ProseMirror-gapcursor:first-child + .code-block {
|
|
122
|
+
margin-top: -${akEditorLineHeight}em !important;
|
|
123
|
+
}
|
|
112
124
|
`;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
import { bulletListSelector, orderedListSelector } from '@atlaskit/adf-schema';
|
|
3
3
|
import browser from '../../utils/browser';
|
|
4
|
+
export const listPaddingLeftMarkerSpace = 24;
|
|
4
5
|
export const listsSharedStyles = css`
|
|
5
6
|
/* =============== INDENTATION SPACING ========= */
|
|
6
7
|
|
|
7
8
|
ul,
|
|
8
9
|
ol {
|
|
9
10
|
box-sizing: border-box;
|
|
10
|
-
padding-left:
|
|
11
|
+
padding-left: ${listPaddingLeftMarkerSpace}px;
|
|
11
12
|
|
|
12
13
|
/*
|
|
13
14
|
Firefox does not handle empty block element inside li tag.
|
|
@@ -116,11 +116,13 @@ const tableSharedStyle = props => css`
|
|
|
116
116
|
margin-top: 0;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
> .ProseMirror-gapcursor
|
|
119
|
+
> .ProseMirror-gapcursor:first-child + *,
|
|
120
|
+
> style:first-child + .ProseMirror-gapcursor + * {
|
|
120
121
|
margin-top: 0;
|
|
121
122
|
}
|
|
122
123
|
|
|
123
|
-
> .ProseMirror-gapcursor:first-
|
|
124
|
+
> .ProseMirror-gapcursor:first-child + span + *,
|
|
125
|
+
> style:first-child + .ProseMirror-gapcursor + span + * {
|
|
124
126
|
margin-top: 0;
|
|
125
127
|
}
|
|
126
128
|
|
package/dist/es2019/{__tests_external__/cases/media/test-cases/types.js → types/copy-button.js}
RENAMED
|
File without changes
|
|
@@ -10,7 +10,7 @@ import { borderRadius, gridSize } from '@atlaskit/theme/constants';
|
|
|
10
10
|
import { token } from '@atlaskit/tokens';
|
|
11
11
|
import Layer from '../Layer';
|
|
12
12
|
const packageName = "@atlaskit/editor-common";
|
|
13
|
-
const packageVersion = "70.
|
|
13
|
+
const packageVersion = "70.2.0";
|
|
14
14
|
const halfFocusRing = 1;
|
|
15
15
|
const dropOffset = `0, ${gridSize()}px`;
|
|
16
16
|
|
|
@@ -117,8 +117,10 @@ const containerStyles = styleProps => {
|
|
|
117
117
|
border-color 0.3s ${akEditorSwoopCubicBezier};
|
|
118
118
|
padding: ${gridSize()}px;
|
|
119
119
|
|
|
120
|
-
// TODO: https://product-fabric.atlassian.net/browse/DSP-4152
|
|
121
120
|
&:hover {
|
|
121
|
+
// TODO: Remove the border styles below once design tokens have been enabled and fallbacks are no longer triggered.
|
|
122
|
+
// This is because the default state already uses the same token and, as such, the hover style won't change anything.
|
|
123
|
+
// https://product-fabric.atlassian.net/browse/DSP-4152
|
|
122
124
|
border: 1px solid
|
|
123
125
|
${themed({
|
|
124
126
|
light: token('color.border', colors.N50A),
|
|
@@ -135,20 +137,20 @@ const containerStyles = styleProps => {
|
|
|
135
137
|
};
|
|
136
138
|
|
|
137
139
|
const contentStyles = styleProps => themeProps => css`
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
140
|
+
padding-top: ${styleProps.expanded ? gridSize() : 0}px;
|
|
141
|
+
padding-right: ${gridSize()}px;
|
|
142
|
+
padding-left: ${gridSize() * 4 - gridSize() / 2}px;
|
|
143
|
+
display: flow-root;
|
|
144
|
+
|
|
145
|
+
// The follow rules inside @supports block are added as a part of ED-8893
|
|
146
|
+
// The fix is targeting mobile bridge on iOS 12 or below,
|
|
147
|
+
// We should consider remove this fix when we no longer support iOS 12
|
|
148
|
+
@supports not (display: flow-root) {
|
|
149
|
+
width: 100%;
|
|
150
|
+
box-sizing: border-box;
|
|
151
|
+
}
|
|
150
152
|
|
|
151
|
-
|
|
153
|
+
${!styleProps.expanded ? `
|
|
152
154
|
.expand-content-wrapper, .nestedExpand-content-wrapper {
|
|
153
155
|
/* We visually hide the content here to preserve the content during copy+paste */
|
|
154
156
|
width: 100%;
|
|
@@ -160,7 +162,7 @@ const contentStyles = styleProps => themeProps => css`
|
|
|
160
162
|
user-select: none;
|
|
161
163
|
}
|
|
162
164
|
` : ''}
|
|
163
|
-
`;
|
|
165
|
+
`;
|
|
164
166
|
|
|
165
167
|
const titleInputStyles = props => css`
|
|
166
168
|
outline: none;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { IntlContext, IntlProvider } from 'react-intl-next';
|
|
3
|
+
|
|
4
|
+
const useCheckIntlContext = () => useContext(IntlContext) === null;
|
|
5
|
+
|
|
6
|
+
export default function IntlProviderIfMissingWrapper({
|
|
7
|
+
children
|
|
8
|
+
}) {
|
|
9
|
+
const missingIntlContext = useCheckIntlContext();
|
|
10
|
+
|
|
11
|
+
if (missingIntlContext) {
|
|
12
|
+
return /*#__PURE__*/React.createElement(IntlProvider, {
|
|
13
|
+
locale: "en"
|
|
14
|
+
}, children);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return children;
|
|
18
|
+
}
|
|
@@ -205,7 +205,8 @@ export default class Popup extends React.Component {
|
|
|
205
205
|
style: {
|
|
206
206
|
position: 'absolute',
|
|
207
207
|
zIndex: this.props.zIndex || akEditorFloatingPanelZIndex,
|
|
208
|
-
...position
|
|
208
|
+
...position,
|
|
209
|
+
...this.props.style
|
|
209
210
|
},
|
|
210
211
|
"aria-label": this.props.ariaLabel || 'Popup' // Indicates component is an editor pop. Required for focus handling in Message.tsx
|
|
211
212
|
,
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
var _class;
|
|
4
|
+
|
|
2
5
|
import React from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
3
7
|
import { createPortal, unmountComponentAtNode, unstable_renderSubtreeIntoContainer } from 'react-dom';
|
|
4
8
|
import { injectIntl, RawIntlProvider, useIntl } from 'react-intl-next';
|
|
5
9
|
import { default as AnalyticsReactContext } from '@atlaskit/analytics-next-stable-react-context';
|
|
6
10
|
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
7
11
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../analytics';
|
|
8
12
|
import { EventDispatcher } from '../../event-dispatcher';
|
|
13
|
+
import IntlProviderIfMissingWrapper from '../IntlProviderIfMissingWrapper';
|
|
9
14
|
import { PortalProviderThemeProviders } from './PortalProviderThemesProvider';
|
|
10
15
|
export class PortalProviderAPI extends EventDispatcher {
|
|
11
16
|
constructor(intl, onAnalyticsEvent, analyticsContext, themeMode) {
|
|
@@ -29,12 +34,10 @@ export class PortalProviderAPI extends EventDispatcher {
|
|
|
29
34
|
hasAnalyticsContext,
|
|
30
35
|
hasIntlContext
|
|
31
36
|
});
|
|
32
|
-
|
|
33
|
-
const childrenWithThemeProviders = () => /*#__PURE__*/React.createElement(PortalProviderThemeProviders, {
|
|
37
|
+
const childrenWithThemeProviders = /*#__PURE__*/React.createElement(PortalProviderThemeProviders, {
|
|
34
38
|
mode: this.themeMode
|
|
35
39
|
}, children());
|
|
36
|
-
|
|
37
|
-
let wrappedChildren = this.useAnalyticsContext ? /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders()) : childrenWithThemeProviders();
|
|
40
|
+
let wrappedChildren = this.useAnalyticsContext ? /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders) : childrenWithThemeProviders;
|
|
38
41
|
|
|
39
42
|
if (hasIntlContext) {
|
|
40
43
|
wrappedChildren = /*#__PURE__*/React.createElement(RawIntlProvider, {
|
|
@@ -60,19 +63,18 @@ export class PortalProviderAPI extends EventDispatcher {
|
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
let wrappedChildren = portal.children();
|
|
63
|
-
|
|
64
|
-
const childrenWithThemeProviders = () => /*#__PURE__*/React.createElement(PortalProviderThemeProviders, {
|
|
66
|
+
const childrenWithThemeProviders = /*#__PURE__*/React.createElement(PortalProviderThemeProviders, {
|
|
65
67
|
mode: themeMode
|
|
66
68
|
}, wrappedChildren);
|
|
67
69
|
|
|
68
70
|
if (portal.hasAnalyticsContext && this.useAnalyticsContext) {
|
|
69
|
-
wrappedChildren = /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders
|
|
71
|
+
wrappedChildren = /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders);
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
if (portal.hasIntlContext) {
|
|
73
75
|
wrappedChildren = /*#__PURE__*/React.createElement(RawIntlProvider, {
|
|
74
76
|
value: this.intl
|
|
75
|
-
}, childrenWithThemeProviders
|
|
77
|
+
}, childrenWithThemeProviders);
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
unstable_renderSubtreeIntoContainer(this.context, wrappedChildren, container);
|
|
@@ -135,17 +137,32 @@ class BasePortalProvider extends React.Component {
|
|
|
135
137
|
_defineProperty(BasePortalProvider, "displayName", 'PortalProvider');
|
|
136
138
|
|
|
137
139
|
export const PortalProvider = injectIntl(BasePortalProvider);
|
|
138
|
-
export const PortalProviderWithThemeProviders =
|
|
140
|
+
export const PortalProviderWithThemeProviders = ({
|
|
141
|
+
onAnalyticsEvent,
|
|
142
|
+
useAnalyticsContext,
|
|
143
|
+
render
|
|
144
|
+
}) => /*#__PURE__*/React.createElement(IntlProviderIfMissingWrapper, null, /*#__PURE__*/React.createElement(PortalProviderWithThemeAndIntlProviders, {
|
|
145
|
+
onAnalyticsEvent: onAnalyticsEvent,
|
|
146
|
+
useAnalyticsContext: useAnalyticsContext,
|
|
147
|
+
render: render
|
|
148
|
+
}));
|
|
149
|
+
|
|
150
|
+
const PortalProviderWithThemeAndIntlProviders = ({
|
|
151
|
+
onAnalyticsEvent,
|
|
152
|
+
useAnalyticsContext,
|
|
153
|
+
render
|
|
154
|
+
}) => {
|
|
139
155
|
const intl = useIntl();
|
|
140
156
|
const globalTheme = useGlobalTheme();
|
|
141
157
|
return /*#__PURE__*/React.createElement(BasePortalProvider, {
|
|
142
158
|
intl: intl,
|
|
143
159
|
themeMode: globalTheme.mode,
|
|
144
|
-
onAnalyticsEvent:
|
|
145
|
-
useAnalyticsContext:
|
|
146
|
-
render:
|
|
160
|
+
onAnalyticsEvent: onAnalyticsEvent,
|
|
161
|
+
useAnalyticsContext: useAnalyticsContext,
|
|
162
|
+
render: render
|
|
147
163
|
});
|
|
148
164
|
};
|
|
165
|
+
|
|
149
166
|
export class PortalRenderer extends React.Component {
|
|
150
167
|
constructor(props) {
|
|
151
168
|
super(props);
|
|
@@ -179,7 +196,7 @@ const dummyAnalyticsContext = {
|
|
|
179
196
|
getAtlaskitAnalyticsEventHandlers() {}
|
|
180
197
|
|
|
181
198
|
};
|
|
182
|
-
const AnalyticsContextWrapper = class extends React.Component {
|
|
199
|
+
const AnalyticsContextWrapper = (_class = class AnalyticsContextWrapper extends React.Component {
|
|
183
200
|
render() {
|
|
184
201
|
const {
|
|
185
202
|
value
|
|
@@ -191,4 +208,6 @@ const AnalyticsContextWrapper = class extends React.Component {
|
|
|
191
208
|
}, this.props.children);
|
|
192
209
|
}
|
|
193
210
|
|
|
194
|
-
}
|
|
211
|
+
}, _defineProperty(_class, "contextTypes", {
|
|
212
|
+
contextAdapter: PropTypes.object
|
|
213
|
+
}), _class);
|
package/dist/es2019/ui/index.js
CHANGED
|
@@ -15,4 +15,5 @@ export { WithCreateAnalyticsEvent } from './WithCreateAnalyticsEvent';
|
|
|
15
15
|
export { messages as expandMessages, sharedExpandStyles, ExpandIconWrapper, expandLayoutWrapperStyle, ExpandLayoutWrapperWithRef } from './Expand';
|
|
16
16
|
export { ErrorMessage, HelperMessage, ValidMessage } from './Messages';
|
|
17
17
|
export { clearNextSiblingMarginTopStyle, clearNextSiblingBlockMarkMarginTopStyle } from './clear-next-sibling-margin-top';
|
|
18
|
-
export { IntlErrorBoundary, REACT_INTL_ERROR_MESSAGE } from './IntlErrorBoundary';
|
|
18
|
+
export { IntlErrorBoundary, REACT_INTL_ERROR_MESSAGE } from './IntlErrorBoundary';
|
|
19
|
+
export { default as IntlProviderIfMissingWrapper } from './IntlProviderIfMissingWrapper';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { akEditorBreakoutPadding, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorWideLayoutWidth, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
|
|
2
2
|
import { mapBreakpointToLayoutMaxWidth } from '../ui/BaseTheme';
|
|
3
3
|
import { getBreakpoint } from '../ui/WidthProvider';
|
|
4
|
+
import { parsePx } from './dom';
|
|
4
5
|
/**
|
|
5
6
|
* Variables required to construct a context for breakout ssr inline script.
|
|
6
7
|
*
|
|
@@ -15,6 +16,11 @@ const breakoutConsts = {
|
|
|
15
16
|
wideLayoutWidth: akEditorWideLayoutWidth,
|
|
16
17
|
mapBreakpointToLayoutMaxWidth,
|
|
17
18
|
getBreakpoint,
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Consumers are opinionated that this will always return a string ending in
|
|
22
|
+
* `px` when called with `full-width` or `wide` as the layout parameter.
|
|
23
|
+
*/
|
|
18
24
|
calcBreakoutWidth: (layout, containerWidth) => {
|
|
19
25
|
const effectiveFullWidth = containerWidth - breakoutConsts.padding;
|
|
20
26
|
|
|
@@ -57,4 +63,44 @@ export const absoluteBreakoutWidth = (layout, containerWidth) => {
|
|
|
57
63
|
};
|
|
58
64
|
export { breakoutConsts };
|
|
59
65
|
export const calcWideWidth = breakoutConsts.calcWideWidth;
|
|
60
|
-
export const calcBreakoutWidth = breakoutConsts.calcBreakoutWidth;
|
|
66
|
+
export const calcBreakoutWidth = breakoutConsts.calcBreakoutWidth;
|
|
67
|
+
export function calculateBreakoutStyles({
|
|
68
|
+
mode,
|
|
69
|
+
widthStateLineLength,
|
|
70
|
+
widthStateWidth
|
|
71
|
+
}) {
|
|
72
|
+
const breakoutWidth = calcBreakoutWidth(mode, widthStateWidth);
|
|
73
|
+
const breakoutWidthPx = parsePx(breakoutWidth);
|
|
74
|
+
|
|
75
|
+
if (!widthStateLineLength) {
|
|
76
|
+
// lineLength is not normally undefined when this is run for,
|
|
77
|
+
// consumers but can be in SSR, initial render or test (jsdom)
|
|
78
|
+
// environments.
|
|
79
|
+
//
|
|
80
|
+
// this approach doesn't work well with position: fixed, so
|
|
81
|
+
// it breaks things like sticky headers.
|
|
82
|
+
//
|
|
83
|
+
// It can also cause bluriness for some child content (such as iframes)
|
|
84
|
+
return {
|
|
85
|
+
type: 'line-length-unknown',
|
|
86
|
+
width: breakoutWidth,
|
|
87
|
+
transform: 'translateX(-50%)',
|
|
88
|
+
marginLeft: '50%'
|
|
89
|
+
};
|
|
90
|
+
} // NOTE
|
|
91
|
+
// At time of writing -- when toggling between full-width and
|
|
92
|
+
// full-page appearance modes. There is a slight delay before
|
|
93
|
+
// the widthState is updated.
|
|
94
|
+
// During this period -- the marginLeftPx will be incorrect.
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
const marginLeftPx = -(breakoutWidthPx - widthStateLineLength) / 2;
|
|
98
|
+
return {
|
|
99
|
+
type: 'line-length-known',
|
|
100
|
+
width: breakoutWidth,
|
|
101
|
+
marginLeft: `${marginLeftPx}px`
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export function calcBreakoutWidthPx(mode, widthStateWidth) {
|
|
105
|
+
return parsePx(calcBreakoutWidth(mode, widthStateWidth));
|
|
106
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const getParticipantsCount = editorState => {
|
|
2
|
+
var _collabEditPlugin$$pa, _collabEditPlugin$$pa2;
|
|
3
|
+
|
|
4
|
+
// TODO: ED-15663
|
|
5
|
+
// Please, do not copy or use this kind of code below
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
if (!editorState || !editorState['collabEditPlugin$']) {
|
|
8
|
+
return 1;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const participantsCount = (_collabEditPlugin$$pa = (_collabEditPlugin$$pa2 = editorState['collabEditPlugin$'].participants) === null || _collabEditPlugin$$pa2 === void 0 ? void 0 : _collabEditPlugin$$pa2.size()) !== null && _collabEditPlugin$$pa !== void 0 ? _collabEditPlugin$$pa : 1;
|
|
12
|
+
return participantsCount;
|
|
13
|
+
};
|
package/dist/es2019/utils/dom.js
CHANGED
|
@@ -90,6 +90,22 @@ export function closest(node, s) {
|
|
|
90
90
|
export function closestElement(node, s) {
|
|
91
91
|
return closest(node, s);
|
|
92
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Util for converting a css pixel size value to a number (of pixels).
|
|
95
|
+
*
|
|
96
|
+
* ie.
|
|
97
|
+
* ```ts
|
|
98
|
+
* const pixels = parsePx('10px')
|
|
99
|
+
* // ^$ const pixels: number
|
|
100
|
+
* ```
|
|
101
|
+
* * ```ts
|
|
102
|
+
* const pixels = parsePx('10')
|
|
103
|
+
* // ^$ const pixels: number | undefined
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
// At time of writting prettier would strip the extend here.
|
|
107
|
+
// prettier-ignore
|
|
108
|
+
|
|
93
109
|
export function parsePx(pxStr) {
|
|
94
110
|
if (!pxStr.endsWith('px')) {
|
|
95
111
|
return undefined;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics';
|
|
2
|
+
import { getParticipantsCount } from './collab';
|
|
3
|
+
import { startMeasure, stopMeasure } from './performance/measure'; // This was existing logic when converting from ReactNodeView
|
|
4
|
+
// our current sampling for this event is not bound by node.type
|
|
5
|
+
|
|
6
|
+
let nodeViewRenderedEventsCounter = 0;
|
|
7
|
+
const DEFAULT_SAMPLING_RATE = 100;
|
|
8
|
+
const DEFAULT_SLOW_THRESHOLD = 7;
|
|
9
|
+
export function getPerformanceOptions(view) {
|
|
10
|
+
var _nodeViewTracking$sam, _nodeViewTracking$slo;
|
|
11
|
+
|
|
12
|
+
// TODO: ED-15663
|
|
13
|
+
// Please, do not copy or use this kind of code below
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
const fakePluginKey = {
|
|
16
|
+
key: 'analyticsPlugin$',
|
|
17
|
+
getState: state => {
|
|
18
|
+
return state['analyticsPlugin$'];
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const pluginState = fakePluginKey.getState(view.state);
|
|
22
|
+
const nodeViewTracking = pluginState && pluginState.performanceTracking ? pluginState.performanceTracking.nodeViewTracking || {} : {};
|
|
23
|
+
const samplingRate = (_nodeViewTracking$sam = nodeViewTracking.samplingRate) !== null && _nodeViewTracking$sam !== void 0 ? _nodeViewTracking$sam : DEFAULT_SAMPLING_RATE;
|
|
24
|
+
const slowThreshold = (_nodeViewTracking$slo = nodeViewTracking.slowThreshold) !== null && _nodeViewTracking$slo !== void 0 ? _nodeViewTracking$slo : DEFAULT_SLOW_THRESHOLD;
|
|
25
|
+
return {
|
|
26
|
+
trackingEnabled: !!nodeViewTracking.enabled,
|
|
27
|
+
samplingRate,
|
|
28
|
+
slowThreshold
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export function startMeasureReactNodeViewRendered({
|
|
32
|
+
nodeTypeName
|
|
33
|
+
}) {
|
|
34
|
+
startMeasure(`🦉${nodeTypeName}::ReactNodeView`);
|
|
35
|
+
}
|
|
36
|
+
export function stopMeasureReactNodeViewRendered({
|
|
37
|
+
nodeTypeName,
|
|
38
|
+
dispatchAnalyticsEvent,
|
|
39
|
+
editorState,
|
|
40
|
+
samplingRate,
|
|
41
|
+
slowThreshold
|
|
42
|
+
}) {
|
|
43
|
+
stopMeasure(`🦉${nodeTypeName}::ReactNodeView`, duration => {
|
|
44
|
+
if (++nodeViewRenderedEventsCounter % samplingRate === 0 && duration > slowThreshold) {
|
|
45
|
+
dispatchAnalyticsEvent({
|
|
46
|
+
action: ACTION.REACT_NODEVIEW_RENDERED,
|
|
47
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
48
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
49
|
+
attributes: {
|
|
50
|
+
node: nodeTypeName,
|
|
51
|
+
duration,
|
|
52
|
+
participants: getParticipantsCount(editorState)
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
@@ -5,7 +5,7 @@ export { default as ErrorReporter } from './error-reporter';
|
|
|
5
5
|
export { isPastDate, timestampToIsoFormat, timestampToString, timestampToTaskContext, timestampToUTCDate, todayTimestampInUTC } from './date';
|
|
6
6
|
export { isElementInTableCell, isTextSelection, isLastItemMediaGroup, setNodeSelection, setTextSelection, nonNullable, stepAddsOneOf, stepHasSlice, extractSliceFromStep, isValidPosition } from './editor-core-utils';
|
|
7
7
|
export { withImageLoader } from './imageLoader';
|
|
8
|
-
export { absoluteBreakoutWidth, calcBreakoutWidth, calcWideWidth, breakoutConsts } from './breakout';
|
|
8
|
+
export { absoluteBreakoutWidth, calcBreakoutWidth, calcWideWidth, breakoutConsts, calculateBreakoutStyles, calcBreakoutWidthPx } from './breakout';
|
|
9
9
|
export { findChangedNodesFromTransaction, validNode, validateNodes, isType, isParagraph, isText, isLinkMark, SelectedState, isNodeSelectedOrInRange, isSupportedInParent } from './nodes';
|
|
10
10
|
export { pluginFactory } from './plugin-state-factory';
|
|
11
11
|
export { getFragmentBackingArray, mapFragment, mapSlice, flatmap, mapChildren } from './slice';
|
|
@@ -26,8 +26,12 @@ export { isTextInput } from './is-text-input';
|
|
|
26
26
|
export { ZERO_WIDTH_SPACE, ZERO_WIDTH_JOINER } from './whitespace';
|
|
27
27
|
export { shouldForceTracking } from './should-force-tracking';
|
|
28
28
|
export { getModeFromTheme } from './getModeFromTheme';
|
|
29
|
+
export { getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from './get-performance-options';
|
|
29
30
|
export { sniffUserBrowserExtensions } from './browser-extensions';
|
|
30
31
|
export { RenderCountProfiler } from './profiler/render-count';
|
|
31
32
|
export { validateADFEntity, validationErrorHandler } from './validate-using-spec';
|
|
32
33
|
export { getShallowPropsDifference, getPropsDifference } from './compare-props';
|
|
33
|
-
export { useComponentRenderTracking } from './performance/hooks/use-component-render-tracking';
|
|
34
|
+
export { useComponentRenderTracking } from './performance/hooks/use-component-render-tracking';
|
|
35
|
+
export { isOutdatedBrowser } from './outdated-browsers';
|
|
36
|
+
export { isReferencedSource } from './referentiality';
|
|
37
|
+
export { sendLogs } from './sendLogs';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const isOutdatedBrowser = userAgent => {
|
|
2
|
+
// Take browsers in both Desktop and Mobile (includes Chrome, Firefox, Edge and Safari) within last 2 years
|
|
3
|
+
const chrome = /Chrome\//.test(userAgent) && !/OPR\//.test(userAgent);
|
|
4
|
+
const chromeVersion = chrome ? parseInt((userAgent.match(/Chrome\/(\d+)/) || [])[1], 10) : 0;
|
|
5
|
+
|
|
6
|
+
if (chromeVersion >= 84) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const gecko = /gecko\/\d/i.test(userAgent);
|
|
11
|
+
const geckoVersion = gecko ? parseInt((userAgent.match(/Firefox\/(\d+)/) || [])[1], 10) : 0;
|
|
12
|
+
|
|
13
|
+
if (geckoVersion >= 84) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const edge = /Edge\/(\d+)/.exec(userAgent);
|
|
18
|
+
const edgeVersion = edge ? +edge[1] : 0;
|
|
19
|
+
|
|
20
|
+
if (edgeVersion >= 84) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const safari = !chrome && !gecko && /Version\/([0-9\._]+).*Safari/.test(userAgent);
|
|
25
|
+
const safariVersion = safari ? parseInt((userAgent.match(/Version\/([0-9\._]+).*Safari/) || [])[1], 10) : 0;
|
|
26
|
+
|
|
27
|
+
if (safariVersion >= 12) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return true;
|
|
32
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const isReferencedSource = (state, node) => {
|
|
2
|
+
var _node$attrs, _node$marks, _node$marks$find, _node$marks$find$attr;
|
|
3
|
+
|
|
4
|
+
if (!node) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
let found = false; // Handle nodes having 2 uuids. They could have a localId or a fragment. Regardless this needs
|
|
9
|
+
// to check if either id is used by a data consumer.
|
|
10
|
+
|
|
11
|
+
const localIds = new Set([(_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId, (_node$marks = node.marks) === null || _node$marks === void 0 ? void 0 : (_node$marks$find = _node$marks.find(mark => mark.type === state.schema.marks.fragment)) === null || _node$marks$find === void 0 ? void 0 : (_node$marks$find$attr = _node$marks$find.attrs) === null || _node$marks$find$attr === void 0 ? void 0 : _node$marks$find$attr.localId].filter(Boolean)); // If there are no uuids on the node then it's not possible for it to be referenced anywhere.
|
|
12
|
+
|
|
13
|
+
if (!localIds.size) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
state.doc.descendants(node => {
|
|
18
|
+
var _dataConsumer$attrs$s, _dataConsumer$attrs$s2;
|
|
19
|
+
|
|
20
|
+
if (found) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const dataConsumer = node.marks.find(mark => mark.type === state.schema.marks.dataConsumer);
|
|
25
|
+
|
|
26
|
+
if (!dataConsumer) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
found = (_dataConsumer$attrs$s = (_dataConsumer$attrs$s2 = dataConsumer.attrs.sources) === null || _dataConsumer$attrs$s2 === void 0 ? void 0 : _dataConsumer$attrs$s2.some(src => localIds.has(src))) !== null && _dataConsumer$attrs$s !== void 0 ? _dataConsumer$attrs$s : false;
|
|
31
|
+
return !found;
|
|
32
|
+
});
|
|
33
|
+
return found;
|
|
34
|
+
};
|
package/dist/es2019/version.json
CHANGED