Enhance Language Selection: Add Dropdown for Syntax Highlighters & Validate Language Before Updating Editor#12
Conversation
|
I have made some modifications in #13 - please check it out. A few layout changes / fixes. The biggest change is that now it will render either the lang-select or the lang-input, but not both, Why :I removed the default languages embeded in the library - its doesnt make much sense to hard-code a list of ~12 languages, its too big or too small for most peoples use case. much better to let people specify it themselves using the config.languages property as you already had. If they dont assign anything to config.languages, then we get the language-input box as before. If you /really/ want both, then i added a flag forceShowLanguageInput |
|
Keeping only one of them visible at a time helps streamline the UI and avoids redundancy. Looks good to me! 👍 I have reviewed your PR #13. Please have a look at my comments and let me know if those make sense. |
👉🏻 Refer this Demo video
✨ New Features
✅ Dropdown for Predefined Languages
✅ Language Validation (Input & Select)
✅ Reset to PlainText
🛠️ Fixes
c#,c++) caused the PrismJS autoloader to break. This prevented valid languages likecsharpandcppfrom being loaded afterward.🔠 Enforce Lowercase for PrismJS Compatibility
If an uppercase language (e.g.,
HTML) was passed, it could cause caching issues and incorrect syntax highlighting.Ensures consistent syntax highlighting and prevents failures when
data.languageis set incorrectly.