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
//Regex to strip the HTML tags from a string | |
var stripHTML = /<\S[^><]*>/g; | |
//Get the HTML from the Editor, assuming myEditor is your Editor reference | |
var html = myEditor.saveHTML(); | |
//Remove the HTML tags from the returned string | |
var text = html.replace(stripHTML, ''); | |
//Get the word count from the text string |
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
//Snippet from event-debug.js | |
_worker = function(delegateKey, e, el) { | |
var target = resolveTextNode((e.target || e.srcElement)), | |
tests = delegates[delegateKey], | |
spec, | |
ename, | |
elements, | |
nElements, |
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
(function() { | |
var Dom = YAHOO.util.Dom, | |
Event = YAHOO.util.Event; | |
var myEditor = new YAHOO.widget.Editor('editor', { | |
height: '300px', | |
width: '600px', | |
dompath: true, | |
//Hide all the images in the document. | |
extracss: 'img { display: none; }', |
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
YUI().use('node', function(Y) { | |
var node = Y.Node.create('<div id="hasalink"><a class="blah" href="#">my link!</a></div>'); | |
node.query('.blah').on('click', function(e) { | |
//do domething | |
e.preventDefault(); | |
}); | |
Y.get('#parent').appendChild(node); | |
}); |
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
myEditor.on('windowRender', function() { | |
myEditor.get('panel').cfg.setProperty('fixedcenter', true); | |
}); |
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
//Get the HTML from the Editor | |
var html = myEditor.saveHTML(), | |
//Filter the URL | |
url = myEditor._baseHREF.replace(/\//gi, '\\/'), | |
//Create a RegEx object from the URL | |
re = new RegExp('href="' + url, 'gi'); | |
//Replace the HTML | |
html = html.replace(re, 'href="'); |
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
YUI.add('my-examples', function(Y) { | |
Y.namespace('MyNamespace'); | |
Y.MyNamespace.MyClass = function() { | |
Y.MyNamespace.MyClass.superclass.constructor.apply(this, arguments); | |
}; | |
Y.MyNamespace.MyClass.NAME = "myClass"; | |
Y.MyNamespace.MyClass.ATTRS = { | |
myAttribute: { | |
value: "defaultValue" |
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<title>Event Bubbling</title> | |
</head> | |
<body> | |
<script src="http://yui.yahooapis.com/3.0.0b1/build/yui/yui-min.js" type="text/javascript"></script> | |
<script> | |
YUI().use('event', 'base', function(Y) { |
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<title>Event Bubbling</title> | |
</head> | |
<body> | |
<script src="http://yui.yahooapis.com/3.0.0b1/build/yui/yui-min.js" type="text/javascript"></script> | |
<script> | |
YUI().use('event', 'base', function(Y) { |
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
//Add this after you include simpleeditor.js but before you call new YAHOO.widget.SimpleEditor | |
YAHOO.widget.SimpleEditor.prototype._handleCreateLinkClink = function() { | |
if (this.get('limitCommands')) { | |
if (!this.toolbar.getButtonByValue('createlink')) { | |
YAHOO.log('Toolbar Button for (createlink) was not found, skipping exec.', 'info', 'SimpleEditor'); | |
return false; | |
} | |
} |