-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Language Improvements #13
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added few comments. Let me know your thoughts.
Thank you.
if(!this._isValidLanguage(language)) { | ||
// If invalid language, fallback to plain text | ||
this.data.language = 'plain'; | ||
this.data.editorInstance.updateLanguage('none'); | ||
this._element.querySelector('.editorjs-codeCup_LangDisplay').innerHTML = 'none'; | ||
this._handleErrorMessage(language); // Show error message | ||
return false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
While this approach prevents invalid syntax highlighting, it may negatively impact the user experience by removing their last valid selection.
Would it be better to retain the previously valid language and syntax highlighter instead? This would help ensure users don’t lose their last selection due to an unintended input error.
if(!this._isValidLanguage(language)) {
this._handleErrorMessage(language); // Show an error message for the invalid language
return false;
}
- Additionally, if we still want to reset the language to plain text, the language display text should also reflect Plain Text rather than showing none for consistency.
static getDefaultLanguages() { | ||
return { | ||
bash: "Bash", | ||
c: "C", | ||
cpp: "C++", | ||
csharp: "C#", | ||
css: "CSS", | ||
go: "Go", | ||
html: "HTML", | ||
java: "Java", | ||
javascript: "JavaScript", | ||
json: "JSON", | ||
kotlin: "Kotlin", | ||
none: "Plain Text", | ||
php: "PHP", | ||
python: "Python", | ||
ruby: "Ruby", | ||
rust: "Rust", | ||
sql: "SQL", | ||
swift: "Swift", | ||
typescript: "TypeScript", | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this now.
@@ -25,7 +25,7 @@ | |||
padding: 5px; | |||
padding-left: 10px; | |||
padding-right: 10px; | |||
right: 0; | |||
right: 0px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.editorjs-codeCup_languageDropdown { | ||
/* top:10px; left:100px; */ | ||
position: fixed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Includes Improvements from @keertyverma and @calumk