@dotcms/react 1.5.5-next.2176 → 1.5.5-next.2180
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.
|
@@ -87,10 +87,15 @@ function DotCMSEditableText({
|
|
|
87
87
|
}
|
|
88
88
|
const {
|
|
89
89
|
oldInode,
|
|
90
|
-
inode
|
|
90
|
+
inode,
|
|
91
|
+
fieldName: focusedFieldName
|
|
91
92
|
} = payload;
|
|
92
93
|
const currentInode = contentlet.inode;
|
|
93
|
-
const
|
|
94
|
+
const matchesInode = currentInode === oldInode || currentInode === inode;
|
|
95
|
+
// Match the field too: a contentlet's fields all share one inode, so an
|
|
96
|
+
// inode-only check focuses every editable field on the contentlet (the
|
|
97
|
+
// last one wins) instead of the one the user clicked.
|
|
98
|
+
const shouldFocus = matchesInode && focusedFieldName === fieldName;
|
|
94
99
|
if (shouldFocus) {
|
|
95
100
|
var _editorRef$current2;
|
|
96
101
|
(_editorRef$current2 = editorRef.current) == null || _editorRef$current2.focus();
|
|
@@ -100,7 +105,7 @@ function DotCMSEditableText({
|
|
|
100
105
|
return () => {
|
|
101
106
|
window.removeEventListener('message', onMessage);
|
|
102
107
|
};
|
|
103
|
-
}, [contentlet == null ? void 0 : contentlet.inode]);
|
|
108
|
+
}, [contentlet == null ? void 0 : contentlet.inode, fieldName]);
|
|
104
109
|
const onMouseDown = event => {
|
|
105
110
|
var _editorRef$current3;
|
|
106
111
|
const {
|