问题
This is the code from this question: How to use TinyMCE functions on text without actually selecting that text? - could we just have a browser/platform-compatible version of it?
tinyMCE.init({
...
setup : function(ed) {
ed.onInit.add(function(ed, evt) {
ed.getBody().setAttribute('contenteditable', false);
var range = ed.selection.dom.createRng();
range.setStartBefore(ed.getBody().firstChild);
range.setEndAfter(ed.getBody().lastChild);
ed.selection.setRng(range);
});
}
});
It works on my machine but I've found out that for some people, the text within a container that is editable by TinyMCE is not automatically all selected, although they're using recent browsers (either latest IE or one of the recent FF versions). How can we make sure it is?
来源:https://stackoverflow.com/questions/14902774/cross-browser-compatible-select-all-tinymce-text-after-initialization