From 30461b62da64d27567360f9784fe4b4f0067be3b Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 8 Jan 2019 16:41:53 +0000 Subject: [PATCH] Widgets: Fix custom HTML widget editor content not updating after save. An integer comparison is performed against `control.currentErrorAnnotations`, but `control.currentErrorAnnotations` is actually an array. This fixes that comparison so the content saves correctly. Props barryceelen. Fixes #43657. git-svn-id: https://develop.svn.wordpress.org/trunk@44474 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/_enqueues/wp/widgets/custom-html.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/_enqueues/wp/widgets/custom-html.js b/src/js/_enqueues/wp/widgets/custom-html.js index a5bc550b07..6cc4835eeb 100644 --- a/src/js/_enqueues/wp/widgets/custom-html.js +++ b/src/js/_enqueues/wp/widgets/custom-html.js @@ -112,7 +112,7 @@ wp.customHtmlWidgets = ( function( $ ) { * to prevent the editor's contents from getting sanitized as soon as a user removes focus from * the editor. This is particularly important for users who cannot unfiltered_html. */ - control.contentUpdateBypassed = control.fields.content.is( document.activeElement ) || control.editor && control.editor.codemirror.state.focused || 0 !== control.currentErrorAnnotations; + control.contentUpdateBypassed = control.fields.content.is( document.activeElement ) || control.editor && control.editor.codemirror.state.focused || 0 !== control.currentErrorAnnotations.length; if ( ! control.contentUpdateBypassed ) { syncInput = control.syncContainer.find( '.sync-input.content' ); control.fields.content.val( syncInput.val() ).trigger( 'change' );