| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|---|
| 2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
|---|
| 3 | <head> |
|---|
| 4 | <title>API Usage — CKEditor Sample</title> |
|---|
| 5 | <meta content="text/html; charset=utf-8" http-equiv="content-type" /> |
|---|
| 6 | <script type="text/javascript" src="../ckeditor_source.js"></script> |
|---|
| 7 | <script type="text/javascript"> |
|---|
| 8 | //<![CDATA[ |
|---|
| 9 | |
|---|
| 10 | var nId = 1; |
|---|
| 11 | function createSpellCheckSpan(oEditor, sHtmlToken) { |
|---|
| 12 | if (null == sHtmlToken) |
|---|
| 13 | return; |
|---|
| 14 | |
|---|
| 15 | var sHtmlSpan = ["<span id ='DDSPELLCHECK", nId++, "' ></span>"].join(""); |
|---|
| 16 | var elementSpan = oEditor.document.$.createElement(sHtmlSpan); |
|---|
| 17 | elementSpan.innerHTML = sHtmlToken; |
|---|
| 18 | return elementSpan; |
|---|
| 19 | } |
|---|
| 20 | |
|---|
| 21 | function InsertSpan() |
|---|
| 22 | { |
|---|
| 23 | // Get the editor instance that we want to interact with. |
|---|
| 24 | var oEditor = CKEDITOR.instances.editor1; |
|---|
| 25 | var oFreeText = oEditor.document.$.getElementById('freetext'); |
|---|
| 26 | var range = oEditor.document.$.selection.createRange(); |
|---|
| 27 | if (range.text.length <= 0) return; |
|---|
| 28 | |
|---|
| 29 | var elementSpan = createSpellCheckSpan(oEditor, range.htmlText); |
|---|
| 30 | elementSpan && range.pasteHTML(elementSpan.outerHTML); |
|---|
| 31 | } |
|---|
| 32 | //]]> |
|---|
| 33 | </script> |
|---|
| 34 | |
|---|
| 35 | </head> |
|---|
| 36 | <body> |
|---|
| 37 | <h3>Bug 1</h3> |
|---|
| 38 | <p>Invalid argument. selection/plugin.js line 775 |
|---|
| 39 | <ul> |
|---|
| 40 | <li>Press "Select All" or Ctrl + A</li> |
|---|
| 41 | <li>Press "Insert Span" button</li> |
|---|
| 42 | </ul> |
|---|
| 43 | <h3>Bug 2</h3> |
|---|
| 44 | <p>Invalid argument. core/dom/node.js line 240 |
|---|
| 45 | <ul> |
|---|
| 46 | <li>Select word "This" (using arrow keys, to make sure that surrounding white characters are not selected)</li> |
|---|
| 47 | <li>Press "Insert Span" button</li> |
|---|
| 48 | </ul> |
|---|
| 49 | <form action="sample_posteddata.php" method="post"> |
|---|
| 50 | <textarea cols="100" id="editor1" name="editor1" rows="10"> |
|---|
| 51 | <div id="freetext">This <br /><br /> is</div> |
|---|
| 52 | </textarea> |
|---|
| 53 | |
|---|
| 54 | <script type="text/javascript"> |
|---|
| 55 | //<![CDATA[ |
|---|
| 56 | // Replace the <textarea id="editor1"> with an CKEditor instance. |
|---|
| 57 | var editor = CKEDITOR.replace( 'editor1', { enterMode : CKEDITOR.ENTER_BR } ); |
|---|
| 58 | //]]> |
|---|
| 59 | </script> |
|---|
| 60 | <div id="eButtons"> |
|---|
| 61 | <input onclick="InsertSpan();" type="button" value="Insert Span" /> |
|---|
| 62 | </div> |
|---|
| 63 | </form> |
|---|
| 64 | </body> |
|---|
| 65 | </html> |
|---|