| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|---|
| 2 | <!-- |
|---|
| 3 | Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. |
|---|
| 4 | For licensing, see LICENSE.html or http://ckeditor.com/license |
|---|
| 5 | --> |
|---|
| 6 | <html> |
|---|
| 7 | <head> |
|---|
| 8 | <title>Replace Textarea by Code — CKEditor Sample</title> |
|---|
| 9 | <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" /> |
|---|
| 10 | <script src="../ckeditor.js" ></script> |
|---|
| 11 | <link href="sample.css" rel="stylesheet"> |
|---|
| 12 | </head> |
|---|
| 13 | <body> |
|---|
| 14 | <h1 class="samples"> |
|---|
| 15 | <a href="index.html">CKEditor Samples</a> » Replace Textarea Elements Using JavaScript Code |
|---|
| 16 | </h1> |
|---|
| 17 | <form action="sample_posteddata.php" method="post"> <!-- accept-charset="windows-1252" --> |
|---|
| 18 | <div class="description"> |
|---|
| 19 | <p> |
|---|
| 20 | This editor is using an <code><iframe></code> element-based editing area, provided by the <strong>Wysiwygarea</strong> plugin. |
|---|
| 21 | </p> |
|---|
| 22 | <pre class="samples"> |
|---|
| 23 | |
|---|
| 24 | CKEDITOR.replace( '<em>textarea_id</em>' ) |
|---|
| 25 | </pre> |
|---|
| 26 | </div> |
|---|
| 27 | <textarea cols="80" rows="10" id="editor1" name="editor1"> |
|---|
| 28 | <p>Iteratively using the source view control over and over will cause spurious paragraph nodes containing a non-breakable space to appear in the document. Each successive cycle causes these elements to duplicate, rapidly corrupting the document</p> |
|---|
| 29 | |
|---|
| 30 | <p> |
|---|
| 31 | The issue appears related to auto-paragraphing. Only certain tags are affected, seemingly based on how they are defined within the dtd. Note that randomly generated tags such as "broken" also introduce the behavior. |
|---|
| 32 | </p> |
|---|
| 33 | |
|---|
| 34 | <p> |
|---|
| 35 | The issue is entirely absent when switching enter mode over to BR. |
|---|
| 36 | </p> |
|---|
| 37 | |
|---|
| 38 | <summary>Summary HTML5 tag, below this tag is where the horrible duplication occurs</summary> |
|---|
| 39 | |
|---|
| 40 | <broken>Fake tags (in this case "broken") also causes the issue</broken> |
|---|
| 41 | </textarea> |
|---|
| 42 | |
|---|
| 43 | <script> |
|---|
| 44 | var html5Tags = ['div', 'article','aside','bdi','details','figcaption','figure','footer','header','main','mark','menuitem','meter','nav','progress','section','summary','wbr']; |
|---|
| 45 | var extraAllowedContent = ''; |
|---|
| 46 | |
|---|
| 47 | html5Tags.forEach(function(tagName) { |
|---|
| 48 | extraAllowedContent += tagName + '[*]{*}(*);'; |
|---|
| 49 | }); |
|---|
| 50 | CKEDITOR.config.extraAllowedContent = extraAllowedContent; |
|---|
| 51 | CKEDITOR.replace( 'editor1' ); |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | </script> |
|---|
| 56 | <p> |
|---|
| 57 | <input type="submit" value="Submit"> |
|---|
| 58 | </p> |
|---|
| 59 | </form> |
|---|
| 60 | <div id="footer"> |
|---|
| 61 | <hr> |
|---|
| 62 | <p> |
|---|
| 63 | CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> |
|---|
| 64 | </p> |
|---|
| 65 | <p id="copy"> |
|---|
| 66 | Copyright © 2003-2013, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico |
|---|
| 67 | Knabben. All rights reserved. |
|---|
| 68 | </p> |
|---|
| 69 | </div> |
|---|
| 70 | </body> |
|---|
| 71 | </html> |
|---|