如何使用Javascript禁用古腾堡中的默认标题栏

时间:2018-11-05 11:50:31

标签: javascript wordpress wordpress-gutenberg

是否可以使用JavaScript禁用古腾堡编辑器中的默认标题栏?在官方API中找不到任何内容。 设置古腾堡时,您需要通过设置对象中的属性。

当前,我喜欢这样(带有标题):

const window = this.iframe.contentWindow // this.iframe is a React ref
const wpData = window.wp ? window.wp.data : false
if (!wpData) {
  return
}
const newPost = Object.assign({ content: { raw: '', rendered: '' } }, window._wpGutenbergDefaultPost)
const editorSettings = {
  alignWide: false,
  availableTemplates: [],
  blockTypes: true,
  disableCustomColors: false,
  disablePostFormats: false,
  titlePlaceholder: '',
  bodyPlaceholder: 'Add content here'
}
const editor = wpData.dispatch('core/editor')

editor.setupEditor(newPost, editorSettings)

0 个答案:

没有答案