I have a question on a javascript i need to loop through user selection(highlighted text) and change the text direction from trl or ltr . here what i did :
this._execCom("FormatBlock", <div> );
var node = null;
if (this.area.contentWindow.getSelection) {
node = this.area.contentWindow.getSelection().anchorNode.parentNode;
}
else if (this.area.contentWindow.document.selection) {
var range = this.area.contentWindow.document.selection.createRange();
if (range) {
node = range.parentElement();
}
var walker=this.area.contentWindow.document.createTreeWalker(node, NodeFilter.SHOW_ELEMENT, null, false);
while (walker.nextNode())
{
x=walker.currentNode.tagName;
if( x == DIV )
walker.currentNode.style.direction="ltr";
}
这就改变了所有四舍五入者的方向,即使这些四舍五入到突出案文中,而且我只需要改动用户选择。
请帮助我。
很多人