@wordpress/dom 3.38.0 → 3.40.0
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 +4 -0
- package/README.md +2 -2
- package/build/data-transfer.js +0 -2
- package/build/data-transfer.js.map +1 -1
- package/build/dom/caret-range-from-point.js +3 -5
- package/build/dom/caret-range-from-point.js.map +1 -1
- package/build/dom/clean-node-list.js +25 -42
- package/build/dom/clean-node-list.js.map +1 -1
- package/build/dom/compute-caret-rect.js +0 -6
- package/build/dom/compute-caret-rect.js.map +1 -1
- package/build/dom/document-has-selection.js +0 -5
- package/build/dom/document-has-selection.js.map +1 -1
- package/build/dom/document-has-text-selection.js +0 -2
- package/build/dom/document-has-text-selection.js.map +1 -1
- package/build/dom/document-has-uncollapsed-selection.js +0 -4
- package/build/dom/document-has-uncollapsed-selection.js.map +1 -1
- package/build/dom/get-computed-style.js +0 -3
- package/build/dom/get-computed-style.js.map +1 -1
- package/build/dom/get-offset-parent.js +8 -19
- package/build/dom/get-offset-parent.js.map +1 -1
- package/build/dom/get-range-height.js +0 -3
- package/build/dom/get-range-height.js.map +1 -1
- package/build/dom/get-rectangle-from-range.js +15 -22
- package/build/dom/get-rectangle-from-range.js.map +1 -1
- package/build/dom/get-scroll-container.js +3 -13
- package/build/dom/get-scroll-container.js.map +1 -1
- package/build/dom/hidden-caret-range-from-point.js +2 -6
- package/build/dom/hidden-caret-range-from-point.js.map +1 -1
- package/build/dom/index.js +0 -27
- package/build/dom/index.js.map +1 -1
- package/build/dom/input-field-has-uncollapsed-selection.js +8 -12
- package/build/dom/input-field-has-uncollapsed-selection.js.map +1 -1
- package/build/dom/insert-after.js +0 -2
- package/build/dom/insert-after.js.map +1 -1
- package/build/dom/is-edge.js +18 -40
- package/build/dom/is-edge.js.map +1 -1
- package/build/dom/is-element.js +0 -2
- package/build/dom/is-element.js.map +1 -1
- package/build/dom/is-empty.js +1 -7
- package/build/dom/is-empty.js.map +1 -1
- package/build/dom/is-entirely-selected.js +2 -18
- package/build/dom/is-entirely-selected.js.map +1 -1
- package/build/dom/is-form-element.js +0 -4
- package/build/dom/is-form-element.js.map +1 -1
- package/build/dom/is-horizontal-edge.js +2 -5
- package/build/dom/is-horizontal-edge.js.map +1 -1
- package/build/dom/is-html-input-element.js +0 -2
- package/build/dom/is-html-input-element.js.map +1 -1
- package/build/dom/is-input-or-text-area.js +0 -2
- package/build/dom/is-input-or-text-area.js.map +1 -1
- package/build/dom/is-number-input.js +0 -6
- package/build/dom/is-number-input.js.map +1 -1
- package/build/dom/is-rtl.js +0 -3
- package/build/dom/is-rtl.js.map +1 -1
- package/build/dom/is-selection-forward.js +6 -10
- package/build/dom/is-selection-forward.js.map +1 -1
- package/build/dom/is-text-field.js +1 -7
- package/build/dom/is-text-field.js.map +1 -1
- package/build/dom/is-vertical-edge.js +2 -5
- package/build/dom/is-vertical-edge.js.map +1 -1
- package/build/dom/place-caret-at-edge.js +8 -31
- package/build/dom/place-caret-at-edge.js.map +1 -1
- package/build/dom/place-caret-at-horizontal-edge.js +0 -3
- package/build/dom/place-caret-at-horizontal-edge.js.map +1 -1
- package/build/dom/place-caret-at-vertical-edge.js +0 -3
- package/build/dom/place-caret-at-vertical-edge.js.map +1 -1
- package/build/dom/remove-invalid-html.js +0 -3
- package/build/dom/remove-invalid-html.js.map +1 -1
- package/build/dom/remove.js +0 -2
- package/build/dom/remove.js.map +1 -1
- package/build/dom/replace-tag.js +0 -4
- package/build/dom/replace-tag.js.map +1 -1
- package/build/dom/replace.js +0 -5
- package/build/dom/replace.js.map +1 -1
- package/build/dom/safe-html.js +0 -8
- package/build/dom/safe-html.js.map +1 -1
- package/build/dom/scroll-if-no-range.js +31 -0
- package/build/dom/scroll-if-no-range.js.map +1 -0
- package/build/dom/strip-html.js +0 -3
- package/build/dom/strip-html.js.map +1 -1
- package/build/dom/unwrap.js +0 -4
- package/build/dom/unwrap.js.map +1 -1
- package/build/dom/wrap.js +0 -2
- package/build/dom/wrap.js.map +1 -1
- package/build/focusable.js +5 -18
- package/build/focusable.js.map +1 -1
- package/build/index.js +0 -11
- package/build/index.js.map +1 -1
- package/build/phrasing-content.js +13 -14
- package/build/phrasing-content.js.map +1 -1
- package/build/tabbable.js +21 -37
- package/build/tabbable.js.map +1 -1
- package/build/utils/assert-is-defined.js +0 -1
- package/build/utils/assert-is-defined.js.map +1 -1
- package/build-module/data-transfer.js +0 -1
- package/build-module/data-transfer.js.map +1 -1
- package/build-module/dom/caret-range-from-point.js +3 -4
- package/build-module/dom/caret-range-from-point.js.map +1 -1
- package/build-module/dom/clean-node-list.js +24 -35
- package/build-module/dom/clean-node-list.js.map +1 -1
- package/build-module/dom/compute-caret-rect.js +1 -3
- package/build-module/dom/compute-caret-rect.js.map +1 -1
- package/build-module/dom/document-has-selection.js +1 -1
- package/build-module/dom/document-has-selection.js.map +1 -1
- package/build-module/dom/document-has-text-selection.js +1 -1
- package/build-module/dom/document-has-text-selection.js.map +1 -1
- package/build-module/dom/document-has-uncollapsed-selection.js +1 -1
- package/build-module/dom/document-has-uncollapsed-selection.js.map +1 -1
- package/build-module/dom/get-computed-style.js +1 -2
- package/build-module/dom/get-computed-style.js.map +1 -1
- package/build-module/dom/get-offset-parent.js +9 -17
- package/build-module/dom/get-offset-parent.js.map +1 -1
- package/build-module/dom/get-range-height.js +0 -2
- package/build-module/dom/get-range-height.js.map +1 -1
- package/build-module/dom/get-rectangle-from-range.js +16 -21
- package/build-module/dom/get-rectangle-from-range.js.map +1 -1
- package/build-module/dom/get-scroll-container.js +4 -11
- package/build-module/dom/get-scroll-container.js.map +1 -1
- package/build-module/dom/hidden-caret-range-from-point.js +3 -3
- package/build-module/dom/hidden-caret-range-from-point.js.map +1 -1
- package/build-module/dom/index.js.map +1 -1
- package/build-module/dom/input-field-has-uncollapsed-selection.js +9 -9
- package/build-module/dom/input-field-has-uncollapsed-selection.js.map +1 -1
- package/build-module/dom/insert-after.js +1 -1
- package/build-module/dom/insert-after.js.map +1 -1
- package/build-module/dom/is-edge.js +19 -32
- package/build-module/dom/is-edge.js.map +1 -1
- package/build-module/dom/is-element.js +0 -1
- package/build-module/dom/is-element.js.map +1 -1
- package/build-module/dom/is-empty.js +1 -6
- package/build-module/dom/is-empty.js.map +1 -1
- package/build-module/dom/is-entirely-selected.js +3 -14
- package/build-module/dom/is-entirely-selected.js.map +1 -1
- package/build-module/dom/is-form-element.js +1 -2
- package/build-module/dom/is-form-element.js.map +1 -1
- package/build-module/dom/is-horizontal-edge.js +3 -3
- package/build-module/dom/is-horizontal-edge.js.map +1 -1
- package/build-module/dom/is-html-input-element.js +0 -1
- package/build-module/dom/is-html-input-element.js.map +1 -1
- package/build-module/dom/is-input-or-text-area.js +0 -1
- package/build-module/dom/is-input-or-text-area.js.map +1 -1
- package/build-module/dom/is-number-input.js +2 -4
- package/build-module/dom/is-number-input.js.map +1 -1
- package/build-module/dom/is-rtl.js +1 -1
- package/build-module/dom/is-rtl.js.map +1 -1
- package/build-module/dom/is-selection-forward.js +7 -9
- package/build-module/dom/is-selection-forward.js.map +1 -1
- package/build-module/dom/is-text-field.js +2 -5
- package/build-module/dom/is-text-field.js.map +1 -1
- package/build-module/dom/is-vertical-edge.js +3 -3
- package/build-module/dom/is-vertical-edge.js.map +1 -1
- package/build-module/dom/place-caret-at-edge.js +9 -26
- package/build-module/dom/place-caret-at-edge.js.map +1 -1
- package/build-module/dom/place-caret-at-horizontal-edge.js +1 -1
- package/build-module/dom/place-caret-at-horizontal-edge.js.map +1 -1
- package/build-module/dom/place-caret-at-vertical-edge.js +1 -1
- package/build-module/dom/place-caret-at-vertical-edge.js.map +1 -1
- package/build-module/dom/remove-invalid-html.js +1 -1
- package/build-module/dom/remove-invalid-html.js.map +1 -1
- package/build-module/dom/remove.js +1 -1
- package/build-module/dom/remove.js.map +1 -1
- package/build-module/dom/replace-tag.js +1 -3
- package/build-module/dom/replace-tag.js.map +1 -1
- package/build-module/dom/replace.js +1 -1
- package/build-module/dom/replace.js.map +1 -1
- package/build-module/dom/safe-html.js +1 -6
- package/build-module/dom/safe-html.js.map +1 -1
- package/build-module/dom/scroll-if-no-range.js +25 -0
- package/build-module/dom/scroll-if-no-range.js.map +1 -0
- package/build-module/dom/strip-html.js +1 -1
- package/build-module/dom/strip-html.js.map +1 -1
- package/build-module/dom/unwrap.js +1 -3
- package/build-module/dom/unwrap.js.map +1 -1
- package/build-module/dom/wrap.js +1 -1
- package/build-module/dom/wrap.js.map +1 -1
- package/build-module/focusable.js +5 -17
- package/build-module/focusable.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/phrasing-content.js +13 -11
- package/build-module/phrasing-content.js.map +1 -1
- package/build-module/tabbable.js +22 -33
- package/build-module/tabbable.js.map +1 -1
- package/build-module/utils/assert-is-defined.js.map +1 -1
- package/build-types/dom/is-edge.d.ts +4 -4
- package/build-types/dom/is-edge.d.ts.map +1 -1
- package/build-types/dom/is-horizontal-edge.d.ts +3 -3
- package/build-types/dom/is-horizontal-edge.d.ts.map +1 -1
- package/build-types/dom/is-vertical-edge.d.ts +3 -3
- package/build-types/dom/is-vertical-edge.d.ts.map +1 -1
- package/build-types/dom/place-caret-at-edge.d.ts.map +1 -1
- package/build-types/dom/scroll-if-no-range.d.ts +12 -0
- package/build-types/dom/scroll-if-no-range.d.ts.map +1 -0
- package/build-types/index.d.ts +2 -2
- package/build-types/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/dom/is-edge.js +6 -8
- package/src/dom/is-horizontal-edge.js +2 -2
- package/src/dom/is-vertical-edge.js +2 -2
- package/src/dom/place-caret-at-edge.js +5 -19
- package/src/dom/scroll-if-no-range.js +34 -0
- package/tsconfig.tsbuildinfo +1 -1
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = getRectangleFromRange;
|
7
|
-
|
8
7
|
var _assertIsDefined = require("../utils/assert-is-defined");
|
9
|
-
|
10
8
|
/**
|
11
9
|
* Internal dependencies
|
12
10
|
*/
|
@@ -24,32 +22,31 @@ function getRectangleFromRange(range) {
|
|
24
22
|
// range; this a rectangle enclosing the union of the bounding rectangles
|
25
23
|
// for all the elements in the range.
|
26
24
|
if (!range.collapsed) {
|
27
|
-
const rects = Array.from(range.getClientRects());
|
25
|
+
const rects = Array.from(range.getClientRects());
|
28
26
|
|
27
|
+
// If there's just a single rect, return it.
|
29
28
|
if (rects.length === 1) {
|
30
29
|
return rects[0];
|
31
|
-
}
|
32
|
-
|
30
|
+
}
|
33
31
|
|
32
|
+
// Ignore tiny selection at the edge of a range.
|
34
33
|
const filteredRects = rects.filter(({
|
35
34
|
width
|
36
|
-
}) => width > 1);
|
35
|
+
}) => width > 1);
|
37
36
|
|
37
|
+
// If it's full of tiny selections, return browser default.
|
38
38
|
if (filteredRects.length === 0) {
|
39
39
|
return range.getBoundingClientRect();
|
40
40
|
}
|
41
|
-
|
42
41
|
if (filteredRects.length === 1) {
|
43
42
|
return filteredRects[0];
|
44
43
|
}
|
45
|
-
|
46
44
|
let {
|
47
45
|
top: furthestTop,
|
48
46
|
bottom: furthestBottom,
|
49
47
|
left: furthestLeft,
|
50
48
|
right: furthestRight
|
51
49
|
} = filteredRects[0];
|
52
|
-
|
53
50
|
for (const {
|
54
51
|
top,
|
55
52
|
bottom,
|
@@ -61,55 +58,51 @@ function getRectangleFromRange(range) {
|
|
61
58
|
if (left < furthestLeft) furthestLeft = left;
|
62
59
|
if (right > furthestRight) furthestRight = right;
|
63
60
|
}
|
64
|
-
|
65
61
|
return new window.DOMRect(furthestLeft, furthestTop, furthestRight - furthestLeft, furthestBottom - furthestTop);
|
66
62
|
}
|
67
|
-
|
68
63
|
const {
|
69
64
|
startContainer
|
70
65
|
} = range;
|
71
66
|
const {
|
72
67
|
ownerDocument
|
73
|
-
} = startContainer;
|
68
|
+
} = startContainer;
|
74
69
|
|
70
|
+
// Correct invalid "BR" ranges. The cannot contain any children.
|
75
71
|
if (startContainer.nodeName === 'BR') {
|
76
72
|
const {
|
77
73
|
parentNode
|
78
74
|
} = startContainer;
|
79
75
|
(0, _assertIsDefined.assertIsDefined)(parentNode, 'parentNode');
|
80
|
-
const index =
|
81
|
-
/** @type {Node[]} */
|
82
|
-
Array.from(parentNode.childNodes).indexOf(startContainer);
|
76
|
+
const index = /** @type {Node[]} */Array.from(parentNode.childNodes).indexOf(startContainer);
|
83
77
|
(0, _assertIsDefined.assertIsDefined)(ownerDocument, 'ownerDocument');
|
84
78
|
range = ownerDocument.createRange();
|
85
79
|
range.setStart(parentNode, index);
|
86
80
|
range.setEnd(parentNode, index);
|
87
81
|
}
|
82
|
+
const rects = range.getClientRects();
|
88
83
|
|
89
|
-
|
84
|
+
// If we have multiple rectangles for a collapsed range, there's no way to
|
90
85
|
// know which it is, so don't return anything.
|
91
|
-
|
92
86
|
if (rects.length > 1) {
|
93
87
|
return null;
|
94
88
|
}
|
89
|
+
let rect = rects[0];
|
95
90
|
|
96
|
-
|
91
|
+
// If the collapsed range starts (and therefore ends) at an element node,
|
97
92
|
// `getClientRects` can be empty in some browsers. This can be resolved
|
98
93
|
// by adding a temporary text node with zero-width space to the range.
|
99
94
|
//
|
100
95
|
// See: https://stackoverflow.com/a/6847328/995445
|
101
|
-
|
102
96
|
if (!rect || rect.height === 0) {
|
103
97
|
(0, _assertIsDefined.assertIsDefined)(ownerDocument, 'ownerDocument');
|
104
|
-
const padNode = ownerDocument.createTextNode('\u200b');
|
105
|
-
|
98
|
+
const padNode = ownerDocument.createTextNode('\u200b');
|
99
|
+
// Do not modify the live range.
|
106
100
|
range = range.cloneRange();
|
107
101
|
range.insertNode(padNode);
|
108
102
|
rect = range.getClientRects()[0];
|
109
103
|
(0, _assertIsDefined.assertIsDefined)(padNode.parentNode, 'padNode.parentNode');
|
110
104
|
padNode.parentNode.removeChild(padNode);
|
111
105
|
}
|
112
|
-
|
113
106
|
return rect;
|
114
107
|
}
|
115
108
|
//# sourceMappingURL=get-rectangle-from-range.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["_assertIsDefined","require","getRectangleFromRange","range","collapsed","rects","Array","from","getClientRects","length","filteredRects","filter","width","getBoundingClientRect","top","furthestTop","bottom","furthestBottom","left","furthestLeft","right","furthestRight","window","DOMRect","startContainer","ownerDocument","nodeName","parentNode","assertIsDefined","index","childNodes","indexOf","createRange","setStart","setEnd","rect","height","padNode","createTextNode","cloneRange","insertNode","removeChild"],"sources":["@wordpress/dom/src/dom/get-rectangle-from-range.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle of a given Range. Returns `null` if no suitable rectangle\n * can be found.\n *\n * @param {Range} range The range.\n *\n * @return {DOMRect?} The rectangle.\n */\nexport default function getRectangleFromRange( range ) {\n\t// For uncollapsed ranges, get the rectangle that bounds the contents of the\n\t// range; this a rectangle enclosing the union of the bounding rectangles\n\t// for all the elements in the range.\n\tif ( ! range.collapsed ) {\n\t\tconst rects = Array.from( range.getClientRects() );\n\n\t\t// If there's just a single rect, return it.\n\t\tif ( rects.length === 1 ) {\n\t\t\treturn rects[ 0 ];\n\t\t}\n\n\t\t// Ignore tiny selection at the edge of a range.\n\t\tconst filteredRects = rects.filter( ( { width } ) => width > 1 );\n\n\t\t// If it's full of tiny selections, return browser default.\n\t\tif ( filteredRects.length === 0 ) {\n\t\t\treturn range.getBoundingClientRect();\n\t\t}\n\n\t\tif ( filteredRects.length === 1 ) {\n\t\t\treturn filteredRects[ 0 ];\n\t\t}\n\n\t\tlet {\n\t\t\ttop: furthestTop,\n\t\t\tbottom: furthestBottom,\n\t\t\tleft: furthestLeft,\n\t\t\tright: furthestRight,\n\t\t} = filteredRects[ 0 ];\n\n\t\tfor ( const { top, bottom, left, right } of filteredRects ) {\n\t\t\tif ( top < furthestTop ) furthestTop = top;\n\t\t\tif ( bottom > furthestBottom ) furthestBottom = bottom;\n\t\t\tif ( left < furthestLeft ) furthestLeft = left;\n\t\t\tif ( right > furthestRight ) furthestRight = right;\n\t\t}\n\n\t\treturn new window.DOMRect(\n\t\t\tfurthestLeft,\n\t\t\tfurthestTop,\n\t\t\tfurthestRight - furthestLeft,\n\t\t\tfurthestBottom - furthestTop\n\t\t);\n\t}\n\n\tconst { startContainer } = range;\n\tconst { ownerDocument } = startContainer;\n\n\t// Correct invalid \"BR\" ranges. The cannot contain any children.\n\tif ( startContainer.nodeName === 'BR' ) {\n\t\tconst { parentNode } = startContainer;\n\t\tassertIsDefined( parentNode, 'parentNode' );\n\t\tconst index = /** @type {Node[]} */ (\n\t\t\tArray.from( parentNode.childNodes )\n\t\t).indexOf( startContainer );\n\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\trange = ownerDocument.createRange();\n\t\trange.setStart( parentNode, index );\n\t\trange.setEnd( parentNode, index );\n\t}\n\n\tconst rects = range.getClientRects();\n\n\t// If we have multiple rectangles for a collapsed range, there's no way to\n\t// know which it is, so don't return anything.\n\tif ( rects.length > 1 ) {\n\t\treturn null;\n\t}\n\n\tlet rect = rects[ 0 ];\n\n\t// If the collapsed range starts (and therefore ends) at an element node,\n\t// `getClientRects` can be empty in some browsers. This can be resolved\n\t// by adding a temporary text node with zero-width space to the range.\n\t//\n\t// See: https://stackoverflow.com/a/6847328/995445\n\tif ( ! rect || rect.height === 0 ) {\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\tconst padNode = ownerDocument.createTextNode( '\\u200b' );\n\t\t// Do not modify the live range.\n\t\trange = range.cloneRange();\n\t\trange.insertNode( padNode );\n\t\trect = range.getClientRects()[ 0 ];\n\t\tassertIsDefined( padNode.parentNode, 'padNode.parentNode' );\n\t\tpadNode.parentNode.removeChild( padNode );\n\t}\n\n\treturn rect;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,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C3DU,OAAO,CAACV,UAAU,CAACc,WAAW,CAAEJ,OAAQ,CAAC;EAC1C;EAEA,OAAOF,IAAI;AACZ"}
|
@@ -1,14 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
8
7
|
exports.default = getScrollContainer;
|
9
|
-
|
10
8
|
var _getComputedStyle = _interopRequireDefault(require("./get-computed-style"));
|
11
|
-
|
12
9
|
/**
|
13
10
|
* Internal dependencies
|
14
11
|
*/
|
@@ -26,7 +23,6 @@ function getScrollContainer(node, direction = 'vertical') {
|
|
26
23
|
if (!node) {
|
27
24
|
return undefined;
|
28
25
|
}
|
29
|
-
|
30
26
|
if (direction === 'vertical' || direction === 'all') {
|
31
27
|
// Scrollable if scrollable height exceeds displayed...
|
32
28
|
if (node.scrollHeight > node.clientHeight) {
|
@@ -34,13 +30,11 @@ function getScrollContainer(node, direction = 'vertical') {
|
|
34
30
|
const {
|
35
31
|
overflowY
|
36
32
|
} = (0, _getComputedStyle.default)(node);
|
37
|
-
|
38
33
|
if (/(auto|scroll)/.test(overflowY)) {
|
39
34
|
return node;
|
40
35
|
}
|
41
36
|
}
|
42
37
|
}
|
43
|
-
|
44
38
|
if (direction === 'horizontal' || direction === 'all') {
|
45
39
|
// Scrollable if scrollable width exceeds displayed...
|
46
40
|
if (node.scrollWidth > node.clientWidth) {
|
@@ -48,20 +42,16 @@ function getScrollContainer(node, direction = 'vertical') {
|
|
48
42
|
const {
|
49
43
|
overflowX
|
50
44
|
} = (0, _getComputedStyle.default)(node);
|
51
|
-
|
52
45
|
if (/(auto|scroll)/.test(overflowX)) {
|
53
46
|
return node;
|
54
47
|
}
|
55
48
|
}
|
56
49
|
}
|
57
|
-
|
58
50
|
if (node.ownerDocument === node.parentNode) {
|
59
51
|
return node;
|
60
|
-
}
|
61
|
-
|
52
|
+
}
|
62
53
|
|
63
|
-
|
64
|
-
/** @type {Element} */
|
65
|
-
node.parentNode, direction);
|
54
|
+
// Continue traversing.
|
55
|
+
return getScrollContainer( /** @type {Element} */node.parentNode, direction);
|
66
56
|
}
|
67
57
|
//# sourceMappingURL=get-scroll-container.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["_getComputedStyle","_interopRequireDefault","require","getScrollContainer","node","direction","undefined","scrollHeight","clientHeight","overflowY","getComputedStyle","test","scrollWidth","clientWidth","overflowX","ownerDocument","parentNode"],"sources":["@wordpress/dom/src/dom/get-scroll-container.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Given a DOM node, finds the closest scrollable container node or the node\n * itself, if scrollable.\n *\n * @param {Element | null} node Node from which to start.\n * @param {?string} direction Direction of scrollable container to search for ('vertical', 'horizontal', 'all').\n * Defaults to 'vertical'.\n * @return {Element | undefined} Scrollable container node, if found.\n */\nexport default function getScrollContainer( node, direction = 'vertical' ) {\n\tif ( ! node ) {\n\t\treturn undefined;\n\t}\n\n\tif ( direction === 'vertical' || direction === 'all' ) {\n\t\t// Scrollable if scrollable height exceeds displayed...\n\t\tif ( node.scrollHeight > node.clientHeight ) {\n\t\t\t// ...except when overflow is defined to be hidden or visible\n\t\t\tconst { overflowY } = getComputedStyle( node );\n\n\t\t\tif ( /(auto|scroll)/.test( overflowY ) ) {\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( direction === 'horizontal' || direction === 'all' ) {\n\t\t// Scrollable if scrollable width exceeds displayed...\n\t\tif ( node.scrollWidth > node.clientWidth ) {\n\t\t\t// ...except when overflow is defined to be hidden or visible\n\t\t\tconst { overflowX } = getComputedStyle( node );\n\n\t\t\tif ( /(auto|scroll)/.test( overflowX ) ) {\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( node.ownerDocument === node.parentNode ) {\n\t\treturn node;\n\t}\n\n\t// Continue traversing.\n\treturn getScrollContainer(\n\t\t/** @type {Element} */ ( node.parentNode ),\n\t\tdirection\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,kBAAkBA,CAAEC,IAAI,EAAEC,SAAS,GAAG,UAAU,EAAG;EAC1E,IAAK,CAAED,IAAI,EAAG;IACb,OAAOE,SAAS;EACjB;EAEA,IAAKD,SAAS,KAAK,UAAU,IAAIA,SAAS,KAAK,KAAK,EAAG;IACtD;IACA,IAAKD,IAAI,CAACG,YAAY,GAAGH,IAAI,CAACI,YAAY,EAAG;MAC5C;MACA,MAAM;QAAEC;MAAU,CAAC,GAAG,IAAAC,yBAAgB,EAAEN,IAAK,CAAC;MAE9C,IAAK,eAAe,CAACO,IAAI,CAAEF,SAAU,CAAC,EAAG;QACxC,OAAOL,IAAI;MACZ;IACD;EACD;EAEA,IAAKC,SAAS,KAAK,YAAY,IAAIA,SAAS,KAAK,KAAK,EAAG;IACxD;IACA,IAAKD,IAAI,CAACQ,WAAW,GAAGR,IAAI,CAACS,WAAW,EAAG;MAC1C;MACA,MAAM;QAAEC;MAAU,CAAC,GAAG,IAAAJ,yBAAgB,EAAEN,IAAK,CAAC;MAE9C,IAAK,eAAe,CAACO,IAAI,CAAEG,SAAU,CAAC,EAAG;QACxC,OAAOV,IAAI;MACZ;IACD;EACD;EAEA,IAAKA,IAAI,CAACW,aAAa,KAAKX,IAAI,CAACY,UAAU,EAAG;IAC7C,OAAOZ,IAAI;EACZ;;EAEA;EACA,OAAOD,kBAAkB,EACxB,sBAAyBC,IAAI,CAACY,UAAU,EACxCX,SACD,CAAC;AACF"}
|
@@ -1,16 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
8
7
|
exports.default = hiddenCaretRangeFromPoint;
|
9
|
-
|
10
8
|
var _caretRangeFromPoint = _interopRequireDefault(require("./caret-range-from-point"));
|
11
|
-
|
12
9
|
var _getComputedStyle = _interopRequireDefault(require("./get-computed-style"));
|
13
|
-
|
14
10
|
/**
|
15
11
|
* Internal dependencies
|
16
12
|
*/
|
@@ -32,12 +28,12 @@ function hiddenCaretRangeFromPoint(doc, x, y, container) {
|
|
32
28
|
const originalPosition = container.style.position;
|
33
29
|
const {
|
34
30
|
position = 'static'
|
35
|
-
} = (0, _getComputedStyle.default)(container);
|
31
|
+
} = (0, _getComputedStyle.default)(container);
|
36
32
|
|
33
|
+
// A z-index only works if the element position is not static.
|
37
34
|
if (position === 'static') {
|
38
35
|
container.style.position = 'relative';
|
39
36
|
}
|
40
|
-
|
41
37
|
container.style.zIndex = '10000';
|
42
38
|
const range = (0, _caretRangeFromPoint.default)(doc, x, y);
|
43
39
|
container.style.zIndex = originalZIndex;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["_caretRangeFromPoint","_interopRequireDefault","require","_getComputedStyle","hiddenCaretRangeFromPoint","doc","x","y","container","originalZIndex","style","zIndex","originalPosition","position","getComputedStyle","range","caretRangeFromPoint"],"sources":["@wordpress/dom/src/dom/hidden-caret-range-from-point.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport caretRangeFromPoint from './caret-range-from-point';\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Get a collapsed range for a given point.\n * Gives the container a temporary high z-index (above any UI).\n * This is preferred over getting the UI nodes and set styles there.\n *\n * @param {Document} doc The document of the range.\n * @param {number} x Horizontal position within the current viewport.\n * @param {number} y Vertical position within the current viewport.\n * @param {HTMLElement} container Container in which the range is expected to be found.\n *\n * @return {?Range} The best range for the given point.\n */\nexport default function hiddenCaretRangeFromPoint( doc, x, y, container ) {\n\tconst originalZIndex = container.style.zIndex;\n\tconst originalPosition = container.style.position;\n\n\tconst { position = 'static' } = getComputedStyle( container );\n\n\t// A z-index only works if the element position is not static.\n\tif ( position === 'static' ) {\n\t\tcontainer.style.position = 'relative';\n\t}\n\n\tcontainer.style.zIndex = '10000';\n\n\tconst range = caretRangeFromPoint( doc, x, y );\n\n\tcontainer.style.zIndex = originalZIndex;\n\tcontainer.style.position = originalPosition;\n\n\treturn range;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,oBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,yBAAyBA,CAAEC,GAAG,EAAEC,CAAC,EAAEC,CAAC,EAAEC,SAAS,EAAG;EACzE,MAAMC,cAAc,GAAGD,SAAS,CAACE,KAAK,CAACC,MAAM;EAC7C,MAAMC,gBAAgB,GAAGJ,SAAS,CAACE,KAAK,CAACG,QAAQ;EAEjD,MAAM;IAAEA,QAAQ,GAAG;EAAS,CAAC,GAAG,IAAAC,yBAAgB,EAAEN,SAAU,CAAC;;EAE7D;EACA,IAAKK,QAAQ,KAAK,QAAQ,EAAG;IAC5BL,SAAS,CAACE,KAAK,CAACG,QAAQ,GAAG,UAAU;EACtC;EAEAL,SAAS,CAACE,KAAK,CAACC,MAAM,GAAG,OAAO;EAEhC,MAAMI,KAAK,GAAG,IAAAC,4BAAmB,EAAEX,GAAG,EAAEC,CAAC,EAAEC,CAAE,CAAC;EAE9CC,SAAS,CAACE,KAAK,CAACC,MAAM,GAAGF,cAAc;EACvCD,SAAS,CAACE,KAAK,CAACG,QAAQ,GAAGD,gBAAgB;EAE3C,OAAOG,KAAK;AACb"}
|
package/build/dom/index.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
@@ -161,56 +160,30 @@ Object.defineProperty(exports, "wrap", {
|
|
161
160
|
return _wrap.default;
|
162
161
|
}
|
163
162
|
});
|
164
|
-
|
165
163
|
var _computeCaretRect = _interopRequireDefault(require("./compute-caret-rect"));
|
166
|
-
|
167
164
|
var _documentHasTextSelection = _interopRequireDefault(require("./document-has-text-selection"));
|
168
|
-
|
169
165
|
var _documentHasUncollapsedSelection = _interopRequireDefault(require("./document-has-uncollapsed-selection"));
|
170
|
-
|
171
166
|
var _documentHasSelection = _interopRequireDefault(require("./document-has-selection"));
|
172
|
-
|
173
167
|
var _getRectangleFromRange = _interopRequireDefault(require("./get-rectangle-from-range"));
|
174
|
-
|
175
168
|
var _getScrollContainer = _interopRequireDefault(require("./get-scroll-container"));
|
176
|
-
|
177
169
|
var _getOffsetParent = _interopRequireDefault(require("./get-offset-parent"));
|
178
|
-
|
179
170
|
var _isEntirelySelected = _interopRequireDefault(require("./is-entirely-selected"));
|
180
|
-
|
181
171
|
var _isFormElement = _interopRequireDefault(require("./is-form-element"));
|
182
|
-
|
183
172
|
var _isHorizontalEdge = _interopRequireDefault(require("./is-horizontal-edge"));
|
184
|
-
|
185
173
|
var _isNumberInput = _interopRequireDefault(require("./is-number-input"));
|
186
|
-
|
187
174
|
var _isTextField = _interopRequireDefault(require("./is-text-field"));
|
188
|
-
|
189
175
|
var _isVerticalEdge = _interopRequireDefault(require("./is-vertical-edge"));
|
190
|
-
|
191
176
|
var _placeCaretAtHorizontalEdge = _interopRequireDefault(require("./place-caret-at-horizontal-edge"));
|
192
|
-
|
193
177
|
var _placeCaretAtVerticalEdge = _interopRequireDefault(require("./place-caret-at-vertical-edge"));
|
194
|
-
|
195
178
|
var _replace = _interopRequireDefault(require("./replace"));
|
196
|
-
|
197
179
|
var _remove = _interopRequireDefault(require("./remove"));
|
198
|
-
|
199
180
|
var _insertAfter = _interopRequireDefault(require("./insert-after"));
|
200
|
-
|
201
181
|
var _unwrap = _interopRequireDefault(require("./unwrap"));
|
202
|
-
|
203
182
|
var _replaceTag = _interopRequireDefault(require("./replace-tag"));
|
204
|
-
|
205
183
|
var _wrap = _interopRequireDefault(require("./wrap"));
|
206
|
-
|
207
184
|
var _stripHtml = _interopRequireDefault(require("./strip-html"));
|
208
|
-
|
209
185
|
var _isEmpty = _interopRequireDefault(require("./is-empty"));
|
210
|
-
|
211
186
|
var _removeInvalidHtml = _interopRequireDefault(require("./remove-invalid-html"));
|
212
|
-
|
213
187
|
var _isRtl = _interopRequireDefault(require("./is-rtl"));
|
214
|
-
|
215
188
|
var _safeHtml = _interopRequireDefault(require("./safe-html"));
|
216
189
|
//# sourceMappingURL=index.js.map
|
package/build/dom/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["@wordpress/dom/src/dom/index.js"],"
|
1
|
+
{"version":3,"names":["_computeCaretRect","_interopRequireDefault","require","_documentHasTextSelection","_documentHasUncollapsedSelection","_documentHasSelection","_getRectangleFromRange","_getScrollContainer","_getOffsetParent","_isEntirelySelected","_isFormElement","_isHorizontalEdge","_isNumberInput","_isTextField","_isVerticalEdge","_placeCaretAtHorizontalEdge","_placeCaretAtVerticalEdge","_replace","_remove","_insertAfter","_unwrap","_replaceTag","_wrap","_stripHtml","_isEmpty","_removeInvalidHtml","_isRtl","_safeHtml"],"sources":["@wordpress/dom/src/dom/index.js"],"sourcesContent":["export { default as computeCaretRect } from './compute-caret-rect';\nexport { default as documentHasTextSelection } from './document-has-text-selection';\nexport { default as documentHasUncollapsedSelection } from './document-has-uncollapsed-selection';\nexport { default as documentHasSelection } from './document-has-selection';\nexport { default as getRectangleFromRange } from './get-rectangle-from-range';\nexport { default as getScrollContainer } from './get-scroll-container';\nexport { default as getOffsetParent } from './get-offset-parent';\nexport { default as isEntirelySelected } from './is-entirely-selected';\nexport { default as isFormElement } from './is-form-element';\nexport { default as isHorizontalEdge } from './is-horizontal-edge';\nexport { default as isNumberInput } from './is-number-input';\nexport { default as isTextField } from './is-text-field';\nexport { default as isVerticalEdge } from './is-vertical-edge';\nexport { default as placeCaretAtHorizontalEdge } from './place-caret-at-horizontal-edge';\nexport { default as placeCaretAtVerticalEdge } from './place-caret-at-vertical-edge';\nexport { default as replace } from './replace';\nexport { default as remove } from './remove';\nexport { default as insertAfter } from './insert-after';\nexport { default as unwrap } from './unwrap';\nexport { default as replaceTag } from './replace-tag';\nexport { default as wrap } from './wrap';\nexport { default as __unstableStripHTML } from './strip-html';\nexport { default as isEmpty } from './is-empty';\nexport { default as removeInvalidHTML } from './remove-invalid-html';\nexport { default as isRTL } from './is-rtl';\nexport { default as safeHTML } from './safe-html';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gCAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,qBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,sBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,mBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,gBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,mBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,cAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,iBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,cAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,YAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,eAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,2BAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,yBAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,QAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,OAAA,GAAAjB,sBAAA,CAAAC,OAAA;AACA,IAAAiB,YAAA,GAAAlB,sBAAA,CAAAC,OAAA;AACA,IAAAkB,OAAA,GAAAnB,sBAAA,CAAAC,OAAA;AACA,IAAAmB,WAAA,GAAApB,sBAAA,CAAAC,OAAA;AACA,IAAAoB,KAAA,GAAArB,sBAAA,CAAAC,OAAA;AACA,IAAAqB,UAAA,GAAAtB,sBAAA,CAAAC,OAAA;AACA,IAAAsB,QAAA,GAAAvB,sBAAA,CAAAC,OAAA;AACA,IAAAuB,kBAAA,GAAAxB,sBAAA,CAAAC,OAAA;AACA,IAAAwB,MAAA,GAAAzB,sBAAA,CAAAC,OAAA;AACA,IAAAyB,SAAA,GAAA1B,sBAAA,CAAAC,OAAA"}
|
@@ -1,16 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
8
7
|
exports.default = inputFieldHasUncollapsedSelection;
|
9
|
-
|
10
8
|
var _isTextField = _interopRequireDefault(require("./is-text-field"));
|
11
|
-
|
12
9
|
var _isHtmlInputElement = _interopRequireDefault(require("./is-html-input-element"));
|
13
|
-
|
14
10
|
/**
|
15
11
|
* Internal dependencies
|
16
12
|
*/
|
@@ -35,22 +31,22 @@ var _isHtmlInputElement = _interopRequireDefault(require("./is-html-input-elemen
|
|
35
31
|
function inputFieldHasUncollapsedSelection(element) {
|
36
32
|
if (!(0, _isHtmlInputElement.default)(element) && !(0, _isTextField.default)(element)) {
|
37
33
|
return false;
|
38
|
-
}
|
34
|
+
}
|
35
|
+
|
36
|
+
// Safari throws a type error when trying to get `selectionStart` and
|
39
37
|
// `selectionEnd` on non-text <input> elements, so a try/catch construct is
|
40
38
|
// necessary.
|
41
|
-
|
42
|
-
|
43
39
|
try {
|
44
40
|
const {
|
45
41
|
selectionStart,
|
46
42
|
selectionEnd
|
47
|
-
} =
|
48
|
-
|
49
|
-
|
50
|
-
return (// `null` means the input type doesn't implement selection, thus we
|
43
|
+
} = /** @type {HTMLInputElement | HTMLTextAreaElement} */element;
|
44
|
+
return (
|
45
|
+
// `null` means the input type doesn't implement selection, thus we
|
51
46
|
// cannot determine whether the selection is collapsed, so we
|
52
47
|
// default to true.
|
53
|
-
selectionStart === null ||
|
48
|
+
selectionStart === null ||
|
49
|
+
// when not null, compare the two points
|
54
50
|
selectionStart !== selectionEnd
|
55
51
|
);
|
56
52
|
} catch (error) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["_isTextField","_interopRequireDefault","require","_isHtmlInputElement","inputFieldHasUncollapsedSelection","element","isHTMLInputElement","isTextField","selectionStart","selectionEnd","error"],"sources":["@wordpress/dom/src/dom/input-field-has-uncollapsed-selection.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isTextField from './is-text-field';\nimport isHTMLInputElement from './is-html-input-element';\n\n/**\n * Check whether the given input field or textarea contains a (uncollapsed)\n * selection of text.\n *\n * CAVEAT: Only specific text-based HTML inputs support the selection APIs\n * needed to determine whether they have a collapsed or uncollapsed selection.\n * This function defaults to returning `true` when the selection cannot be\n * inspected, such as with `<input type=\"time\">`. The rationale is that this\n * should cause the block editor to defer to the browser's native selection\n * handling (e.g. copying and pasting), thereby reducing friction for the user.\n *\n * See: https://html.spec.whatwg.org/multipage/input.html#do-not-apply\n *\n * @param {Element} element The HTML element.\n *\n * @return {boolean} Whether the input/textareaa element has some \"selection\".\n */\nexport default function inputFieldHasUncollapsedSelection( element ) {\n\tif ( ! isHTMLInputElement( element ) && ! isTextField( element ) ) {\n\t\treturn false;\n\t}\n\n\t// Safari throws a type error when trying to get `selectionStart` and\n\t// `selectionEnd` on non-text <input> elements, so a try/catch construct is\n\t// necessary.\n\ttry {\n\t\tconst { selectionStart, selectionEnd } =\n\t\t\t/** @type {HTMLInputElement | HTMLTextAreaElement} */ ( element );\n\t\treturn (\n\t\t\t// `null` means the input type doesn't implement selection, thus we\n\t\t\t// cannot determine whether the selection is collapsed, so we\n\t\t\t// default to true.\n\t\t\tselectionStart === null ||\n\t\t\t// when not null, compare the two points\n\t\t\tselectionStart !== selectionEnd\n\t\t);\n\t} catch ( error ) {\n\t\t// This is Safari's way of saying that the input type doesn't implement\n\t\t// selection, so we default to true.\n\t\treturn true;\n\t}\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,iCAAiCA,CAAEC,OAAO,EAAG;EACpE,IAAK,CAAE,IAAAC,2BAAkB,EAAED,OAAQ,CAAC,IAAI,CAAE,IAAAE,oBAAW,EAAEF,OAAQ,CAAC,EAAG;IAClE,OAAO,KAAK;EACb;;EAEA;EACA;EACA;EACA,IAAI;IACH,MAAM;MAAEG,cAAc;MAAEC;IAAa,CAAC,GACrC,qDAAwDJ,OAAS;IAClE;MACC;MACA;MACA;MACAG,cAAc,KAAK,IAAI;MACvB;MACAA,cAAc,KAAKC;IAAY;EAEjC,CAAC,CAAC,OAAQC,KAAK,EAAG;IACjB;IACA;IACA,OAAO,IAAI;EACZ;AACD"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["_assertIsDefined","require","insertAfter","newNode","referenceNode","assertIsDefined","parentNode","insertBefore","nextSibling"],"sources":["@wordpress/dom/src/dom/insert-after.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Given two DOM nodes, inserts the former in the DOM as the next sibling of\n * the latter.\n *\n * @param {Node} newNode Node to be inserted.\n * @param {Node} referenceNode Node after which to perform the insertion.\n * @return {void}\n */\nexport default function insertAfter( newNode, referenceNode ) {\n\tassertIsDefined( referenceNode.parentNode, 'referenceNode.parentNode' );\n\treferenceNode.parentNode.insertBefore( newNode, referenceNode.nextSibling );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,WAAWA,CAAEC,OAAO,EAAEC,aAAa,EAAG;EAC7D,IAAAC,gCAAe,EAAED,aAAa,CAACE,UAAU,EAAE,0BAA2B,CAAC;EACvEF,aAAa,CAACE,UAAU,CAACC,YAAY,CAAEJ,OAAO,EAAEC,aAAa,CAACI,WAAY,CAAC;AAC5E"}
|
package/build/dom/is-edge.js
CHANGED
@@ -1,26 +1,18 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
8
7
|
exports.default = isEdge;
|
9
|
-
|
10
8
|
var _isRtl = _interopRequireDefault(require("./is-rtl"));
|
11
|
-
|
12
9
|
var _getRangeHeight = _interopRequireDefault(require("./get-range-height"));
|
13
|
-
|
14
10
|
var _getRectangleFromRange = _interopRequireDefault(require("./get-rectangle-from-range"));
|
15
|
-
|
16
11
|
var _isSelectionForward = _interopRequireDefault(require("./is-selection-forward"));
|
17
|
-
|
18
12
|
var _hiddenCaretRangeFromPoint = _interopRequireDefault(require("./hidden-caret-range-from-point"));
|
19
|
-
|
20
13
|
var _assertIsDefined = require("../utils/assert-is-defined");
|
21
|
-
|
22
14
|
var _isInputOrTextArea = _interopRequireDefault(require("./is-input-or-text-area"));
|
23
|
-
|
15
|
+
var _scrollIfNoRange = require("./scroll-if-no-range");
|
24
16
|
/**
|
25
17
|
* Internal dependencies
|
26
18
|
*/
|
@@ -30,9 +22,9 @@ var _isInputOrTextArea = _interopRequireDefault(require("./is-input-or-text-area
|
|
30
22
|
* horizontal position by default. Set `onlyVertical` to true to check only
|
31
23
|
* vertically.
|
32
24
|
*
|
33
|
-
* @param {
|
34
|
-
* @param {boolean}
|
35
|
-
* @param {boolean}
|
25
|
+
* @param {HTMLElement} container Focusable element.
|
26
|
+
* @param {boolean} isReverse Set to true to check left, false to check right.
|
27
|
+
* @param {boolean} [onlyVertical=false] Set to true to check only vertical position.
|
36
28
|
*
|
37
29
|
* @return {boolean} True if at the edge, false if not.
|
38
30
|
*/
|
@@ -41,20 +33,14 @@ function isEdge(container, isReverse, onlyVertical = false) {
|
|
41
33
|
if (container.selectionStart !== container.selectionEnd) {
|
42
34
|
return false;
|
43
35
|
}
|
44
|
-
|
45
36
|
if (isReverse) {
|
46
37
|
return container.selectionStart === 0;
|
47
38
|
}
|
48
|
-
|
49
39
|
return container.value.length === container.selectionStart;
|
50
40
|
}
|
51
|
-
|
52
|
-
if (!
|
53
|
-
/** @type {HTMLElement} */
|
54
|
-
container.isContentEditable) {
|
41
|
+
if (! /** @type {HTMLElement} */container.isContentEditable) {
|
55
42
|
return true;
|
56
43
|
}
|
57
|
-
|
58
44
|
const {
|
59
45
|
ownerDocument
|
60
46
|
} = container;
|
@@ -63,39 +49,37 @@ function isEdge(container, isReverse, onlyVertical = false) {
|
|
63
49
|
} = ownerDocument;
|
64
50
|
(0, _assertIsDefined.assertIsDefined)(defaultView, 'defaultView');
|
65
51
|
const selection = defaultView.getSelection();
|
66
|
-
|
67
52
|
if (!selection || !selection.rangeCount) {
|
68
53
|
return false;
|
69
54
|
}
|
70
|
-
|
71
55
|
const range = selection.getRangeAt(0);
|
72
56
|
const collapsedRange = range.cloneRange();
|
73
57
|
const isForward = (0, _isSelectionForward.default)(selection);
|
74
|
-
const isCollapsed = selection.isCollapsed;
|
58
|
+
const isCollapsed = selection.isCollapsed;
|
75
59
|
|
60
|
+
// Collapse in direction of selection.
|
76
61
|
if (!isCollapsed) {
|
77
62
|
collapsedRange.collapse(!isForward);
|
78
63
|
}
|
79
|
-
|
80
64
|
const collapsedRangeRect = (0, _getRectangleFromRange.default)(collapsedRange);
|
81
65
|
const rangeRect = (0, _getRectangleFromRange.default)(range);
|
82
|
-
|
83
66
|
if (!collapsedRangeRect || !rangeRect) {
|
84
67
|
return false;
|
85
|
-
}
|
68
|
+
}
|
69
|
+
|
70
|
+
// Only consider the multiline selection at the edge if the direction is
|
86
71
|
// towards the edge. The selection is multiline if it is taller than the
|
87
72
|
// collapsed selection.
|
88
|
-
|
89
|
-
|
90
73
|
const rangeHeight = (0, _getRangeHeight.default)(range);
|
91
|
-
|
92
74
|
if (!isCollapsed && rangeHeight && rangeHeight > collapsedRangeRect.height && isForward === isReverse) {
|
93
75
|
return false;
|
94
|
-
}
|
95
|
-
|
76
|
+
}
|
96
77
|
|
78
|
+
// In the case of RTL scripts, the horizontal edge is at the opposite side.
|
97
79
|
const isReverseDir = (0, _isRtl.default)(container) ? !isReverse : isReverse;
|
98
|
-
const containerRect = container.getBoundingClientRect();
|
80
|
+
const containerRect = container.getBoundingClientRect();
|
81
|
+
|
82
|
+
// To check if a selection is at the edge, we insert a test selection at the
|
99
83
|
// edge of the container and check if the selections have the same vertical
|
100
84
|
// or horizontal position. If they do, the selection is at the edge.
|
101
85
|
// This method proves to be better than a DOM-based calculation for the
|
@@ -105,28 +89,22 @@ function isEdge(container, isReverse, onlyVertical = false) {
|
|
105
89
|
// It also proves better than using the computed style for the vertical
|
106
90
|
// edge, because we cannot know the padding and line height reliably in
|
107
91
|
// pixels. `getComputedStyle` may return a value with different units.
|
108
|
-
|
109
92
|
const x = isReverseDir ? containerRect.left + 1 : containerRect.right - 1;
|
110
93
|
const y = isReverse ? containerRect.top + 1 : containerRect.bottom - 1;
|
111
|
-
const testRange = (0, _hiddenCaretRangeFromPoint.default)(ownerDocument, x, y,
|
112
|
-
/** @type {HTMLElement} */
|
113
|
-
container);
|
114
|
-
|
94
|
+
const testRange = (0, _scrollIfNoRange.scrollIfNoRange)(container, isReverse, () => (0, _hiddenCaretRangeFromPoint.default)(ownerDocument, x, y, container));
|
115
95
|
if (!testRange) {
|
116
96
|
return false;
|
117
97
|
}
|
118
|
-
|
119
98
|
const testRect = (0, _getRectangleFromRange.default)(testRange);
|
120
|
-
|
121
99
|
if (!testRect) {
|
122
100
|
return false;
|
123
101
|
}
|
124
|
-
|
125
102
|
const verticalSide = isReverse ? 'top' : 'bottom';
|
126
103
|
const horizontalSide = isReverseDir ? 'left' : 'right';
|
127
104
|
const verticalDiff = testRect[verticalSide] - rangeRect[verticalSide];
|
128
|
-
const horizontalDiff = testRect[horizontalSide] - collapsedRangeRect[horizontalSide];
|
105
|
+
const horizontalDiff = testRect[horizontalSide] - collapsedRangeRect[horizontalSide];
|
129
106
|
|
107
|
+
// Allow the position to be 1px off.
|
130
108
|
const hasVerticalDiff = Math.abs(verticalDiff) <= 1;
|
131
109
|
const hasHorizontalDiff = Math.abs(horizontalDiff) <= 1;
|
132
110
|
return onlyVertical ? hasVerticalDiff : hasVerticalDiff && hasHorizontalDiff;
|
package/build/dom/is-edge.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["_isRtl","_interopRequireDefault","require","_getRangeHeight","_getRectangleFromRange","_isSelectionForward","_hiddenCaretRangeFromPoint","_assertIsDefined","_isInputOrTextArea","_scrollIfNoRange","isEdge","container","isReverse","onlyVertical","isInputOrTextArea","selectionStart","selectionEnd","value","length","isContentEditable","ownerDocument","defaultView","assertIsDefined","selection","getSelection","rangeCount","range","getRangeAt","collapsedRange","cloneRange","isForward","isSelectionForward","isCollapsed","collapse","collapsedRangeRect","getRectangleFromRange","rangeRect","rangeHeight","getRangeHeight","height","isReverseDir","isRTL","containerRect","getBoundingClientRect","x","left","right","y","top","bottom","testRange","scrollIfNoRange","hiddenCaretRangeFromPoint","testRect","verticalSide","horizontalSide","verticalDiff","horizontalDiff","hasVerticalDiff","Math","abs","hasHorizontalDiff"],"sources":["@wordpress/dom/src/dom/is-edge.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isRTL from './is-rtl';\nimport getRangeHeight from './get-range-height';\nimport getRectangleFromRange from './get-rectangle-from-range';\nimport isSelectionForward from './is-selection-forward';\nimport hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\nimport { scrollIfNoRange } from './scroll-if-no-range';\n\n/**\n * Check whether the selection is at the edge of the container. Checks for\n * horizontal position by default. Set `onlyVertical` to true to check only\n * vertically.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false to check right.\n * @param {boolean} [onlyVertical=false] Set to true to check only vertical position.\n *\n * @return {boolean} True if at the edge, false if not.\n */\nexport default function isEdge( container, isReverse, onlyVertical = false ) {\n\tif (\n\t\tisInputOrTextArea( container ) &&\n\t\ttypeof container.selectionStart === 'number'\n\t) {\n\t\tif ( container.selectionStart !== container.selectionEnd ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( isReverse ) {\n\t\t\treturn container.selectionStart === 0;\n\t\t}\n\n\t\treturn container.value.length === container.selectionStart;\n\t}\n\n\tif ( ! ( /** @type {HTMLElement} */ ( container ).isContentEditable ) ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = container;\n\tconst { defaultView } = ownerDocument;\n\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\n\tif ( ! selection || ! selection.rangeCount ) {\n\t\treturn false;\n\t}\n\n\tconst range = selection.getRangeAt( 0 );\n\tconst collapsedRange = range.cloneRange();\n\tconst isForward = isSelectionForward( selection );\n\tconst isCollapsed = selection.isCollapsed;\n\n\t// Collapse in direction of selection.\n\tif ( ! isCollapsed ) {\n\t\tcollapsedRange.collapse( ! isForward );\n\t}\n\n\tconst collapsedRangeRect = getRectangleFromRange( collapsedRange );\n\tconst rangeRect = getRectangleFromRange( range );\n\n\tif ( ! collapsedRangeRect || ! rangeRect ) {\n\t\treturn false;\n\t}\n\n\t// Only consider the multiline selection at the edge if the direction is\n\t// towards the edge. The selection is multiline if it is taller than the\n\t// collapsed selection.\n\tconst rangeHeight = getRangeHeight( range );\n\tif (\n\t\t! isCollapsed &&\n\t\trangeHeight &&\n\t\trangeHeight > collapsedRangeRect.height &&\n\t\tisForward === isReverse\n\t) {\n\t\treturn false;\n\t}\n\n\t// In the case of RTL scripts, the horizontal edge is at the opposite side.\n\tconst isReverseDir = isRTL( container ) ? ! isReverse : isReverse;\n\tconst containerRect = container.getBoundingClientRect();\n\n\t// To check if a selection is at the edge, we insert a test selection at the\n\t// edge of the container and check if the selections have the same vertical\n\t// or horizontal position. If they do, the selection is at the edge.\n\t// This method proves to be better than a DOM-based calculation for the\n\t// horizontal edge, since it ignores empty textnodes and a trailing line\n\t// break element. In other words, we need to check visual positioning, not\n\t// DOM positioning.\n\t// It also proves better than using the computed style for the vertical\n\t// edge, because we cannot know the padding and line height reliably in\n\t// pixels. `getComputedStyle` may return a value with different units.\n\tconst x = isReverseDir ? containerRect.left + 1 : containerRect.right - 1;\n\tconst y = isReverse ? containerRect.top + 1 : containerRect.bottom - 1;\n\tconst testRange = scrollIfNoRange( container, isReverse, () =>\n\t\thiddenCaretRangeFromPoint( ownerDocument, x, y, container )\n\t);\n\n\tif ( ! testRange ) {\n\t\treturn false;\n\t}\n\n\tconst testRect = getRectangleFromRange( testRange );\n\n\tif ( ! testRect ) {\n\t\treturn false;\n\t}\n\n\tconst verticalSide = isReverse ? 'top' : 'bottom';\n\tconst horizontalSide = isReverseDir ? 'left' : 'right';\n\tconst verticalDiff = testRect[ verticalSide ] - rangeRect[ verticalSide ];\n\tconst horizontalDiff =\n\t\ttestRect[ horizontalSide ] - collapsedRangeRect[ horizontalSide ];\n\n\t// Allow the position to be 1px off.\n\tconst hasVerticalDiff = Math.abs( verticalDiff ) <= 1;\n\tconst hasHorizontalDiff = Math.abs( horizontalDiff ) <= 1;\n\n\treturn onlyVertical\n\t\t? hasVerticalDiff\n\t\t: hasVerticalDiff && hasHorizontalDiff;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,sBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,0BAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AAVA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASQ,MAAMA,CAAEC,SAAS,EAAEC,SAAS,EAAEC,YAAY,GAAG,KAAK,EAAG;EAC5E,IACC,IAAAC,0BAAiB,EAAEH,SAAU,CAAC,IAC9B,OAAOA,SAAS,CAACI,cAAc,KAAK,QAAQ,EAC3C;IACD,IAAKJ,SAAS,CAACI,cAAc,KAAKJ,SAAS,CAACK,YAAY,EAAG;MAC1D,OAAO,KAAK;IACb;IAEA,IAAKJ,SAAS,EAAG;MAChB,OAAOD,SAAS,CAACI,cAAc,KAAK,CAAC;IACtC;IAEA,OAAOJ,SAAS,CAACM,KAAK,CAACC,MAAM,KAAKP,SAAS,CAACI,cAAc;EAC3D;EAEA,IAAK,EAAI,0BAA6BJ,SAAS,CAAGQ,iBAAmB,EAAG;IACvE,OAAO,IAAI;EACZ;EAEA,MAAM;IAAE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