The Gallery is deprecated. No new Gallery components may be submitted, and modifying existing components is disabled. For more information please read the Gallery Deprecation blog post. This is a static snapshot of the Gallery for archive purposes.
See 2 more by this user. Created: 06/11/10
Last CDN Push: 09/22/10
Build Tag: gallery-2010.09.22-20-15
Project: YUI 3
License: YUI BSD
YUI Version: 3.2.0
Free for use.
This module provides a YUI plugin that could be added to input boxes and small textareas, so that when a user types Arabic or Hebrew text inside a left-to-right text input box, the direction would automatically switch to right-to-left. This is required in order to make bidirectional text readable.
Since this plugin uses gallery-node-setdir, a "directionChange" event would be fired anytime the direction of the text input box changes.
Notes:
The following code sample creates an input box, plugs in the functionality, and watches the event fired when the direction changes based on user input.
<script src="http://yui.yahooapis.com/3.2.0/build/yui/yui-min.js"></script>
YUI({
//Last Gallery Build of this module
gallery: 'gallery-2010.09.22-20-15'
}).use("gallery-bidi-textinput", "node-pluginhost", function(Y) {
Y.one("html").append("<input style='position:absolute;width:40%;left:10%' type='text' class='autobidi'>");
Y.all("input.autobidi").plug(Y.Plugin.BidiTextEntry);
Y.on("directionChange", function (e) {
Y.log('bidi: direction switch happened. dir:'+e.dir+', target:'+e.target);
});
});
All code on this site is licensed under the BSD License unless stated otherwise.