Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2df0c5b

Browse files
committedJan 21, 2023
Filter out extension names in options list
1 parent 21d5874 commit 2df0c5b

File tree

3 files changed

+468
-5
lines changed

3 files changed

+468
-5
lines changed
 

‎dist/editorjs-codeflask.bundle.js

Lines changed: 463 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/codeflask.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
import NiceSelect from "nice-select2/dist/js/nice-select2";
4343
import NiceSelectStyle from "nice-select2/dist/css/nice-select2.css";
44+
import { EXCLUDED_LANGUAGES } from "./vars";
4445

4546
class EditorJsCodeFlask {
4647
/**
@@ -196,15 +197,15 @@
196197
//Create and append the options
197198
for (var i = 0; i < languages.length; i++) {
198199
// Weirdly PrismJS doesnt expose a list of installed languages, or rather it does, but it is mixed with helper functions, which i have to clear here.
199-
if (languages[i] == "extend" || languages[i] == "insertBefore" || languages[i] == "DFS") {
200+
if (EXCLUDED_LANGUAGES.includes(languages[i])) {
200201
continue;
201202
}
202203

203204
var option = document.createElement("option");
204205
option.value = languages[i];
205206
option.text = languages[i];
206-
if(languages[i] == this.data.language){
207-
option.selected="selected"
207+
if(languages[i] === this.data.language){
208+
option.selected = "selected"
208209
}
209210
languagesSelect.appendChild(option);
210211
}

‎src/vars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const EXCLUDED_LANGUAGES = ["js", 'py', "ts", "txt", "md", 'plaintext', 'extend', 'insertBefore', "DFS"]

0 commit comments

Comments
 (0)
This repository has been archived.