Created
December 28, 2010 23:49
-
-
Save binnyg/757924 to your computer and use it in GitHub Desktop.
YUI RTE BUG
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> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<title>Simple Editor — Advanced Buttons</title> | |
<style type="text/css"> | |
/*margin and padding on body element | |
can introduce errors in determining | |
element position and are not recommended; | |
we turn them off as a foundation for YUI | |
CSS treatments. */ | |
body { | |
margin:0; | |
padding:0; | |
} | |
</style> | |
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.2r1/build/fonts/fonts-min.css" /> | |
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.2r1/build/menu/assets/skins/sam/menu.css" /> | |
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.2r1/build/button/assets/skins/sam/button.css" /> | |
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.2r1/build/editor/assets/skins/sam/simpleeditor.css" /> | |
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.2r1/build/yahoo-dom-event/yahoo-dom-event.js"></script> | |
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.2r1/build/element/element-min.js"></script> | |
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.2r1/build/container/container_core-min.js"></script> | |
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.2r1/build/menu/menu-min.js"></script> | |
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.2r1/build/button/button-min.js"></script> | |
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.2r1/build/editor/simpleeditor.js"></script> | |
<!--there is no custom header content for this example--> | |
</head> | |
<body class="yui-skin-sam"> | |
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== --> | |
<form method="post" action="#" id="form1"> | |
<br/> | |
<a href="javascript:copyText()" style="margin-left:10px;font-weight:bold;font-size:15px;">Copy the input</a> | |
<br/> | |
<h1>This is the input</h1> | |
<textarea id="editor-clone" name="editor-clone" rows="5" cols="100"><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/4WGj-oq7g34?fs=1&hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"/><embed src="http://www.youtube.com/v/4WGj-oq7g34?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object></textarea> | |
<h1>This is the YUI editor which has the issue</h1> | |
<h4>Inspect the contents with firebug</h4> | |
<textarea id="editor" name="editor" rows="10" cols="75"> | |
This is some more test text.<br>This is some more test text.<br>This is some more test text.<br>This is some more test text. | |
</textarea> | |
<h1>This retains the value</h1> | |
<textarea id="normal-ta"></textarea> | |
</form> | |
<h1>Looses closing tag too but it works (Div tag)</h1> | |
<div id="testing-xml"></div> | |
<script> | |
var myEditor; | |
var initrte = function() { | |
var Dom = YAHOO.util.Dom, | |
Event = YAHOO.util.Event; | |
var myConfig = { | |
height: '100px', | |
width: '600px', | |
dompath: true, | |
focusAtStart: true | |
}; | |
YAHOO.log('Create the Editor..', 'info', 'example'); | |
myEditor = new YAHOO.widget.SimpleEditor('editor', myConfig); | |
myEditor._defaultToolbar.buttonType = 'advanced'; | |
myEditor.render(); | |
}; | |
function copyText() { | |
var clone = YAHOO.util.Dom.get("editor-clone"); | |
myEditor._getDoc().body.innerHTML = clone.value; | |
YAHOO.util.Dom.get('testing-xml').innerHTML = clone.value; | |
YAHOO.util.Dom.get('normal-ta').innerHTML = clone.value; | |
} | |
initrte(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment