在contenteditable div中启用div的resize

时间:2015-07-30 09:04:13

标签: javascript jquery html css

我有一个div,其中contenteditable设置为true。现在我想在contenteditable div中启用div的resize。

在我的示例中,html插入工作正常,但如何使插入的html div可调整大小?

代码:

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>");
    }
}

小提琴:http://jsfiddle.net/q6q05f1b/

1 个答案:

答案 0 :(得分:0)

input_split = input.split(",")
input_split.sort()
count = {}
for i in input_split:
    if i in count:
        count[i] += 1
    else:
        count[i] = 1

return count
#editme {
  resize: vertical;
  overflow: auto;
}