Skip to content

Commit

Permalink
initial steps to make _setTextDirAttr() method in _BidiSupport.js, ba…
Browse files Browse the repository at this point in the history
…sed on setTextDirAttr_in_BidiSupport1.patch from Alex Shensis (IBM, CCLA), refs #15739 !strict.

git-svn-id: http://svn.dojotoolkit.org/src/dijit/trunk@29557 560b804f-0ae3-0310-86f3-f6aa0a117693
  • Loading branch information
wkeese committed Aug 26, 2012
1 parent 33a398f commit f340b66
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 35 deletions.
17 changes: 1 addition & 16 deletions InlineEditBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -633,25 +633,10 @@ define([
this.defer("onCancel"); // defer prevents browser freeze for long-running event handlers

this._showText(focus);
},

_setTextDirAttr: function(/*String*/ textDir){
// summary:
// Setter for textDir.
// description:
// Users shouldn't call this function; they should be calling
// set('textDir', value)
// tags:
// private
if(!this._created || this.textDir != textDir){
this._set("textDir", textDir);
this.applyTextDir(this.displayNode, this.displayNode.innerText);
this.displayNode.align = this.dir == "rtl" ? "right" : "left"; //fix the text alignment
}
}
});

InlineEditBox._InlineEditor = InlineEditor; // for monkey patching

return InlineEditBox;
});
});
23 changes: 23 additions & 0 deletions _BidiSupport.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,29 @@ define(["./_WidgetBase"], function(_WidgetBase){
delete origObj.originalText;
}
return origObj;
},

_setTextDirAttr: function(/*String*/ textDir){
// summary:
// Setter for textDir.
// description:
// Users shouldn't call this function; they should be calling
// set('textDir', value)
if(!this._created || this.textDir != textDir){
this._set("textDir", textDir);
var node = null;
if(this.displayNode){
node = this.displayNode;
value = this.displayNode.textContent || this.displayNode.innerText || "";
this.displayNode.align = this.dir == "rtl" ? "right" : "left";
}else if(this.textbox){
node = this.textbox;
value = this.textbox.value
}
if(node){
this.applyTextDir(node, value);
}
}
}
});

Expand Down
19 changes: 0 additions & 19 deletions form/_TextBoxMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,25 +427,6 @@ var _TextBoxMixin = declare("dijit.form._TextBoxMixin", null, {
// Additionally resets the displayed textbox value to ''
this.textbox.value = '';
this.inherited(arguments);
},

_setTextDirAttr: function(/*String*/ textDir){
// summary:
// Setter for textDir.
// description:
// Users shouldn't call this function; they should be calling
// set('textDir', value)
// tags:
// private

// only if new textDir is different from the old one
// and on widgets creation.
if(!this._created
|| this.textDir != textDir){
this._set("textDir", textDir);
// so the change of the textDir will take place immediately.
this.applyTextDir(this.focusNode, this.focusNode.value);
}
}
});

Expand Down

0 comments on commit f340b66

Please sign in to comment.