diff --git a/WebSocketClient/src/ImportExportFiles.ts b/WebSocketClient/src/ImportExportFiles.ts index 4333254..b5f4e28 100644 --- a/WebSocketClient/src/ImportExportFiles.ts +++ b/WebSocketClient/src/ImportExportFiles.ts @@ -1,4 +1,5 @@ import config from './config'; +import {displayEditorErrorAtContent} from "./util.ts"; export function downloadFile(content: string, filename: string): void { // Create a Blob from the file content @@ -38,7 +39,9 @@ export function uploadFile(): Promise { uploadInput.files = null; uploadInput.value = ""; stringPromise.then((res) => { - if(res.length > config.MAX_NUMBER_LINES){ + const lineCount = res.split('\n').length; + if(lineCount > config.MAX_NUMBER_LINES){ + displayEditorErrorAtContent(`The Editor only allows content up to ${config.MAX_NUMBER_LINES} Lines!`); resolve(res.split('\n').slice(0, config.MAX_NUMBER_LINES - 1).reduce((acc, curr) => acc + curr + "\n", "")); }else{ resolve(res); diff --git a/WebSocketClient/src/util.ts b/WebSocketClient/src/util.ts index 7ba6da8..336e37f 100644 --- a/WebSocketClient/src/util.ts +++ b/WebSocketClient/src/util.ts @@ -70,7 +70,7 @@ export function displayEditorErrorAtContent(msg: string) { debounceRemoveWidget(); } -const debounceRemoveWidget = lodash.debounce(removeWidget, 2000); +const debounceRemoveWidget = lodash.debounce(removeWidget, 5000); function removeWidget() { if (currentContentWidget) {