Skip to content

Disable Code Editor #3496

@swissspidy

Description

@swissspidy

Feature description

The AMP Stories editor is built on top of the Gutenberg block editor, which has a feature to switch between visual editing and the underlying code representing the blocks.

Other than in the regular post editor, this code view is not something that is of use in the stories editor.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • Access to the code editor via the "More tools & options" in top right corner should be prevented, i.e. it should not be visible
  • The keyboard shortcut should not work either
  • Access to the code editor for an individual block via the block toolbar should be prevented as well

Implementation brief

  • \AMP_Story_Post_Type::filter_block_editor_settings should be amended to disable codeEditingEnabled. richEditingEnabled should be always true in that case.
    (Documentation)
  • All parts of code related to the code editor should be removed as they are no longer needed.

QA testing instructions

  1. Create a new story
  2. Edit text block
  3. Verify: In the "More tools" (three dots) menu in the block toolbar, there should be no "Edit as HTML" option visible
  4. Click on "More tools & options" in top right corner
  5. Verify: there should be no "Code editor" menu item in the list

Demo

Changelog entry

  • Disabled access to code editor

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions