fix
This commit is contained in:
parent
76bf7ebf53
commit
9dc86db663
|
|
@ -61,7 +61,21 @@ const Renaming: FC<{
|
|||
spellCheck={false}
|
||||
onChange={(e) => {
|
||||
local.newname = e.currentTarget.value;
|
||||
let shouldReplace =
|
||||
local.newname.includes("=>") || local.newname.includes("<=");
|
||||
const target = e.currentTarget;
|
||||
let position = target.selectionStart;
|
||||
if (shouldReplace) {
|
||||
local.newname = local.newname.replace("<=", "⇦");
|
||||
local.newname = local.newname.replace("=>", "⇨");
|
||||
}
|
||||
local.render();
|
||||
setTimeout(() => {
|
||||
if (position && shouldReplace) target.selectionEnd = position - 1;
|
||||
});
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
onFocus={(e) => {
|
||||
e.currentTarget.select();
|
||||
|
|
@ -71,7 +85,9 @@ const Renaming: FC<{
|
|||
e.currentTarget.blur();
|
||||
}
|
||||
}}
|
||||
onBlur={() => {
|
||||
onBlur={(e) => {
|
||||
setTimeout(() => {
|
||||
if (document.activeElement !== e.currentTarget) {
|
||||
doneRenaming();
|
||||
if (isComponent) {
|
||||
const comp = item.get("component");
|
||||
|
|
@ -97,6 +113,8 @@ const Renaming: FC<{
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
}}
|
||||
autoFocus
|
||||
/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue