1 | <!DOCTYPE html> |
---|
2 | <!-- |
---|
3 | Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. |
---|
4 | For licensing, see LICENSE.md or http://ckeditor.com/license |
---|
5 | --> |
---|
6 | <html> |
---|
7 | <head> |
---|
8 | <meta charset="utf-8"> |
---|
9 | <title>#11490</title> |
---|
10 | <script src="../ckeditor.js"></script> |
---|
11 | <link href="sample.css" rel="stylesheet"> |
---|
12 | </head> |
---|
13 | <body> |
---|
14 | <h1 class="samples">#11490</h1> |
---|
15 | <form action="sample_posteddata.php" method="post"> |
---|
16 | </div> |
---|
17 | <textarea cols="80" id="editor1" name="editor1" rows="10"> |
---|
18 | <p>Foo</p> |
---|
19 | </textarea> |
---|
20 | <script> |
---|
21 | |
---|
22 | ( function() { |
---|
23 | |
---|
24 | var allowedContent = 'kbd;cite', |
---|
25 | requiredContent = 'kbd;cite'; |
---|
26 | |
---|
27 | CKEDITOR.plugins.add( 'test', { |
---|
28 | requires: 'menubutton', |
---|
29 | icons: 'test', // %REMOVE_LINE_CORE% |
---|
30 | |
---|
31 | init: function( editor ) { |
---|
32 | var plugin = this, |
---|
33 | items = {}; |
---|
34 | |
---|
35 | // Remove language indicator button. |
---|
36 | items.test_kbd = { |
---|
37 | label: 'Insert kbd', |
---|
38 | group: 'test', |
---|
39 | state: CKEDITOR.TRISTATE_DISABLED, |
---|
40 | order: items.length, |
---|
41 | onClick: function() { |
---|
42 | editor.insertHtml('<kbd>Test kbd</kbd>'); |
---|
43 | } |
---|
44 | }; |
---|
45 | |
---|
46 | // Remove language indicator button. |
---|
47 | items.test_cite = { |
---|
48 | label: 'Insert cite', |
---|
49 | group: 'test', |
---|
50 | state: CKEDITOR.TRISTATE_DISABLED, |
---|
51 | order: items.length, |
---|
52 | onClick: function() { |
---|
53 | editor.insertHtml('<cite>Test cite</cite>'); |
---|
54 | } |
---|
55 | }; |
---|
56 | |
---|
57 | // Initialize groups for menu. |
---|
58 | editor.addMenuGroup( 'test', 1 ); |
---|
59 | editor.addMenuItems( items ); |
---|
60 | |
---|
61 | editor.ui.add( 'Test', CKEDITOR.UI_MENUBUTTON, { |
---|
62 | label: 'Test', |
---|
63 | // MenuButtons do not (yet) has toFeature method, so we cannot do this: |
---|
64 | // toFeature: function( editor ) { return editor.getCommand( 'test' ); } |
---|
65 | // Set feature's properties directly on button. |
---|
66 | allowedContent: allowedContent, |
---|
67 | requiredContent: requiredContent, |
---|
68 | toolbar: 'bidi,30', |
---|
69 | modes : { wysiwyg: 1, source: 1 }, |
---|
70 | onMenu: function() { |
---|
71 | var activeItems = {}; |
---|
72 | |
---|
73 | for ( var prop in items ) |
---|
74 | activeItems[ prop ] = CKEDITOR.TRISTATE_ON; |
---|
75 | |
---|
76 | return activeItems; |
---|
77 | } |
---|
78 | } ); |
---|
79 | } |
---|
80 | } ); |
---|
81 | } )(); |
---|
82 | |
---|
83 | CKEDITOR.replace( 'editor1', { extraPlugins: 'test', toolbar: [ [ 'Language', 'Test', 'Source' ] ] } ); |
---|
84 | |
---|
85 | </script> |
---|
86 | <p> |
---|
87 | <input type="submit" value="Submit"> |
---|
88 | </p> |
---|
89 | </form> |
---|
90 | </body> |
---|
91 | </html> |
---|