@atlaskit/editor-common 99.5.1 → 99.5.2
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 +8 -0
- package/dist/cjs/card/MediaAndEmbedsToolbar/index.js +3 -12
- package/dist/cjs/commands/index.js +42 -50
- package/dist/cjs/commands/insert-block.js +1 -4
- package/dist/cjs/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +1 -6
- package/dist/cjs/extensibility/Extension/Extension/index.js +6 -3
- package/dist/cjs/extensibility/Extension/InlineExtension/index.js +4 -2
- package/dist/cjs/extensibility/Extension/Lozenge/ExtensionLabel.js +16 -6
- package/dist/cjs/extensibility/Extension/Lozenge/LozengeComponent.js +4 -2
- package/dist/cjs/extensibility/Extension/Lozenge/index.js +4 -2
- package/dist/cjs/extensibility/MultiBodiedExtension/index.js +4 -2
- package/dist/cjs/extensibility/extensionNodeView.js +1 -2
- package/dist/cjs/guideline/dynamicGuideline.js +1 -4
- package/dist/cjs/guideline/relativeGuideline.js +3 -12
- package/dist/cjs/guideline/updateGuideline.js +1 -4
- package/dist/cjs/hooks/useSharedPluginStateSelector/useSharedPluginStateSelector.js +9 -11
- package/dist/cjs/insert/index.js +1 -4
- package/dist/cjs/keymaps/index.js +0 -3
- package/dist/cjs/lazy-node-view/index.js +1 -6
- package/dist/cjs/lazy-node-view/node-view.js +0 -2
- package/dist/cjs/link/LinkPicker/HyperlinkAddToolbar/HyperlinkAddToolbar.js +0 -2
- package/dist/cjs/lists/analytics.js +0 -2
- package/dist/cjs/mark/commands.js +2 -11
- package/dist/cjs/media-single/utils.js +0 -5
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/node-width/index.js +1 -4
- package/dist/cjs/paste/md-plugins/ignore-list-heading-md-plugin.js +0 -5
- package/dist/cjs/preset/core-plugin/requestDocument.js +1 -2
- package/dist/cjs/react-node-view/index.js +1 -9
- package/dist/cjs/resizer/Resizer.js +2 -8
- package/dist/cjs/selection/gap-cursor/actions.js +2 -8
- package/dist/cjs/selection/index.js +0 -2
- package/dist/cjs/selection-based-node-view/SelectionBasedNodeView.js +0 -6
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/Layer/index.js +0 -2
- package/dist/cjs/ui/MediaSingle/grid.js +2 -8
- package/dist/cjs/ui/MediaSingle/styled.js +0 -4
- package/dist/cjs/ui/Popup/utils.js +0 -7
- package/dist/cjs/ui/ResizerLegacy/index.js +0 -4
- package/dist/cjs/ui/unsupported-content-helper.js +0 -2
- package/dist/cjs/utils/breakout.js +0 -2
- package/dist/cjs/utils/commands.js +1 -4
- package/dist/cjs/utils/editor-core-utils.js +0 -3
- package/dist/cjs/utils/input-rules.js +1 -4
- package/dist/cjs/utils/nodes.js +1 -6
- package/dist/cjs/utils/page-element-counts.js +10 -3
- package/dist/cjs/utils/performance/measure-tti.js +0 -5
- package/dist/cjs/utils/plugin-state-factory.js +0 -2
- package/dist/cjs/utils/processRawValue.js +0 -6
- package/dist/cjs/utils/prosemirror/autojoin.js +0 -2
- package/dist/cjs/utils/rich-media-utils.js +1 -4
- package/dist/cjs/utils/track-unsupported-content.js +2 -8
- package/dist/cjs/utils/validate-using-spec.js +1 -7
- package/dist/cjs/with-plugin-state/index.js +0 -4
- package/dist/es2019/card/MediaAndEmbedsToolbar/index.js +3 -12
- package/dist/es2019/commands/index.js +2 -8
- package/dist/es2019/commands/insert-block.js +1 -4
- package/dist/es2019/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +1 -6
- package/dist/es2019/extensibility/Extension/Extension/index.js +6 -3
- package/dist/es2019/extensibility/Extension/InlineExtension/index.js +4 -2
- package/dist/es2019/extensibility/Extension/Lozenge/ExtensionLabel.js +16 -6
- package/dist/es2019/extensibility/Extension/Lozenge/LozengeComponent.js +4 -2
- package/dist/es2019/extensibility/Extension/Lozenge/index.js +4 -2
- package/dist/es2019/extensibility/MultiBodiedExtension/index.js +4 -2
- package/dist/es2019/extensibility/extensionNodeView.js +0 -3
- package/dist/es2019/guideline/dynamicGuideline.js +1 -4
- package/dist/es2019/guideline/relativeGuideline.js +3 -12
- package/dist/es2019/guideline/snapping.js +1 -4
- package/dist/es2019/guideline/updateGuideline.js +1 -4
- package/dist/es2019/hooks/useSharedPluginStateSelector/useSharedPluginStateSelector.js +9 -11
- package/dist/es2019/insert/index.js +1 -4
- package/dist/es2019/keymaps/index.js +0 -3
- package/dist/es2019/lazy-node-view/index.js +1 -6
- package/dist/es2019/lazy-node-view/node-view.js +0 -2
- package/dist/es2019/link/LinkPicker/HyperlinkAddToolbar/HyperlinkAddToolbar.js +0 -2
- package/dist/es2019/lists/analytics.js +0 -2
- package/dist/es2019/mark/commands.js +2 -11
- package/dist/es2019/media-single/utils.js +0 -5
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/node-width/index.js +1 -4
- package/dist/es2019/paste/md-plugins/ignore-list-heading-md-plugin.js +0 -5
- package/dist/es2019/preset/core-plugin/requestDocument.js +1 -2
- package/dist/es2019/react-node-view/index.js +0 -7
- package/dist/es2019/resizer/Resizer.js +2 -8
- package/dist/es2019/selection/gap-cursor/actions.js +2 -8
- package/dist/es2019/selection/index.js +0 -2
- package/dist/es2019/selection-based-node-view/SelectionBasedNodeView.js +0 -6
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/Layer/index.js +0 -2
- package/dist/es2019/ui/MediaSingle/grid.js +2 -8
- package/dist/es2019/ui/MediaSingle/styled.js +0 -4
- package/dist/es2019/ui/Popup/utils.js +0 -7
- package/dist/es2019/ui/ResizerLegacy/index.js +0 -4
- package/dist/es2019/ui/unsupported-content-helper.js +0 -2
- package/dist/es2019/utils/breakout.js +0 -2
- package/dist/es2019/utils/commands.js +1 -4
- package/dist/es2019/utils/compare-props.js +1 -4
- package/dist/es2019/utils/editor-core-utils.js +0 -3
- package/dist/es2019/utils/input-rules.js +1 -4
- package/dist/es2019/utils/nodes.js +1 -6
- package/dist/es2019/utils/page-element-counts.js +10 -3
- package/dist/es2019/utils/performance/measure-tti.js +0 -6
- package/dist/es2019/utils/plugin-state-factory.js +0 -2
- package/dist/es2019/utils/processRawValue.js +0 -6
- package/dist/es2019/utils/prosemirror/autojoin.js +0 -2
- package/dist/es2019/utils/rich-media-utils.js +1 -4
- package/dist/es2019/utils/track-unsupported-content.js +3 -12
- package/dist/es2019/utils/validate-using-spec.js +1 -7
- package/dist/es2019/with-plugin-state/index.js +0 -4
- package/dist/esm/card/MediaAndEmbedsToolbar/index.js +3 -12
- package/dist/esm/commands/index.js +42 -50
- package/dist/esm/commands/insert-block.js +1 -4
- package/dist/esm/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +1 -6
- package/dist/esm/extensibility/Extension/Extension/index.js +6 -3
- package/dist/esm/extensibility/Extension/InlineExtension/index.js +4 -2
- package/dist/esm/extensibility/Extension/Lozenge/ExtensionLabel.js +16 -6
- package/dist/esm/extensibility/Extension/Lozenge/LozengeComponent.js +4 -2
- package/dist/esm/extensibility/Extension/Lozenge/index.js +4 -2
- package/dist/esm/extensibility/MultiBodiedExtension/index.js +4 -2
- package/dist/esm/extensibility/extensionNodeView.js +0 -3
- package/dist/esm/guideline/dynamicGuideline.js +1 -4
- package/dist/esm/guideline/relativeGuideline.js +3 -12
- package/dist/esm/guideline/updateGuideline.js +1 -4
- package/dist/esm/hooks/useSharedPluginStateSelector/useSharedPluginStateSelector.js +9 -11
- package/dist/esm/insert/index.js +1 -4
- package/dist/esm/keymaps/index.js +0 -3
- package/dist/esm/lazy-node-view/index.js +1 -6
- package/dist/esm/lazy-node-view/node-view.js +0 -2
- package/dist/esm/link/LinkPicker/HyperlinkAddToolbar/HyperlinkAddToolbar.js +0 -2
- package/dist/esm/lists/analytics.js +0 -2
- package/dist/esm/mark/commands.js +2 -11
- package/dist/esm/media-single/utils.js +0 -5
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/node-width/index.js +1 -4
- package/dist/esm/paste/md-plugins/ignore-list-heading-md-plugin.js +0 -5
- package/dist/esm/preset/core-plugin/requestDocument.js +1 -2
- package/dist/esm/react-node-view/index.js +1 -9
- package/dist/esm/resizer/Resizer.js +2 -8
- package/dist/esm/selection/gap-cursor/actions.js +2 -8
- package/dist/esm/selection/index.js +0 -2
- package/dist/esm/selection-based-node-view/SelectionBasedNodeView.js +0 -6
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/Layer/index.js +0 -2
- package/dist/esm/ui/MediaSingle/grid.js +2 -8
- package/dist/esm/ui/MediaSingle/styled.js +0 -4
- package/dist/esm/ui/Popup/utils.js +0 -7
- package/dist/esm/ui/ResizerLegacy/index.js +0 -4
- package/dist/esm/ui/unsupported-content-helper.js +0 -2
- package/dist/esm/utils/breakout.js +0 -2
- package/dist/esm/utils/commands.js +1 -4
- package/dist/esm/utils/editor-core-utils.js +0 -3
- package/dist/esm/utils/input-rules.js +1 -4
- package/dist/esm/utils/nodes.js +1 -6
- package/dist/esm/utils/page-element-counts.js +10 -3
- package/dist/esm/utils/performance/measure-tti.js +0 -6
- package/dist/esm/utils/plugin-state-factory.js +0 -2
- package/dist/esm/utils/processRawValue.js +0 -6
- package/dist/esm/utils/prosemirror/autojoin.js +0 -2
- package/dist/esm/utils/rich-media-utils.js +1 -4
- package/dist/esm/utils/track-unsupported-content.js +2 -8
- package/dist/esm/utils/validate-using-spec.js +1 -7
- package/dist/esm/with-plugin-state/index.js +0 -4
- package/dist/types/extensibility/Extension/Lozenge/ExtensionLabel.d.ts +3 -1
- package/dist/types/extensibility/Extension/Lozenge/LozengeComponent.d.ts +3 -1
- package/dist/types/extensibility/Extension/Lozenge/index.d.ts +2 -0
- package/dist/types-ts4.5/extensibility/Extension/Lozenge/ExtensionLabel.d.ts +3 -1
- package/dist/types-ts4.5/extensibility/Extension/Lozenge/LozengeComponent.d.ts +3 -1
- package/dist/types-ts4.5/extensibility/Extension/Lozenge/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -19,10 +19,7 @@ export function calcPctFromPx(width, lineLength) {
|
|
|
19
19
|
return (width + MEDIA_SINGLE_GUTTER_SIZE) / maxWidth;
|
|
20
20
|
}
|
|
21
21
|
export const wrappedLayouts = ['wrap-left', 'wrap-right', 'align-end', 'align-start'];
|
|
22
|
-
export const calcPctWidth = (containerWidth, pctWidth, origWidth, origHeight
|
|
23
|
-
// Ignored via go/ees005
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
25
|
-
) => pctWidth && origWidth && origHeight && Math.ceil(calcPxFromPct(pctWidth / 100, containerWidth.lineLength || containerWidth.width));
|
|
22
|
+
export const calcPctWidth = (containerWidth, pctWidth, origWidth, origHeight) => pctWidth && origWidth && origHeight && Math.ceil(calcPxFromPct(pctWidth / 100, containerWidth.lineLength || containerWidth.width));
|
|
26
23
|
export const calcMediaPxWidth = opts => {
|
|
27
24
|
const {
|
|
28
25
|
origWidth,
|
|
@@ -74,10 +71,7 @@ export const calcMediaPxWidth = opts => {
|
|
|
74
71
|
}
|
|
75
72
|
return origWidth;
|
|
76
73
|
};
|
|
77
|
-
export const snapToGrid = (gridWidth, width, height, lineLength, gridSize
|
|
78
|
-
// Ignored via go/ees005
|
|
79
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
80
|
-
) => {
|
|
74
|
+
export const snapToGrid = (gridWidth, width, height, lineLength, gridSize) => {
|
|
81
75
|
const pxWidth = calcPxFromPct(gridWidth / 100, lineLength);
|
|
82
76
|
const columnSpan = Math.round(calcColumnsFromPx(pxWidth, lineLength, gridSize));
|
|
83
77
|
const alignedWidth = calcPxFromColumns(columnSpan, lineLength, gridSize);
|
|
@@ -40,8 +40,6 @@ function getWidthIfDefaultMode(originalWidth, containerWidth, isInsideOfInlineEx
|
|
|
40
40
|
* then an image in wide or full-width can not be wider than the image's
|
|
41
41
|
* original width.
|
|
42
42
|
*/
|
|
43
|
-
// Ignored via go/ees005
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
45
43
|
export function calcLegacyWidth(layout, width, containerWidth = 0, fullWidthMode, isResized, isInsideOfInlineExtension) {
|
|
46
44
|
switch (layout) {
|
|
47
45
|
case 'align-start':
|
|
@@ -65,8 +63,6 @@ export function calcLegacyWidth(layout, width, containerWidth = 0, fullWidthMode
|
|
|
65
63
|
* then an image in wide or full-width can not be wider than the image's
|
|
66
64
|
* original width.
|
|
67
65
|
*/
|
|
68
|
-
// Ignored via go/ees005
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
70
66
|
export function calcLegacyWidthForInline(layout, width, containerWidth = 0, fullWidthMode, isResized) {
|
|
71
67
|
switch (layout) {
|
|
72
68
|
case 'align-start':
|
|
@@ -8,8 +8,6 @@ export function isTextNode(elem) {
|
|
|
8
8
|
/**
|
|
9
9
|
* Decides if given fitHeight fits below or above the target taking boundaries into account.
|
|
10
10
|
*/
|
|
11
|
-
// Ignored via go/ees005
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
13
11
|
export function getVerticalPlacement(target, boundariesElement, fitHeight, alignY, forcePlacement, preventOverflow) {
|
|
14
12
|
if (forcePlacement && alignY) {
|
|
15
13
|
return alignY;
|
|
@@ -49,8 +47,6 @@ export function getVerticalPlacement(target, boundariesElement, fitHeight, align
|
|
|
49
47
|
/**
|
|
50
48
|
* Decides if given fitWidth fits to the left or to the right of the target taking boundaries into account.
|
|
51
49
|
*/
|
|
52
|
-
// Ignored via go/ees005
|
|
53
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
54
50
|
export function getHorizontalPlacement(target, boundariesElement, fitWidth, alignX, forcePlacement, preventOverflow) {
|
|
55
51
|
// force placement unless preventOverflow is enabled
|
|
56
52
|
if (forcePlacement && alignX && !preventOverflow) {
|
|
@@ -81,9 +77,6 @@ export function getHorizontalPlacement(target, boundariesElement, fitWidth, alig
|
|
|
81
77
|
}
|
|
82
78
|
return 'right';
|
|
83
79
|
}
|
|
84
|
-
|
|
85
|
-
// Ignored via go/ees005
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
87
80
|
export function calculatePlacement(target, boundariesElement, fitWidth, fitHeight, alignX, alignY, forcePlacement, preventOverflow) {
|
|
88
81
|
return [getVerticalPlacement(target, boundariesElement, fitHeight, alignY, forcePlacement, preventOverflow), getHorizontalPlacement(target, boundariesElement, fitWidth, alignX, forcePlacement, preventOverflow)];
|
|
89
82
|
}
|
|
@@ -54,8 +54,6 @@ export default class Resizer extends React.Component {
|
|
|
54
54
|
displayGrid === null || displayGrid === void 0 ? void 0 : displayGrid(newHighlights.length > 0, gridTypeForLayout(layout), newHighlights);
|
|
55
55
|
});
|
|
56
56
|
});
|
|
57
|
-
// Ignored via go/ees005
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
59
57
|
_defineProperty(this, "handleResize", (_event, _direction, _elementRef, delta) => {
|
|
60
58
|
const {
|
|
61
59
|
highlights,
|
|
@@ -89,8 +87,6 @@ export default class Resizer extends React.Component {
|
|
|
89
87
|
isResizing: true
|
|
90
88
|
});
|
|
91
89
|
});
|
|
92
|
-
// Ignored via go/ees005
|
|
93
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
94
90
|
_defineProperty(this, "handleResizeStop", (_event, _direction, _elementRef, delta) => {
|
|
95
91
|
const {
|
|
96
92
|
highlights,
|
|
@@ -50,8 +50,6 @@ const breakoutConsts = {
|
|
|
50
50
|
return breakoutConsts.calcBreakoutWidth(mode, editorContainerWidth);
|
|
51
51
|
},
|
|
52
52
|
calcLineLength: () => breakoutConsts.defaultLayoutWidth,
|
|
53
|
-
// Ignored via go/ees005
|
|
54
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
55
53
|
calcWideWidth: (containerWidth = breakoutConsts.defaultLayoutWidth, maxWidth = Infinity, fallback = '100%', padding) => {
|
|
56
54
|
const effectiveFullWidth = containerWidth - (padding !== null && padding !== void 0 ? padding : breakoutConsts.padding);
|
|
57
55
|
const layoutMaxWidth = breakoutConsts.mapBreakpointToLayoutMaxWidth(breakoutConsts.getBreakpoint(containerWidth));
|
|
@@ -258,10 +258,7 @@ export const deleteEmptyParagraphAndMoveBlockUp = canNextNodeMoveUp => {
|
|
|
258
258
|
return false;
|
|
259
259
|
};
|
|
260
260
|
};
|
|
261
|
-
export const insertContentDeleteRange = (tr, getSelectionResolvedPos, insertions, deletions
|
|
262
|
-
// Ignored via go/ees005
|
|
263
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
264
|
-
) => {
|
|
261
|
+
export const insertContentDeleteRange = (tr, getSelectionResolvedPos, insertions, deletions) => {
|
|
265
262
|
insertions.forEach(contentInsert => {
|
|
266
263
|
const [content, pos] = contentInsert;
|
|
267
264
|
tr.insert(tr.mapping.map(pos), content);
|
|
@@ -34,10 +34,7 @@ export const serializeValue = value => {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
export const getPropsDifference = (object1, object2, curDepth = 0, maxDepth = 2, keysToIgnore = []
|
|
38
|
-
// Ignored via go/ees005
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
40
|
-
) => {
|
|
37
|
+
export const getPropsDifference = (object1, object2, curDepth = 0, maxDepth = 2, keysToIgnore = []) => {
|
|
41
38
|
const {
|
|
42
39
|
added,
|
|
43
40
|
common,
|
|
@@ -104,9 +104,6 @@ export const isValidPosition = (pos, state) => {
|
|
|
104
104
|
export const isInLayoutColumn = state => {
|
|
105
105
|
return hasParentNodeOfType(state.schema.nodes.layoutSection)(state.selection);
|
|
106
106
|
};
|
|
107
|
-
|
|
108
|
-
// Ignored via go/ees005
|
|
109
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
110
107
|
export function filterChildrenBetween(doc, from, to, predicate) {
|
|
111
108
|
const results = [];
|
|
112
109
|
doc.nodesBetween(from, to, (node, pos, parent) => {
|
|
@@ -26,10 +26,7 @@ export const createWrappingJoinRule = ({
|
|
|
26
26
|
getAttrs,
|
|
27
27
|
joinPredicate
|
|
28
28
|
}) => {
|
|
29
|
-
const handler = (state, match, start, end
|
|
30
|
-
// Ignored via go/ees005
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
32
|
-
) => {
|
|
29
|
+
const handler = (state, match, start, end) => {
|
|
33
30
|
const attrs = (getAttrs instanceof Function ? getAttrs(match) : getAttrs) || {};
|
|
34
31
|
const tr = state.tr;
|
|
35
32
|
const fixedStart = Math.max(start, 1);
|
|
@@ -9,8 +9,6 @@ export const findChangedNodesFromTransaction = tr => {
|
|
|
9
9
|
const nodes = [];
|
|
10
10
|
const steps = tr.steps || [];
|
|
11
11
|
steps.forEach(step => {
|
|
12
|
-
// Ignored via go/ees005
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
14
12
|
step.getMap().forEach((oldStart, oldEnd, newStart, newEnd) => {
|
|
15
13
|
tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), node => {
|
|
16
14
|
if (!nodes.find(n => n === node)) {
|
|
@@ -49,10 +47,7 @@ export let SelectedState = /*#__PURE__*/function (SelectedState) {
|
|
|
49
47
|
* If the node is selected then an enum is returned that describes weather the node
|
|
50
48
|
* is fully selected by a range or if the "inside" of the node has been selected or clicked.
|
|
51
49
|
*/
|
|
52
|
-
export const isNodeSelectedOrInRange = (anchorPosition, headPosition, nodePosition, nodeSize
|
|
53
|
-
// Ignored via go/ees005
|
|
54
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
55
|
-
) => {
|
|
50
|
+
export const isNodeSelectedOrInRange = (anchorPosition, headPosition, nodePosition, nodeSize) => {
|
|
56
51
|
if (typeof nodePosition !== 'number') {
|
|
57
52
|
return null;
|
|
58
53
|
}
|
|
@@ -69,11 +69,18 @@ const getHasNestedTable = node => {
|
|
|
69
69
|
return hasNestedTable;
|
|
70
70
|
}
|
|
71
71
|
if (node.type === 'table') {
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
// The first node that we pass into the reduce function is a table node, and we need to ignore it
|
|
73
|
+
let foundFirstTable = false;
|
|
74
|
+
return reduce(node, (hasNestedTable, node) => {
|
|
75
|
+
if (hasNestedTable) {
|
|
76
|
+
return hasNestedTable;
|
|
77
|
+
}
|
|
78
|
+
if (node.type === 'table' && foundFirstTable) {
|
|
74
79
|
return true;
|
|
80
|
+
} else if (node.type === 'table') {
|
|
81
|
+
foundFirstTable = true;
|
|
75
82
|
}
|
|
76
|
-
return
|
|
83
|
+
return hasNestedTable;
|
|
77
84
|
}, false);
|
|
78
85
|
}
|
|
79
86
|
return hasNestedTable;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { SEVERITY } from '../analytics';
|
|
2
2
|
import { isPerformanceObserverLongTaskAvailable } from './is-performance-api-available';
|
|
3
3
|
import { getDistortedDurationMonitor } from './measure-render';
|
|
4
|
-
|
|
5
|
-
// Ignored via go/ees005
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
7
4
|
export function measureTTI(onMeasureComplete, idleThreshold = 1000, cancelAfter = 60,
|
|
8
5
|
// Dependency Injection for easier testing
|
|
9
6
|
PerfObserver) {
|
|
@@ -66,9 +63,6 @@ export const TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS = {
|
|
|
66
63
|
NORMAL: 5000,
|
|
67
64
|
DEGRADED: 8000
|
|
68
65
|
};
|
|
69
|
-
|
|
70
|
-
// Ignored via go/ees005
|
|
71
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
72
66
|
export function getTTISeverity(tti, ttiFromInvocation, ttiSeverityNormalThreshold, ttiSeverityDegradedThreshold, ttiFromInvocationSeverityNormalThreshold, ttiFromInvocationSeverityDegradedThreshold) {
|
|
73
67
|
const ttiNormalThreshold = ttiSeverityNormalThreshold || TTI_SEVERITY_THRESHOLD_DEFAULTS.NORMAL;
|
|
74
68
|
const ttiDegradedThreshold = ttiSeverityDegradedThreshold || TTI_SEVERITY_THRESHOLD_DEFAULTS.DEGRADED;
|
|
@@ -60,8 +60,6 @@ export function pluginFactory(pluginKey, reducer, options = {}) {
|
|
|
60
60
|
createPluginState(dispatch, initialState) {
|
|
61
61
|
return {
|
|
62
62
|
init: (_, state) => isFunction(initialState) ? initialState(state) : initialState,
|
|
63
|
-
// Ignored via go/ees005
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
65
63
|
apply: (tr, _pluginState, _oldEditorState, newEditorState) => {
|
|
66
64
|
const oldPluginState = mapping ? mapping(tr, _pluginState, newEditorState) : _pluginState;
|
|
67
65
|
let newPluginState = oldPluginState;
|
|
@@ -67,9 +67,6 @@ export function processRawValueWithoutValidation(schema, value, dispatchAnalytic
|
|
|
67
67
|
return Node.fromJSON(schema, node);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
// Ignored via go/ees005
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
73
70
|
export function processRawValue(schema, value, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent) {
|
|
74
71
|
if (!value) {
|
|
75
72
|
return;
|
|
@@ -258,9 +255,6 @@ export function processRawValue(schema, value, providerFactory, sanitizePrivateC
|
|
|
258
255
|
return;
|
|
259
256
|
}
|
|
260
257
|
}
|
|
261
|
-
|
|
262
|
-
// Ignored via go/ees005
|
|
263
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
264
258
|
export function processRawFragmentValue(schema, value, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent) {
|
|
265
259
|
if (!value) {
|
|
266
260
|
return;
|
|
@@ -21,8 +21,6 @@ export function autoJoinTr(tr, isJoinable) {
|
|
|
21
21
|
for (let j = 0; j < ranges.length; j++) {
|
|
22
22
|
ranges[j] = map.map(ranges[j]);
|
|
23
23
|
}
|
|
24
|
-
// Ignored via go/ees005
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
26
24
|
map.forEach((_s, _e, from, to) => ranges.push(from, to));
|
|
27
25
|
}
|
|
28
26
|
|
|
@@ -18,10 +18,7 @@ export const isRichMediaInsideOfBlockNode = (view, pos) => {
|
|
|
18
18
|
} = view.state.schema.nodes;
|
|
19
19
|
return !!findParentNodeOfTypeClosestToPos($pos, [expand, nestedExpand, layoutColumn]);
|
|
20
20
|
};
|
|
21
|
-
export const alignAttributes = (layout, oldAttrs, gridSize = 12, originalWidth, lineLength
|
|
22
|
-
// Ignored via go/ees005
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
24
|
-
) => {
|
|
21
|
+
export const alignAttributes = (layout, oldAttrs, gridSize = 12, originalWidth, lineLength) => {
|
|
25
22
|
let width = oldAttrs.width;
|
|
26
23
|
const oldLayout = oldAttrs.layout;
|
|
27
24
|
const oldLayoutIsNonWrapped = nonWrappedLayouts.indexOf(oldLayout) > -1;
|
|
@@ -38,10 +38,7 @@ const sanitizeAttributes = (attrs = {}) => {
|
|
|
38
38
|
});
|
|
39
39
|
return sanitizedAttrs;
|
|
40
40
|
};
|
|
41
|
-
const trackUnsupportedContentTooltipActionFor = (action, dispatchAnalyticsEvent, unsupportedContentType, originalNodeType
|
|
42
|
-
// Ignored via go/ees005
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
44
|
-
) => {
|
|
41
|
+
const trackUnsupportedContentTooltipActionFor = (action, dispatchAnalyticsEvent, unsupportedContentType, originalNodeType) => {
|
|
45
42
|
dispatchAnalyticsEvent({
|
|
46
43
|
action: action,
|
|
47
44
|
actionSubjectId: unsupportedContentType,
|
|
@@ -52,10 +49,7 @@ const trackUnsupportedContentTooltipActionFor = (action, dispatchAnalyticsEvent,
|
|
|
52
49
|
}
|
|
53
50
|
});
|
|
54
51
|
};
|
|
55
|
-
export const findAndTrackUnsupportedContentNodes = (node, schema, dispatchAnalyticsEvent, ancestorHierarchy = ''
|
|
56
|
-
// Ignored via go/ees005
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
58
|
-
) => {
|
|
52
|
+
export const findAndTrackUnsupportedContentNodes = (node, schema, dispatchAnalyticsEvent, ancestorHierarchy = '') => {
|
|
59
53
|
const {
|
|
60
54
|
type: nodeType,
|
|
61
55
|
marks: nodeMarks
|
|
@@ -128,10 +122,7 @@ export const findAndTrackUnsupportedContentNodes = (node, schema, dispatchAnalyt
|
|
|
128
122
|
node.content.forEach(childNode => findAndTrackUnsupportedContentNodes(childNode, schema, dispatchAnalyticsEvent, concatAncestorHierarchy(node, ancestorHierarchy)));
|
|
129
123
|
}
|
|
130
124
|
};
|
|
131
|
-
export const fireUnsupportedEvent = (dispatchAnalyticsEvent, actionSubjectId, unsupportedNode, errorCode
|
|
132
|
-
// Ignored via go/ees005
|
|
133
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
134
|
-
) => {
|
|
125
|
+
export const fireUnsupportedEvent = (dispatchAnalyticsEvent, actionSubjectId, unsupportedNode, errorCode) => {
|
|
135
126
|
const sanitizedAttrs = sanitizeAttributes(unsupportedNode.attrs);
|
|
136
127
|
const sanitizedMarks = sanitizeMarks(unsupportedNode.marks);
|
|
137
128
|
const sanitizedUnsupportedNode = {
|
|
@@ -7,10 +7,7 @@ const errorCallbackFor = (marks, validate, dispatchAnalyticsEvent) => {
|
|
|
7
7
|
return validationErrorHandler(entity, error, options, marks, validate, dispatchAnalyticsEvent);
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
-
export const validationErrorHandler = (entity, error, options, marks, validate, dispatchAnalyticsEvent
|
|
11
|
-
// Ignored via go/ees005
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
13
|
-
) => {
|
|
10
|
+
export const validationErrorHandler = (entity, error, options, marks, validate, dispatchAnalyticsEvent) => {
|
|
14
11
|
if (entity && entity.type === UNSUPPORTED_NODE_ATTRIBUTE) {
|
|
15
12
|
return entity;
|
|
16
13
|
}
|
|
@@ -67,9 +64,6 @@ export const validationErrorHandler = (entity, error, options, marks, validate,
|
|
|
67
64
|
}
|
|
68
65
|
return entity;
|
|
69
66
|
};
|
|
70
|
-
|
|
71
|
-
// Ignored via go/ees005
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
73
67
|
function getEntityForInvalidContentLength(error, entity, validate, marks, dispatchAnalyticsEvent) {
|
|
74
68
|
const meta = error.meta;
|
|
75
69
|
if (meta.type === 'maximum') {
|
|
@@ -88,8 +88,6 @@ export class WithPluginStateInner extends React.Component {
|
|
|
88
88
|
_defineProperty(this, "notAppliedState", {});
|
|
89
89
|
_defineProperty(this, "isSubscribed", false);
|
|
90
90
|
_defineProperty(this, "callsCount", 0);
|
|
91
|
-
// Ignored via go/ees005
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
93
91
|
_defineProperty(this, "handlePluginStateChange", (propName, pluginName, performanceOptions, skipEqualityCheck) =>
|
|
94
92
|
// Ignored via go/ees005
|
|
95
93
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -313,8 +311,6 @@ export class WithPluginStateOld extends React.Component {
|
|
|
313
311
|
_defineProperty(this, "notAppliedState", {});
|
|
314
312
|
_defineProperty(this, "isSubscribed", false);
|
|
315
313
|
_defineProperty(this, "callsCount", 0);
|
|
316
|
-
// Ignored via go/ees005
|
|
317
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
318
314
|
_defineProperty(this, "handlePluginStateChange", (propName, pluginName, performanceOptions, skipEqualityCheck) =>
|
|
319
315
|
// Ignored via go/ees005
|
|
320
316
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -110,10 +110,7 @@ var getNodeWidth = function getNodeWidth(node, schema) {
|
|
|
110
110
|
}
|
|
111
111
|
return node.firstChild && node.firstChild.attrs.width || node.attrs.width;
|
|
112
112
|
};
|
|
113
|
-
var makeAlign = function makeAlign(layout, nodeType, widthPluginDependencyApi, analyticsApi
|
|
114
|
-
// Ignored via go/ees005
|
|
115
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
116
|
-
) {
|
|
113
|
+
var makeAlign = function makeAlign(layout, nodeType, widthPluginDependencyApi, analyticsApi) {
|
|
117
114
|
return function (state, dispatch) {
|
|
118
115
|
var _ref = state.selection,
|
|
119
116
|
node = _ref.node;
|
|
@@ -165,10 +162,7 @@ var getToolbarLayout = function getToolbarLayout(layout) {
|
|
|
165
162
|
}
|
|
166
163
|
return layout;
|
|
167
164
|
};
|
|
168
|
-
var mapIconsToToolbarItem = function mapIconsToToolbarItem(icons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi, isChangingLayoutDisabled
|
|
169
|
-
// Ignored via go/ees005
|
|
170
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
171
|
-
) {
|
|
165
|
+
var mapIconsToToolbarItem = function mapIconsToToolbarItem(icons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi, isChangingLayoutDisabled) {
|
|
172
166
|
return icons.map(function (toolbarItem) {
|
|
173
167
|
var id = toolbarItem.id,
|
|
174
168
|
value = toolbarItem.value;
|
|
@@ -191,10 +185,7 @@ var shouldHideLayoutToolbar = function shouldHideLayoutToolbar(selection, _ref2,
|
|
|
191
185
|
var buildLayoutButtons = function buildLayoutButtons(state, intl, nodeType, widthPluginDependencyApi, analyticsApi, allowResizing, allowResizingInTables) {
|
|
192
186
|
var allowWrapping = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : true;
|
|
193
187
|
var allowAlignment = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : true;
|
|
194
|
-
var isChangingLayoutDisabled
|
|
195
|
-
// Ignored via go/ees005
|
|
196
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
197
|
-
= arguments.length > 9 ? arguments[9] : undefined;
|
|
188
|
+
var isChangingLayoutDisabled = arguments.length > 9 ? arguments[9] : undefined;
|
|
198
189
|
var selection = state.selection;
|
|
199
190
|
if (!(selection instanceof NodeSelection) || !selection.node || !nodeType || shouldHideLayoutToolbar(selection, state.schema, allowResizingInTables)) {
|
|
200
191
|
return [];
|
|
@@ -45,60 +45,52 @@ export var changeImageAlignment = function changeImageAlignment(align) {
|
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
47
|
export var createToggleBlockMarkOnRange = function createToggleBlockMarkOnRange(markType, getAttrs, allowedBlocks) {
|
|
48
|
-
return (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return !markType.excludes(mark.type);
|
|
66
|
-
}).concat(newAttrs === false ? [] : markType.create(newAttrs)));
|
|
67
|
-
markApplied = true;
|
|
68
|
-
}
|
|
48
|
+
return function (from, to, tr, state) {
|
|
49
|
+
var markApplied = false;
|
|
50
|
+
state.doc.nodesBetween(from, to, function (node, pos, parent) {
|
|
51
|
+
if (!node.type.isBlock) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
if ((!allowedBlocks || (Array.isArray(allowedBlocks) ? allowedBlocks.indexOf(node.type) > -1 : allowedBlocks(state.schema, node, parent))) && parent !== null && parent !== void 0 && parent.type.allowsMarkType(markType)) {
|
|
55
|
+
var oldMarks = node.marks.filter(function (mark) {
|
|
56
|
+
return mark.type === markType;
|
|
57
|
+
});
|
|
58
|
+
var prevAttrs = oldMarks.length ? oldMarks[0].attrs : undefined;
|
|
59
|
+
var newAttrs = getAttrs(prevAttrs, node);
|
|
60
|
+
if (newAttrs !== undefined) {
|
|
61
|
+
tr.setNodeMarkup(pos, node.type, node.attrs, node.marks.filter(function (mark) {
|
|
62
|
+
return !markType.excludes(mark.type);
|
|
63
|
+
}).concat(newAttrs === false ? [] : markType.create(newAttrs)));
|
|
64
|
+
markApplied = true;
|
|
69
65
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
}
|
|
67
|
+
return;
|
|
68
|
+
});
|
|
69
|
+
return markApplied;
|
|
70
|
+
};
|
|
75
71
|
};
|
|
76
72
|
export var createToggleInlineMarkOnRange = function createToggleInlineMarkOnRange(markType, getAttrs) {
|
|
77
|
-
return (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}).concat(newAttrs === false ? [] : markType.create(newAttrs)));
|
|
93
|
-
tr.setSelection(NodeSelection.create(tr.doc, state.selection.from));
|
|
94
|
-
markApplied = true;
|
|
95
|
-
}
|
|
73
|
+
return function (from, to, tr, state) {
|
|
74
|
+
var markApplied = false;
|
|
75
|
+
state.doc.nodesBetween(from, to, function (node, pos, parent) {
|
|
76
|
+
if (parent !== null && parent !== void 0 && parent.type.allowsMarkType(markType)) {
|
|
77
|
+
var oldMarks = node.marks.filter(function (mark) {
|
|
78
|
+
return mark.type === markType;
|
|
79
|
+
});
|
|
80
|
+
var prevAttrs = oldMarks.length ? oldMarks[0].attrs : undefined;
|
|
81
|
+
var newAttrs = getAttrs(prevAttrs, node);
|
|
82
|
+
if (newAttrs !== undefined) {
|
|
83
|
+
tr.setNodeMarkup(pos, node.type, node.attrs, node.marks.filter(function (mark) {
|
|
84
|
+
return !markType.excludes(mark.type);
|
|
85
|
+
}).concat(newAttrs === false ? [] : markType.create(newAttrs)));
|
|
86
|
+
tr.setSelection(NodeSelection.create(tr.doc, state.selection.from));
|
|
87
|
+
markApplied = true;
|
|
96
88
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
89
|
+
}
|
|
90
|
+
return;
|
|
91
|
+
});
|
|
92
|
+
return markApplied;
|
|
93
|
+
};
|
|
102
94
|
};
|
|
103
95
|
|
|
104
96
|
/**
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
-
export var insertBlock = function insertBlock(state, nodeType, start, end, attrs
|
|
4
|
-
// Ignored via go/ees005
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
6
|
-
) {
|
|
3
|
+
export var insertBlock = function insertBlock(state, nodeType, start, end, attrs) {
|
|
7
4
|
// To ensure that match is done after HardBreak.
|
|
8
5
|
var _state$schema$nodes = state.schema.nodes,
|
|
9
6
|
hardBreak = _state$schema$nodes.hardBreak,
|
|
@@ -189,10 +189,7 @@ var getInitialState = function getInitialState(listSize, canFocusViewMore) {
|
|
|
189
189
|
};
|
|
190
190
|
|
|
191
191
|
// Get the offset forwards - skip items that are disabled
|
|
192
|
-
var skipForwardOffsetToSafeItem = function skipForwardOffsetToSafeItem(currentIndex, listSize, stepSize, itemIsDisabled
|
|
193
|
-
// Ignored via go/ees005
|
|
194
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
195
|
-
) {
|
|
192
|
+
var skipForwardOffsetToSafeItem = function skipForwardOffsetToSafeItem(currentIndex, listSize, stepSize, itemIsDisabled) {
|
|
196
193
|
if (currentIndex === undefined) {
|
|
197
194
|
return undefined;
|
|
198
195
|
}
|
|
@@ -223,8 +220,6 @@ var skipBackwardOffsetToSafeItem = function skipBackwardOffsetToSafeItem(current
|
|
|
223
220
|
// Move to search if no available index
|
|
224
221
|
return currentIndex + 1;
|
|
225
222
|
};
|
|
226
|
-
// Ignored via go/ees005
|
|
227
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
228
223
|
function useSelectAndFocusOnArrowNavigation(listSize, step, canFocusViewMore, itemIsDisabled, isFocusSearch) {
|
|
229
224
|
var _useReducer = useReducer(reducer, initialState, getInitialState(listSize, canFocusViewMore)),
|
|
230
225
|
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
@@ -42,7 +42,8 @@ function ExtensionWithPluginState(props) {
|
|
|
42
42
|
showLivePagesBodiedMacrosRendererView = props.showLivePagesBodiedMacrosRendererView,
|
|
43
43
|
showUpdatedLivePages1PBodiedExtensionUI = props.showUpdatedLivePages1PBodiedExtensionUI,
|
|
44
44
|
showBodiedExtensionRendererView = props.showBodiedExtensionRendererView,
|
|
45
|
-
setShowBodiedExtensionRendererView = props.setShowBodiedExtensionRendererView
|
|
45
|
+
setShowBodiedExtensionRendererView = props.setShowBodiedExtensionRendererView,
|
|
46
|
+
pluginInjectionApi = props.pluginInjectionApi;
|
|
46
47
|
var _ref = macroInteractionDesignFeatureFlags || {},
|
|
47
48
|
showMacroInteractionDesignUpdates = _ref.showMacroInteractionDesignUpdates;
|
|
48
49
|
var hasBody = ['bodiedExtension', 'multiBodiedExtension'].includes(node.type.name);
|
|
@@ -123,7 +124,8 @@ function ExtensionWithPluginState(props) {
|
|
|
123
124
|
showLivePagesBodiedMacrosRendererView: showLivePagesBodiedMacrosRendererView,
|
|
124
125
|
showUpdatedLivePages1PBodiedExtensionUI: showUpdatedLivePages1PBodiedExtensionUI,
|
|
125
126
|
showBodiedExtensionRendererView: showBodiedExtensionRendererView,
|
|
126
|
-
setShowBodiedExtensionRendererView: setShowBodiedExtensionRendererView
|
|
127
|
+
setShowBodiedExtensionRendererView: setShowBodiedExtensionRendererView,
|
|
128
|
+
pluginInjectionApi: pluginInjectionApi
|
|
127
129
|
}), jsx("div", {
|
|
128
130
|
"data-testid": "extension-container",
|
|
129
131
|
ref: handleRef,
|
|
@@ -164,7 +166,8 @@ function ExtensionWithPluginState(props) {
|
|
|
164
166
|
}, !removeBorder && jsx(ExtensionLozenge, {
|
|
165
167
|
isNodeSelected: isNodeSelected,
|
|
166
168
|
node: node,
|
|
167
|
-
showMacroInteractionDesignUpdates: showMacroInteractionDesignUpdates
|
|
169
|
+
showMacroInteractionDesignUpdates: showMacroInteractionDesignUpdates,
|
|
170
|
+
pluginInjectionApi: pluginInjectionApi
|
|
168
171
|
}), children), hasBody &&
|
|
169
172
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
170
173
|
jsx("div", {
|
|
@@ -43,7 +43,8 @@ var InlineExtension = function InlineExtension(props) {
|
|
|
43
43
|
isNodeSelected: isNodeSelected,
|
|
44
44
|
isNodeHovered: isNodeHovered,
|
|
45
45
|
showMacroInteractionDesignUpdates: showMacroInteractionDesignUpdates,
|
|
46
|
-
setIsNodeHovered: setIsNodeHovered
|
|
46
|
+
setIsNodeHovered: setIsNodeHovered,
|
|
47
|
+
pluginInjectionApi: pluginInjectionApi
|
|
47
48
|
}), jsx("div", {
|
|
48
49
|
"data-testid": "inline-extension-wrapper"
|
|
49
50
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
@@ -64,7 +65,8 @@ var InlineExtension = function InlineExtension(props) {
|
|
|
64
65
|
}), children ? children : jsx(ExtensionLozenge, {
|
|
65
66
|
node: node,
|
|
66
67
|
isNodeSelected: isNodeSelected,
|
|
67
|
-
showMacroInteractionDesignUpdates: showMacroInteractionDesignUpdates
|
|
68
|
+
showMacroInteractionDesignUpdates: showMacroInteractionDesignUpdates,
|
|
69
|
+
pluginInjectionApi: pluginInjectionApi
|
|
68
70
|
})));
|
|
69
71
|
return jsx(WidthContext.Provider, {
|
|
70
72
|
value: createWidthContext(rendererContainerWidth)
|
|
@@ -10,6 +10,7 @@ import classnames from 'classnames';
|
|
|
10
10
|
import { defineMessages, FormattedMessage } from 'react-intl-next';
|
|
11
11
|
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
12
12
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
13
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
14
|
import Tooltip from '@atlaskit/tooltip';
|
|
14
15
|
var containerStyles = css({
|
|
15
16
|
textAlign: 'left',
|
|
@@ -96,10 +97,7 @@ var i18n = defineMessages({
|
|
|
96
97
|
description: 'Text in tooltip that tells user they can configure the specific macro.'
|
|
97
98
|
}
|
|
98
99
|
});
|
|
99
|
-
export var getShouldShowBodiedMacroLabel = function getShouldShowBodiedMacroLabel(isBodiedMacro, isNodeHovered, showLivePagesBodiedMacrosRendererView, showBodiedExtensionRendererView, showUpdatedLivePages1PBodiedExtensionUI
|
|
100
|
-
// Ignored via go/ees005
|
|
101
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
102
|
-
) {
|
|
100
|
+
export var getShouldShowBodiedMacroLabel = function getShouldShowBodiedMacroLabel(isBodiedMacro, isNodeHovered, showLivePagesBodiedMacrosRendererView, showBodiedExtensionRendererView, showUpdatedLivePages1PBodiedExtensionUI) {
|
|
103
101
|
// Bodied macros show the label by default except for the new live pages 1P bodied macro experience where we only show it on hover
|
|
104
102
|
if (!isBodiedMacro || showUpdatedLivePages1PBodiedExtensionUI) {
|
|
105
103
|
return isNodeHovered;
|
|
@@ -119,7 +117,8 @@ export var ExtensionLabel = function ExtensionLabel(_ref) {
|
|
|
119
117
|
isBodiedMacro = _ref.isBodiedMacro,
|
|
120
118
|
showUpdatedLivePages1PBodiedExtensionUI = _ref.showUpdatedLivePages1PBodiedExtensionUI,
|
|
121
119
|
showLivePagesBodiedMacrosRendererView = _ref.showLivePagesBodiedMacrosRendererView,
|
|
122
|
-
showBodiedExtensionRendererView = _ref.showBodiedExtensionRendererView
|
|
120
|
+
showBodiedExtensionRendererView = _ref.showBodiedExtensionRendererView,
|
|
121
|
+
pluginInjectionApi = _ref.pluginInjectionApi;
|
|
123
122
|
var isInlineExtension = extensionName === 'inlineExtension';
|
|
124
123
|
var showDefaultBodiedStyles = isBodiedMacro && !isNodeHovered;
|
|
125
124
|
var shouldShowBodiedMacroLabel = getShouldShowBodiedMacroLabel(isBodiedMacro, isNodeHovered, showLivePagesBodiedMacrosRendererView, showBodiedExtensionRendererView, showUpdatedLivePages1PBodiedExtensionUI);
|
|
@@ -143,7 +142,7 @@ export var ExtensionLabel = function ExtensionLabel(_ref) {
|
|
|
143
142
|
'hide-icon': isBodiedMacro && !isNodeHovered
|
|
144
143
|
});
|
|
145
144
|
return (
|
|
146
|
-
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
145
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events
|
|
147
146
|
jsx("div", {
|
|
148
147
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
149
148
|
css: containerStyles
|
|
@@ -161,6 +160,17 @@ export var ExtensionLabel = function ExtensionLabel(_ref) {
|
|
|
161
160
|
onMouseLeave: function onMouseLeave() {
|
|
162
161
|
setIsNodeHovered === null || setIsNodeHovered === void 0 || setIsNodeHovered(false);
|
|
163
162
|
},
|
|
163
|
+
onClick: function onClick() {
|
|
164
|
+
if (editorExperiment('live_pages_graceful_edit', 'text-click-delayed') || editorExperiment('live_pages_graceful_edit', 'text-click-no-delay')) {
|
|
165
|
+
var _pluginInjectionApi$c, _pluginInjectionApi$e;
|
|
166
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.actions) === null || _pluginInjectionApi$c === void 0 || _pluginInjectionApi$c.execute( // Extensions are not yet using the new plugin architecture, and the use of the pluginInjectionApi
|
|
167
|
+
// is not type safe in editor-common.
|
|
168
|
+
// @ts-ignore
|
|
169
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.commands.updateContentMode({
|
|
170
|
+
type: 'intent-to-edit'
|
|
171
|
+
}));
|
|
172
|
+
}
|
|
173
|
+
},
|
|
164
174
|
"data-testid": "new-lozenge-container"
|
|
165
175
|
}, jsx(Tooltip, {
|
|
166
176
|
content: jsx(FormattedMessage
|