@atlaskit/editor-core 187.4.0 → 187.4.5
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 +12 -0
- package/dist/cjs/plugins/selection/pm-plugins/events/create-selection-between.js +20 -0
- package/dist/cjs/ui/ColorPickerButton/index.js +8 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/selection/pm-plugins/events/create-selection-between.js +20 -0
- package/dist/es2019/ui/ColorPickerButton/index.js +13 -5
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/selection/pm-plugins/events/create-selection-between.js +20 -0
- package/dist/esm/ui/ColorPickerButton/index.js +9 -4
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.4.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`eba71a21f88`](https://bitbucket.org/atlassian/atlassian-frontend/commits/eba71a21f88) - [ED-19204] Let ProseMirror handle selections targeting empty paragraphs on root
|
|
8
|
+
|
|
9
|
+
## 187.4.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`e64541c6fda`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e64541c6fda) - [ux] [ED-18759] Updated table border, handlebar controls, blanket, icon, icon background and table cell options button colour tokens on light and dark theme for table selection and table deletion. Borders for Table Floating Contextual Button & Floating toolbar color palette button on dark & light theme are also updated.
|
|
14
|
+
|
|
3
15
|
## 187.4.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -14,6 +14,17 @@ function findEmptySelectableParentNodePosition($pos, isValidPosition) {
|
|
|
14
14
|
if (isValidPosition($pos)) {
|
|
15
15
|
return $pos;
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
// We can not use `$pos.before()` because ProseMirror throws an error when depth is zero.
|
|
19
|
+
var currentPosIndex = $pos.index();
|
|
20
|
+
if (currentPosIndex === 0) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
var previousIndex = currentPosIndex - 1;
|
|
24
|
+
var $previousPos = $pos.doc.resolve($pos.posAtIndex(previousIndex));
|
|
25
|
+
if (isValidPosition($previousPos)) {
|
|
26
|
+
return $previousPos;
|
|
27
|
+
}
|
|
17
28
|
return null;
|
|
18
29
|
}
|
|
19
30
|
if (isValidPosition($pos)) {
|
|
@@ -49,9 +60,18 @@ function findNextSelectionPosition(_ref) {
|
|
|
49
60
|
return null;
|
|
50
61
|
}
|
|
51
62
|
var onCreateSelectionBetween = function onCreateSelectionBetween(view, $anchor, $head) {
|
|
63
|
+
var _$head$parent;
|
|
52
64
|
if ($anchor.pos === $head.pos) {
|
|
53
65
|
return null;
|
|
54
66
|
}
|
|
67
|
+
if ($anchor.depth === $head.depth && $anchor.sameParent($head)) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// If the head is targeting a paragraph on root, then let ProseMirror handle the text selection
|
|
72
|
+
if ($head.depth === 1 && ((_$head$parent = $head.parent) === null || _$head$parent === void 0 ? void 0 : _$head$parent.type.name) === 'paragraph') {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
55
75
|
var $nextHeadPosition = findNextSelectionPosition({
|
|
56
76
|
$targetHead: $head,
|
|
57
77
|
$anchor: $anchor,
|
|
@@ -41,7 +41,6 @@ var colorPickerWrapper = function colorPickerWrapper(theme) {
|
|
|
41
41
|
/* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
|
|
42
42
|
|
|
43
43
|
var ColorPickerButton = function ColorPickerButton(props) {
|
|
44
|
-
var _props$size, _props$size2, _props$size3;
|
|
45
44
|
var buttonRef = _react.default.useRef(null);
|
|
46
45
|
var _React$useState = _react.default.useState(false),
|
|
47
46
|
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
|
@@ -168,8 +167,14 @@ var ColorPickerButton = function ColorPickerButton(props) {
|
|
|
168
167
|
};
|
|
169
168
|
var title = props.title || '';
|
|
170
169
|
var currentColor = props.currentColor && props.hexToPaletteColor ? props.hexToPaletteColor(props.currentColor) : props.currentColor;
|
|
171
|
-
var buttonStyle =
|
|
172
|
-
|
|
170
|
+
var buttonStyle = function buttonStyle(theme) {
|
|
171
|
+
var _props$size, _props$size2, _props$size3;
|
|
172
|
+
return (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n padding: 0 10px;\n background-color: ", ";\n ", "\n &:before {\n display: flex;\n justify-content: center;\n align-items: center;\n align-self: center;\n content: '';\n border: 1px solid ", ";\n border-radius: ", "px;\n background-color: ", ";\n width: ", ";\n height: ", ";\n padding: 0;\n margin: 0px 2px;\n }\n &:hover {\n background: ", ";\n }\n "])), "var(--ds-background-neutral-subtle, transparent)", /* If custom props size height, override the button base height property */
|
|
173
|
+
!!((_props$size = props.size) !== null && _props$size !== void 0 && _props$size.height) && "height: inherit;", _common.DEFAULT_BORDER_COLOR, (0, _constants.borderRadius)(), currentColor || 'transparent', ((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.width) || '14px', ((_props$size3 = props.size) === null || _props$size3 === void 0 ? void 0 : _props$size3.height) || '14px', (0, _components.themed)({
|
|
174
|
+
light: "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N30A, ")"),
|
|
175
|
+
dark: "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N30A, ")")
|
|
176
|
+
})(theme));
|
|
177
|
+
};
|
|
173
178
|
return (0, _react2.jsx)("div", {
|
|
174
179
|
css: colorPickerButtonWrapper
|
|
175
180
|
}, (0, _react2.jsx)(_tooltip.default, {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "187.4.
|
|
9
|
+
var version = "187.4.5";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
|
@@ -10,6 +10,17 @@ function findEmptySelectableParentNodePosition($pos, isValidPosition) {
|
|
|
10
10
|
if (isValidPosition($pos)) {
|
|
11
11
|
return $pos;
|
|
12
12
|
}
|
|
13
|
+
|
|
14
|
+
// We can not use `$pos.before()` because ProseMirror throws an error when depth is zero.
|
|
15
|
+
const currentPosIndex = $pos.index();
|
|
16
|
+
if (currentPosIndex === 0) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const previousIndex = currentPosIndex - 1;
|
|
20
|
+
const $previousPos = $pos.doc.resolve($pos.posAtIndex(previousIndex));
|
|
21
|
+
if (isValidPosition($previousPos)) {
|
|
22
|
+
return $previousPos;
|
|
23
|
+
}
|
|
13
24
|
return null;
|
|
14
25
|
}
|
|
15
26
|
if (isValidPosition($pos)) {
|
|
@@ -46,9 +57,18 @@ function findNextSelectionPosition({
|
|
|
46
57
|
return null;
|
|
47
58
|
}
|
|
48
59
|
export const onCreateSelectionBetween = (view, $anchor, $head) => {
|
|
60
|
+
var _$head$parent;
|
|
49
61
|
if ($anchor.pos === $head.pos) {
|
|
50
62
|
return null;
|
|
51
63
|
}
|
|
64
|
+
if ($anchor.depth === $head.depth && $anchor.sameParent($head)) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// If the head is targeting a paragraph on root, then let ProseMirror handle the text selection
|
|
69
|
+
if ($head.depth === 1 && ((_$head$parent = $head.parent) === null || _$head$parent === void 0 ? void 0 : _$head$parent.type.name) === 'paragraph') {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
52
72
|
const $nextHeadPosition = findNextSelectionPosition({
|
|
53
73
|
$targetHead: $head,
|
|
54
74
|
$anchor,
|
|
@@ -6,7 +6,7 @@ import { ArrowKeyNavigationProvider, ArrowKeyNavigationType } from '@atlaskit/ed
|
|
|
6
6
|
import { getSelectedRowAndColumnFromPalette } from '@atlaskit/editor-common/ui-color';
|
|
7
7
|
import Button from '@atlaskit/button';
|
|
8
8
|
import Tooltip from '@atlaskit/tooltip';
|
|
9
|
-
import { DN50, N0, N60A } from '@atlaskit/theme/colors';
|
|
9
|
+
import { DN50, N0, N60A, N30A } from '@atlaskit/theme/colors';
|
|
10
10
|
import { themed } from '@atlaskit/theme/components';
|
|
11
11
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
12
12
|
import ColorPalette from '../ColorPalette';
|
|
@@ -39,7 +39,6 @@ const colorPickerWrapper = theme => css`
|
|
|
39
39
|
/* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
|
|
40
40
|
|
|
41
41
|
const ColorPickerButton = props => {
|
|
42
|
-
var _props$size, _props$size2, _props$size3;
|
|
43
42
|
const buttonRef = React.useRef(null);
|
|
44
43
|
const [isPopupOpen, setIsPopupOpen] = React.useState(false);
|
|
45
44
|
const [isPopupPositioned, setIsPopupPositioned] = React.useState(false);
|
|
@@ -156,11 +155,13 @@ const ColorPickerButton = props => {
|
|
|
156
155
|
};
|
|
157
156
|
const title = props.title || '';
|
|
158
157
|
const currentColor = props.currentColor && props.hexToPaletteColor ? props.hexToPaletteColor(props.currentColor) : props.currentColor;
|
|
159
|
-
const buttonStyle =
|
|
158
|
+
const buttonStyle = theme => {
|
|
159
|
+
var _props$size, _props$size2, _props$size3;
|
|
160
|
+
return css`
|
|
160
161
|
padding: 0 10px;
|
|
161
|
-
background-color: ${"var(--ds-background-neutral, transparent)"};
|
|
162
|
+
background-color: ${"var(--ds-background-neutral-subtle, transparent)"};
|
|
162
163
|
${
|
|
163
|
-
|
|
164
|
+
/* If custom props size height, override the button base height property */!!((_props$size = props.size) !== null && _props$size !== void 0 && _props$size.height) && `height: inherit;`}
|
|
164
165
|
&:before {
|
|
165
166
|
display: flex;
|
|
166
167
|
justify-content: center;
|
|
@@ -175,7 +176,14 @@ const ColorPickerButton = props => {
|
|
|
175
176
|
padding: 0;
|
|
176
177
|
margin: 0px 2px;
|
|
177
178
|
}
|
|
179
|
+
&:hover {
|
|
180
|
+
background: ${themed({
|
|
181
|
+
light: `var(--ds-background-neutral-subtle-hovered, ${N30A})`,
|
|
182
|
+
dark: `var(--ds-background-neutral-subtle-hovered, ${N30A})`
|
|
183
|
+
})(theme)};
|
|
184
|
+
}
|
|
178
185
|
`;
|
|
186
|
+
};
|
|
179
187
|
return jsx("div", {
|
|
180
188
|
css: colorPickerButtonWrapper
|
|
181
189
|
}, jsx(Tooltip, {
|
package/dist/es2019/version.json
CHANGED
|
@@ -8,6 +8,17 @@ function findEmptySelectableParentNodePosition($pos, isValidPosition) {
|
|
|
8
8
|
if (isValidPosition($pos)) {
|
|
9
9
|
return $pos;
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
// We can not use `$pos.before()` because ProseMirror throws an error when depth is zero.
|
|
13
|
+
var currentPosIndex = $pos.index();
|
|
14
|
+
if (currentPosIndex === 0) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
var previousIndex = currentPosIndex - 1;
|
|
18
|
+
var $previousPos = $pos.doc.resolve($pos.posAtIndex(previousIndex));
|
|
19
|
+
if (isValidPosition($previousPos)) {
|
|
20
|
+
return $previousPos;
|
|
21
|
+
}
|
|
11
22
|
return null;
|
|
12
23
|
}
|
|
13
24
|
if (isValidPosition($pos)) {
|
|
@@ -43,9 +54,18 @@ function findNextSelectionPosition(_ref) {
|
|
|
43
54
|
return null;
|
|
44
55
|
}
|
|
45
56
|
export var onCreateSelectionBetween = function onCreateSelectionBetween(view, $anchor, $head) {
|
|
57
|
+
var _$head$parent;
|
|
46
58
|
if ($anchor.pos === $head.pos) {
|
|
47
59
|
return null;
|
|
48
60
|
}
|
|
61
|
+
if ($anchor.depth === $head.depth && $anchor.sameParent($head)) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// If the head is targeting a paragraph on root, then let ProseMirror handle the text selection
|
|
66
|
+
if ($head.depth === 1 && ((_$head$parent = $head.parent) === null || _$head$parent === void 0 ? void 0 : _$head$parent.type.name) === 'paragraph') {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
49
69
|
var $nextHeadPosition = findNextSelectionPosition({
|
|
50
70
|
$targetHead: $head,
|
|
51
71
|
$anchor: $anchor,
|
|
@@ -9,7 +9,7 @@ import { ArrowKeyNavigationProvider, ArrowKeyNavigationType } from '@atlaskit/ed
|
|
|
9
9
|
import { getSelectedRowAndColumnFromPalette } from '@atlaskit/editor-common/ui-color';
|
|
10
10
|
import Button from '@atlaskit/button';
|
|
11
11
|
import Tooltip from '@atlaskit/tooltip';
|
|
12
|
-
import { DN50, N0, N60A } from '@atlaskit/theme/colors';
|
|
12
|
+
import { DN50, N0, N60A, N30A } from '@atlaskit/theme/colors';
|
|
13
13
|
import { themed } from '@atlaskit/theme/components';
|
|
14
14
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
15
15
|
import ColorPalette from '../ColorPalette';
|
|
@@ -35,7 +35,6 @@ var colorPickerWrapper = function colorPickerWrapper(theme) {
|
|
|
35
35
|
/* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
|
|
36
36
|
|
|
37
37
|
var ColorPickerButton = function ColorPickerButton(props) {
|
|
38
|
-
var _props$size, _props$size2, _props$size3;
|
|
39
38
|
var buttonRef = React.useRef(null);
|
|
40
39
|
var _React$useState = React.useState(false),
|
|
41
40
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -162,8 +161,14 @@ var ColorPickerButton = function ColorPickerButton(props) {
|
|
|
162
161
|
};
|
|
163
162
|
var title = props.title || '';
|
|
164
163
|
var currentColor = props.currentColor && props.hexToPaletteColor ? props.hexToPaletteColor(props.currentColor) : props.currentColor;
|
|
165
|
-
var buttonStyle =
|
|
166
|
-
|
|
164
|
+
var buttonStyle = function buttonStyle(theme) {
|
|
165
|
+
var _props$size, _props$size2, _props$size3;
|
|
166
|
+
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: 0 10px;\n background-color: ", ";\n ", "\n &:before {\n display: flex;\n justify-content: center;\n align-items: center;\n align-self: center;\n content: '';\n border: 1px solid ", ";\n border-radius: ", "px;\n background-color: ", ";\n width: ", ";\n height: ", ";\n padding: 0;\n margin: 0px 2px;\n }\n &:hover {\n background: ", ";\n }\n "])), "var(--ds-background-neutral-subtle, transparent)", /* If custom props size height, override the button base height property */
|
|
167
|
+
!!((_props$size = props.size) !== null && _props$size !== void 0 && _props$size.height) && "height: inherit;", DEFAULT_BORDER_COLOR, borderRadius(), currentColor || 'transparent', ((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.width) || '14px', ((_props$size3 = props.size) === null || _props$size3 === void 0 ? void 0 : _props$size3.height) || '14px', themed({
|
|
168
|
+
light: "var(--ds-background-neutral-subtle-hovered, ".concat(N30A, ")"),
|
|
169
|
+
dark: "var(--ds-background-neutral-subtle-hovered, ".concat(N30A, ")")
|
|
170
|
+
})(theme));
|
|
171
|
+
};
|
|
167
172
|
return jsx("div", {
|
|
168
173
|
css: colorPickerButtonWrapper
|
|
169
174
|
}, jsx(Tooltip, {
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "187.4.
|
|
3
|
+
"version": "187.4.5",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@atlaskit/code": "^14.6.0",
|
|
56
56
|
"@atlaskit/date": "^0.10.0",
|
|
57
57
|
"@atlaskit/datetime-picker": "^12.7.0",
|
|
58
|
-
"@atlaskit/editor-common": "^74.
|
|
58
|
+
"@atlaskit/editor-common": "^74.26.0",
|
|
59
59
|
"@atlaskit/editor-json-transformer": "^8.10.0",
|
|
60
60
|
"@atlaskit/editor-markdown-transformer": "^5.2.5",
|
|
61
61
|
"@atlaskit/editor-palette": "1.5.1",
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"@af/integration-testing": "*",
|
|
148
148
|
"@atlaskit/code": "^14.6.0",
|
|
149
149
|
"@atlaskit/collab-provider": "9.7.3",
|
|
150
|
-
"@atlaskit/dropdown-menu": "^11.
|
|
150
|
+
"@atlaskit/dropdown-menu": "^11.11.0",
|
|
151
151
|
"@atlaskit/editor-extension-dropbox": "^0.4.0",
|
|
152
152
|
"@atlaskit/editor-plugin-table": "^2.5.0",
|
|
153
153
|
"@atlaskit/editor-test-helpers": "^18.10.0",
|