Also allow backspacing into another chunk
It will still defocus the chunk almost immediately though, this needs to be fixed later
This commit is contained in:
parent
3c9f6963b8
commit
7ce5b120a0
|
@ -640,7 +640,7 @@ function chunkOnKeyDown(event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow left and right arrow keys to move between chunks
|
// Allow left and right arrow keys (and backspace) to move between chunks
|
||||||
switch(event.keyCode) {
|
switch(event.keyCode) {
|
||||||
case 37: // left
|
case 37: // left
|
||||||
case 39: // right
|
case 39: // right
|
||||||
|
@ -672,6 +672,25 @@ function chunkOnKeyDown(event) {
|
||||||
}
|
}
|
||||||
}, 2);
|
}, 2);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case 8: // backspace
|
||||||
|
old_length = document.activeElement.innerText.length;
|
||||||
|
setTimeout(function () {
|
||||||
|
// Wait a few milliseconds and compare the chunk's length
|
||||||
|
if(old_length != document.activeElement.innerText.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// If it's the same, we're at the beginning of a chunk
|
||||||
|
if((chunk = document.activeElement.previousSibling) && chunk.tagName == "CHUNK") {
|
||||||
|
range = document.createRange();
|
||||||
|
selection = getSelection();
|
||||||
|
range.selectNodeContents(chunk);
|
||||||
|
range.collapse(false);
|
||||||
|
selection.removeAllRanges();
|
||||||
|
selection.addRange(range);
|
||||||
|
}
|
||||||
|
}, 2);
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't allow any edits if not connected to server
|
// Don't allow any edits if not connected to server
|
||||||
|
|
Loading…
Reference in New Issue