code
code copied to clipboard
Specifying the language of the written code
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:



Please merge this.