Skip to content

Commit

Permalink
Tailor 1.8.1
Browse files Browse the repository at this point in the history
* Added - The ability to modify the default media query sizes.
* Improved - Frontend CSS is automatically recompiled from project SCSS files when Customizer settings are updated.
* Improved - The performance of the tailor_modify_colorpicker function.
* Fixed - Element CSS not loading when restoring the "Initialized" history snapshot.
* Fixed - Notice of undefined index [body_class] displayed on the Gutenberg edit screen [GitHub 134](#134).
* Fixed - Certain character sets are not being encoded properly [GitHub 137](#137).
* Fixed - Custom elements are not being correctly extracted from saved HTML content [GitHub 138](#138).
  • Loading branch information
Enclavelyio committed Aug 22, 2017
1 parent f2d2057 commit fd69c68
Show file tree
Hide file tree
Showing 57 changed files with 10,199 additions and 77 deletions.
2 changes: 1 addition & 1 deletion assets/css/admin.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/css/admin.min.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/css/canvas.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/canvas.min.css.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/css/frontend.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/css/frontend.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/frontend.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/frontend.min.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/sidebar.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/sidebar.min.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/tinymce.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/css/tinymce.min.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions assets/js/dist/canvas.js
Expand Up @@ -170,11 +170,11 @@
app.channel.on( 'sidebar:initialize', function() {

// Load modules
app.module( 'module:css', require( './canvas/modules/css/css' ) );
app.module( 'module:elements', require( './canvas/modules/elements/elements' ) );
app.module( 'module:templates', require( './canvas/modules/templates/templates' ) );
app.module( 'module:canvas', require( './canvas/modules/canvas/canvas' ) );
app.module( 'module:tools', require( './canvas/modules/tools/tools' ) );
app.module( 'module:css', require( './canvas/modules/css/css' ) );

app.channel.on( 'module:canvas:ready', function() {

Expand Down Expand Up @@ -5468,7 +5468,7 @@ CSSModule = Marionette.Module.extend( {
*
* @since 1.0.0
*/
onStart : function( options ) {
onBeforeStart : function( options ) {
this.stylesheets = [];
this.collection = app.channel.request( 'canvas:elements' );

Expand Down
4 changes: 2 additions & 2 deletions assets/js/dist/canvas.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions assets/js/dist/sidebar.js
Expand Up @@ -5522,6 +5522,8 @@ var SnapshotCollection = Backbone.Collection.extend( {
var templates = app.channel.request( 'canvas:templates' );
var css = app.channel.request( 'canvas:css' );

console.log( models, templates, css );

// Add the new entry to the collection
var entry = this.add( {
label : label || '',
Expand Down
4 changes: 2 additions & 2 deletions assets/js/dist/sidebar.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/src/canvas.js
Expand Up @@ -169,11 +169,11 @@
app.channel.on( 'sidebar:initialize', function() {

// Load modules
app.module( 'module:css', require( './canvas/modules/css/css' ) );
app.module( 'module:elements', require( './canvas/modules/elements/elements' ) );
app.module( 'module:templates', require( './canvas/modules/templates/templates' ) );
app.module( 'module:canvas', require( './canvas/modules/canvas/canvas' ) );
app.module( 'module:tools', require( './canvas/modules/tools/tools' ) );
app.module( 'module:css', require( './canvas/modules/css/css' ) );

app.channel.on( 'module:canvas:ready', function() {

Expand Down
2 changes: 1 addition & 1 deletion assets/js/src/canvas/modules/css/css.js
Expand Up @@ -8,7 +8,7 @@ CSSModule = Marionette.Module.extend( {
*
* @since 1.0.0
*/
onStart : function( options ) {
onBeforeStart : function( options ) {
this.stylesheets = [];
this.collection = app.channel.request( 'canvas:elements' );

Expand Down
2 changes: 2 additions & 0 deletions assets/js/src/sidebar/entities/collections/snapshots.js
Expand Up @@ -65,6 +65,8 @@ var SnapshotCollection = Backbone.Collection.extend( {
var templates = app.channel.request( 'canvas:templates' );
var css = app.channel.request( 'canvas:css' );

console.log( models, templates, css );

// Add the new entry to the collection
var entry = this.add( {
label : label || '',
Expand Down
1 change: 1 addition & 0 deletions assets/scss/_variables.scss
@@ -1,5 +1,6 @@
$global-class-prefix: 'tailor-' !default;

$global-section-width: 100% !default;
$global-spacing-vertical: 1rem !default;
$global-spacing-horizontal: 1rem !default;
$global-transition-duration: 150ms !default;
Expand Down
72 changes: 36 additions & 36 deletions assets/scss/components/frontend/_columns.scss
Expand Up @@ -38,53 +38,50 @@ $column-number: 12 !default;
//
@mixin row( $size ) {

.#{$global-class-prefix}ui {

// Row
.#{$size}-columns {
margin-left: -$row-spacing-horizontal;
margin-right: -$row-spacing-horizontal;
// Row
.#{$size}-columns {
margin-left: -$row-spacing-horizontal;
margin-right: -$row-spacing-horizontal;

@include flex;
@include flex;

// Widths
@for $i from 1 through $column-number {
// Widths
@for $i from 1 through $column-number {

.columns-#{$i} {
width: percentage( ( $i / $column-number ) );
}
.columns-#{$i} {
width: percentage( ( $i / $column-number ) );
}
}

@for $i from 1 through $column-number {
@for $i from 1 through $column-number {

@media #{$tablet} {
@media #{$tablet} {

.columns-tablet-#{$i} {
width: percentage( ( $i / $column-number ) );
}
.columns-tablet-#{$i} {
width: percentage( ( $i / $column-number ) );
}
}
}

@for $i from 1 through $column-number {
@for $i from 1 through $column-number {

@media #{$mobile} {
@media #{$mobile} {

.columns-mobile-#{$i} {
width: percentage( ( $i / $column-number ) );
}
.columns-mobile-#{$i} {
width: percentage( ( $i / $column-number ) );
}
}
}

// Column
.#{$column-class-prefix}column {
padding-left: $row-spacing-horizontal;
padding-right: $row-spacing-horizontal;
// Column
.#{$column-class-prefix}column {
padding-left: $row-spacing-horizontal;
padding-right: $row-spacing-horizontal;

@include flex( column );
@include flex( column );

> :last-child {
margin-bottom: 0;
}
> :last-child {
margin-bottom: 0;
}
}
}
Expand Down Expand Up @@ -139,12 +136,15 @@ $column-number: 12 !default;
//
// Media queries
//
@include row( mobile );
.#{$global-class-prefix}ui {

@media #{$tablet-up} {
@include row( tablet );
}
@include row( mobile );

@media #{$desktop} {
@include row( desktop );
@media #{$tablet-up} {
@include row( tablet );
}

@media #{$desktop} {
@include row( desktop );
}
}
1 change: 1 addition & 0 deletions assets/scss/components/frontend/_section.scss
Expand Up @@ -40,6 +40,7 @@ $section-box-shadow: none !default;
z-index: 2;
margin: 0 auto;
width: 100%;
max-width: $global-section-width;

@include flex( column );
}
Expand Down
16 changes: 13 additions & 3 deletions includes/class-custom-css.php
Expand Up @@ -97,7 +97,7 @@ public function __construct() {
protected function add_actions() {

// Print CSS
add_action( 'wp_head', array( $this, 'print_customizer_css' ) );
//add_action( 'wp_head', array( $this, 'print_customizer_css' ) );
add_action( 'wp_head', array( $this, 'print_custom_css' ) );
add_action( 'wp_head', array( $this, 'print_dynamic_css' ) );

Expand Down Expand Up @@ -267,6 +267,8 @@ public function get_setting_css_rules() {
'_tailor_section_width' => array(),
'_tailor_column_spacing' => array(),
'_tailor_element_spacing' => array(),
'_tailor_mobile_breakpoint' => array(),
'_tailor_tablet_breakpoint' => array(),
);

$setting_css_rules['_tailor_section_width'][] = array(
Expand Down Expand Up @@ -300,6 +302,14 @@ public function get_setting_css_rules() {
),
);

$setting_css_rules['_tailor_mobile_breakpoint'][] = array(
'selectors' => array( '.tailor-ui .tailor-element' ),
'media' => 'mobile',
'declarations' => array(
'margin-bottom' => '{{value}}',
),
);

return $setting_css_rules;
}

Expand Down Expand Up @@ -539,7 +549,7 @@ public function print_customizer_css() {
}
}
}

$customizer_css = $this->clean_css( $customizer_css );

// Do nothing if there is no Customizer CSS
Expand Down Expand Up @@ -636,7 +646,7 @@ public function print_dynamic_css() {
$post_id = get_the_ID();
$css_rule_sets = $this->get_dynamic_css_rules( $post_id );
}

$dynamic_css = $this->clean_css( $this->generate_css( $css_rule_sets ) );

// Do nothing if there is no dynamic CSS
Expand Down
11 changes: 5 additions & 6 deletions includes/class-models.php
Expand Up @@ -698,9 +698,7 @@ public function generate_shortcodes( $parent_id, $ordered_sanitized_models ) {
}

$shortcode = $element->generate_shortcode( $sanitized_model['id'], $sanitized_model['atts'], $content );

$element_type = str_replace( 'tailor_', '', $element->tag );
$comment_data = "tailor:{$element_type}:{$sanitized_model['id']}";
$comment_data = "tailor:{$element->tag}:{$sanitized_model['id']}";
$shortcodes .= "<!-- {$comment_data} -->{$shortcode}<!-- /{$comment_data} -->";
}

Expand Down Expand Up @@ -928,6 +926,7 @@ public function generate_models() {
*/
public function generate_models_from_html( $html, $parent, $models ) {
$placeholder = tailor_get_setting( 'content_placeholder', __( 'This is placeholder text which you can replace by editing this element.', 'tailor' ) );

if ( preg_match_all( $this->regex, $html, $matches ) ) {
for ( $i = 0; $i < count( $matches[3] ); $i++ ) {
$id = $matches[3][ $i ];
Expand All @@ -942,11 +941,11 @@ public function generate_models_from_html( $html, $parent, $models ) {
);

// Get the inner HTML of content elements
if ( $type == 'content' ) {
if ( $type == 'tailor_content' ) {
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->encoding='UTF-8';
$dom->loadHtml(preg_replace( $this->regex, '', $content ));
$dom->loadHtml(mb_convert_encoding( preg_replace( $this->regex, '', $content ), 'HTML-ENTITIES', 'UTF-8') );
$inner_html = '';

foreach ( $dom->getElementsByTagName("div") as $node ) {
if ( strpos( $node->getAttribute("class"), "tailor-{$id}" ) !== false ) {
foreach ( $node->childNodes as $el ) {
Expand Down
7 changes: 6 additions & 1 deletion includes/class-tinymce.php
Expand Up @@ -89,7 +89,12 @@ public function add_actions() {
*/
public function configure_tinymce( $settings ) {

$settings['body_class'] .= ' tailor-ui tailor-editor';
if ( empty( $settings['body_class'] ) ) {
$settings['body_class'] = 'tailor-ui tailor-editor';
}
else {
$settings['body_class'] .= ' tailor-ui tailor-editor';
}

if ( empty( $settings['extended_valid_elements'] ) ) {
$settings['extended_valid_elements'] = '';
Expand Down
29 changes: 29 additions & 0 deletions includes/customizer/customizer-settings.php
Expand Up @@ -22,6 +22,7 @@ function tailor_get_customizer_settings() {
$settings = array(
'tailor_section_width' => array(
'setting' => array(
'default' => '100%',
'sanitize_callback' => 'tailor_sanitize_text',
),
'control' => array(
Expand All @@ -34,6 +35,7 @@ function tailor_get_customizer_settings() {
),
'tailor_column_spacing' => array(
'setting' => array(
'default' => '1rem',
'sanitize_callback' => 'tailor_sanitize_text',
),
'control' => array(
Expand All @@ -46,6 +48,7 @@ function tailor_get_customizer_settings() {
),
'tailor_element_spacing' => array(
'setting' => array(
'default' => '1rem',
'sanitize_callback' => 'tailor_sanitize_text',
),
'control' => array(
Expand All @@ -56,6 +59,32 @@ function tailor_get_customizer_settings() {
'section' => 'tailor_layout',
),
),
'tailor_mobile_breakpoint' => array(
'setting' => array(
'default' => 320,
'sanitize_callback' => 'tailor_sanitize_number',
),
'control' => array(
'label' => __( 'Mobile breakpoint', 'tailor' ),
'description' => __( 'The maximum screen size for "mobile" devices (px).', 'tailor' ),
'type' => 'number',
'priority' => 40,
'section' => 'tailor_layout',
),
),
'tailor_tablet_breakpoint' => array(
'setting' => array(
'default' => 720,
'sanitize_callback' => 'tailor_sanitize_number',
),
'control' => array(
'label' => __( 'Tablet breakpoint', 'tailor' ),
'description' => __( 'The maximum screen size for "tablet" devices (px).', 'tailor' ),
'type' => 'number',
'priority' => 50,
'section' => 'tailor_layout',
),
),
);

/**
Expand Down

0 comments on commit fd69c68

Please sign in to comment.