| Total Complexity | 3 |
| Complexity/F | 1.5 |
| Lines of Code | 31 |
| Function Count | 2 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | /* global tinyMCE */ |
||
| 2 | wp.customize.controlConstructor['kirki-editor'] = wp.customize.kirkiDynamicControl.extend({ |
||
| 3 | |||
| 4 | initKirkiControl: function() { |
||
| 5 | |||
| 6 | var control = this, |
||
| 7 | element = control.container.find( 'textarea' ), |
||
| 8 | id = 'kirki-editor-' + control.id.replace( '[', '' ).replace( ']', '' ), |
||
| 9 | editor; |
||
| 10 | |||
| 11 | wp.editor.initialize( id, { |
||
| 12 | tinymce: { |
||
| 13 | wpautop: true |
||
| 14 | }, |
||
| 15 | quicktags: true, |
||
| 16 | mediaButtons: true |
||
| 17 | }); |
||
| 18 | |||
| 19 | editor = tinyMCE.get( id ); |
||
| 20 | |||
| 21 | if ( editor ) { |
||
| 22 | editor.onChange.add( function( ed ) { |
||
| 23 | var content; |
||
| 24 | |||
| 25 | ed.save(); |
||
| 26 | content = editor.getContent(); |
||
| 27 | element.val( content ).trigger( 'change' ); |
||
| 28 | wp.customize.instance( control.id ).set( content ); |
||
| 29 | }); |
||
| 30 | } |
||
| 31 | } |
||
| 32 | }); |
||
| 33 |