1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Fixed editing with special characters

This commit is contained in:
krateng 2022-04-17 15:24:36 +02:00
parent 83e3157ad1
commit 977385a700
2 changed files with 5 additions and 4 deletions

1
dev/releases/branch.yml Normal file
View File

@ -0,0 +1 @@
- "[Feature] Can now edit track titles and artist names from web interface"

View File

@ -37,15 +37,15 @@ function editEntity() {
// cancel on esc
else if (e.key === "Escape" || e.key === "Esc") {
e.preventDefault();
namefield.innerHTML = entity_name;
namefield.textContent = entity_name;
namefield.blur();
}
})
// emergency, not pretty because it will move cursor
namefield.addEventListener('input',function(e){
if (namefield.innerHTML.includes("\n")) {
namefield.innerHTML = namefield.innerHTML.replace("\n","");
if (namefield.textContent.includes("\n")) {
namefield.textContent = namefield.textContent.replace("\n","");
}
})
@ -63,7 +63,7 @@ function editEntity() {
function doneEditing() {
var namefield = document.getElementById('main_entity_name');
namefield.contentEditable = "false";
newname = namefield.innerHTML;
newname = namefield.textContent;
if (newname != entity_name) {
var searchParams = new URLSearchParams(window.location.search);