@wordpress/dom 4.43.0 → 4.43.1-next.v.202604091042.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/build/dom/input-field-has-uncollapsed-selection.cjs +1 -1
- package/build/dom/input-field-has-uncollapsed-selection.cjs.map +2 -2
- package/build-module/dom/input-field-has-uncollapsed-selection.mjs +1 -1
- package/build-module/dom/input-field-has-uncollapsed-selection.mjs.map +2 -2
- package/package.json +3 -3
- package/src/dom/input-field-has-uncollapsed-selection.js +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/dom/input-field-has-uncollapsed-selection.js"],
|
|
4
|
-
"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/textarea 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
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,2BAAwB;AACxB,mCAA+B;AAmBhB,SAAR,kCAAoD,SAAU;AACpE,MAAK,KAAE,6BAAAA,SAAoB,OAAQ,KAAK,KAAE,qBAAAC,SAAa,OAAQ,GAAI;AAClE,WAAO;AAAA,EACR;AAKA,MAAI;AACH,UAAM,EAAE,gBAAgB,aAAa;AAAA;AAAA,MACoB;AAAA;AACzD;AAAA;AAAA;AAAA;AAAA,MAIC,mBAAmB;AAAA,MAEnB,mBAAmB;AAAA;AAAA,EAErB,
|
|
4
|
+
"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/textarea 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 {\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"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,2BAAwB;AACxB,mCAA+B;AAmBhB,SAAR,kCAAoD,SAAU;AACpE,MAAK,KAAE,6BAAAA,SAAoB,OAAQ,KAAK,KAAE,qBAAAC,SAAa,OAAQ,GAAI;AAClE,WAAO;AAAA,EACR;AAKA,MAAI;AACH,UAAM,EAAE,gBAAgB,aAAa;AAAA;AAAA,MACoB;AAAA;AACzD;AAAA;AAAA;AAAA;AAAA,MAIC,mBAAmB;AAAA,MAEnB,mBAAmB;AAAA;AAAA,EAErB,QAAQ;AAGP,WAAO;AAAA,EACR;AACD;",
|
|
6
6
|
"names": ["isHTMLInputElement", "isTextField"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/dom/input-field-has-uncollapsed-selection.js"],
|
|
4
|
-
"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/textarea 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
|
|
5
|
-
"mappings": ";AAGA,OAAO,iBAAiB;AACxB,OAAO,wBAAwB;AAmBhB,SAAR,kCAAoD,SAAU;AACpE,MAAK,CAAE,mBAAoB,OAAQ,KAAK,CAAE,YAAa,OAAQ,GAAI;AAClE,WAAO;AAAA,EACR;AAKA,MAAI;AACH,UAAM,EAAE,gBAAgB,aAAa;AAAA;AAAA,MACoB;AAAA;AACzD;AAAA;AAAA;AAAA;AAAA,MAIC,mBAAmB;AAAA,MAEnB,mBAAmB;AAAA;AAAA,EAErB,
|
|
4
|
+
"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/textarea 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 {\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"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,iBAAiB;AACxB,OAAO,wBAAwB;AAmBhB,SAAR,kCAAoD,SAAU;AACpE,MAAK,CAAE,mBAAoB,OAAQ,KAAK,CAAE,YAAa,OAAQ,GAAI;AAClE,WAAO;AAAA,EACR;AAKA,MAAI;AACH,UAAM,EAAE,gBAAgB,aAAa;AAAA;AAAA,MACoB;AAAA;AACzD;AAAA;AAAA;AAAA;AAAA,MAIC,mBAAmB;AAAA,MAEnB,mBAAmB;AAAA;AAAA,EAErB,QAAQ;AAGP,WAAO;AAAA,EACR;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/dom",
|
|
3
|
-
"version": "4.43.0",
|
|
3
|
+
"version": "4.43.1-next.v.202604091042.0+668146787",
|
|
4
4
|
"description": "DOM utilities module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"types": "build-types",
|
|
46
46
|
"sideEffects": false,
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@wordpress/deprecated": "^4.43.0"
|
|
48
|
+
"@wordpress/deprecated": "^4.43.1-next.v.202604091042.0+668146787"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "73606df74f1c38a084bfa5db97205259ef817593"
|
|
54
54
|
}
|
|
@@ -40,7 +40,7 @@ export default function inputFieldHasUncollapsedSelection( element ) {
|
|
|
40
40
|
// when not null, compare the two points
|
|
41
41
|
selectionStart !== selectionEnd
|
|
42
42
|
);
|
|
43
|
-
} catch
|
|
43
|
+
} catch {
|
|
44
44
|
// This is Safari's way of saying that the input type doesn't implement
|
|
45
45
|
// selection, so we default to true.
|
|
46
46
|
return true;
|