-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Custom HTML block description and use sandbox for preview #1625
Changes from all commits
3befa8a
84d279a
c698ae1
f1b515c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,7 @@ div[data-type="core/html"] { | |
overflow-x: auto; | ||
width: 100%; | ||
} | ||
iframe { | ||
display: block; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -487,6 +487,10 @@ function gutenberg_editor_scripts_and_styles( $hook ) { | |||||||||
'before' | ||||||||||
); | ||||||||||
|
||||||||||
// Export data required by the Custom HTML block. | ||||||||||
wp_add_inline_script( 'wp-editor', sprintf( 'wp.editor.canUnfilteredHtml = %s;', wp_json_encode( current_user_can( 'unfiltered_html' ) ) ) ); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we merge this in with other editor settings? I'm thinking we need a scalable solution here. gutenberg/lib/client-assets.php Lines 790 to 793 in 1cea1fb
The https://github.com/WordPress/gutenberg/tree/master/blocks/with-editor-settings There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I absolutely agree. The |
||||||||||
wp_add_inline_script( 'wp-editor', sprintf( 'wp.editor.allowedPostHtml = %s;', wp_json_encode( wp_kses_allowed_html( 'post' ) ) ) ); | ||||||||||
|
||||||||||
// Initialize the editor. | ||||||||||
wp_add_inline_script( 'wp-editor', 'wp.api.init().done( function() { wp.editor.createEditorInstance( \'editor\', window._wpGutenbergPost ); } );' ); | ||||||||||
|
||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Object.keys
and if so, pass from the server asarray_keys
? Not sure how likely it is we'd do anything with the allowed attributes and could avoid increasing the size of the page by including only what's used.allowedPostHtml
is not a prop and is not likely to change, this may not be an issue, but could still be seen as an over-optimization to split the logic as we've done here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it is useful as it is. The data consists of keys for the HTML tags, and then the values are objects that indicate the attributes that are allowed for each element. It's the same structure as: https://github.com/WordPress/wordpress-develop/blob/1eda9654da06715798cbf911372c0c13e5baf7ca/src/wp-includes/kses.php#L53-L416