Cross-browser compatible select all TinyMCE text after initialization

只愿长相守 提交于 2019-12-24 08:57:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!