0
在WYSIHTML5編輯器中,當我們添加無序列表時,它不會專注於Google Chrome瀏覽器中的可編輯區域。但是,對於其他選項(如粗體,斜體等),它已正常工作,但我一直無法找到此錯誤的解決方案。WYSIHTML5編輯器在Chrome中插入無序列表時不會集中可編輯區域
在WYSIHTML5編輯器中,當我們添加無序列表時,它不會專注於Google Chrome瀏覽器中的可編輯區域。但是,對於其他選項(如粗體,斜體等),它已正常工作,但我一直無法找到此錯誤的解決方案。WYSIHTML5編輯器在Chrome中插入無序列表時不會集中可編輯區域
在WYSIHTML5 JS,搜索線wysihtml5.commands.insertUnorderedList
,並進一步查找
composer.commands.exec("formatBlock", "div", tempClassName);
tempElement = doc.querySelector("." + tempClassName);
isEmpty = tempElement.innerHTML === "" || tempElement.innerHTML === wysihtml5.INVISIBLE_SPACE;
composer.selection.executeAndRestoreSimple(function() {
list = wysihtml5.dom.convertToList(tempElement, "ul");
});
if (isEmpty) {
composer.selection.selectNode(list.querySelector("li"));
}
和評論或刪除的條件部分,如:
composer.commands.exec("formatBlock", "div", tempClassName);
tempElement = doc.querySelector("." + tempClassName);
isEmpty = tempElement.innerHTML === "" || tempElement.innerHTML === wysihtml5.INVISIBLE_SPACE;
composer.selection.executeAndRestoreSimple(function() {
list = wysihtml5.dom.convertToList(tempElement, "ul");
});
//if (isEmpty) {
composer.selection.selectNode(list.querySelector("li"));
//}
它的工作對我,因爲條件isEmpty = tempElement.innerHTML === "" || tempElement.innerHTML === wysihtml5.INVISIBLE_SPACE;
永遠無法成爲真正的因爲我們已經插入了無序列表並且可編輯區域在此之後不是空白的。祝你好運..!!