@atlaskit/editor-plugin-block-controls 1.3.2 → 1.3.4
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 +17 -0
- package/dist/cjs/ui/consts.js +4 -3
- package/dist/cjs/ui/drag-handle.js +49 -19
- package/dist/es2019/ui/consts.js +3 -2
- package/dist/es2019/ui/drag-handle.js +46 -20
- package/dist/esm/ui/consts.js +3 -2
- package/dist/esm/ui/drag-handle.js +50 -21
- package/dist/types/ui/consts.d.ts +3 -2
- package/dist/types-ts4.5/ui/consts.d.ts +3 -2
- package/package.json +11 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 1.3.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#99555](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99555)
|
|
8
|
+
[`703d23b83234`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/703d23b83234) -
|
|
9
|
+
[ux] Update drag handle style based on design
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 1.3.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#98101](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/98101)
|
|
17
|
+
[`930a81c221d3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/930a81c221d3) -
|
|
18
|
+
Update example page to enable resizable table and media-single nodes
|
|
19
|
+
|
|
3
20
|
## 1.3.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/cjs/ui/consts.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_HEIGHT = void 0;
|
|
7
|
-
var DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_HEIGHT =
|
|
8
|
-
var DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_WIDTH =
|
|
6
|
+
exports.DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_BORDER_RADIUS = void 0;
|
|
7
|
+
var DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_HEIGHT = 24;
|
|
8
|
+
var DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_WIDTH = 12;
|
|
9
|
+
var DRAG_HANDLE_BORDER_RADIUS = exports.DRAG_HANDLE_BORDER_RADIUS = 4;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.DragHandle = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
7
9
|
var _react = require("react");
|
|
8
10
|
var _react2 = require("@emotion/react");
|
|
11
|
+
var _dragHandler = _interopRequireDefault(require("@atlaskit/icon/glyph/drag-handler"));
|
|
9
12
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
10
13
|
var _setCustomNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview");
|
|
11
14
|
var _main = require("../pm-plugins/main");
|
|
@@ -13,14 +16,35 @@ var _consts = require("./consts");
|
|
|
13
16
|
var _dragPreview = require("./drag-preview");
|
|
14
17
|
/** @jsx jsx */
|
|
15
18
|
|
|
16
|
-
var
|
|
17
|
-
position: '
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
var dragHandleButtonStyles = (0, _react2.css)({
|
|
20
|
+
position: 'relative',
|
|
21
|
+
// TODO - we have ticket ED-23209 to correctly position the drag handle for each node
|
|
22
|
+
//https://product-fabric.atlassian.net/browse/ED-23209
|
|
23
|
+
top: 12,
|
|
24
|
+
left: -18,
|
|
25
|
+
padding: "var(--ds-space-025, 2px)".concat(" 0"),
|
|
26
|
+
boxSizing: 'border-box',
|
|
27
|
+
display: 'flex',
|
|
28
|
+
flexDirection: 'column',
|
|
29
|
+
justifyContent: 'center',
|
|
30
|
+
alignItems: 'center',
|
|
21
31
|
height: _consts.DRAG_HANDLE_HEIGHT,
|
|
22
32
|
width: _consts.DRAG_HANDLE_WIDTH,
|
|
23
|
-
|
|
33
|
+
border: 'none',
|
|
34
|
+
background: 'transparent',
|
|
35
|
+
borderRadius: _consts.DRAG_HANDLE_BORDER_RADIUS,
|
|
36
|
+
color: "var(--ds-icon, #44546F)",
|
|
37
|
+
cursor: 'grab',
|
|
38
|
+
':hover': {
|
|
39
|
+
backgroundColor: "var(--ds-background-neutral-subtle-hovered, #091E420F)"
|
|
40
|
+
},
|
|
41
|
+
':active': {
|
|
42
|
+
backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
var selectedStyles = (0, _react2.css)({
|
|
46
|
+
backgroundColor: "var(--ds-background-selected, #E9F2FF)",
|
|
47
|
+
color: "var(--ds-icon-selected, #0C66E4)"
|
|
24
48
|
});
|
|
25
49
|
var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
26
50
|
var dom = _ref.dom,
|
|
@@ -28,6 +52,10 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
28
52
|
start = _ref.start;
|
|
29
53
|
var buttonRef = (0, _react.useRef)(null);
|
|
30
54
|
var domRef = (0, _react.useRef)(dom);
|
|
55
|
+
var _useState = (0, _react.useState)(false),
|
|
56
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
57
|
+
dragHandleSelected = _useState2[0],
|
|
58
|
+
setDragHandleSelected = _useState2[1];
|
|
31
59
|
(0, _react.useEffect)(function () {
|
|
32
60
|
var element = buttonRef.current;
|
|
33
61
|
if (!element) {
|
|
@@ -74,20 +102,22 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
74
102
|
}
|
|
75
103
|
});
|
|
76
104
|
}, [api, start]);
|
|
77
|
-
return (0, _react2.jsx)("
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
top: dom.clientHeight / 2 - _consts.DRAG_HANDLE_HEIGHT / 2
|
|
81
|
-
},
|
|
105
|
+
return (0, _react2.jsx)("button", {
|
|
106
|
+
type: "button",
|
|
107
|
+
css: [dragHandleButtonStyles, dragHandleSelected && selectedStyles],
|
|
82
108
|
ref: buttonRef,
|
|
83
109
|
onClick: function onClick() {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
})
|
|
110
|
+
setDragHandleSelected(!dragHandleSelected);
|
|
111
|
+
|
|
112
|
+
// TODO - add drag menu
|
|
113
|
+
// api?.core?.actions.execute(({ tr }) =>
|
|
114
|
+
// tr.setMeta(key, {
|
|
115
|
+
// toggleMenu: true,
|
|
116
|
+
// }),
|
|
117
|
+
// );
|
|
91
118
|
}
|
|
92
|
-
})
|
|
119
|
+
}, (0, _react2.jsx)(_dragHandler.default, {
|
|
120
|
+
label: "",
|
|
121
|
+
size: "medium"
|
|
122
|
+
}));
|
|
93
123
|
};
|
package/dist/es2019/ui/consts.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export const DRAG_HANDLE_HEIGHT =
|
|
2
|
-
export const DRAG_HANDLE_WIDTH =
|
|
1
|
+
export const DRAG_HANDLE_HEIGHT = 24;
|
|
2
|
+
export const DRAG_HANDLE_WIDTH = 12;
|
|
3
|
+
export const DRAG_HANDLE_BORDER_RADIUS = 4;
|
|
@@ -1,19 +1,41 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
+
import DragHandlerIcon from '@atlaskit/icon/glyph/drag-handler';
|
|
4
5
|
import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
5
6
|
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
|
|
6
7
|
import { key } from '../pm-plugins/main';
|
|
7
|
-
import { DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH } from './consts';
|
|
8
|
+
import { DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH } from './consts';
|
|
8
9
|
import { dragPreview } from './drag-preview';
|
|
9
|
-
const
|
|
10
|
-
position: '
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const dragHandleButtonStyles = css({
|
|
11
|
+
position: 'relative',
|
|
12
|
+
// TODO - we have ticket ED-23209 to correctly position the drag handle for each node
|
|
13
|
+
//https://product-fabric.atlassian.net/browse/ED-23209
|
|
14
|
+
top: 12,
|
|
15
|
+
left: -18,
|
|
16
|
+
padding: `${"var(--ds-space-025, 2px)"} 0`,
|
|
17
|
+
boxSizing: 'border-box',
|
|
18
|
+
display: 'flex',
|
|
19
|
+
flexDirection: 'column',
|
|
20
|
+
justifyContent: 'center',
|
|
21
|
+
alignItems: 'center',
|
|
14
22
|
height: DRAG_HANDLE_HEIGHT,
|
|
15
23
|
width: DRAG_HANDLE_WIDTH,
|
|
16
|
-
|
|
24
|
+
border: 'none',
|
|
25
|
+
background: 'transparent',
|
|
26
|
+
borderRadius: DRAG_HANDLE_BORDER_RADIUS,
|
|
27
|
+
color: "var(--ds-icon, #44546F)",
|
|
28
|
+
cursor: 'grab',
|
|
29
|
+
':hover': {
|
|
30
|
+
backgroundColor: "var(--ds-background-neutral-subtle-hovered, #091E420F)"
|
|
31
|
+
},
|
|
32
|
+
':active': {
|
|
33
|
+
backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const selectedStyles = css({
|
|
37
|
+
backgroundColor: "var(--ds-background-selected, #E9F2FF)",
|
|
38
|
+
color: "var(--ds-icon-selected, #0C66E4)"
|
|
17
39
|
});
|
|
18
40
|
export const DragHandle = ({
|
|
19
41
|
dom,
|
|
@@ -22,6 +44,7 @@ export const DragHandle = ({
|
|
|
22
44
|
}) => {
|
|
23
45
|
const buttonRef = useRef(null);
|
|
24
46
|
const domRef = useRef(dom);
|
|
47
|
+
const [dragHandleSelected, setDragHandleSelected] = useState(false);
|
|
25
48
|
useEffect(() => {
|
|
26
49
|
const element = buttonRef.current;
|
|
27
50
|
if (!element) {
|
|
@@ -68,19 +91,22 @@ export const DragHandle = ({
|
|
|
68
91
|
}
|
|
69
92
|
});
|
|
70
93
|
}, [api, start]);
|
|
71
|
-
return jsx("
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
top: dom.clientHeight / 2 - DRAG_HANDLE_HEIGHT / 2
|
|
75
|
-
},
|
|
94
|
+
return jsx("button", {
|
|
95
|
+
type: "button",
|
|
96
|
+
css: [dragHandleButtonStyles, dragHandleSelected && selectedStyles],
|
|
76
97
|
ref: buttonRef,
|
|
77
98
|
onClick: () => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}) =>
|
|
82
|
-
|
|
83
|
-
|
|
99
|
+
setDragHandleSelected(!dragHandleSelected);
|
|
100
|
+
|
|
101
|
+
// TODO - add drag menu
|
|
102
|
+
// api?.core?.actions.execute(({ tr }) =>
|
|
103
|
+
// tr.setMeta(key, {
|
|
104
|
+
// toggleMenu: true,
|
|
105
|
+
// }),
|
|
106
|
+
// );
|
|
84
107
|
}
|
|
85
|
-
}
|
|
108
|
+
}, jsx(DragHandlerIcon, {
|
|
109
|
+
label: "",
|
|
110
|
+
size: "medium"
|
|
111
|
+
}));
|
|
86
112
|
};
|
package/dist/esm/ui/consts.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export var DRAG_HANDLE_HEIGHT =
|
|
2
|
-
export var DRAG_HANDLE_WIDTH =
|
|
1
|
+
export var DRAG_HANDLE_HEIGHT = 24;
|
|
2
|
+
export var DRAG_HANDLE_WIDTH = 12;
|
|
3
|
+
export var DRAG_HANDLE_BORDER_RADIUS = 4;
|
|
@@ -1,19 +1,42 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
1
2
|
/** @jsx jsx */
|
|
2
|
-
import { useEffect, useRef } from 'react';
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
+
import DragHandlerIcon from '@atlaskit/icon/glyph/drag-handler';
|
|
4
6
|
import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
5
7
|
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
|
|
6
8
|
import { key } from '../pm-plugins/main';
|
|
7
|
-
import { DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH } from './consts';
|
|
9
|
+
import { DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH } from './consts';
|
|
8
10
|
import { dragPreview } from './drag-preview';
|
|
9
|
-
var
|
|
10
|
-
position: '
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
var dragHandleButtonStyles = css({
|
|
12
|
+
position: 'relative',
|
|
13
|
+
// TODO - we have ticket ED-23209 to correctly position the drag handle for each node
|
|
14
|
+
//https://product-fabric.atlassian.net/browse/ED-23209
|
|
15
|
+
top: 12,
|
|
16
|
+
left: -18,
|
|
17
|
+
padding: "var(--ds-space-025, 2px)".concat(" 0"),
|
|
18
|
+
boxSizing: 'border-box',
|
|
19
|
+
display: 'flex',
|
|
20
|
+
flexDirection: 'column',
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
alignItems: 'center',
|
|
14
23
|
height: DRAG_HANDLE_HEIGHT,
|
|
15
24
|
width: DRAG_HANDLE_WIDTH,
|
|
16
|
-
|
|
25
|
+
border: 'none',
|
|
26
|
+
background: 'transparent',
|
|
27
|
+
borderRadius: DRAG_HANDLE_BORDER_RADIUS,
|
|
28
|
+
color: "var(--ds-icon, #44546F)",
|
|
29
|
+
cursor: 'grab',
|
|
30
|
+
':hover': {
|
|
31
|
+
backgroundColor: "var(--ds-background-neutral-subtle-hovered, #091E420F)"
|
|
32
|
+
},
|
|
33
|
+
':active': {
|
|
34
|
+
backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
var selectedStyles = css({
|
|
38
|
+
backgroundColor: "var(--ds-background-selected, #E9F2FF)",
|
|
39
|
+
color: "var(--ds-icon-selected, #0C66E4)"
|
|
17
40
|
});
|
|
18
41
|
export var DragHandle = function DragHandle(_ref) {
|
|
19
42
|
var dom = _ref.dom,
|
|
@@ -21,6 +44,10 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
21
44
|
start = _ref.start;
|
|
22
45
|
var buttonRef = useRef(null);
|
|
23
46
|
var domRef = useRef(dom);
|
|
47
|
+
var _useState = useState(false),
|
|
48
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
49
|
+
dragHandleSelected = _useState2[0],
|
|
50
|
+
setDragHandleSelected = _useState2[1];
|
|
24
51
|
useEffect(function () {
|
|
25
52
|
var element = buttonRef.current;
|
|
26
53
|
if (!element) {
|
|
@@ -67,20 +94,22 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
67
94
|
}
|
|
68
95
|
});
|
|
69
96
|
}, [api, start]);
|
|
70
|
-
return jsx("
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
top: dom.clientHeight / 2 - DRAG_HANDLE_HEIGHT / 2
|
|
74
|
-
},
|
|
97
|
+
return jsx("button", {
|
|
98
|
+
type: "button",
|
|
99
|
+
css: [dragHandleButtonStyles, dragHandleSelected && selectedStyles],
|
|
75
100
|
ref: buttonRef,
|
|
76
101
|
onClick: function onClick() {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
})
|
|
102
|
+
setDragHandleSelected(!dragHandleSelected);
|
|
103
|
+
|
|
104
|
+
// TODO - add drag menu
|
|
105
|
+
// api?.core?.actions.execute(({ tr }) =>
|
|
106
|
+
// tr.setMeta(key, {
|
|
107
|
+
// toggleMenu: true,
|
|
108
|
+
// }),
|
|
109
|
+
// );
|
|
84
110
|
}
|
|
85
|
-
}
|
|
111
|
+
}, jsx(DragHandlerIcon, {
|
|
112
|
+
label: "",
|
|
113
|
+
size: "medium"
|
|
114
|
+
}));
|
|
86
115
|
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export declare const DRAG_HANDLE_HEIGHT =
|
|
2
|
-
export declare const DRAG_HANDLE_WIDTH =
|
|
1
|
+
export declare const DRAG_HANDLE_HEIGHT = 24;
|
|
2
|
+
export declare const DRAG_HANDLE_WIDTH = 12;
|
|
3
|
+
export declare const DRAG_HANDLE_BORDER_RADIUS = 4;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export declare const DRAG_HANDLE_HEIGHT =
|
|
2
|
-
export declare const DRAG_HANDLE_WIDTH =
|
|
1
|
+
export declare const DRAG_HANDLE_HEIGHT = 24;
|
|
2
|
+
export declare const DRAG_HANDLE_WIDTH = 12;
|
|
3
|
+
export declare const DRAG_HANDLE_BORDER_RADIUS = 4;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,9 +31,11 @@
|
|
|
31
31
|
".": "./src/index.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atlaskit/editor-common": "^79.
|
|
34
|
+
"@atlaskit/editor-common": "^79.6.0",
|
|
35
35
|
"@atlaskit/editor-prosemirror": "4.0.1",
|
|
36
|
+
"@atlaskit/icon": "^22.1.0",
|
|
36
37
|
"@atlaskit/pragmatic-drag-and-drop": "^1.1.0",
|
|
38
|
+
"@atlaskit/tokens": "^1.48.0",
|
|
37
39
|
"@babel/runtime": "^7.0.0",
|
|
38
40
|
"@emotion/react": "^11.7.1"
|
|
39
41
|
},
|
|
@@ -79,5 +81,11 @@
|
|
|
79
81
|
]
|
|
80
82
|
}
|
|
81
83
|
},
|
|
82
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
84
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0",
|
|
85
|
+
"platform-feature-flags": {
|
|
86
|
+
"platform.editor.media.extended-resize-experience": {
|
|
87
|
+
"type": "boolean",
|
|
88
|
+
"referenceOnly": true
|
|
89
|
+
}
|
|
90
|
+
}
|
|
83
91
|
}
|