PluginProbe
Customify / 1.5.3
Customify v1.5.3
2.10.9 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.7.1 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.6.0 1.6.0.1 1.6.5 1.7.0 1.7.1 All 77 releases
customify / js / live_css_editor.js

live_css_editor.js in Customify 1.5.3, at js/live_css_editor.js

40 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function($, exports){
2
3 var timeout = null;
4
5 $(document).ready(function(){
6 var api = wp.customize;
7 if ( $('#css_editor').length < 1 ) {
8 return ;
9 }
10 var css_editor = ace.edit("css_editor");
11 css_editor.$blockScrolling = Infinity;
12
13 // init the ace editor
14 css_editor.setTheme("ace/theme/github");
15 css_editor.getSession().setMode("ace/mode/css");
16
17 // hide the textarea and enable the ace editor
18 var textarea = $('#css_editor_textarea').hide();
19 css_editor.getSession().setValue(textarea.val());
20
21 var customizer_overlay = $('.wp-full-overlay');
22
23 // open the ace editor section when we click on the panel
24 $('#accordion-section-live_css_edit_section').on('click', function(){
25 customizer_overlay.addClass('editor_opened');
26 });
27
28 $(document).on('click', '.customize-section-back', function(){
29 customizer_overlay.removeClass('editor_opened');
30 });
31
32 // each time a change is triggered also make those edits in the preview
33 css_editor.getSession().on('change', function(e) {
34 textarea.val(css_editor.getSession().getValue());
35 textarea.trigger('change');
36 });
37
38 });
39 })(jQuery, window);
40