I am trying to create an text-editor. In this i am using contenteditable div in which i have to create multiple canvas element but when i create it by using
var A = "<canvas style='border:1px solid' id='matharea'
class='mathdoxformula'></canvas>";
document.execCommand("insertHTML", A,null);
it create problem with cursor, what happen is when backspace is press it delete all the canvas element. I need to delete one by one. I thought this problem is because of no space present in between two elements, but when i create textarea just for check it works fine.
Required Output 1. I can create canvas element at any cursor position 2. Need one cursor distance in between two canvas element, so i can write in editable div in between elements. 3. Delete canvas element one by one
In this image
DARK BOLD BLACK BOX : contenteditable div
BLACK BOX INSIDE DIV : canvas element
RED COLOR LINE : Cursor pointing
I used document.execCommand because to place canvas element at any cursor position. Help me out.
Restriction : Only use JavaScript and HTML