Reputation: 177
I have a div with contenteditable set to true. Now I want to enable resize for div inside contenteditable div.
In my example html insert works fine but how to make inserted html div to be resizable?
Code:
function inserthtml() {
var sel = document.selection;
if (sel) {
var textRange = sel.createRange();
document.execCommand('inserthtml', false, "<div><img src='https://www.google.com/images/srpr/logo11w.png' height='42' width='42'></div>");
textRange.collapse(false);
textRange.select();
} else {
document.execCommand('inserthtml', false, "<div><img src='https://www.google.com/images/srpr/logo11w.png' height='42' width='42'></div>");
}
}
fiddle: http://jsfiddle.net/q6q05f1b/
Upvotes: 7
Views: 4017
Reputation: 542
#editme {
resize: vertical;
overflow: auto;
}
<div id="editme" contenteditable="true">Click somewhere in here and press the 'insert html' button</div>
Upvotes: 9