diff options
Diffstat (limited to 'sources/plugins/liststyle/plugin.js')
-rw-r--r-- | sources/plugins/liststyle/plugin.js | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/sources/plugins/liststyle/plugin.js b/sources/plugins/liststyle/plugin.js new file mode 100644 index 0000000..1394996 --- /dev/null +++ b/sources/plugins/liststyle/plugin.js | |||
@@ -0,0 +1,69 @@ | |||
1 | /** | ||
2 | * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. | ||
3 | * For licensing, see LICENSE.md or http://ckeditor.com/license | ||
4 | */ | ||
5 | |||
6 | ( function() { | ||
7 | CKEDITOR.plugins.liststyle = { | ||
8 | requires: 'dialog,contextmenu', | ||
9 | // jscs:disable maximumLineLength | ||
10 | lang: 'af,ar,bg,bn,bs,ca,cs,cy,da,de,de-ch,el,en,en-au,en-ca,en-gb,eo,es,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn', // %REMOVE_LINE_CORE% | ||
11 | // jscs:enable maximumLineLength | ||
12 | init: function( editor ) { | ||
13 | if ( editor.blockless ) | ||
14 | return; | ||
15 | |||
16 | var def, cmd; | ||
17 | |||
18 | def = new CKEDITOR.dialogCommand( 'numberedListStyle', { | ||
19 | requiredContent: 'ol', | ||
20 | allowedContent: 'ol{list-style-type}[start]' | ||
21 | } ); | ||
22 | cmd = editor.addCommand( 'numberedListStyle', def ); | ||
23 | editor.addFeature( cmd ); | ||
24 | CKEDITOR.dialog.add( 'numberedListStyle', this.path + 'dialogs/liststyle.js' ); | ||
25 | |||
26 | def = new CKEDITOR.dialogCommand( 'bulletedListStyle', { | ||
27 | requiredContent: 'ul', | ||
28 | allowedContent: 'ul{list-style-type}' | ||
29 | } ); | ||
30 | cmd = editor.addCommand( 'bulletedListStyle', def ); | ||
31 | editor.addFeature( cmd ); | ||
32 | CKEDITOR.dialog.add( 'bulletedListStyle', this.path + 'dialogs/liststyle.js' ); | ||
33 | |||
34 | //Register map group; | ||
35 | editor.addMenuGroup( 'list', 108 ); | ||
36 | |||
37 | editor.addMenuItems( { | ||
38 | numberedlist: { | ||
39 | label: editor.lang.liststyle.numberedTitle, | ||
40 | group: 'list', | ||
41 | command: 'numberedListStyle' | ||
42 | }, | ||
43 | bulletedlist: { | ||
44 | label: editor.lang.liststyle.bulletedTitle, | ||
45 | group: 'list', | ||
46 | command: 'bulletedListStyle' | ||
47 | } | ||
48 | } ); | ||
49 | |||
50 | editor.contextMenu.addListener( function( element ) { | ||
51 | if ( !element || element.isReadOnly() ) | ||
52 | return null; | ||
53 | |||
54 | while ( element ) { | ||
55 | var name = element.getName(); | ||
56 | if ( name == 'ol' ) | ||
57 | return { numberedlist: CKEDITOR.TRISTATE_OFF }; | ||
58 | else if ( name == 'ul' ) | ||
59 | return { bulletedlist: CKEDITOR.TRISTATE_OFF }; | ||
60 | |||
61 | element = element.getParent(); | ||
62 | } | ||
63 | return null; | ||
64 | } ); | ||
65 | } | ||
66 | }; | ||
67 | |||
68 | CKEDITOR.plugins.add( 'liststyle', CKEDITOR.plugins.liststyle ); | ||
69 | } )(); | ||