Changeset 2675077
- Timestamp:
- 02/08/2022 02:34:02 PM (4 years ago)
- Location:
- codeless-page-builder/trunk
- Files:
-
- 11 edited
-
README.txt (modified) (1 diff)
-
assets/css/kirki-styles.css (modified) (2 diffs)
-
assets/js/cl-builder.js (modified) (2 diffs)
-
assets/js/cl-customize-pane.js (modified) (3 diffs)
-
assets/js/kirki-new.js (modified) (12 diffs)
-
config/cl-page-elements.php (modified) (2 diffs)
-
include/core/cl-builder-base.php (modified) (3 diffs)
-
include/core/cl-kirki-setup.php (modified) (4 diffs)
-
include/core/kirki-setup/codeless_controls.php (modified) (1 diff)
-
include/core/kirki-setup/codeless_custom_panel.php (modified) (1 diff)
-
include/core/kirki-setup/codeless_custom_section.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
codeless-page-builder/trunk/README.txt
r2250484 r2675077 9 9 Tested up to: 5.3.2 10 10 Requires PHP: 7.0 11 Stable tag: 1. 012 Version: 1. 011 Stable tag: 1.1.0 12 Version: 1.1.0 13 13 License: GPLv2 or later 14 14 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
codeless-page-builder/trunk/assets/css/kirki-styles.css
r2250479 r2675077 36 36 } 37 37 38 .customize-control-kirki- select > label{38 .customize-control-kirki-react-select > label{ 39 39 display:flex; 40 40 align-items:center; 41 41 } 42 42 43 .customize-control-kirki- select .customize-control-title{43 .customize-control-kirki-react-select .customize-control-title{ 44 44 min-width:160px; 45 45 } 46 46 47 .customize-control-kirki- select .select2-selection{47 .customize-control-kirki-react-select .select2-selection{ 48 48 border:none; 49 49 } 50 50 51 .customize-control-kirki- select .select2-selection__rendered{51 .customize-control-kirki-react-select .select2-selection__rendered{ 52 52 text-align:right; 53 53 } 54 54 55 .customize-control-kirki- select .select2-selection__rendered:focus, .customize-control-kirki-select .select2-selection--single:focus{55 .customize-control-kirki-react-select .select2-selection__rendered:focus, .customize-control-kirki-react-select .select2-selection--single:focus{ 56 56 border:none !important; 57 57 outline:none !important; … … 601 601 } 602 602 603 .customize-control-kirki- select .kirki-input-container label{603 .customize-control-kirki-react-select .kirki-input-container label{ 604 604 display:flex; 605 605 flex-wrap:wrap; 606 606 } 607 .customize-control-kirki- select.multiple-select .kirki-input-container label{607 .customize-control-kirki-react-select.multiple-select .kirki-input-container label{ 608 608 display:block !important; 609 609 } 610 610 611 .customize-control-kirki- select .kirki-input-container .select2-container{611 .customize-control-kirki-react-select .kirki-input-container .select2-container{ 612 612 flex:1; 613 613 } -
codeless-page-builder/trunk/assets/js/cl-builder.js
r2250858 r2675077 4893 4893 data['name'] = model.get('fields') 4894 4894 data['options'] = _.clone( model.get('params') ); 4895 4895 4896 wp.customize.preview.send('cl_show_options', data ); 4896 4897 }, … … 5652 5653 5653 5654 api.bind( 'preview-ready', function(){ 5654 if( ! _.isUndefined(window['CL_FRONT']) ) 5655 window['CL_FRONT'].config.$isCustomizer = true; 5656 5657 5658 setTimeout(function(){ 5659 cl.build(); 5660 5661 }, 100); 5655 api.preview.bind( 'active', function() { 5656 wp.customize.preview.send('' ); 5657 if( ! _.isUndefined(window['CL_FRONT']) ) 5658 window['CL_FRONT'].config.$isCustomizer = true; 5659 5660 5661 setTimeout(function(){ 5662 cl.build(); 5663 5664 }, 100); 5665 }); 5662 5666 5663 5667 -
codeless-page-builder/trunk/assets/js/cl-customize-pane.js
r2250479 r2675077 200 200 201 201 self.activeElement = function(element){ 202 202 console.log('dakuu'); 203 203 if( cl_kirki.element === false || cl_kirki.element.id !== element.id ) 204 204 cl_kirki.initialize( element ); 205 205 console.log('mren'); 206 206 var section = 'cl_codeless_page_builder'; 207 207 if( element.header_element ) 208 208 section = 'cl_codeless_header_builder'; 209 209 setTimeout(function(){ 210 console.log(section); 210 211 api.section(section).expand(); 211 212 }, 400); … … 294 295 295 296 api.bind( 'ready', function() { 297 296 298 self.init(); 297 299 298 300 if( typeof api( 'cl_page_content' ) !== 'undefined' && api( 'cl_page_content' ).get()['changeset'] != api.settings.changeset.uuid ){ 299 301 … … 308 310 }); 309 311 312 console.log('une daku punoj'); 313 310 314 return self; 311 315 }( jQuery, wp.customize ) ); -
codeless-page-builder/trunk/assets/js/kirki-new.js
r2250479 r2675077 1 1 var api = wp.customize; 2 3 function cl_validateCssValue( value ) { 4 5 var control = this, 6 validUnits = [ 'fr', 'rem', 'em', 'ex', '%', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ch', 'vh', 'vw', 'vmin', 'vmax' ], 7 numericValue, 8 unit, 9 multiples, 10 multiplesValid = true; 11 12 // Whitelist values. 13 if ( ! value || '' === value || 0 === value || '0' === value || 'auto' === value || 'inherit' === value || 'initial' === value ) { 14 return true; 15 } 16 17 // Skip checking if calc(). 18 if ( 0 <= value.indexOf( 'calc(' ) && 0 <= value.indexOf( ')' ) ) { 19 return true; 20 } 21 22 // Get the numeric value. 23 numericValue = parseFloat( value ); 24 25 // Get the unit 26 unit = value.replace( numericValue, '' ); 27 28 // Allow unitless. 29 if ( ! unit ) { 30 return true; 31 } 32 33 // Check for multiple values. 34 multiples = value.split( ' ' ); 35 if ( 2 <= multiples.length ) { 36 multiples.forEach( function( item ) { 37 if ( item && ! control.validateCssValue( item ) ) { 38 multiplesValid = false; 39 } 40 }); 41 42 return multiplesValid; 43 } 44 45 // Check the validity of the numeric value and units. 46 return ( ! isNaN( numericValue ) && -1 !== validUnits.indexOf( unit ) ); 47 } 2 48 3 49 wp.customize.controlConstructor['css_tool'] = wp.customize.kirkiDynamicControl.extend({ … … 16 62 new_value = jQuery(this).val(); 17 63 18 if ( false === kirki.util.validate.cssValue( new_value ) && new_value != '' ) {64 if ( false === cl_validateCssValue( new_value ) && new_value != '' ) { 19 65 20 66 jQuery(this).addClass('invalid'); … … 30 76 value[el] = new_value; 31 77 // Update the value in the customizer. 32 kirki.setting.set( control.id,value );78 control.setting.set( value ); 33 79 34 80 … … 68 114 setGalleryDataAndRenderContent: function(id) { 69 115 var control = this; 70 var value = kirki.setting.get(control.id);116 var value = control.setting.get(); 71 117 72 118 if( !_.isUndefined(value) && value.length ){ … … 138 184 galleryPreSelectImages = function() { 139 185 var selection, ids, attachment, library; 186 140 187 141 188 library = control.frame.state().get( 'library' ); 142 189 selection = control.frame.state().get( 'selection' ); 143 190 144 ids = kirki.setting.get(control.id);191 ids = control.setting.get(); 145 192 if( !_.isUndefined( ids ) && !_.isEmpty( ids ) ) 146 193 ids = ids.replace('__array__', '').replace( '__array__end__', '' ).split(','); … … 171 218 changeopt = function(){ 172 219 173 var value = kirki.setting.get(control.id);220 var value = control.setting.get(); 174 221 175 kirki.setting.set( control.id,'' );176 kirki.setting.set( control.id,value );222 control.setting.set( '' ); 223 control.setting.set( value ); 177 224 }; 178 225 … … 202 249 203 250 newValue = JSON.stringify(attachmentIds).replace('[', '__array__').replace(']', '__array__end__'); 204 kirki.setting.set( control.id,newValue );251 control.setting.set( newValue ); 205 252 control.container.focus(); 206 253 control.setGalleryDataAndRenderContent(fieldId); … … 257 304 var newValue = JSON.stringify(selectedValues).replace('[', '__array__').replace(']', '__array__end__'); 258 305 259 kirki.setting.set( control.id,newValue);306 control.setting.set(newValue); 260 307 } 261 308 }); … … 370 417 371 418 // Custom for multiple select 372 if( params_.type == 'kirki- select' && !_.isUndefined( params_.multiple ) && params_.multiple )419 if( params_.type == 'kirki-react-select' && !_.isUndefined( params_.multiple ) && params_.multiple ) 373 420 control.container.addClass('multiple-select'); 421 422 if( params_.type == 'kirki-slider' && !_.isUndefined( params_.choices ) ){ 423 params_.choices.max = parseInt(params_.choices.max)-1; 424 } 425 426 374 427 375 428 // Build Required List … … 425 478 } ); 426 479 427 if( params_.type == 'kirki-select' ) 428 return new api.controlConstructor['kirki-select']( key, { 480 if( params_.type == 'kirki-react-select' ) 481 return new api.controlConstructor['kirki-react-select']( key, { 482 params:params_ 483 } ); 484 485 if( params_.type == 'kirki-react-colorful' ) 486 return new api.controlConstructor['kirki-react-colorful']( key, { 429 487 params:params_ 430 488 } ); … … 448 506 449 507 customParamsCheck: function( params, key ){ 450 if( params.type == 'kirki-color' ){ 451 if( _.isUndefined( params.choices ) ) 452 params.choices = { alpha: true } 453 } 454 508 509 if( params.type == 'kirki-react-colorful' ){ 510 params.mode = 'alpha'; 511 params.choices = {}; 512 params.choices.formComponent = 'ChromePicker'; 513 params.choices.labelStyle = 'default' 514 params.choices.swatches = ['#000000', 515 '#ffffff', 516 '#dd3333', 517 '#dd9933', 518 '#eeee22', 519 '#81d742', 520 '#1e73be', 521 '#8224e3']; 522 console.log(params); 523 } 455 524 if( key == 'content' ) 456 525 params.type = 'textarea'; … … 480 549 reMapType: function( type ){ 481 550 var reMap = { 482 'color': 'kirki- color',551 'color': 'kirki-react-colorful', 483 552 'switch': 'kirki-switch', 484 'select': 'kirki- select',553 'select': 'kirki-react-select', 485 554 'slider': 'kirki-slider', 486 'inline_select': 'kirki- select',555 'inline_select': 'kirki-react-select', 487 556 'text' : 'text', 488 557 'inline_text' : 'text', -
codeless-page-builder/trunk/config/cl-page-elements.php
r2250479 r2675077 2429 2429 'css_property' => 'line-height', 2430 2430 'choices' => array( 2431 'min' => ' 20',2431 'min' => '0', 2432 2432 'max' => '100', 2433 2433 'step' => '1', … … 2890 2890 'min' => '20', 2891 2891 'max' => '200', 2892 'step' => '1 ',2892 'step' => '10', 2893 2893 'suffix' => 'px' 2894 2894 ), -
codeless-page-builder/trunk/include/core/cl-builder-base.php
r2250479 r2675077 102 102 */ 103 103 wp_enqueue_script( 'cl-lazyload', cl_asset_url('js/cl-lazyload.js') ); 104 wp_enqueue_script( 'cl-builder', cl_asset_url('js/cl-builder.js'), array(' backbone', 'underscore', 'customize-preview', 'shortcode', 'jquery-ui-sortable', 'jquery-ui-droppable') );104 wp_enqueue_script( 'cl-builder', cl_asset_url('js/cl-builder.js'), array('jquery', 'wp-util', 'backbone', 'underscore', 'customize-preview', 'shortcode', 'jquery-ui-sortable', 'jquery-ui-droppable') ); 105 105 106 106 wp_enqueue_script( 'cl-editor-exts', cl_asset_url('js/medium-editor/cl-editor-exts.js')); … … 128 128 function pane_init_enqueue(){ 129 129 global $cl_builder; 130 wp_enqueue_script( 'codeless-cssbox', cl_asset_url( 'js/kirki-new.js' ), array( 'kirki-script' ) ); 130 131 // Enqueue the script. 132 wp_enqueue_script( 'codeless-cssbox', cl_asset_url( 'js/kirki-new.js' ), array( 'kirki-control-base' ) ); 131 133 132 134 wp_localize_script( 'codeless-cssbox', 'codelessPalettes', codeless_builder_generate_palettes() ); … … 136 138 wp_localize_script( 'codeless-cssbox', 'codelessHeaderElementsMap', Cl_Builder_Mapper::getHeaderElements() ); 137 139 } 138 wp_enqueue_script( 'cl-customize-pane', cl_asset_url('js/cl-customize-pane.js'), array( 'customize-controls', ' jquery', 'codeless-cssbox' ) );140 wp_enqueue_script( 'cl-customize-pane', cl_asset_url('js/cl-customize-pane.js'), array( 'customize-controls', 'codeless-cssbox' ) ); 139 141 140 142 -
codeless-page-builder/trunk/include/core/cl-kirki-setup.php
r2250479 r2675077 39 39 'register_custom_types' 40 40 ) ); 41 add_filter( 'kirki /panel_types', array(41 add_filter( 'kirki_panel_types', array( 42 42 &$this, 43 43 'load_custom_panel' 44 44 ) ); 45 add_filter( 'kirki /section_types', array(45 add_filter( 'kirki_section_types', array( 46 46 &$this, 47 47 'load_custom_section' … … 79 79 public function register_custom_types() { 80 80 global $wp_customize; 81 require_once cl_path_dir( 'KIRKI_SETUP', 'codeless_custom_panel.php' ); 82 require_once cl_path_dir( 'KIRKI_SETUP', 'codeless_custom_section.php' ); 81 83 $wp_customize->register_panel_type( 'WP_Customize_Codeless_Panel' ); 82 84 $wp_customize->register_section_type( 'WP_Customize_Codeless_Section' ); … … 85 87 86 88 public function load_custom_panel( $panels ) { 87 require_once cl_path_dir( 'KIRKI_SETUP', 'codeless_custom_panel.php' );89 88 90 $panels['codeless'] = 'WP_Customize_Codeless_Panel'; 89 91 return $panels; … … 91 93 92 94 public function load_custom_section( $sections ) { 93 require_once cl_path_dir( 'KIRKI_SETUP', 'codeless_custom_section.php' );95 94 96 $sections['codeless'] = 'WP_Customize_Codeless_Section'; 95 97 return $sections; -
codeless-page-builder/trunk/include/core/kirki-setup/codeless_controls.php
r2250479 r2675077 306 306 $wp_customize->register_control_type( 'Codeless_Controls_ClText_Control' ); 307 307 $wp_customize->register_control_type( 'Codeless_Controls_ImageGallery_Control' ); 308 308 309 }); 310 309 311 ?> -
codeless-page-builder/trunk/include/core/kirki-setup/codeless_custom_panel.php
r2250479 r2675077 9 9 10 10 11 class WP_Customize_Codeless_Panel extends WP_Customize_Panel { 11 12 class WP_Customize_Codeless_Panel extends \WP_Customize_Panel { 12 13 13 14 /** -
codeless-page-builder/trunk/include/core/kirki-setup/codeless_custom_section.php
r2250479 r2675077 1 1 <?php 2 2 3 class WP_Customize_Codeless_Section extends WP_Customize_Section { 3 4 if( class_exists( '\WP_Customize_Section' ) ){ 5 class WP_Customize_Codeless_Section extends \WP_Customize_Section { 4 6 5 7 /** … … 51 53 } 52 54 } 55 }
Note: See TracChangeset
for help on using the changeset viewer.