mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Fix join behavior and exclude Backspace/Delete from printable character
This commit is contained in:
parent
e876a374e2
commit
54c1f54ab0
1 changed files with 8 additions and 8 deletions
|
@ -54,7 +54,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
splitTag(active!, Infinity, Infinity);
|
splitTag(active!, Infinity, Infinity);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateWithTagName(tag: TagType): void {
|
function updateTagName(tag: TagType): void {
|
||||||
tag.name = activeName;
|
tag.name = activeName;
|
||||||
tags = tags;
|
tags = tags;
|
||||||
}
|
}
|
||||||
|
@ -172,9 +172,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
const deleted = deleteTagAt(index - 1);
|
const deleted = deleteTagAt(index - 1);
|
||||||
activeName = deleted.name + activeName;
|
activeName = deleted.name + activeName;
|
||||||
active = active! - 1;
|
active!--;
|
||||||
console.log("joinprevious", activeName, active);
|
updateTagName(tags[active!]);
|
||||||
tags = tags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function joinWithNextTag(index: number): void {
|
function joinWithNextTag(index: number): void {
|
||||||
|
@ -184,7 +183,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
const deleted = deleteTagAt(index + 1);
|
const deleted = deleteTagAt(index + 1);
|
||||||
activeName = activeName + deleted.name;
|
activeName = activeName + deleted.name;
|
||||||
tags = tags;
|
updateTagName(tags[active!]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function moveToPreviousTag(index: number): void {
|
function moveToPreviousTag(index: number): void {
|
||||||
|
@ -235,7 +234,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
return (
|
return (
|
||||||
(event.location === KeyboardEvent.DOM_KEY_LOCATION_STANDARD ||
|
(event.location === KeyboardEvent.DOM_KEY_LOCATION_STANDARD ||
|
||||||
event.location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD) &&
|
event.location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD) &&
|
||||||
!event.code.startsWith("Arrow")
|
!event.code.startsWith("Arrow") &&
|
||||||
|
event.code !== "Backspace" && event.code !== "Delete"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
createAutocomplete(activeInput);
|
createAutocomplete(activeInput);
|
||||||
}}
|
}}
|
||||||
on:keydown={(event) => update(event, autocomplete)}
|
on:keydown={(event) => update(event, autocomplete)}
|
||||||
on:input={() => updateWithTagName(tag)}
|
on:input={() => updateTagName(tag)}
|
||||||
on:tagsplit={({ detail }) =>
|
on:tagsplit={({ detail }) =>
|
||||||
enterBehavior(
|
enterBehavior(
|
||||||
index,
|
index,
|
||||||
|
@ -333,7 +333,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
on:tagaccept={() => {
|
on:tagaccept={() => {
|
||||||
deleteTagIfNotUnique(tag, index);
|
deleteTagIfNotUnique(tag, index);
|
||||||
if (tag) {
|
if (tag) {
|
||||||
updateWithTagName(tag);
|
updateTagName(tag);
|
||||||
}
|
}
|
||||||
saveTags();
|
saveTags();
|
||||||
decideNextActive();
|
decideNextActive();
|
||||||
|
|
Loading…
Reference in a new issue