[#7532] added compositionend listener

This commit is contained in:
Gani Georgiev
2026-02-17 18:20:07 +02:00
parent f6675702ea
commit 19ad2f3b04
31 changed files with 119 additions and 95 deletions

View File

@@ -455,6 +455,14 @@
autofocus={!collection.id}
placeholder={isAuth ? `eg. "users"` : `eg. "posts"`}
value={collection.name}
on:compositionend={(e) => {
if (!e.data) {
return
}
collection.name = CommonHelper.slugify(e.target.value);
e.target.value = collection.name;
}}
on:input={(e) => {
if (e.isComposing) {
return

View File

@@ -70,6 +70,18 @@
}
}
function onFieldRename(input) {
if (!input) {
return
}
const oldName = field.name;
field.name = CommonHelper.slugify(input.value);
input.value = field.name;
dispatch("rename", { oldName: oldName, newName: field.name });
}
function restore() {
field._toDelete = false;
@@ -173,15 +185,19 @@
spellcheck="false"
placeholder="Field name"
value={field.name}
on:compositionend={(e) => {
if (!e.data) {
return
}
onFieldRename(e.target)
}}
on:input={(e) => {
if (e.isComposing) {
return
}
const oldName = field.name;
field.name = CommonHelper.slugify(e.target.value);
e.target.value = field.name;
dispatch("rename", { oldName: oldName, newName: field.name });
onFieldRename(e.target)
}}
/>
</Field>