Make WordPress Core

Ticket #43657: 43657.diff

File 43657.diff, 1.0 KB (added by barryceelen, 7 years ago)

Check for length of control.currentErrorAnnotations

  • wp-admin/js/widgets/custom-html-widgets.js

    diff --git a/wp-admin/js/widgets/custom-html-widgets.js b/wp-admin/js/widgets/custom-html-widgets.js
    index 5469755870..ecaf5066bc 100644
    a b wp.customHtmlWidgets = ( function( $ ) { 
    108108                         * to prevent the editor's contents from getting sanitized as soon as a user removes focus from
    109109                         * the editor. This is particularly important for users who cannot unfiltered_html.
    110110                         */
    111                         control.contentUpdateBypassed = control.fields.content.is( document.activeElement ) || control.editor && control.editor.codemirror.state.focused || 0 !== control.currentErrorAnnotations;
     111                        control.contentUpdateBypassed = control.fields.content.is( document.activeElement ) || control.editor && control.editor.codemirror.state.focused || 0 !== control.currentErrorAnnotations.length;
    112112                        if ( ! control.contentUpdateBypassed ) {
    113113                                syncInput = control.syncContainer.find( '.sync-input.content' );
    114114                                control.fields.content.val( syncInput.val() ).trigger( 'change' );