Customize: Allow notifications for linting errors in code editor control (for Additional CSS) to be overridden to allow saving.
Implements the same override that was implemented in [41721] for the theme/plugin editors. See #41897, #41887. Fixes #42528. Built from https://develop.svn.wordpress.org/trunk@42171 git-svn-id: http://core.svn.wordpress.org/trunk@42001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
609c0db668
commit
e484b66335
|
@ -5280,6 +5280,27 @@
|
||||||
codemirror: $.Deferred()
|
codemirror: $.Deferred()
|
||||||
} );
|
} );
|
||||||
api.Control.prototype.initialize.call( control, id, options );
|
api.Control.prototype.initialize.call( control, id, options );
|
||||||
|
|
||||||
|
// Note that rendering is debounced so the props will be used when rendering happens after add event.
|
||||||
|
control.notifications.bind( 'add', function( notification ) {
|
||||||
|
|
||||||
|
// Skip if control notification is not from setting csslint_error notification.
|
||||||
|
if ( notification.code !== control.setting.id + ':csslint_error' ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Customize the template and behavior of csslint_error notifications.
|
||||||
|
notification.templateId = 'customize-code-editor-lint-error-notification';
|
||||||
|
notification.render = (function( render ) {
|
||||||
|
return function() {
|
||||||
|
var li = render.call( this );
|
||||||
|
li.find( 'input[type=checkbox]' ).on( 'click', function() {
|
||||||
|
control.setting.notifications.remove( 'csslint_error' );
|
||||||
|
} );
|
||||||
|
return li;
|
||||||
|
};
|
||||||
|
})( notification.render );
|
||||||
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4125,6 +4125,18 @@ final class WP_Customize_Manager {
|
||||||
</li>
|
</li>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script type="text/html" id="tmpl-customize-code-editor-lint-error-notification">
|
||||||
|
<li class="notice notice-{{ data.type || 'info' }} {{ data.alt ? 'notice-alt' : '' }} {{ data.dismissible ? 'is-dismissible' : '' }} {{ data.containerClasses || '' }}" data-code="{{ data.code }}" data-type="{{ data.type }}">
|
||||||
|
<div class="notification-message">{{{ data.message || data.code }}}</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<# var elementId = 'el-' + String( Math.random() ); #>
|
||||||
|
<input id="{{ elementId }}" type="checkbox">
|
||||||
|
<label for="{{ elementId }}"><?php _e( 'Update anyway, even though it might break your site?' ); ?></label>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
</script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
/* The following template is obsolete in core but retained for plugins. */
|
/* The following template is obsolete in core but retained for plugins. */
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.0-alpha-42169';
|
$wp_version = '5.0-alpha-42171';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue