Mottie/Keyboard

Caret Does Not Go to pos. '0' when using Mottie Left Arrow Key

Closed this issue · 2 comments

When using the left arrow key on the Mottie KB, clicking it will move the caret to the left (I am not using the preview), but the caret will stop at position 1 and not go back to the beginning (position 0). I have implemented a fix for the is in the Mottie code (jquery.keyboard.js, in the caret() function - I will share it below. As you can see I added a condition to the if statement so when options.start and options.end are 0, they can pass through.
.
.
.

var s, start, e, end, selRange, range, stored_range, te, val,
selection = document.selection, t = this[0], sTop = t.scrollTop,
ss = false, supportCaret = true;
try {
ss = typeof t.selectionStart !== 'undefined';
} catch(err){
supportCaret = false;
}
if ((typeof options === 'object' && options.start && options.end)||
(typeof options === 'object' && options.start==0 && options.end==0)) {
start = options.start;
end = options.end;
.
.
.

Hi @cbellitti!

Thanks for reporting this issue and sharing the fix! I have push these changes to the working branch for now. I'll try to spend some time on the plugin this weekend and push the next update to master.

Ok, this should be fixed in 1.19.0. Thanks for your patience!