Skip to content

Commit 755b99d

Browse files
committed
only create set once
1 parent c661efc commit 755b99d

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

web_src/js/features/codeeditor.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {basename, extname, isObject, isDarkTheme, containsEle} from '../utils.js';
1+
import {basename, extname, isObject, isDarkTheme} from '../utils.js';
22
import {debounce} from 'throttle-debounce';
33

44
const languagesByFilename = {};
@@ -157,8 +157,8 @@ export async function createCodeEditor(textarea, filenameInput) {
157157

158158
const debounceInputHandler = debounce(500, () => {
159159
const filename = filenameInput.value;
160-
const isMarkdown = containsEle(markdownExts, extname(filename));
161-
togglePreviewDisplay(isMarkdown, previewFileModes);
160+
const isMarkdown = markdownExtsSet.has(extname(filename));
161+
togglePreviewDisplay(isMarkdown, hasMarkdown);
162162
updateEditor(monaco, editor, filename, lineWrapExts);
163163
});
164164

web_src/js/utils.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,3 @@ export function useLightTextOnBackground(backgroundColor) {
162162
return brightness < 0.35;
163163
}
164164

165-
// return whether an array has an element
166-
export function containsEle(arr, element) {
167-
return new Set(arr).has(element);
168-
}

0 commit comments

Comments
 (0)