I am attempting to move span
tags and their contents to the left or right by one position when the cursor is inside of them and Ctrl Right or Control Left is pressed. The span tags are inside of a contenteditable
paragraph. I am not even having any luck getting a test message to log to the console to indicate that the cursor is even inside of the span tag. Here is the fiddle:
https://jsfiddle.net/scooke/5tp5oe7z/
Javascript/Jquery
$(document).on('keyup','.move',function(e){
if (e.ctrlKey && (e.which === 37 || e.which === 39)){
//move character at right or left of span to the other side
//to simulate the whole span moved
}
e.stopPropagation();
});
Sample Html
<p class="parent" contenteditable="true">Bacon ipsum dolor amet jowl chicken pork loin <span class="move">[move text]</span>tail. Short ribs meatball
<br>bresaola beef boudin hamburger, cow rump swine. Pork belly ribeye leberkas venison
<br>ground <span class="move">[move text]</span>round</p>