@atlaskit/editor-common 99.5.0 → 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 +16 -0
- package/dist/cjs/analytics/types/ai-events.js +5 -0
- package/dist/cjs/analytics/types/enums.js +2 -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/messages/ai-proactive-setting.js +109 -0
- package/dist/cjs/messages/ai-proactive-transform.js +99 -0
- package/dist/cjs/messages/ai-proactive.js +145 -0
- package/dist/cjs/messages/index.js +14 -0
- 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/analytics/types/ai-events.js +1 -0
- package/dist/es2019/analytics/types/enums.js +2 -0
- 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/messages/ai-proactive-setting.js +103 -0
- package/dist/es2019/messages/ai-proactive-transform.js +93 -0
- package/dist/es2019/messages/ai-proactive.js +145 -0
- package/dist/es2019/messages/index.js +2 -0
- 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/analytics/types/ai-events.js +1 -0
- package/dist/esm/analytics/types/enums.js +2 -0
- 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/messages/ai-proactive-setting.js +103 -0
- package/dist/esm/messages/ai-proactive-transform.js +93 -0
- package/dist/esm/messages/ai-proactive.js +145 -0
- package/dist/esm/messages/index.js +2 -0
- 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/analytics/index.d.ts +1 -0
- package/dist/types/analytics/types/ai-events.d.ts +15 -0
- package/dist/types/analytics/types/ai-proactive-events.d.ts +1 -1
- package/dist/types/analytics/types/enums.d.ts +2 -0
- package/dist/types/analytics/types/events.d.ts +5 -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/messages/ai-proactive-setting.d.ts +102 -0
- package/dist/types/messages/ai-proactive-transform.d.ts +92 -0
- package/dist/types/messages/ai-proactive.d.ts +145 -0
- package/dist/types/messages/index.d.ts +2 -0
- package/dist/types-ts4.5/analytics/index.d.ts +1 -0
- package/dist/types-ts4.5/analytics/types/ai-events.d.ts +15 -0
- package/dist/types-ts4.5/analytics/types/ai-proactive-events.d.ts +1 -1
- package/dist/types-ts4.5/analytics/types/enums.d.ts +2 -0
- package/dist/types-ts4.5/analytics/types/events.d.ts +5 -4
- 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/dist/types-ts4.5/messages/ai-proactive-setting.d.ts +102 -0
- package/dist/types-ts4.5/messages/ai-proactive-transform.d.ts +92 -0
- package/dist/types-ts4.5/messages/ai-proactive.d.ts +145 -0
- package/dist/types-ts4.5/messages/index.d.ts +2 -0
- package/package.json +3 -3
|
@@ -54,10 +54,7 @@ const ResizerNext = (props, ref) => {
|
|
|
54
54
|
setIsResizing(true);
|
|
55
55
|
handleResizeStart();
|
|
56
56
|
}, [handleResizeStart]);
|
|
57
|
-
const onResize = useCallback((_event, _direction, _elementRef, delta
|
|
58
|
-
// Ignored via go/ees005
|
|
59
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
60
|
-
) => {
|
|
57
|
+
const onResize = useCallback((_event, _direction, _elementRef, delta) => {
|
|
61
58
|
if (!handleResize) {
|
|
62
59
|
return;
|
|
63
60
|
}
|
|
@@ -73,10 +70,7 @@ const ResizerNext = (props, ref) => {
|
|
|
73
70
|
};
|
|
74
71
|
handleResize(originalState, delta);
|
|
75
72
|
}, [handleResize]);
|
|
76
|
-
const onResizeStop = useCallback((_event, _direction, _elementRef, delta
|
|
77
|
-
// Ignored via go/ees005
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
79
|
-
) => {
|
|
73
|
+
const onResizeStop = useCallback((_event, _direction, _elementRef, delta) => {
|
|
80
74
|
const resizableCurrent = resizable.current;
|
|
81
75
|
if (!resizableCurrent || !resizableCurrent.state.original) {
|
|
82
76
|
return;
|
|
@@ -4,10 +4,7 @@ import { isValidTargetNode } from './utils/is-valid-target-node';
|
|
|
4
4
|
|
|
5
5
|
// This function captures clicks outside of the ProseMirror contentEditable area
|
|
6
6
|
// see also description of "handleClick" in gap-cursor pm-plugin
|
|
7
|
-
const captureCursorCoords = (event, editorRef, posAtCoords, tr
|
|
8
|
-
// Ignored via go/ees005
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
10
|
-
) => {
|
|
7
|
+
const captureCursorCoords = (event, editorRef, posAtCoords, tr) => {
|
|
11
8
|
const rect = editorRef.getBoundingClientRect();
|
|
12
9
|
|
|
13
10
|
// capture clicks before the first block element
|
|
@@ -44,10 +41,7 @@ const captureCursorCoords = (event, editorRef, posAtCoords, tr
|
|
|
44
41
|
}
|
|
45
42
|
return null;
|
|
46
43
|
};
|
|
47
|
-
export const setSelectionTopLevelBlocks = (tr, event, editorRef, posAtCoords, editorFocused
|
|
48
|
-
// Ignored via go/ees005
|
|
49
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
50
|
-
) => {
|
|
44
|
+
export const setSelectionTopLevelBlocks = (tr, event, editorRef, posAtCoords, editorFocused) => {
|
|
51
45
|
const cursorCoords = captureCursorCoords(event, editorRef, posAtCoords, tr);
|
|
52
46
|
if (!cursorCoords) {
|
|
53
47
|
return;
|
|
@@ -101,8 +101,6 @@ export const selectNode = pos => (state, dispatch) => {
|
|
|
101
101
|
return true;
|
|
102
102
|
};
|
|
103
103
|
export function createSelectionClickHandler(nodes, isValidTarget, options) {
|
|
104
|
-
// Ignored via go/ees005
|
|
105
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
106
104
|
return function handleClickOn(view, pos, node, nodePos, event, direct) {
|
|
107
105
|
if (options.useLongPressSelection) {
|
|
108
106
|
return false;
|
|
@@ -26,16 +26,12 @@ import ReactNodeView from '../react-node-view';
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
export class SelectionBasedNodeView extends ReactNodeView {
|
|
29
|
-
// Ignored via go/ees005
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
31
29
|
constructor(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps,
|
|
32
30
|
// Ignored via go/ees005
|
|
33
31
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
32
|
reactComponent, viewShouldUpdate) {
|
|
35
33
|
super(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate);
|
|
36
34
|
_defineProperty(this, "isSelectedNode", false);
|
|
37
|
-
// Ignored via go/ees005
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
39
35
|
_defineProperty(this, "isNodeInsideSelection", (from, to, pos, posEnd) => {
|
|
40
36
|
({
|
|
41
37
|
pos,
|
|
@@ -46,8 +42,6 @@ export class SelectionBasedNodeView extends ReactNodeView {
|
|
|
46
42
|
}
|
|
47
43
|
return from <= pos && to >= posEnd;
|
|
48
44
|
});
|
|
49
|
-
// Ignored via go/ees005
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
51
45
|
_defineProperty(this, "isSelectionInsideNode", (from, to, pos, posEnd) => {
|
|
52
46
|
({
|
|
53
47
|
pos,
|
|
@@ -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.5.
|
|
16
|
+
const packageVersion = "99.5.2";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
// Ignored via go/ees005
|
|
@@ -87,8 +87,6 @@ export default class Layer extends Component {
|
|
|
87
87
|
* the bottom of the popper not being viewable.
|
|
88
88
|
* Only works if the popper uses viewport as the boundary and has a fixed position ancestor.
|
|
89
89
|
*/
|
|
90
|
-
// Ignored via go/ees005
|
|
91
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
92
90
|
calculateMaxHeight(originalHeight, currentHeight, positionTop, cssPosition) {
|
|
93
91
|
let DocumentElementClientHeight = 0;
|
|
94
92
|
if (document.documentElement) {
|
|
@@ -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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -114,6 +114,7 @@ export var ACTION = /*#__PURE__*/function (ACTION) {
|
|
|
114
114
|
ACTION["TRANSACTION_MUTATED_AFTER_DISPATCH"] = "transactionMutatedAfterDispatched";
|
|
115
115
|
ACTION["TYPING_FINISHED"] = "typingFinished";
|
|
116
116
|
ACTION["TYPING_STARTED"] = "typingStarted";
|
|
117
|
+
ACTION["UNHANDLED_ERROR_CAUGHT"] = "unhandledErrorCaught";
|
|
117
118
|
ACTION["UNLINK"] = "unlinked";
|
|
118
119
|
ACTION["UNSUPPORTED_CONTENT_ENCOUNTERED"] = "unsupportedContentEncounteredV2";
|
|
119
120
|
ACTION["UPDATED"] = "updated";
|
|
@@ -326,6 +327,7 @@ export var ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTION_SUBJECT_ID) {
|
|
|
326
327
|
ACTION_SUBJECT_ID["EMBEDS"] = "embeds";
|
|
327
328
|
ACTION_SUBJECT_ID["EMOJI"] = "emoji";
|
|
328
329
|
ACTION_SUBJECT_ID["EXPAND"] = "expand";
|
|
330
|
+
ACTION_SUBJECT_ID["EXPERIENCE_APPLICATION"] = "experienceApplication";
|
|
329
331
|
ACTION_SUBJECT_ID["EXTENSION"] = "extension";
|
|
330
332
|
ACTION_SUBJECT_ID["EXTENSION_API"] = "extensionApi";
|
|
331
333
|
ACTION_SUBJECT_ID["EXTENSION_BLOCK"] = "extension";
|
|
@@ -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,
|