@@ -7,82 +7,85 @@ var OLCS = OLCS || {};
7
7
* formatting/code it spews out
8
8
*/
9
9
10
- OLCS . wysiwyg = ( function ( document , $ , undefined ) {
11
- "use strict" ;
10
+ OLCS . wysiwyg = ( function ( document , $ , undefined ) {
11
+
12
+ 'use strict' ;
12
13
13
14
return function init ( ) {
14
- OLCS . eventEmitter . on ( "render" , function ( ) {
15
- if ( typeof tinymce === "undefined" ) {
15
+
16
+ OLCS . eventEmitter . on ( 'render' , function ( ) {
17
+
18
+ if ( typeof ( tinymce ) === 'undefined' ) {
16
19
return ;
17
20
}
18
21
19
- $ ( " .tinymce" ) . each ( function ( ) {
22
+ $ ( ' .tinymce' ) . each ( function ( ) {
20
23
$ ( this ) . tinymce ( {
21
- menubar : false ,
22
- statusbar : false ,
23
- document_base_url : " ../tinymce/" ,
24
- spellchecker_languages : " +English=en_GB" ,
25
- spellchecker_language : "en_GB" ,
26
- spellchecker_rpc_url : " index.php" ,
27
- spellchecker_report_misspellings : true ,
24
+ menubar : false ,
25
+ statusbar : false ,
26
+ document_base_url : ' ../tinymce/' ,
27
+ spellchecker_languages : ' +English=en' ,
28
+ spellchecker_language : 'en' ,
29
+ spellchecker_rpc_url : ' index.php' ,
30
+ spellchecker_report_misspellings : true ,
28
31
forced_root_blocks : false ,
29
- height : 260 ,
30
- content_css : " ../tinymce/skins/lightgray/custom.css" ,
32
+ height : 260 ,
33
+ content_css : ' ../tinymce/skins/lightgray/custom.css' ,
31
34
style_formats : [
32
- { title : "Header 1" , format : "h1" } ,
33
- { title : "Header 2" , format : "h2" } ,
34
- { title : "Header 3" , format : "h3" } ,
35
+ { title : 'Header 1' , format : 'h1' } ,
36
+ { title : 'Header 2' , format : 'h2' } ,
37
+ { title : 'Header 3' , format : 'h3' }
38
+ ] ,
39
+ plugins : [
40
+ 'lists charmap' ,
41
+ 'searchreplace' ,
42
+ 'paste spellchecker'
35
43
] ,
36
- plugins : [ "lists charmap" , "searchreplace" , "paste spellchecker" ] ,
37
- paste_postprocess : function ( plugin , args ) {
38
- var elements = args . node . getElementsByTagName ( "*" ) ;
39
- for ( var i = 0 ; i < elements . length ; i ++ ) {
40
- elements [ i ] . className = "" ;
44
+ paste_postprocess : function ( plugin , args ) {
45
+ var elements = args . node . getElementsByTagName ( '*' ) ;
46
+ for ( var i = 0 ; i < elements . length ; i ++ ) {
47
+ elements [ i ] . className = '' ;
41
48
}
42
49
} ,
43
50
paste_as_text : false ,
44
- toolbar : " styleselect | bold italic underline | bullist numlist | indent outdent | spellchecker" ,
45
- init_instance_callback : function ( ) {
51
+ toolbar : ' styleselect | bold italic underline | bullist numlist | indent outdent | spellchecker' ,
52
+ init_instance_callback : function ( ) {
46
53
lockActions ( ) ;
47
54
} ,
48
- setup : function ( editor ) {
49
- editor . on ( "keyup" , function ( ) {
50
- if ( tinymce . activeEditor . getContent ( ) ) {
51
- // jshint ignore:line
55
+ setup : function ( editor ) {
56
+ editor . on ( 'keyup' , function ( ) {
57
+ if ( tinymce . activeEditor . getContent ( ) ) { // jshint ignore:line
52
58
unlockActions ( ) ;
53
59
} else {
54
60
lockActions ( ) ;
55
61
}
56
62
} ) ;
57
- } ,
63
+ }
58
64
} ) ;
59
65
60
66
// If the editor was initialised in a modal, we need to remove it
61
67
// when the modal closes
62
- OLCS . eventEmitter . on ( " hide:modal" , function ( ) {
68
+ OLCS . eventEmitter . on ( ' hide:modal' , function ( ) {
63
69
tinymce . EditorManager . editors = [ ] ; // jshint ignore:line
64
70
} ) ;
65
71
} ) ;
66
72
67
73
// Upon init, we need to lock submit buttons until something actually
68
74
// gets written into tinymce editor, to prevent issues with validation
69
75
function lockActions ( ) {
70
- $ ( ".modal" )
71
- . find ( ".govuk-button-group" )
72
- . children ( )
73
- . first ( ) // the save/submit button
74
- . addClass ( "govuk-button--disabled" )
75
- . prop ( "disabled" , true ) ;
76
+ $ ( '.modal' ) . find ( '.govuk-button-group' )
77
+ . children ( ) . first ( ) // the save/submit button
78
+ . addClass ( 'govuk-button--disabled' ) . prop ( 'disabled' , true ) ;
76
79
}
77
80
78
81
function unlockActions ( ) {
79
- $ ( ".modal" )
80
- . find ( ".govuk-button-group" )
81
- . children ( )
82
- . first ( ) // the save/submit button
83
- . removeClass ( "govuk-button--disabled" )
84
- . prop ( "disabled" , false ) ;
82
+ $ ( '.modal' ) . find ( '.govuk-button-group' )
83
+ . children ( ) . first ( ) // the save/submit button
84
+ . removeClass ( 'govuk-button--disabled' ) . prop ( 'disabled' , false ) ;
85
85
}
86
+
86
87
} ) ;
88
+
87
89
} ;
88
- } ) ( document , window . jQuery ) ;
90
+
91
+ } ( document , window . jQuery ) ) ;
0 commit comments