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:

JAVASCRIPT:

  1.  
  2. textarea = new Control.TextArea(’textarea_id’);
  3. textarea.textarea; //refers to the DOM element ‘textarea_id’
  4. textarea.observe(’change’,function(){
  5.     //called after the user types content, or clicks a button
  6.     //the change event refers to the Control.TextArea object, NOT the DOM element object
  7. });
  8. textarea.onChangeTimeoutLength = 500; //default value, amount to wait before firing the change callback
  9.  
  10. textarea.getValue(); //gets the contents of the whole textarea
  11. textarea.getSelection(); //gets the current selection as a string
  12. textarea.replaceSelection(’my new text’); //repalce the current selection with this text
  13. textarea.wrapSelection(’before text’,'after text’); //wrap the current selection with these two strings
  14. textarea.insertBeforeSelection(’before text’); //inserts the string before the current selection
  15. textarea.insertAfterSelection(’after text’); //inserts the string after the current selection
  16. textarea.insertBeforeEachSelectedLine(’> ‘); //inserts the string before each selected line
  17. textarea.injectEachSelectedLine(function(lines,line){ //works just like Hash.inject() for each selected line
  18.     lines.push(line); //this logic won’t modify the selection, but you can modify each line here
  19.     return lines;
  20. });
  21.  

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

Leave a Reply

You must be logged in to post a comment.



Site Navigation