Skip to content
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

Fix textarea height bug #93

Open
wants to merge 4 commits into
base: fomantic-and-asciidocs
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions static/jscn/syngrafias.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,15 @@ function autoconv(celliden) {
let textareaElement = document.getElementById("textdata-" + celliden);
let textdata = textareaElement.value;
let htmldata = Asciidoctor().convert(textdata);
document.getElementById("otptdata-" + celliden).innerHTML = htmldata;
textareaElement.style.height = '100%';
let opContainer = document.getElementById("otptdata-" + celliden);
opContainer.innerHTML = htmldata;
opContainer.style.flexGrow = '';
let ht = window.getComputedStyle(opContainer, null).getPropertyValue("height");
// console.log(ht)
let opHeight = ht.substr(0, ht.length-2);
textareaElement.style.height = '10px';
textareaElement.style.height = Math.max(opHeight, textareaElement.scrollHeight+2) + 'px';
opContainer.style.flexGrow = '1';
}

function chektime(chekqant) {
Expand Down Expand Up @@ -337,11 +344,11 @@ function makecell(celliden) {
<div class='' style='display: flex;'>
<div id='txtar-${celliden}' class='default'>
<div class='ui tiny form field' style='height: 100%;'>
<textarea rows='' id='textdata-${celliden}' class='monotext' onkeyup='autoconv("${celliden}"); sendnote("${celliden}");'></textarea>
<textarea rows='' id='textdata-${celliden}' style="resize: none; overflow-y: hidden;" class='monotext' onkeyup='autoconv("${celliden}"); sendnote("${celliden}");'></textarea>
</div>
</div>
<div id='op-${celliden}' class='' style='border-width: 2px; border-radius: 2px;'>
<div class='ui form textbase' style='border: 1px solid #dedede; border-radius: 5px; height: 100%; padding: 1%; background-color: #FFFFFF;' id='otptdata-${celliden}'></div>
<div id='op-${celliden}' class='' style='display: flex; flex-direction: column; border-width: 2px; border-radius: 2px;'>
<div class='ui form textbase' style='flex-grow: 1; border: 1px solid #dedede; border-radius: 5px; padding: 1%; background-color: #FFFFFF;' id='otptdata-${celliden}'></div>
</div>
</div>
</div>
Expand Down Expand Up @@ -477,11 +484,12 @@ function toggleCell(celliden) {
ta.style.width = "calc(50% - "+(gutterSize/2)+"px)";
ta.style.display = "block";
op.style.width = "calc(50% - "+(gutterSize/2)+"px)";
op.style.display = "block";
op.style.display = "flex";
gt.style.display = "block";
}
ta.style.height = '100%';

let opContainer = document.getElementById("otptdata-" + celliden);
opContainer.style.flexGrow = '';
opContainer.style.flexGrow = '1';
}

function sendpull(celliden) {
Expand Down