3

有没有办法使用 JavaScript 禁用 Gutenberg 编辑器中的默认标题栏?在官方 API 中找不到任何内容。设置 Gutenberg 时传递的设置对象中的属性之类的东西。

目前,我确实喜欢这样(标题):

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)
4

0 回答 0