ckeditor - editor.getSelection().getRanges()[0] don't return the same result in IE11 -
i have been looking issue few hours , can't find way fix it. using ckeditor 4.3
(also try 4.5) custom colour picker change font colour.
all work in chrome
, firefox
, opera
, safari
yet not in ie
. problem come
editor.getselection().getranges()[0].startcontainer
which gave me span
in chrome want , p
in ie
1 level high.
here litle exemple :
_me.editor.focus(); var range = _me.editor.getselection().getranges()[0]; addlinkcolor(range.startcontainer, value.value); var addlinkcolor = function (element, color) { var selectedchild = null; if (element.getchildren) { selectedchild = element.getchildren(); } if (selectedchild) { if (selectedchild.count) { (var = 0; < selectedchild.count() ; i++) { var childelement = selectedchild.getitem(i); if (childelement.getstyle && childelement.getstyle('color') != '' && childelement.getstyle('color') != color) childelement.setstyle('color',` color); if (childelement.getchildcount && childelement.getchildcount() > 0) addlinkcolor(childelement, color); if (element.$.tagname == 'a') element.setstyle('color', color); } } } };
any other face same issue?
i have tried variant of startcontainer
gave dom element, commonancestor , such still same problem.
selection behaves differently in different browsers, because there's no specification platforms behave differently in general. long results reflect real position of selection fine. that's nothing surprising , nothing worry about. problem need handle different selections , makes creating editor hard. therefore, ckeditor api contains many tools simplify job.
Comments
Post a Comment