@wordpress/block-editor 14.14.2 → 14.14.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/build/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +14 -11
- package/build/components/block-list/use-block-props/use-firefox-draggable-compatibility.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +14 -11
- package/build-module/components/block-list/use-block-props/use-firefox-draggable-compatibility.js.map +1 -1
- package/package.json +6 -6
- package/src/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +14 -11
|
@@ -47,12 +47,15 @@ function down(event) {
|
|
|
47
47
|
} = event;
|
|
48
48
|
const {
|
|
49
49
|
ownerDocument,
|
|
50
|
-
isContentEditable
|
|
50
|
+
isContentEditable,
|
|
51
|
+
tagName
|
|
51
52
|
} = target;
|
|
53
|
+
const isInputOrTextArea = ['INPUT', 'TEXTAREA'].includes(tagName);
|
|
52
54
|
const nodes = nodesByDocument.get(ownerDocument);
|
|
53
|
-
if (isContentEditable) {
|
|
54
|
-
// Whenever an editable element is clicked,
|
|
55
|
-
// blocks contain this element, and temporarily
|
|
55
|
+
if (isContentEditable || isInputOrTextArea) {
|
|
56
|
+
// Whenever an editable element or an input or textarea is clicked,
|
|
57
|
+
// check which draggable blocks contain this element, and temporarily
|
|
58
|
+
// disable draggability.
|
|
56
59
|
for (const node of nodes) {
|
|
57
60
|
if (node.getAttribute('draggable') === 'true' && node.contains(target)) {
|
|
58
61
|
node.removeAttribute('draggable');
|
|
@@ -60,8 +63,8 @@ function down(event) {
|
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
} else {
|
|
63
|
-
// Whenever a non-editable element is clicked,
|
|
64
|
-
// for any blocks that were previously disabled.
|
|
66
|
+
// Whenever a non-editable element or an input or textarea is clicked,
|
|
67
|
+
// re-enable draggability for any blocks that were previously disabled.
|
|
65
68
|
for (const node of nodes) {
|
|
66
69
|
restore(node);
|
|
67
70
|
}
|
|
@@ -69,11 +72,11 @@ function down(event) {
|
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
/**
|
|
72
|
-
* In Firefox, the `draggable` and `contenteditable`
|
|
73
|
-
* together. When
|
|
74
|
-
* doesn't get set in the right place. The only
|
|
75
|
-
* remove the `draggable` attribute clicking inside
|
|
76
|
-
*
|
|
75
|
+
* In Firefox, the `draggable` and `contenteditable` or `input` or `textarea`
|
|
76
|
+
* elements don't play well together. When these elements are within a
|
|
77
|
+
* `draggable` element, selection doesn't get set in the right place. The only
|
|
78
|
+
* solution is to temporarily remove the `draggable` attribute clicking inside
|
|
79
|
+
* these elements.
|
|
77
80
|
* @return {Function} Cleanup function.
|
|
78
81
|
*/
|
|
79
82
|
function useFirefoxDraggableCompatibility() {
|
package/build/components/block-list/use-block-props/use-firefox-draggable-compatibility.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","nodesByDocument","Map","add","doc","node","set","get","Set","addEventListener","down","remove","delete","restore","size","removeEventListener","prevDraggable","getAttribute","removeAttribute","setAttribute","event","target","ownerDocument","isContentEditable","nodes","contains","useFirefoxDraggableCompatibility","useRefEffect"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-firefox-draggable-compatibility.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\n\nconst nodesByDocument = new Map();\n\nfunction add( doc, node ) {\n\tlet set = nodesByDocument.get( doc );\n\tif ( ! set ) {\n\t\tset = new Set();\n\t\tnodesByDocument.set( doc, set );\n\t\tdoc.addEventListener( 'pointerdown', down );\n\t}\n\tset.add( node );\n}\n\nfunction remove( doc, node ) {\n\tconst set = nodesByDocument.get( doc );\n\tif ( set ) {\n\t\tset.delete( node );\n\t\trestore( node );\n\t\tif ( set.size === 0 ) {\n\t\t\tnodesByDocument.delete( doc );\n\t\t\tdoc.removeEventListener( 'pointerdown', down );\n\t\t}\n\t}\n}\n\nfunction restore( node ) {\n\tconst prevDraggable = node.getAttribute( 'data-draggable' );\n\tif ( prevDraggable ) {\n\t\tnode.removeAttribute( 'data-draggable' );\n\t\t// Only restore if `draggable` is still removed. It could have been\n\t\t// changed by React in the meantime.\n\t\tif ( prevDraggable === 'true' && ! node.getAttribute( 'draggable' ) ) {\n\t\t\tnode.setAttribute( 'draggable', 'true' );\n\t\t}\n\t}\n}\n\nfunction down( event ) {\n\tconst { target } = event;\n\tconst { ownerDocument, isContentEditable } = target;\n\tconst nodes = nodesByDocument.get( ownerDocument );\n\n\tif ( isContentEditable ) {\n\t\t// Whenever an editable element
|
|
1
|
+
{"version":3,"names":["_compose","require","nodesByDocument","Map","add","doc","node","set","get","Set","addEventListener","down","remove","delete","restore","size","removeEventListener","prevDraggable","getAttribute","removeAttribute","setAttribute","event","target","ownerDocument","isContentEditable","tagName","isInputOrTextArea","includes","nodes","contains","useFirefoxDraggableCompatibility","useRefEffect"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-firefox-draggable-compatibility.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\n\nconst nodesByDocument = new Map();\n\nfunction add( doc, node ) {\n\tlet set = nodesByDocument.get( doc );\n\tif ( ! set ) {\n\t\tset = new Set();\n\t\tnodesByDocument.set( doc, set );\n\t\tdoc.addEventListener( 'pointerdown', down );\n\t}\n\tset.add( node );\n}\n\nfunction remove( doc, node ) {\n\tconst set = nodesByDocument.get( doc );\n\tif ( set ) {\n\t\tset.delete( node );\n\t\trestore( node );\n\t\tif ( set.size === 0 ) {\n\t\t\tnodesByDocument.delete( doc );\n\t\t\tdoc.removeEventListener( 'pointerdown', down );\n\t\t}\n\t}\n}\n\nfunction restore( node ) {\n\tconst prevDraggable = node.getAttribute( 'data-draggable' );\n\tif ( prevDraggable ) {\n\t\tnode.removeAttribute( 'data-draggable' );\n\t\t// Only restore if `draggable` is still removed. It could have been\n\t\t// changed by React in the meantime.\n\t\tif ( prevDraggable === 'true' && ! node.getAttribute( 'draggable' ) ) {\n\t\t\tnode.setAttribute( 'draggable', 'true' );\n\t\t}\n\t}\n}\n\nfunction down( event ) {\n\tconst { target } = event;\n\tconst { ownerDocument, isContentEditable, tagName } = target;\n\tconst isInputOrTextArea = [ 'INPUT', 'TEXTAREA' ].includes( tagName );\n\n\tconst nodes = nodesByDocument.get( ownerDocument );\n\n\tif ( isContentEditable || isInputOrTextArea ) {\n\t\t// Whenever an editable element or an input or textarea is clicked,\n\t\t// check which draggable blocks contain this element, and temporarily\n\t\t// disable draggability.\n\t\tfor ( const node of nodes ) {\n\t\t\tif (\n\t\t\t\tnode.getAttribute( 'draggable' ) === 'true' &&\n\t\t\t\tnode.contains( target )\n\t\t\t) {\n\t\t\t\tnode.removeAttribute( 'draggable' );\n\t\t\t\tnode.setAttribute( 'data-draggable', 'true' );\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// Whenever a non-editable element or an input or textarea is clicked,\n\t\t// re-enable draggability for any blocks that were previously disabled.\n\t\tfor ( const node of nodes ) {\n\t\t\trestore( node );\n\t\t}\n\t}\n}\n\n/**\n * In Firefox, the `draggable` and `contenteditable` or `input` or `textarea`\n * elements don't play well together. When these elements are within a\n * `draggable` element, selection doesn't get set in the right place. The only\n * solution is to temporarily remove the `draggable` attribute clicking inside\n * these elements.\n * @return {Function} Cleanup function.\n */\nexport function useFirefoxDraggableCompatibility() {\n\treturn useRefEffect( ( node ) => {\n\t\tadd( node.ownerDocument, node );\n\t\treturn () => {\n\t\t\tremove( node.ownerDocument, node );\n\t\t};\n\t}, [] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,eAAe,GAAG,IAAIC,GAAG,CAAC,CAAC;AAEjC,SAASC,GAAGA,CAAEC,GAAG,EAAEC,IAAI,EAAG;EACzB,IAAIC,GAAG,GAAGL,eAAe,CAACM,GAAG,CAAEH,GAAI,CAAC;EACpC,IAAK,CAAEE,GA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1B,eAAe,CAACM,GAAG,CAAEe,aAAc,CAAC;EAElD,IAAKC,iBAAiB,IAAIE,iBAAiB,EAAG;IAC7C;IACA;IACA;IACA,KAAM,MAAMpB,IAAI,IAAIsB,KAAK,EAAG;MAC3B,IACCtB,IAAI,CAACY,YAAY,CAAE,WAAY,CAAC,KAAK,MAAM,IAC3CZ,IAAI,CAACuB,QAAQ,CAAEP,MAAO,CAAC,EACtB;QACDhB,IAAI,CAACa,eAAe,CAAE,WAAY,CAAC;QACnCb,IAAI,CAACc,YAAY,CAAE,gBAAgB,EAAE,MAAO,CAAC;MAC9C;IACD;EACD,CAAC,MAAM;IACN;IACA;IACA,KAAM,MAAMd,IAAI,IAAIsB,KAAK,EAAG;MAC3Bd,OAAO,CAAER,IAAK,CAAC;IAChB;EACD;AACD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASwB,gCAAgCA,CAAA,EAAG;EAClD,OAAO,IAAAC,qBAAY,EAAIzB,IAAI,IAAM;IAChCF,GAAG,CAAEE,IAAI,CAACiB,aAAa,EAAEjB,IAAK,CAAC;IAC/B,OAAO,MAAM;MACZM,MAAM,CAAEN,IAAI,CAACiB,aAAa,EAAEjB,IAAK,CAAC;IACnC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR","ignoreList":[]}
|
package/build-module/components/block-list/use-block-props/use-firefox-draggable-compatibility.js
CHANGED
|
@@ -40,12 +40,15 @@ function down(event) {
|
|
|
40
40
|
} = event;
|
|
41
41
|
const {
|
|
42
42
|
ownerDocument,
|
|
43
|
-
isContentEditable
|
|
43
|
+
isContentEditable,
|
|
44
|
+
tagName
|
|
44
45
|
} = target;
|
|
46
|
+
const isInputOrTextArea = ['INPUT', 'TEXTAREA'].includes(tagName);
|
|
45
47
|
const nodes = nodesByDocument.get(ownerDocument);
|
|
46
|
-
if (isContentEditable) {
|
|
47
|
-
// Whenever an editable element is clicked,
|
|
48
|
-
// blocks contain this element, and temporarily
|
|
48
|
+
if (isContentEditable || isInputOrTextArea) {
|
|
49
|
+
// Whenever an editable element or an input or textarea is clicked,
|
|
50
|
+
// check which draggable blocks contain this element, and temporarily
|
|
51
|
+
// disable draggability.
|
|
49
52
|
for (const node of nodes) {
|
|
50
53
|
if (node.getAttribute('draggable') === 'true' && node.contains(target)) {
|
|
51
54
|
node.removeAttribute('draggable');
|
|
@@ -53,8 +56,8 @@ function down(event) {
|
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
58
|
} else {
|
|
56
|
-
// Whenever a non-editable element is clicked,
|
|
57
|
-
// for any blocks that were previously disabled.
|
|
59
|
+
// Whenever a non-editable element or an input or textarea is clicked,
|
|
60
|
+
// re-enable draggability for any blocks that were previously disabled.
|
|
58
61
|
for (const node of nodes) {
|
|
59
62
|
restore(node);
|
|
60
63
|
}
|
|
@@ -62,11 +65,11 @@ function down(event) {
|
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
/**
|
|
65
|
-
* In Firefox, the `draggable` and `contenteditable`
|
|
66
|
-
* together. When
|
|
67
|
-
* doesn't get set in the right place. The only
|
|
68
|
-
* remove the `draggable` attribute clicking inside
|
|
69
|
-
*
|
|
68
|
+
* In Firefox, the `draggable` and `contenteditable` or `input` or `textarea`
|
|
69
|
+
* elements don't play well together. When these elements are within a
|
|
70
|
+
* `draggable` element, selection doesn't get set in the right place. The only
|
|
71
|
+
* solution is to temporarily remove the `draggable` attribute clicking inside
|
|
72
|
+
* these elements.
|
|
70
73
|
* @return {Function} Cleanup function.
|
|
71
74
|
*/
|
|
72
75
|
export function useFirefoxDraggableCompatibility() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRefEffect","nodesByDocument","Map","add","doc","node","set","get","Set","addEventListener","down","remove","delete","restore","size","removeEventListener","prevDraggable","getAttribute","removeAttribute","setAttribute","event","target","ownerDocument","isContentEditable","nodes","contains","useFirefoxDraggableCompatibility"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-firefox-draggable-compatibility.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\n\nconst nodesByDocument = new Map();\n\nfunction add( doc, node ) {\n\tlet set = nodesByDocument.get( doc );\n\tif ( ! set ) {\n\t\tset = new Set();\n\t\tnodesByDocument.set( doc, set );\n\t\tdoc.addEventListener( 'pointerdown', down );\n\t}\n\tset.add( node );\n}\n\nfunction remove( doc, node ) {\n\tconst set = nodesByDocument.get( doc );\n\tif ( set ) {\n\t\tset.delete( node );\n\t\trestore( node );\n\t\tif ( set.size === 0 ) {\n\t\t\tnodesByDocument.delete( doc );\n\t\t\tdoc.removeEventListener( 'pointerdown', down );\n\t\t}\n\t}\n}\n\nfunction restore( node ) {\n\tconst prevDraggable = node.getAttribute( 'data-draggable' );\n\tif ( prevDraggable ) {\n\t\tnode.removeAttribute( 'data-draggable' );\n\t\t// Only restore if `draggable` is still removed. It could have been\n\t\t// changed by React in the meantime.\n\t\tif ( prevDraggable === 'true' && ! node.getAttribute( 'draggable' ) ) {\n\t\t\tnode.setAttribute( 'draggable', 'true' );\n\t\t}\n\t}\n}\n\nfunction down( event ) {\n\tconst { target } = event;\n\tconst { ownerDocument, isContentEditable } = target;\n\tconst nodes = nodesByDocument.get( ownerDocument );\n\n\tif ( isContentEditable ) {\n\t\t// Whenever an editable element
|
|
1
|
+
{"version":3,"names":["useRefEffect","nodesByDocument","Map","add","doc","node","set","get","Set","addEventListener","down","remove","delete","restore","size","removeEventListener","prevDraggable","getAttribute","removeAttribute","setAttribute","event","target","ownerDocument","isContentEditable","tagName","isInputOrTextArea","includes","nodes","contains","useFirefoxDraggableCompatibility"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-firefox-draggable-compatibility.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\n\nconst nodesByDocument = new Map();\n\nfunction add( doc, node ) {\n\tlet set = nodesByDocument.get( doc );\n\tif ( ! set ) {\n\t\tset = new Set();\n\t\tnodesByDocument.set( doc, set );\n\t\tdoc.addEventListener( 'pointerdown', down );\n\t}\n\tset.add( node );\n}\n\nfunction remove( doc, node ) {\n\tconst set = nodesByDocument.get( doc );\n\tif ( set ) {\n\t\tset.delete( node );\n\t\trestore( node );\n\t\tif ( set.size === 0 ) {\n\t\t\tnodesByDocument.delete( doc );\n\t\t\tdoc.removeEventListener( 'pointerdown', down );\n\t\t}\n\t}\n}\n\nfunction restore( node ) {\n\tconst prevDraggable = node.getAttribute( 'data-draggable' );\n\tif ( prevDraggable ) {\n\t\tnode.removeAttribute( 'data-draggable' );\n\t\t// Only restore if `draggable` is still removed. It could have been\n\t\t// changed by React in the meantime.\n\t\tif ( prevDraggable === 'true' && ! node.getAttribute( 'draggable' ) ) {\n\t\t\tnode.setAttribute( 'draggable', 'true' );\n\t\t}\n\t}\n}\n\nfunction down( event ) {\n\tconst { target } = event;\n\tconst { ownerDocument, isContentEditable, tagName } = target;\n\tconst isInputOrTextArea = [ 'INPUT', 'TEXTAREA' ].includes( tagName );\n\n\tconst nodes = nodesByDocument.get( ownerDocument );\n\n\tif ( isContentEditable || isInputOrTextArea ) {\n\t\t// Whenever an editable element or an input or textarea is clicked,\n\t\t// check which draggable blocks contain this element, and temporarily\n\t\t// disable draggability.\n\t\tfor ( const node of nodes ) {\n\t\t\tif (\n\t\t\t\tnode.getAttribute( 'draggable' ) === 'true' &&\n\t\t\t\tnode.contains( target )\n\t\t\t) {\n\t\t\t\tnode.removeAttribute( 'draggable' );\n\t\t\t\tnode.setAttribute( 'data-draggable', 'true' );\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// Whenever a non-editable element or an input or textarea is clicked,\n\t\t// re-enable draggability for any blocks that were previously disabled.\n\t\tfor ( const node of nodes ) {\n\t\t\trestore( node );\n\t\t}\n\t}\n}\n\n/**\n * In Firefox, the `draggable` and `contenteditable` or `input` or `textarea`\n * elements don't play well together. When these elements are within a\n * `draggable` element, selection doesn't get set in the right place. The only\n * solution is to temporarily remove the `draggable` attribute clicking inside\n * these elements.\n * @return {Function} Cleanup function.\n */\nexport function useFirefoxDraggableCompatibility() {\n\treturn useRefEffect( ( node ) => {\n\t\tadd( node.ownerDocument, node );\n\t\treturn () => {\n\t\t\tremove( node.ownerDocument, node );\n\t\t};\n\t}, [] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,oBAAoB;AAEjD,MAAMC,eAAe,GAAG,IAAIC,GAAG,CAAC,CAAC;AAEjC,SAASC,GAAGA,CAAEC,GAAG,EAAEC,IAAI,EAAG;EACzB,IAAIC,GAAG,GAAGL,eAAe,CAACM,GAAG,CAAEH,GAAI,CAAC;EACpC,IAAK,CAAEE,GAAG,EAAG;IACZA,GAAG,GAAG,IAAIE,GAAG,CAAC,CAAC;IACfP,eAAe,CAACK,GAAG,CAAEF,GAAG,EAAEE,GAAI,CAAC;IAC/BF,GAAG,CAACK,gBAAgB,CAAE,aAAa,EAAEC,IAAK,CAAC;EAC5C;EACAJ,GAAG,CAACH,GAAG,CAAEE,IAAK,CAAC;AAChB;AAEA,SAASM,MAAMA,CAAEP,GAAG,EAAEC,IAAI,EAAG;EAC5B,MAAMC,GAAG,GAAGL,eAAe,CAACM,GAAG,CAAEH,GAAI,CAAC;EACtC,IAAKE,GAAG,EAAG;IACVA,GAAG,CAACM,MAAM,CAAEP,IAAK,CAAC;IAClBQ,OAAO,CAAER,IAAK,CAAC;IACf,IAAKC,GAAG,CAACQ,IAAI,KAAK,CAAC,EAAG;MACrBb,eAAe,CAACW,MAAM,CAAER,GAAI,CAAC;MAC7BA,GAAG,CAACW,mBAAmB,CAAE,aAAa,EAAEL,IAAK,CAAC;IAC/C;EACD;AACD;AAEA,SAASG,OAAOA,CAAER,IAAI,EAAG;EACxB,MAAMW,aAAa,GAAGX,IAAI,CAACY,YAAY,CAAE,gBAAiB,CAAC;EAC3D,IAAKD,aAAa,EAAG;IACpBX,IAAI,CAACa,eAAe,CAAE,gBAAiB,CAAC;IACxC;IACA;IACA,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oreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "14.14.
|
|
3
|
+
"version": "14.14.3",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"@wordpress/blob": "^4.19.1",
|
|
43
43
|
"@wordpress/block-serialization-default-parser": "^5.19.1",
|
|
44
44
|
"@wordpress/blocks": "^14.8.1",
|
|
45
|
-
"@wordpress/commands": "^1.19.
|
|
46
|
-
"@wordpress/components": "^29.5.
|
|
45
|
+
"@wordpress/commands": "^1.19.2",
|
|
46
|
+
"@wordpress/components": "^29.5.2",
|
|
47
47
|
"@wordpress/compose": "^7.19.1",
|
|
48
48
|
"@wordpress/data": "^10.19.1",
|
|
49
49
|
"@wordpress/date": "^5.19.1",
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"@wordpress/keyboard-shortcuts": "^5.19.1",
|
|
60
60
|
"@wordpress/keycodes": "^4.19.1",
|
|
61
61
|
"@wordpress/notices": "^5.19.1",
|
|
62
|
-
"@wordpress/preferences": "^4.19.
|
|
62
|
+
"@wordpress/preferences": "^4.19.2",
|
|
63
63
|
"@wordpress/priority-queue": "^3.19.1",
|
|
64
64
|
"@wordpress/private-apis": "^1.19.1",
|
|
65
65
|
"@wordpress/rich-text": "^7.19.1",
|
|
66
66
|
"@wordpress/style-engine": "^2.19.1",
|
|
67
67
|
"@wordpress/token-list": "^3.19.1",
|
|
68
|
-
"@wordpress/upload-media": "^0.4.
|
|
68
|
+
"@wordpress/upload-media": "^0.4.2",
|
|
69
69
|
"@wordpress/url": "^4.19.1",
|
|
70
70
|
"@wordpress/warning": "^3.19.1",
|
|
71
71
|
"@wordpress/wordcount": "^4.19.1",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"publishConfig": {
|
|
92
92
|
"access": "public"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "0750912b313e3e488ec2cad0c084e548cedd6b95"
|
|
95
95
|
}
|
|
@@ -41,12 +41,15 @@ function restore( node ) {
|
|
|
41
41
|
|
|
42
42
|
function down( event ) {
|
|
43
43
|
const { target } = event;
|
|
44
|
-
const { ownerDocument, isContentEditable } = target;
|
|
44
|
+
const { ownerDocument, isContentEditable, tagName } = target;
|
|
45
|
+
const isInputOrTextArea = [ 'INPUT', 'TEXTAREA' ].includes( tagName );
|
|
46
|
+
|
|
45
47
|
const nodes = nodesByDocument.get( ownerDocument );
|
|
46
48
|
|
|
47
|
-
if ( isContentEditable ) {
|
|
48
|
-
// Whenever an editable element is clicked,
|
|
49
|
-
// blocks contain this element, and temporarily
|
|
49
|
+
if ( isContentEditable || isInputOrTextArea ) {
|
|
50
|
+
// Whenever an editable element or an input or textarea is clicked,
|
|
51
|
+
// check which draggable blocks contain this element, and temporarily
|
|
52
|
+
// disable draggability.
|
|
50
53
|
for ( const node of nodes ) {
|
|
51
54
|
if (
|
|
52
55
|
node.getAttribute( 'draggable' ) === 'true' &&
|
|
@@ -57,8 +60,8 @@ function down( event ) {
|
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
62
|
} else {
|
|
60
|
-
// Whenever a non-editable element is clicked,
|
|
61
|
-
// for any blocks that were previously disabled.
|
|
63
|
+
// Whenever a non-editable element or an input or textarea is clicked,
|
|
64
|
+
// re-enable draggability for any blocks that were previously disabled.
|
|
62
65
|
for ( const node of nodes ) {
|
|
63
66
|
restore( node );
|
|
64
67
|
}
|
|
@@ -66,11 +69,11 @@ function down( event ) {
|
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
/**
|
|
69
|
-
* In Firefox, the `draggable` and `contenteditable`
|
|
70
|
-
* together. When
|
|
71
|
-
* doesn't get set in the right place. The only
|
|
72
|
-
* remove the `draggable` attribute clicking inside
|
|
73
|
-
*
|
|
72
|
+
* In Firefox, the `draggable` and `contenteditable` or `input` or `textarea`
|
|
73
|
+
* elements don't play well together. When these elements are within a
|
|
74
|
+
* `draggable` element, selection doesn't get set in the right place. The only
|
|
75
|
+
* solution is to temporarily remove the `draggable` attribute clicking inside
|
|
76
|
+
* these elements.
|
|
74
77
|
* @return {Function} Cleanup function.
|
|
75
78
|
*/
|
|
76
79
|
export function useFirefoxDraggableCompatibility() {
|