diff options
Diffstat (limited to 'sources/plugins/liststyle/plugin.js')
-rw-r--r-- | sources/plugins/liststyle/plugin.js | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/sources/plugins/liststyle/plugin.js b/sources/plugins/liststyle/plugin.js new file mode 100644 index 0000000..2d94142 --- /dev/null +++ b/sources/plugins/liststyle/plugin.js | |||
@@ -0,0 +1,75 @@ | |||
1 | /** | ||
2 | * @license Copyright (c) 2003-2017, 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,az,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,oc,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]; li{list-style-type}[value]', | ||
21 | contentTransformations: [ | ||
22 | [ 'ol: listTypeToStyle' ] | ||
23 | ] | ||
24 | } ); | ||
25 | cmd = editor.addCommand( 'numberedListStyle', def ); | ||
26 | editor.addFeature( cmd ); | ||
27 | CKEDITOR.dialog.add( 'numberedListStyle', this.path + 'dialogs/liststyle.js' ); | ||
28 | |||
29 | def = new CKEDITOR.dialogCommand( 'bulletedListStyle', { | ||
30 | requiredContent: 'ul', | ||
31 | allowedContent: 'ul{list-style-type}', | ||
32 | contentTransformations: [ | ||
33 | [ 'ul: listTypeToStyle' ] | ||
34 | ] | ||
35 | } ); | ||
36 | cmd = editor.addCommand( 'bulletedListStyle', def ); | ||
37 | editor.addFeature( cmd ); | ||
38 | CKEDITOR.dialog.add( 'bulletedListStyle', this.path + 'dialogs/liststyle.js' ); | ||
39 | |||
40 | //Register map group; | ||
41 | editor.addMenuGroup( 'list', 108 ); | ||
42 | |||
43 | editor.addMenuItems( { | ||
44 | numberedlist: { | ||
45 | label: editor.lang.liststyle.numberedTitle, | ||
46 | group: 'list', | ||
47 | command: 'numberedListStyle' | ||
48 | }, | ||
49 | bulletedlist: { | ||
50 | label: editor.lang.liststyle.bulletedTitle, | ||
51 | group: 'list', | ||
52 | command: 'bulletedListStyle' | ||
53 | } | ||
54 | } ); | ||
55 | |||
56 | editor.contextMenu.addListener( function( element ) { | ||
57 | if ( !element || element.isReadOnly() ) | ||
58 | return null; | ||
59 | |||
60 | while ( element ) { | ||
61 | var name = element.getName(); | ||
62 | if ( name == 'ol' ) | ||
63 | return { numberedlist: CKEDITOR.TRISTATE_OFF }; | ||
64 | else if ( name == 'ul' ) | ||
65 | return { bulletedlist: CKEDITOR.TRISTATE_OFF }; | ||
66 | |||
67 | element = element.getParent(); | ||
68 | } | ||
69 | return null; | ||
70 | } ); | ||
71 | } | ||
72 | }; | ||
73 | |||
74 | CKEDITOR.plugins.add( 'liststyle', CKEDITOR.plugins.liststyle ); | ||
75 | } )(); | ||