Contextual menu options for code blocks in the Content Editor

Problem to solve

There are some actions that need to be taken when formatting content that are best handled in context on the page. The formatting toolbar can offer the same functionality, but it can be tedious to move the cursor or scroll the page to get to the toolbar. Additionally, limiting the controls to a toolbar or global menu loses the context and requires much more descriptive text.

Proposal

Code blocks in the Content Editor should have a contextual menu available on hover or selection that includes the ability to:

  • Select syntax language
  • Delete code block
  • Create a new snippet

This menu is useful in an MVC state but becomes really exciting when we think about other functionality we could implement with code blocks and how the menu could enable access to functionality like execute script or if a code block references a specific file in the repository, Jump to filename.rb.

This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.

Edited by 🤖 GitLab Bot 🤖