Created
April 1, 2009 02:31
-
-
Save davglass/88511 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This example shows how to programatically create a link inside the | |
* YUI Rich Text Editor. | |
*/ | |
var myEditor; //Editor Reference | |
//Focus the window first | |
myEditor.focus(); | |
//Fire the execCommand | |
myEditor.execCommand('createlink', ''); | |
//Now if we need a default URL: | |
myEditor.currentElement[0].href = 'http://foo.com/'; | |
//Now we fire the event's to open the window. | |
myEditor.toolbar.fireEvent('createlinkClick', { type: 'createlinkClick', target: myEditor.toolbar }); | |
myEditor.fireEvent('afterExecCommand', { type: 'afterExecCommand', target: myEditor }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment