code icon indicating copy to clipboard operation
code copied to clipboard

Specifying the language of the written code

Open Al3bad opened this issue 4 years ago • 1 comments

Hi,

Recently I was developing a blog for my website and I used Editor JS + code plugin as a text editor. There is only one thing missing, and that is specifying the language of the code written in the textarea. So, I’ve added this feature where if the user specified an array of languages in the config object, there will be a dropdown menu rendered that containing the languages.

Here is an example:

const editor = new EditorJS({
  holder: "editorjs",
  tools: {
    code: {
      class: CodeTool,
      config: {
        languages: ["HTML", "CSS", "Javascript"],
      },
    },
  },
});

And here are the screenshots of the component that was rendered and the output on saving:

image

image

image

Al3bad avatar Apr 08 '21 17:04 Al3bad

Please merge this.

MrMooky avatar Mar 09 '22 20:03 MrMooky