@atlaskit/editor-common 74.44.1 → 74.45.1
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 +15 -0
- package/dist/cjs/icons/shared/table.js +24 -7
- package/dist/cjs/mark/commands.js +21 -26
- package/dist/cjs/media-single/constants.js +3 -1
- package/dist/cjs/media-single/index.js +6 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/quick-insert/assets/list-number.js +18 -6
- package/dist/cjs/quick-insert/assets/list.js +21 -10
- package/dist/cjs/quick-insert/assets/quote.js +15 -3
- package/dist/cjs/quick-insert/assets/status.js +55 -16
- package/dist/cjs/selection/index.js +36 -0
- package/dist/cjs/selection/utils.js +46 -1
- package/dist/cjs/styles/shared/media-single.js +1 -2
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/MediaSingle/styled.js +1 -8
- package/dist/cjs/utils/index.js +150 -0
- package/dist/cjs/utils/rich-media-utils.js +3 -6
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/icons/shared/table.js +25 -7
- package/dist/es2019/mark/commands.js +21 -28
- package/dist/es2019/mark/index.js +1 -1
- package/dist/es2019/media-single/constants.js +1 -0
- package/dist/es2019/media-single/index.js +1 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/quick-insert/assets/list-number.js +19 -6
- package/dist/es2019/quick-insert/assets/list.js +22 -9
- package/dist/es2019/quick-insert/assets/quote.js +16 -3
- package/dist/es2019/quick-insert/assets/status.js +56 -15
- package/dist/es2019/selection/index.js +1 -1
- package/dist/es2019/selection/utils.js +52 -1
- package/dist/es2019/styles/shared/media-single.js +3 -4
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/MediaSingle/styled.js +1 -11
- package/dist/es2019/utils/index.js +139 -1
- package/dist/es2019/utils/rich-media-utils.js +3 -6
- package/dist/es2019/version.json +1 -1
- package/dist/esm/icons/shared/table.js +24 -7
- package/dist/esm/mark/commands.js +21 -26
- package/dist/esm/mark/index.js +1 -1
- package/dist/esm/media-single/constants.js +1 -0
- package/dist/esm/media-single/index.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/quick-insert/assets/list-number.js +18 -6
- package/dist/esm/quick-insert/assets/list.js +21 -9
- package/dist/esm/quick-insert/assets/quote.js +15 -3
- package/dist/esm/quick-insert/assets/status.js +55 -15
- package/dist/esm/selection/index.js +1 -1
- package/dist/esm/selection/utils.js +40 -1
- package/dist/esm/styles/shared/media-single.js +1 -2
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/MediaSingle/styled.js +1 -8
- package/dist/esm/utils/index.js +141 -1
- package/dist/esm/utils/rich-media-utils.js +3 -6
- package/dist/esm/version.json +1 -1
- package/dist/types/collab/index.d.ts +4 -1
- package/dist/types/mark/commands.d.ts +4 -4
- package/dist/types/mark/index.d.ts +1 -1
- package/dist/types/media-single/constants.d.ts +1 -0
- package/dist/types/media-single/index.d.ts +1 -1
- package/dist/types/selection/index.d.ts +1 -1
- package/dist/types/selection/utils.d.ts +9 -2
- package/dist/types/utils/index.d.ts +17 -0
- package/dist/types/utils/input-rules.d.ts +3 -2
- package/dist/types/utils/rich-media-utils.d.ts +4 -4
- package/dist/types-ts4.5/collab/index.d.ts +4 -1
- package/dist/types-ts4.5/mark/commands.d.ts +4 -4
- package/dist/types-ts4.5/mark/index.d.ts +1 -1
- package/dist/types-ts4.5/media-single/constants.d.ts +1 -0
- package/dist/types-ts4.5/media-single/index.d.ts +1 -1
- package/dist/types-ts4.5/selection/index.d.ts +1 -1
- package/dist/types-ts4.5/selection/utils.d.ts +9 -2
- package/dist/types-ts4.5/utils/index.d.ts +17 -0
- package/dist/types-ts4.5/utils/input-rules.d.ts +3 -2
- package/dist/types-ts4.5/utils/rich-media-utils.d.ts +4 -4
- package/package.json +1 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
// TODO: https://product-fabric.atlassian.net/browse/DSP-4138
|
|
2
|
-
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
3
1
|
import React from 'react';
|
|
2
|
+
import { useIconThemed } from '../use-icon-themed';
|
|
4
3
|
export default function IconStatus() {
|
|
4
|
+
const {
|
|
5
|
+
iconThemed
|
|
6
|
+
} = useIconThemed();
|
|
5
7
|
return /*#__PURE__*/React.createElement("svg", {
|
|
6
8
|
focusable: "false",
|
|
7
9
|
"aria-hidden": true,
|
|
@@ -11,17 +13,26 @@ export default function IconStatus() {
|
|
|
11
13
|
fill: "none",
|
|
12
14
|
fillRule: "evenodd"
|
|
13
15
|
}, /*#__PURE__*/React.createElement("path", {
|
|
14
|
-
fill:
|
|
16
|
+
fill: iconThemed({
|
|
17
|
+
light: '#FFF',
|
|
18
|
+
dark: '#161A1D'
|
|
19
|
+
}),
|
|
15
20
|
d: "M0 0h40v40H0z"
|
|
16
21
|
}), /*#__PURE__*/React.createElement("g", {
|
|
17
22
|
transform: "translate(5 11)"
|
|
18
23
|
}, /*#__PURE__*/React.createElement("rect", {
|
|
19
|
-
fill:
|
|
24
|
+
fill: iconThemed({
|
|
25
|
+
light: '#B3D4FF',
|
|
26
|
+
dark: '#09326C'
|
|
27
|
+
}),
|
|
20
28
|
width: 14,
|
|
21
29
|
height: 5,
|
|
22
30
|
rx: 1
|
|
23
31
|
}), /*#__PURE__*/React.createElement("rect", {
|
|
24
|
-
fill:
|
|
32
|
+
fill: iconThemed({
|
|
33
|
+
light: '#0065FF',
|
|
34
|
+
dark: '#1D7AFC'
|
|
35
|
+
}),
|
|
25
36
|
x: 2,
|
|
26
37
|
y: 2,
|
|
27
38
|
width: 10,
|
|
@@ -30,12 +41,18 @@ export default function IconStatus() {
|
|
|
30
41
|
})), /*#__PURE__*/React.createElement("g", {
|
|
31
42
|
transform: "translate(5 18)"
|
|
32
43
|
}, /*#__PURE__*/React.createElement("rect", {
|
|
33
|
-
fill:
|
|
44
|
+
fill: iconThemed({
|
|
45
|
+
light: '#C3F8DF',
|
|
46
|
+
dark: '#164B35'
|
|
47
|
+
}),
|
|
34
48
|
width: 14,
|
|
35
49
|
height: 5,
|
|
36
50
|
rx: 1
|
|
37
51
|
}), /*#__PURE__*/React.createElement("rect", {
|
|
38
|
-
fill:
|
|
52
|
+
fill: iconThemed({
|
|
53
|
+
light: '#36B37E',
|
|
54
|
+
dark: '#22A06B'
|
|
55
|
+
}),
|
|
39
56
|
x: 2,
|
|
40
57
|
y: 2,
|
|
41
58
|
width: 10,
|
|
@@ -44,12 +61,18 @@ export default function IconStatus() {
|
|
|
44
61
|
})), /*#__PURE__*/React.createElement("g", {
|
|
45
62
|
transform: "translate(5 25)"
|
|
46
63
|
}, /*#__PURE__*/React.createElement("rect", {
|
|
47
|
-
fill:
|
|
64
|
+
fill: iconThemed({
|
|
65
|
+
light: '#DFE1E6',
|
|
66
|
+
dark: '#2C333A'
|
|
67
|
+
}),
|
|
48
68
|
width: 14,
|
|
49
69
|
height: 5,
|
|
50
70
|
rx: 1
|
|
51
71
|
}), /*#__PURE__*/React.createElement("rect", {
|
|
52
|
-
fill:
|
|
72
|
+
fill: iconThemed({
|
|
73
|
+
light: '#8993A4',
|
|
74
|
+
dark: '#5A6977'
|
|
75
|
+
}),
|
|
53
76
|
x: 2,
|
|
54
77
|
y: 2,
|
|
55
78
|
width: 10,
|
|
@@ -58,12 +81,18 @@ export default function IconStatus() {
|
|
|
58
81
|
})), /*#__PURE__*/React.createElement("g", {
|
|
59
82
|
transform: "translate(21 25)"
|
|
60
83
|
}, /*#__PURE__*/React.createElement("rect", {
|
|
61
|
-
fill:
|
|
84
|
+
fill: iconThemed({
|
|
85
|
+
light: '#FFD3C8',
|
|
86
|
+
dark: '#601D16'
|
|
87
|
+
}),
|
|
62
88
|
width: 14,
|
|
63
89
|
height: 5,
|
|
64
90
|
rx: 1
|
|
65
91
|
}), /*#__PURE__*/React.createElement("rect", {
|
|
66
|
-
fill:
|
|
92
|
+
fill: iconThemed({
|
|
93
|
+
light: '#FF5230',
|
|
94
|
+
dark: '#F35844'
|
|
95
|
+
}),
|
|
67
96
|
x: 2,
|
|
68
97
|
y: 2,
|
|
69
98
|
width: 10,
|
|
@@ -72,12 +101,18 @@ export default function IconStatus() {
|
|
|
72
101
|
})), /*#__PURE__*/React.createElement("g", {
|
|
73
102
|
transform: "translate(21 11)"
|
|
74
103
|
}, /*#__PURE__*/React.createElement("rect", {
|
|
75
|
-
fill:
|
|
104
|
+
fill: iconThemed({
|
|
105
|
+
light: '#EAE6FF',
|
|
106
|
+
dark: '#352C63'
|
|
107
|
+
}),
|
|
76
108
|
width: 14,
|
|
77
109
|
height: 5,
|
|
78
110
|
rx: 1
|
|
79
111
|
}), /*#__PURE__*/React.createElement("rect", {
|
|
80
|
-
fill:
|
|
112
|
+
fill: iconThemed({
|
|
113
|
+
light: '#8777D9',
|
|
114
|
+
dark: '#8270DB'
|
|
115
|
+
}),
|
|
81
116
|
x: 2,
|
|
82
117
|
y: 2,
|
|
83
118
|
width: 10,
|
|
@@ -86,12 +121,18 @@ export default function IconStatus() {
|
|
|
86
121
|
})), /*#__PURE__*/React.createElement("g", {
|
|
87
122
|
transform: "translate(21 18)"
|
|
88
123
|
}, /*#__PURE__*/React.createElement("rect", {
|
|
89
|
-
fill:
|
|
124
|
+
fill: iconThemed({
|
|
125
|
+
light: '#FFF0B3',
|
|
126
|
+
dark: '#5F3811'
|
|
127
|
+
}),
|
|
90
128
|
width: 14,
|
|
91
129
|
height: 5,
|
|
92
130
|
rx: 1
|
|
93
131
|
}), /*#__PURE__*/React.createElement("rect", {
|
|
94
|
-
fill:
|
|
132
|
+
fill: iconThemed({
|
|
133
|
+
light: '#FF991F',
|
|
134
|
+
dark: '#D19D00'
|
|
135
|
+
}),
|
|
95
136
|
x: 2,
|
|
96
137
|
y: 2,
|
|
97
138
|
width: 10,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { RelativeSelectionPos } from './types';
|
|
2
2
|
export { GapCursorSelection, Side, JSON_ID, GapBookmark } from './gap-cursor/selection';
|
|
3
3
|
export { isIgnored, isValidTargetNode } from './gap-cursor/utils';
|
|
4
|
-
export {
|
|
4
|
+
export { atTheBeginningOfBlock, atTheBeginningOfDoc, atTheEndOfBlock, atTheEndOfDoc, endPositionOfParent, isSelectionAtEndOfNode, isSelectionAtStartOfNode, startPositionOfParent } from './utils';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import { GapCursorSelection } from './gap-cursor/selection';
|
|
1
3
|
export const isSelectionAtStartOfNode = ($pos, parentNode) => {
|
|
2
4
|
if (!parentNode) {
|
|
3
5
|
return false;
|
|
@@ -27,4 +29,53 @@ export const isSelectionAtEndOfNode = ($pos, parentNode) => {
|
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
return true;
|
|
30
|
-
};
|
|
32
|
+
};
|
|
33
|
+
export function atTheEndOfDoc(state) {
|
|
34
|
+
const {
|
|
35
|
+
selection,
|
|
36
|
+
doc
|
|
37
|
+
} = state;
|
|
38
|
+
return doc.nodeSize - selection.$to.pos - 2 === selection.$to.depth;
|
|
39
|
+
}
|
|
40
|
+
export function atTheBeginningOfDoc(state) {
|
|
41
|
+
const {
|
|
42
|
+
selection
|
|
43
|
+
} = state;
|
|
44
|
+
return selection.$from.pos === selection.$from.depth;
|
|
45
|
+
}
|
|
46
|
+
export function atTheEndOfBlock(state) {
|
|
47
|
+
const {
|
|
48
|
+
selection
|
|
49
|
+
} = state;
|
|
50
|
+
const {
|
|
51
|
+
$to
|
|
52
|
+
} = selection;
|
|
53
|
+
if (selection instanceof GapCursorSelection) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
if (selection instanceof NodeSelection && selection.node.isBlock) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
return endPositionOfParent($to) === $to.pos + 1;
|
|
60
|
+
}
|
|
61
|
+
export function atTheBeginningOfBlock(state) {
|
|
62
|
+
const {
|
|
63
|
+
selection
|
|
64
|
+
} = state;
|
|
65
|
+
const {
|
|
66
|
+
$from
|
|
67
|
+
} = selection;
|
|
68
|
+
if (selection instanceof GapCursorSelection) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
if (selection instanceof NodeSelection && selection.node.isBlock) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
return startPositionOfParent($from) === $from.pos;
|
|
75
|
+
}
|
|
76
|
+
export function startPositionOfParent(resolvedPos) {
|
|
77
|
+
return resolvedPos.start(resolvedPos.depth);
|
|
78
|
+
}
|
|
79
|
+
export function endPositionOfParent(resolvedPos) {
|
|
80
|
+
return resolvedPos.end(resolvedPos.depth) + 1;
|
|
81
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
const richMediaClassName = 'rich-media-item';
|
|
4
3
|
const wrappedMediaBreakoutPoint = 410;
|
|
5
4
|
const mediaSingleSharedStyle = css`
|
|
@@ -61,15 +60,15 @@ const mediaSingleSharedStyle = css`
|
|
|
61
60
|
margin-left: 0;
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
|
|
63
|
+
@media all and (max-width: ${wrappedMediaBreakoutPoint}px) {
|
|
65
64
|
div.mediaSingleView-content-wrap[layout='wrap-left'],
|
|
66
65
|
div.mediaSingleView-content-wrap[data-layout='wrap-left'],
|
|
67
66
|
div.mediaSingleView-content-wrap[layout='wrap-right'],
|
|
68
67
|
div.mediaSingleView-content-wrap[data-layout='wrap-right'] {
|
|
69
68
|
float: none;
|
|
70
69
|
overflow: auto;
|
|
71
|
-
margin: 12px 0;
|
|
70
|
+
margin: ${"var(--ds-space-150, 12px)"} 0;
|
|
72
71
|
}
|
|
73
|
-
}
|
|
72
|
+
}
|
|
74
73
|
`;
|
|
75
74
|
export { mediaSingleSharedStyle, richMediaClassName };
|
|
@@ -8,7 +8,7 @@ import { themed } from '@atlaskit/theme/components';
|
|
|
8
8
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
9
9
|
import Layer from '../Layer';
|
|
10
10
|
const packageName = "@atlaskit/editor-common";
|
|
11
|
-
const packageVersion = "74.
|
|
11
|
+
const packageVersion = "74.45.1";
|
|
12
12
|
const halfFocusRing = 1;
|
|
13
13
|
const dropOffset = '0, 8';
|
|
14
14
|
class DropList extends Component {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import { akEditorFullPageMaxWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
6
|
-
import { calcMediaSingleMaxWidth } from '../../media-single';
|
|
7
6
|
import { nonWrappedLayouts } from '../../utils';
|
|
8
7
|
import { calcBreakoutWidth, calcWideWidth } from '../../utils/breakout';
|
|
9
8
|
function float(layout) {
|
|
@@ -72,12 +71,6 @@ function calcMaxWidth(layout, containerWidth) {
|
|
|
72
71
|
return '100%';
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
|
-
const getEffectiveFullWidth = (containerWidth, fullWidthMode) => {
|
|
76
|
-
if (fullWidthMode) {
|
|
77
|
-
return '100%';
|
|
78
|
-
}
|
|
79
|
-
return `${calcMediaSingleMaxWidth(containerWidth)}px`;
|
|
80
|
-
};
|
|
81
74
|
function calcMargin(layout) {
|
|
82
75
|
switch (layout) {
|
|
83
76
|
case 'wrap-right':
|
|
@@ -137,10 +130,7 @@ export const MediaSingleDimensionHelper = ({
|
|
|
137
130
|
|
|
138
131
|
&[class*='not-resizing'] {
|
|
139
132
|
${!isNestedNode && `${nonWrappedLayouts.includes(layout) && `margin-left: 50%;
|
|
140
|
-
transform: translateX(-50%);`}
|
|
141
|
-
|
|
142
|
-
// override min-width to counteract max-width set by ResizerNext inline style
|
|
143
|
-
${layout === 'full-width' && `min-width: ${getEffectiveFullWidth(containerWidth, fullWidthMode)} !important;`};`}
|
|
133
|
+
transform: translateX(-50%);`}`}
|
|
144
134
|
}
|
|
145
135
|
|
|
146
136
|
float: ${float(layout)};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
1
2
|
export { canApplyAnnotationOnRange, getAnnotationIdsFromRange } from './annotation';
|
|
2
3
|
export { getExtensionLozengeData } from './macro';
|
|
3
4
|
export { default as browser } from './browser';
|
|
4
5
|
export { default as ErrorReporter } from './error-reporter';
|
|
5
6
|
export { isPastDate, timestampToIsoFormat, timestampToString, timestampToTaskContext, timestampToUTCDate, todayTimestampInUTC } from './date';
|
|
6
7
|
export { isElementInTableCell, isTextSelection, isLastItemMediaGroup, setNodeSelection, setTextSelection, nonNullable, stepAddsOneOf, stepHasSlice, extractSliceFromStep, isValidPosition, isEmptyParagraph, isInLayoutColumn, removeBlockMarks, filterChildrenBetween } from './editor-core-utils';
|
|
8
|
+
import { isEmptyParagraph } from './editor-core-utils';
|
|
7
9
|
export { withImageLoader } from './imageLoader';
|
|
8
10
|
export { absoluteBreakoutWidth, calcBreakoutWidth, calcWideWidth, breakoutConsts, calculateBreakoutStyles, calcBreakoutWidthPx, getNextBreakoutMode, getTitle } from './breakout';
|
|
9
11
|
export { findChangedNodesFromTransaction, validNode, validateNodes, isType, isParagraph, isText, isLinkMark, SelectedState, isNodeSelectedOrInRange, isSupportedInParent, isMediaNode, isNodeBeforeMediaNode } from './nodes';
|
|
@@ -51,4 +53,140 @@ export function shallowEqual(obj1 = {}, obj2 = {}) {
|
|
|
51
53
|
const keys2 = Object.keys(obj2);
|
|
52
54
|
return keys1.length === keys2.length && keys1.reduce((acc, key) => acc && obj1[key] === obj2[key], true);
|
|
53
55
|
}
|
|
54
|
-
export { inputRuleWithAnalytics, createWrappingJoinRule, createRule } from './input-rules';
|
|
56
|
+
export { inputRuleWithAnalytics, createWrappingJoinRule, createRule } from './input-rules';
|
|
57
|
+
export function isSelectionInsideLastNodeInDocument(selection) {
|
|
58
|
+
const docNode = selection.$anchor.node(0);
|
|
59
|
+
const rootNode = selection.$anchor.node(1);
|
|
60
|
+
return docNode.lastChild === rootNode;
|
|
61
|
+
}
|
|
62
|
+
export const isInListItem = state => {
|
|
63
|
+
return hasParentNodeOfType(state.schema.nodes.listItem)(state.selection);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Find the farthest node given a condition
|
|
68
|
+
* @param predicate Function to check the node
|
|
69
|
+
*/
|
|
70
|
+
export const findFarthestParentNode = predicate => $pos => {
|
|
71
|
+
let candidate = null;
|
|
72
|
+
for (let i = $pos.depth; i > 0; i--) {
|
|
73
|
+
const node = $pos.node(i);
|
|
74
|
+
if (predicate(node)) {
|
|
75
|
+
candidate = {
|
|
76
|
+
pos: i > 0 ? $pos.before(i) : 0,
|
|
77
|
+
start: $pos.start(i),
|
|
78
|
+
depth: i,
|
|
79
|
+
node
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return candidate;
|
|
84
|
+
};
|
|
85
|
+
export const insideTableCell = state => {
|
|
86
|
+
const {
|
|
87
|
+
tableCell,
|
|
88
|
+
tableHeader
|
|
89
|
+
} = state.schema.nodes;
|
|
90
|
+
return hasParentNodeOfType([tableCell, tableHeader])(state.selection);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Traverse the document until an "ancestor" is found. Any nestable block can be an ancestor.
|
|
95
|
+
*/
|
|
96
|
+
function findAncestorPosition(doc, pos) {
|
|
97
|
+
const nestableBlocks = ['blockquote', 'bulletList', 'orderedList'];
|
|
98
|
+
if (pos.depth === 1) {
|
|
99
|
+
return pos;
|
|
100
|
+
}
|
|
101
|
+
let node = pos.node(pos.depth);
|
|
102
|
+
let newPos = pos;
|
|
103
|
+
while (pos.depth >= 1) {
|
|
104
|
+
pos = doc.resolve(pos.before(pos.depth));
|
|
105
|
+
node = pos.node(pos.depth);
|
|
106
|
+
if (node && nestableBlocks.indexOf(node.type.name) !== -1) {
|
|
107
|
+
newPos = pos;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return newPos;
|
|
111
|
+
}
|
|
112
|
+
export function checkNodeDown(selection, doc, filter) {
|
|
113
|
+
const ancestorDepth = findAncestorPosition(doc, selection.$to).depth;
|
|
114
|
+
|
|
115
|
+
// Top level node
|
|
116
|
+
if (ancestorDepth === 0) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
const res = doc.resolve(selection.$to.after(ancestorDepth));
|
|
120
|
+
return res.nodeAfter ? filter(res.nodeAfter) : false;
|
|
121
|
+
}
|
|
122
|
+
export const isEmptyNode = schema => {
|
|
123
|
+
const {
|
|
124
|
+
doc,
|
|
125
|
+
paragraph,
|
|
126
|
+
codeBlock,
|
|
127
|
+
blockquote,
|
|
128
|
+
panel,
|
|
129
|
+
heading,
|
|
130
|
+
listItem,
|
|
131
|
+
bulletList,
|
|
132
|
+
orderedList,
|
|
133
|
+
taskList,
|
|
134
|
+
taskItem,
|
|
135
|
+
decisionList,
|
|
136
|
+
decisionItem,
|
|
137
|
+
media,
|
|
138
|
+
mediaGroup,
|
|
139
|
+
mediaSingle
|
|
140
|
+
} = schema.nodes;
|
|
141
|
+
const innerIsEmptyNode = node => {
|
|
142
|
+
switch (node.type) {
|
|
143
|
+
case media:
|
|
144
|
+
case mediaGroup:
|
|
145
|
+
case mediaSingle:
|
|
146
|
+
return false;
|
|
147
|
+
case paragraph:
|
|
148
|
+
case codeBlock:
|
|
149
|
+
case heading:
|
|
150
|
+
case taskItem:
|
|
151
|
+
case decisionItem:
|
|
152
|
+
return node.content.size === 0;
|
|
153
|
+
case blockquote:
|
|
154
|
+
case panel:
|
|
155
|
+
case listItem:
|
|
156
|
+
return node.content.size === 2 && innerIsEmptyNode(node.content.firstChild);
|
|
157
|
+
case bulletList:
|
|
158
|
+
case orderedList:
|
|
159
|
+
return node.content.size === 4 && innerIsEmptyNode(node.content.firstChild);
|
|
160
|
+
case taskList:
|
|
161
|
+
case decisionList:
|
|
162
|
+
return node.content.size === 2 && innerIsEmptyNode(node.content.firstChild);
|
|
163
|
+
case doc:
|
|
164
|
+
let isEmpty = true;
|
|
165
|
+
node.content.forEach(child => {
|
|
166
|
+
isEmpty = isEmpty && innerIsEmptyNode(child);
|
|
167
|
+
});
|
|
168
|
+
return isEmpty;
|
|
169
|
+
default:
|
|
170
|
+
return isNodeEmpty(node);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
return innerIsEmptyNode;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Checks if a node has any content. Ignores node that only contain empty block nodes.
|
|
178
|
+
*/
|
|
179
|
+
export function isNodeEmpty(node) {
|
|
180
|
+
if (node && node.textContent) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
if (!node || !node.childCount || node.childCount === 1 && isEmptyParagraph(node.firstChild)) {
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
const block = [];
|
|
187
|
+
const nonBlock = [];
|
|
188
|
+
node.forEach(child => {
|
|
189
|
+
child.isInline ? nonBlock.push(child) : block.push(child);
|
|
190
|
+
});
|
|
191
|
+
return !nonBlock.length && !block.filter(childNode => !!childNode.childCount && !(childNode.childCount === 1 && isEmptyParagraph(childNode.firstChild)) || childNode.isAtom).length;
|
|
192
|
+
}
|
|
@@ -6,7 +6,7 @@ export const shouldAddDefaultWrappedWidth = (layout, width, lineLength) => {
|
|
|
6
6
|
};
|
|
7
7
|
export const nonWrappedLayouts = ['center', 'wide', 'full-width'];
|
|
8
8
|
export const floatingLayouts = ['wrap-left', 'wrap-right'];
|
|
9
|
-
export const isRichMediaInsideOfBlockNode = (view, pos
|
|
9
|
+
export const isRichMediaInsideOfBlockNode = (view, pos) => {
|
|
10
10
|
if (typeof pos !== 'number' || isNaN(pos) || !view) {
|
|
11
11
|
return false;
|
|
12
12
|
}
|
|
@@ -14,12 +14,9 @@ export const isRichMediaInsideOfBlockNode = (view, pos, includeMoreParentNodeTyp
|
|
|
14
14
|
const {
|
|
15
15
|
expand,
|
|
16
16
|
nestedExpand,
|
|
17
|
-
layoutColumn
|
|
18
|
-
tableCell,
|
|
19
|
-
listItem
|
|
17
|
+
layoutColumn
|
|
20
18
|
} = view.state.schema.nodes;
|
|
21
|
-
|
|
22
|
-
return !!findParentNodeOfTypeClosestToPos($pos, includeMoreParentNodeTypes ? [...parentNodeTypes, tableCell, listItem] : parentNodeTypes);
|
|
19
|
+
return !!findParentNodeOfTypeClosestToPos($pos, [expand, nestedExpand, layoutColumn]);
|
|
23
20
|
};
|
|
24
21
|
export const alignAttributes = (layout, oldAttrs, gridSize = 12, originalWidth, lineLength) => {
|
|
25
22
|
let width = oldAttrs.width;
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { useIconThemed } from '../../quick-insert/use-icon-themed';
|
|
3
4
|
export default function IconTable() {
|
|
5
|
+
var _useIconThemed = useIconThemed(),
|
|
6
|
+
iconThemed = _useIconThemed.iconThemed;
|
|
7
|
+
var cellBackgroundColour = iconThemed({
|
|
8
|
+
light: '#FFF',
|
|
9
|
+
dark: '#1D2125'
|
|
10
|
+
});
|
|
11
|
+
var headerBackgroundColour = iconThemed({
|
|
12
|
+
light: '#DFE1E6',
|
|
13
|
+
dark: '#5A6977'
|
|
14
|
+
});
|
|
4
15
|
return /*#__PURE__*/React.createElement("svg", {
|
|
5
16
|
focusable: "false",
|
|
6
17
|
"aria-hidden": true,
|
|
@@ -10,24 +21,30 @@ export default function IconTable() {
|
|
|
10
21
|
fill: "none",
|
|
11
22
|
fillRule: "evenodd"
|
|
12
23
|
}, /*#__PURE__*/React.createElement("path", {
|
|
13
|
-
fill:
|
|
24
|
+
fill: iconThemed({
|
|
25
|
+
light: '#FFF',
|
|
26
|
+
dark: '#161A1D'
|
|
27
|
+
}),
|
|
14
28
|
d: "M0 0h40v40H0z"
|
|
15
29
|
}), /*#__PURE__*/React.createElement("g", {
|
|
16
|
-
stroke:
|
|
30
|
+
stroke: iconThemed({
|
|
31
|
+
light: '#C1C7D0',
|
|
32
|
+
dark: '#454F59'
|
|
33
|
+
})
|
|
17
34
|
}, /*#__PURE__*/React.createElement("path", {
|
|
18
|
-
fill:
|
|
35
|
+
fill: cellBackgroundColour,
|
|
19
36
|
d: "M20 16h14v8H20z"
|
|
20
37
|
}), /*#__PURE__*/React.createElement("path", {
|
|
21
38
|
d: "M20 8h13a1 1 0 011 1v7H20V8z",
|
|
22
|
-
fill:
|
|
39
|
+
fill: headerBackgroundColour
|
|
23
40
|
}), /*#__PURE__*/React.createElement("path", {
|
|
24
41
|
d: "M20 24h14v7a1 1 0 01-1 1H20v-8zM6 16h14v8H6z",
|
|
25
|
-
fill:
|
|
42
|
+
fill: cellBackgroundColour
|
|
26
43
|
}), /*#__PURE__*/React.createElement("path", {
|
|
27
44
|
d: "M7 8h13v8H6V9a1 1 0 011-1z",
|
|
28
|
-
fill:
|
|
45
|
+
fill: headerBackgroundColour
|
|
29
46
|
}), /*#__PURE__*/React.createElement("path", {
|
|
30
47
|
d: "M6 24h14v8H7a1 1 0 01-1-1v-7z",
|
|
31
|
-
fill:
|
|
48
|
+
fill: cellBackgroundColour
|
|
32
49
|
}))));
|
|
33
50
|
}
|
|
@@ -119,19 +119,19 @@ var entireSelectionContainsMark = function entireSelectionContainsMark(mark, doc
|
|
|
119
119
|
return onlyContainsMark;
|
|
120
120
|
};
|
|
121
121
|
var toggleMarkInRange = function toggleMarkInRange(mark) {
|
|
122
|
-
return function (
|
|
123
|
-
var tr =
|
|
124
|
-
if (
|
|
122
|
+
return function (_ref2) {
|
|
123
|
+
var tr = _ref2.tr;
|
|
124
|
+
if (tr.selection instanceof CellSelection) {
|
|
125
125
|
var removeMark = true;
|
|
126
126
|
var cells = [];
|
|
127
|
-
|
|
127
|
+
tr.selection.forEachCell(function (cell, cellPos) {
|
|
128
128
|
cells.push({
|
|
129
129
|
node: cell,
|
|
130
130
|
pos: cellPos
|
|
131
131
|
});
|
|
132
132
|
var from = cellPos;
|
|
133
133
|
var to = cellPos + cell.nodeSize;
|
|
134
|
-
removeMark && (removeMark = entireSelectionContainsMark(mark,
|
|
134
|
+
removeMark && (removeMark = entireSelectionContainsMark(mark, tr.doc, from, to));
|
|
135
135
|
});
|
|
136
136
|
for (var i = cells.length - 1; i >= 0; i--) {
|
|
137
137
|
var cell = cells[i];
|
|
@@ -140,51 +140,46 @@ var toggleMarkInRange = function toggleMarkInRange(mark) {
|
|
|
140
140
|
applyMarkOnRange(from, to, removeMark, mark, tr);
|
|
141
141
|
}
|
|
142
142
|
} else {
|
|
143
|
-
var
|
|
144
|
-
$from =
|
|
145
|
-
$to =
|
|
143
|
+
var _tr$selection = tr.selection,
|
|
144
|
+
$from = _tr$selection.$from,
|
|
145
|
+
$to = _tr$selection.$to;
|
|
146
146
|
// We decide to remove the mark only if the entire selection contains the mark
|
|
147
147
|
// Examples with *bold* text
|
|
148
148
|
// Scenario 1: Selection contains both bold and non-bold text -> bold entire selection
|
|
149
149
|
// Scenario 2: Selection contains only bold text -> un-bold entire selection
|
|
150
150
|
// Scenario 3: Selection contains no bold text -> bold entire selection
|
|
151
|
-
var _removeMark = entireSelectionContainsMark(mark,
|
|
151
|
+
var _removeMark = entireSelectionContainsMark(mark, tr.doc, $from.pos, $to.pos);
|
|
152
152
|
applyMarkOnRange($from.pos, $to.pos, _removeMark, mark, tr);
|
|
153
153
|
}
|
|
154
154
|
if (tr.docChanged) {
|
|
155
|
-
|
|
156
|
-
dispatch(tr);
|
|
157
|
-
}
|
|
158
|
-
return true;
|
|
155
|
+
return tr;
|
|
159
156
|
}
|
|
160
|
-
return
|
|
157
|
+
return null;
|
|
161
158
|
};
|
|
162
159
|
};
|
|
163
160
|
|
|
164
161
|
/**
|
|
165
|
-
* A
|
|
166
|
-
*
|
|
162
|
+
* A custom version of the ProseMirror toggleMark, where we only toggle marks
|
|
163
|
+
* on text nodes in the selection rather than all inline nodes.
|
|
167
164
|
* @param markType
|
|
168
165
|
* @param attrs
|
|
169
166
|
*/
|
|
170
167
|
export var toggleMark = function toggleMark(markType, attrs) {
|
|
171
|
-
return function (
|
|
168
|
+
return function (_ref3) {
|
|
169
|
+
var tr = _ref3.tr;
|
|
172
170
|
var mark = markType.create(attrs);
|
|
173
171
|
|
|
174
172
|
// For cursor selections we can use the default behaviour.
|
|
175
|
-
if (
|
|
176
|
-
|
|
177
|
-
if (mark.isInSet(state.storedMarks || state.selection.$cursor.marks())) {
|
|
173
|
+
if (tr.selection instanceof TextSelection && tr.selection.$cursor) {
|
|
174
|
+
if (mark.isInSet(tr.storedMarks || tr.selection.$cursor.marks())) {
|
|
178
175
|
tr.removeStoredMark(mark);
|
|
179
176
|
} else {
|
|
180
177
|
tr.addStoredMark(mark);
|
|
181
178
|
}
|
|
182
|
-
|
|
183
|
-
dispatch(tr);
|
|
184
|
-
return true;
|
|
185
|
-
}
|
|
186
|
-
return false;
|
|
179
|
+
return tr;
|
|
187
180
|
}
|
|
188
|
-
return toggleMarkInRange(mark)(
|
|
181
|
+
return toggleMarkInRange(mark)({
|
|
182
|
+
tr: tr
|
|
183
|
+
});
|
|
189
184
|
};
|
|
190
185
|
};
|
package/dist/esm/mark/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { transformSmartCharsMentionsAndEmojis, applyMarkOnRange,
|
|
1
|
+
export { transformSmartCharsMentionsAndEmojis, applyMarkOnRange, filterChildrenBetween, toggleMark } from './commands';
|
|
2
2
|
export { anyMarkActive } from './text-formatting';
|
|
@@ -5,6 +5,7 @@ export var MEDIA_SINGLE_HANDLE_MARGIN = 12;
|
|
|
5
5
|
export var MEDIA_SINGLE_GUTTER_SIZE = MEDIA_SINGLE_HANDLE_MARGIN * 2;
|
|
6
6
|
export var DEFAULT_IMAGE_WIDTH = 250;
|
|
7
7
|
export var DEFAULT_IMAGE_HEIGHT = 200;
|
|
8
|
+
export var MEDIA_SINGLE_RESIZE_THROTTLE_TIME = 100;
|
|
8
9
|
export var Layout = /*#__PURE__*/function (Layout) {
|
|
9
10
|
Layout["FULL_WIDTH"] = "full-width";
|
|
10
11
|
Layout["WIDE"] = "wide";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { MEDIA_SINGLE_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP, MEDIA_SINGLE_GUTTER_SIZE, Layout as MediaSingleLayout, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, wrappedLayouts } from './constants';
|
|
1
|
+
export { MEDIA_SINGLE_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP, MEDIA_SINGLE_GUTTER_SIZE, MEDIA_SINGLE_RESIZE_THROTTLE_TIME, Layout as MediaSingleLayout, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, wrappedLayouts } from './constants';
|
|
2
2
|
export { getMediaSinglePixelWidth, calcMediaSinglePixelWidth, calcMediaSingleMaxWidth, getMediaSingleInitialWidth, calculateOffsetLeft, roundToNearest } from './utils';
|
|
@@ -6,7 +6,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
6
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
7
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
8
8
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
9
|
-
var packageVersion = "74.
|
|
9
|
+
var packageVersion = "74.45.1";
|
|
10
10
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
11
11
|
// Remove URL as it has UGC
|
|
12
12
|
// TODO: Sanitise the URL instead of just removing it
|