@atlaskit/editor-plugin-selection-toolbar 1.5.1 → 1.5.3
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/pm-plugins/calculate-toolbar-position.js +4 -0
- package/dist/es2019/index.js +3 -0
- package/dist/es2019/pm-plugins/calculate-toolbar-position.js +6 -2
- package/dist/es2019/selectionToolbarPlugin.js +2 -2
- package/dist/esm/index.js +3 -0
- package/dist/esm/pm-plugins/calculate-toolbar-position.js +4 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,8 @@ exports.calculateToolbarPositionTrackHead = void 0;
|
|
|
13
13
|
var getScrollParent = function getScrollParent(editorView) {
|
|
14
14
|
var _editorContentArea$pa;
|
|
15
15
|
// Find the nearest Editor
|
|
16
|
+
// Ignored via go/ees005
|
|
17
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
16
18
|
var editorContentArea = editorView.dom.closest('.ak-editor-content-area');
|
|
17
19
|
|
|
18
20
|
// Check if the Editor is a child of another, the annotation editor inside
|
|
@@ -65,6 +67,8 @@ var getScrollParent = function getScrollParent(editorView) {
|
|
|
65
67
|
*/
|
|
66
68
|
var calculateToolbarPositionTrackHead = exports.calculateToolbarPositionTrackHead = function calculateToolbarPositionTrackHead(toolbarTitle) {
|
|
67
69
|
return function (editorView, nextPos) {
|
|
70
|
+
// Ignored via go/ees005
|
|
71
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
68
72
|
var toolbar = document.querySelector("div[aria-label=\"".concat(toolbarTitle, "\"]"));
|
|
69
73
|
if (!toolbar) {
|
|
70
74
|
return nextPos;
|
package/dist/es2019/index.js
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
const getScrollParent = editorView => {
|
|
8
8
|
var _editorContentArea$pa;
|
|
9
9
|
// Find the nearest Editor
|
|
10
|
+
// Ignored via go/ees005
|
|
11
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
10
12
|
const editorContentArea = editorView.dom.closest('.ak-editor-content-area');
|
|
11
13
|
|
|
12
14
|
// Check if the Editor is a child of another, the annotation editor inside
|
|
@@ -58,6 +60,8 @@ const getScrollParent = editorView => {
|
|
|
58
60
|
- editorView.dom bounds differ to wrapperBounds, convert at the end
|
|
59
61
|
*/
|
|
60
62
|
export const calculateToolbarPositionTrackHead = toolbarTitle => (editorView, nextPos) => {
|
|
63
|
+
// Ignored via go/ees005
|
|
64
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
61
65
|
const toolbar = document.querySelector(`div[aria-label="${toolbarTitle}"]`);
|
|
62
66
|
if (!toolbar) {
|
|
63
67
|
return nextPos;
|
|
@@ -77,8 +81,8 @@ export const calculateToolbarPositionTrackHead = toolbarTitle => (editorView, ne
|
|
|
77
81
|
head,
|
|
78
82
|
anchor
|
|
79
83
|
} = editorView.state.selection;
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
const topCoords = editorView.coordsAtPos(Math.min(head, anchor));
|
|
85
|
+
const bottomCoords = editorView.coordsAtPos(Math.max(head, anchor) - Math.min(range.endOffset, 1));
|
|
82
86
|
let top;
|
|
83
87
|
// If not the same line, display toolbar below.
|
|
84
88
|
if (head > anchor && topCoords.top !== bottomCoords.top) {
|
|
@@ -7,7 +7,7 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
|
7
7
|
import { toggleToolbar } from './pm-plugins/commands';
|
|
8
8
|
import { selectionToolbarPluginKey } from './pm-plugins/plugin-key';
|
|
9
9
|
export const selectionToolbarPlugin = options => {
|
|
10
|
-
|
|
10
|
+
const __selectionToolbarHandlers = [];
|
|
11
11
|
return {
|
|
12
12
|
name: 'selectionToolbar',
|
|
13
13
|
...(fg('platform_editor_ai_definitions_live_page_view_mode') && {
|
|
@@ -173,7 +173,7 @@ export const selectionToolbarPlugin = options => {
|
|
|
173
173
|
};
|
|
174
174
|
};
|
|
175
175
|
function getSelectionNodeTypes(state) {
|
|
176
|
-
|
|
176
|
+
const selectionNodeTypes = [];
|
|
177
177
|
state.doc.nodesBetween(state.selection.from, state.selection.to, (node, _pos, parent) => {
|
|
178
178
|
if (selectionNodeTypes.indexOf(node.type) !== 0) {
|
|
179
179
|
selectionNodeTypes.push(node.type);
|
package/dist/esm/index.js
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
var getScrollParent = function getScrollParent(editorView) {
|
|
8
8
|
var _editorContentArea$pa;
|
|
9
9
|
// Find the nearest Editor
|
|
10
|
+
// Ignored via go/ees005
|
|
11
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
10
12
|
var editorContentArea = editorView.dom.closest('.ak-editor-content-area');
|
|
11
13
|
|
|
12
14
|
// Check if the Editor is a child of another, the annotation editor inside
|
|
@@ -59,6 +61,8 @@ var getScrollParent = function getScrollParent(editorView) {
|
|
|
59
61
|
*/
|
|
60
62
|
export var calculateToolbarPositionTrackHead = function calculateToolbarPositionTrackHead(toolbarTitle) {
|
|
61
63
|
return function (editorView, nextPos) {
|
|
64
|
+
// Ignored via go/ees005
|
|
65
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
62
66
|
var toolbar = document.querySelector("div[aria-label=\"".concat(toolbarTitle, "\"]"));
|
|
63
67
|
if (!toolbar) {
|
|
64
68
|
return nextPos;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection-toolbar",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"description": "@atlaskit/editor-plugin-selection-toolbar for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@atlaskit/editor-common": "^
|
|
39
|
+
"@atlaskit/editor-common": "^98.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
|
|
41
41
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
42
42
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
43
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
43
|
+
"@atlaskit/tmp-editor-statsig": "^2.31.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"bind-event-listener": "^3.0.0"
|
|
46
46
|
},
|