Ticket #12610: sample.html

File sample.html, 1.6 KB (added by Irina, 9 years ago)
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<!--
3Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
4For licensing, see LICENSE.html or http://ckeditor.com/license
5
6Copyright IBM Corp. 2010-2014  All Rights Reserved.
7-->
8
9<html xmlns="http://www.w3.org/1999/xhtml">
10<head>
11        <title>Skins - CKEditor Sample</title>
12        <meta content="text/html; charset=utf-8" http-equiv="content-type" />
13        <script type="text/javascript" src="http://nightly.ckeditor.com/full/ckeditor.js"></script>     
14        <link href="sample.css" rel="stylesheet" type="text/css" />
15</head>
16<body>
17<textarea id="editor" name="editor" rows="10" cols="80"></textarea>
18                        <script type="text/javascript">
19                        //<![CDATA[
20
21                                CKEDITOR.replace( 'editor',{
22                                        toolbar : ''
23                                });
24                                CKEDITOR.on( 'instanceReady', function( ev ) {
25                                        var editor = ev.editor;
26                                        var setstyle = false;
27                               
28                                        var style = new CKEDITOR.style( { element : 'span', styles : {'color':'rgb(255, 0, 0);' }} );
29                                       
30                                        editor.on( 'key', function(evt) {
31                                                var selection = editor.getSelection().getRanges()[0];
32                                        var parentNode = selection.endContainer.getParent();
33                                        if(parentNode.type === CKEDITOR.NODE_ELEMENT && parentNode.getName){
34                                                if(parentNode.getName() == 'span' && style.checkElementMatch(parentNode, true, editor))
35                                                                setstyle=false;
36                                                else
37                                                                setstyle=true;
38                                                        if(setstyle){
39                                                                editor.applyStyle( style );
40                                                        }
41                                        }
42                                               
43                                        }, null, null, 1);
44                                });
45       
46                        //]]>
47                        </script>
48</body>
49</html>
50
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy