| 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-2012, CKSource - Frederico Knabben. All rights reserved. |
|---|
| 4 | For licensing, see LICENSE.html or http://ckeditor.com/license |
|---|
| 5 | --> |
|---|
| 6 | <html xmlns="http://www.w3.org/1999/xhtml"> |
|---|
| 7 | <head> |
|---|
| 8 | <title>Replace Textarea by Code — CKEditor Sample</title> |
|---|
| 9 | <meta content="text/html; charset=utf-8" http-equiv="content-type" /> |
|---|
| 10 | <script type="text/javascript" src="http://ckeditor.com/apps/ckeditor/3.6.5/ckeditor.js"></script> |
|---|
| 11 | </head> |
|---|
| 12 | <body> |
|---|
| 13 | <textarea rows="8" id="my-editor" cols="80"> |
|---|
| 14 | <p class="Kuvateksti element-has-class">Test</p> |
|---|
| 15 | <table class="Testitaulukko element-has-class"> |
|---|
| 16 | <tbody><tr><td>I'm a table</td></tr></tbody> |
|---|
| 17 | </table> |
|---|
| 18 | <ul class="Testilista-ul element-has-class"><li><ul><li><ul><li>I'm very nested.</li></ul></li></ul></li></ul> |
|---|
| 19 | |
|---|
| 20 | <table class="element-has-class"> |
|---|
| 21 | <tbody><tr><td>I'm a table</td></tr></tbody> |
|---|
| 22 | </table> |
|---|
| 23 | |
|---|
| 24 | <p> This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p> |
|---|
| 25 | |
|---|
| 26 | </textarea> |
|---|
| 27 | <script> |
|---|
| 28 | window.x = CKEDITOR.editor.replace('my-editor', { |
|---|
| 29 | skin : 'office2003', |
|---|
| 30 | stylesSet: [ |
|---|
| 31 | // Block example |
|---|
| 32 | { name: 'Kuvateksti', element: 'p', attributes: { 'class': 'Kuvateksti element-has-class'} }, |
|---|
| 33 | // Inline example |
|---|
| 34 | { name: 'Huomiovari', element: 'span', attributes: { 'class':'Huomiovari element-has-class' } } |
|---|
| 35 | // From DB |
|---|
| 36 | ,{ name : 'Testitaulukko2', element : 'table', attributes : { 'class':'element-has-class'} } |
|---|
| 37 | ,{ name : 'Testitaulukko', element : 'table', attributes : { 'class':'Testitaulukko element-has-class'} } |
|---|
| 38 | ,{ name : 'Testilista-ul', element : 'ul', attributes : { 'class':'Testilista-ul element-has-class'} } |
|---|
| 39 | ,{ name : 'Testilista-ol', element : 'ol', attributes : { 'class':'Testilista-ol element-has-class'} } |
|---|
| 40 | ,{ name: 'Custom anchor', element: 'a', styles: { 'line-height': '18px', color: 'red' } } |
|---|
| 41 | ] |
|---|
| 42 | }); |
|---|
| 43 | window.x.addCss( '.element-has-class{ background-color: #eee; border: 3px solid purple; color:red; }' ); |
|---|
| 44 | </script> |
|---|
| 45 | </body> |
|---|
| 46 | </html> |
|---|