Skip to content

Commit

Permalink
Html error validator (#310)
Browse files Browse the repository at this point in the history
* added is valid block html function

* added js validation for block editor output

* build

* moved PreviewErrorBoundary to components folder

* deleted unused isValidBlockHtml util

* added error boundary to preview server callback

* build

* changed key for preview error boundary on response

* build
  • Loading branch information
Fellan-91 authored May 1, 2024
1 parent d183aed commit a23422c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion assets/components/preview-server-callback/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import apiFetch from '@wordpress/api-fetch';
* Internal dependencies.
*/
import RenderBlockContent from './render-block-content';
import PreviewErrorBoundary from '../../components/preview-error-boundary';

/**
* Block Editor custom PHP preview.
Expand Down Expand Up @@ -242,7 +243,7 @@ export default function PreviewServerCallback(props) {

return (
<div ref={blockContentWrapper} className="lzb-preview-server">
{result}
<PreviewErrorBoundary key={response}>{result}</PreviewErrorBoundary>
</div>
);
}
2 changes: 1 addition & 1 deletion assets/editor-constructor/block/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import ControlsSettings from '../boxes/controls';
import SelectedControlSettings from '../boxes/selected-control-settings';
import CustomCodeSettings from '../boxes/code';
import CodePreview from '../boxes/code-preview';
import PreviewErrorBoundary from '../boxes/code-preview/preview-error-boundary';
import PreviewErrorBoundary from '../../components/preview-error-boundary';

import '../../components/tab-panel';

Expand Down
2 changes: 1 addition & 1 deletion build/editor.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '2a02e1b8977a51d9255b');
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '3c4e3a041da709ca0bed');
6 changes: 3 additions & 3 deletions build/editor.js

Large diffs are not rendered by default.

0 comments on commit a23422c

Please sign in to comment.