Rich Text Controls: Tiny MCE 2.1.1 and Control.TextArea
Written by on May 10th, 2007 in Ajax News.
There are a couple of updates in the world of rich text controls.
Ryan Johnson has created a new control: Control.TextArea. This is a very different tool, as it isn’t about WYSIWYG functionality, but rather building toolbar based text areas that wrap simple text. It has support for functionality such as Markdown, Textile, etc. Everything can be driving from JavaScript to create your own functionality:
-
-
textarea = new Control.TextArea(’textarea_id’);
-
textarea.textarea; //refers to the DOM element ‘textarea_id’
-
textarea.observe(’change’,function(){
-
//called after the user types content, or clicks a button
-
//the change event refers to the Control.TextArea object, NOT the DOM element object
-
});
-
textarea.onChangeTimeoutLength = 500; //default value, amount to wait before firing the change callback
-
-
textarea.getValue(); //gets the contents of the whole textarea
-
textarea.getSelection(); //gets the current selection as a string
-
textarea.replaceSelection(’my new text’); //repalce the current selection with this text
-
textarea.wrapSelection(’before text’,'after text’); //wrap the current selection with these two strings
-
textarea.insertBeforeSelection(’before text’); //inserts the string before the current selection
-
textarea.insertAfterSelection(’after text’); //inserts the string after the current selection
-
textarea.insertBeforeEachSelectedLine(’> ‘); //inserts the string before each selected line
-
textarea.injectEachSelectedLine(function(lines,line){ //works just like Hash.inject() for each selected line
-
lines.push(line); //this logic won’t modify the selection, but you can modify each line here
-
return lines;
-
});
-
TinyMCE has a new 2.2.1 release, that has update such as:
- Fixed problem where TinyMCE failed to initialized if used together
with libraries like Scriptaculous. - Fixed various problems with the media plugin, now easier to embed
Youtube/Googlevideo. - Fixed so store/restore selection logic works in Opera and Safari
(Nightly). - Cleaned up the source code by removing some obsolete code.
- Removed debug option, no longer needed since the devkit does it better.
- Removed old IE 5.0 code and reduced the overall code by using smarter
prototype add methods.
Source: Ajaxian
Original Article: http://ajaxian.com/archives/rich-text-controls-tiny-mce-211-and-controltextarea