Skip to content

Commit

Permalink
[Blocks] Disable broken WP blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricewijnia committed May 21, 2019
1 parent 186fe30 commit edcfaa0
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/resources/js/lib/configure-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default function configureEditor (options) {
setupMedia(options)
setupSidebar(options)
setupSubmit(editorSettings.target)
disableWPBlocks()
removeBlockManagement()
if (options.maxHeight) { setMaxHeight(options.maxHeight) }
if (options.minHeight) { setMinHeight(options.minHeight) }
Expand All @@ -28,6 +29,20 @@ export function clearSubmitFromButtons () {
}
}

function disableWPBlocks () {
data.dispatch('core/blocks').removeBlockTypes([
'core/archives',
'core/categories',
'core/freeform',
'core/latest-comments',
'core/latest-posts',
'core/more',
'core/nextpage',
'core/page-break',
'core/shortcode'
])
}

/**
* Sets the max-height style value
* @param {String} maxHeight css value for max-height
Expand Down Expand Up @@ -68,9 +83,11 @@ function setupMedia (options) {
if (options.laravelFilemanager) {
setupLaravelFilemanager(options.laravelFilemanager)
} else {
data.dispatch('core/blocks').removeBlockTypes('core/cover')
data.dispatch('core/blocks').removeBlockTypes('core/gallery')
data.dispatch('core/blocks').removeBlockTypes('core/media-text')
data.dispatch('core/blocks').removeBlockTypes([
'core/cover',
'core/gallery',
'core/media-text'
])
}
}

Expand Down

0 comments on commit edcfaa0

Please sign in to comment.