calumk / editorjs-codecup

editorjs-codecup
9 stars 3 forks source link

Enhance Language Selection with a Dropdown List for Syntax Highlighters. #8

Open keertyverma opened 3 months ago

keertyverma commented 3 months ago

Currently, when a user enters a language name, the CDN dynamically loads the corresponding syntax highlighter. If the user mistypes the language name, the syntax highlighter fails to load properly, and the typo remains displayed in the bottom-right corner of the code editor.

This can cause confusion, as no error is raised if the syntax highlighter fails to load correctly, leaving users without feedback on the validity of their input.

image

Proposed Improvement:

  1. Language Selection List: Replace the input box with a dropdown list of predefined languages. This ensures that only valid languages are selected, preventing syntax highlighter errors.

  2. Custom Language Option: Provide a fallback mechanism allowing users to add custom languages to the list if their desired language is not available.

This update will enhance user experience by reducing errors and improving the accuracy of syntax highlighting.

Thanks for your help!

calumk commented 2 months ago

@keertyverma Something like this? (not yet finished) If a prefefined set of languages is provided, then a select to choose them is provided, Else it falls back to the text-entry method?

image image