diff --git a/blocks/library/html/editor.scss b/blocks/library/html/editor.scss
index 0924aade0e47f3..6a76fd7d376570 100644
--- a/blocks/library/html/editor.scss
+++ b/blocks/library/html/editor.scss
@@ -1,12 +1,25 @@
-.gutenberg textarea.wp-block-html {
- box-shadow: none;
- font-family: $editor-html-font;
- font-size: $text-editor-font-size;
- color: $dark-gray-800;
- border: 1px solid $light-gray-500;
- border-radius: 4px;
- padding: .8em 1.6em;
- margin: 0;
- overflow-x: auto;
- width: 100%;
+.gutenberg .wp-block-html {
+ iframe {
+ display: block;
+
+ // Disable pointer events so that we can click on the block to select it
+ pointer-events: none;
+ }
+
+ .CodeMirror {
+ border-radius: 4px;
+ border: 1px solid $light-gray-500;
+ font-family: $editor-html-font;
+ font-size: $text-editor-font-size;
+ height: auto;
+ }
+
+ .CodeMirror-gutters {
+ background: $white;
+ border-right: none;
+ }
+
+ .CodeMirror-lines {
+ padding: 8px 8px 8px 0;
+ }
}
diff --git a/blocks/library/html/index.js b/blocks/library/html/index.js
index 05ebd25338e1e8..e36c2438f64f6e 100644
--- a/blocks/library/html/index.js
+++ b/blocks/library/html/index.js
@@ -1,13 +1,8 @@
-/**
- * External dependencies
- */
-import TextareaAutosize from 'react-autosize-textarea';
-
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
-import { withState } from '@wordpress/components';
+import { withState, SandBox, CodeEditor } from '@wordpress/components';
/**
* Internal dependencies
@@ -42,35 +37,38 @@ registerBlockType( 'core/html', {
edit: withState( {
preview: false,
- } )( ( { attributes, setAttributes, setState, focus, preview } ) => [
- focus && (
-