Skip to content

Commit a969af7

Browse files
committed
update textbox size on upload
1 parent 453e7e3 commit a969af7

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

dnotebook/src/public/javascripts/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,6 @@ $("#import-notebook-file").change(() => {
447447
}
448448
reader.readAsText(content);
449449
}
450-
$("#uploadNoteModal").modal('hide');
451450
})
452451

453452

dnotebook/src/public/javascripts/utils.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@
365365

366366
$(`textarea#text-box_${id}`).addClass("text-box")
367367
$(`textarea#text-box_${id}`).val(md_out)
368-
// update_text_box_size()
368+
update_text_box_size()
369369

370370
$(`#text-div_${id}`)
371371
.mouseover(function () {
@@ -381,7 +381,21 @@
381381
}
382382
}
383383

384-
384+
385+
386+
/**
387+
* Helper function to update text box size dynamically
388+
*/
389+
function update_text_box_size() {
390+
$('textarea').each(function () {
391+
this.setAttribute('style', 'height:' + (this.scrollHeight) + 'px;overflow-y:hidden;');
392+
}).on('input', function () {
393+
this.style.height = 'auto';
394+
this.style.height = (this.scrollHeight) + 'px';
395+
});
396+
}
397+
398+
385399
/**
386400
* Helper function to easily log output from for loops in Dom
387401
* @param {*} args
@@ -401,7 +415,7 @@
401415
global.notebook_json = notebook_json
402416
global.load_notebook = load_notebook
403417
global.load_package = load_package
404-
global.load_data = load_csv
418+
global.load_csv = load_csv
405419
global.table = table
406420

407421
})(window)

0 commit comments

Comments
 (0)