【发布时间】:2020-01-04 12:00:09
【问题描述】:
我正在尝试为模态框中的 Textarea 提供尺寸。
从这里 Add content of showModalDialog() to the clipboard Google Script
HTML 是
<textarea id="copy"><?=temp?></textarea>
<button>Copy</button>
<script type="text/javascript">
let t = document.getElementById('copy');
let copy = () => {
t.select();
document.execCommand('copy');
};
/*copy();//try copying without user click */
let bt = document.querySelector('button');
bt.addEventListener('click', copy);
</script>
我可以给模态框指定尺寸
//Output to Html
var template = HtmlService.createTemplateFromFile('copy');
template.temp = temp;
var htmlOutput = template.evaluate();
htmlOutput.setWidth(610)
htmlOutput.setHeight(500);
SpreadsheetApp.getUi().showModalDialog(htmlOutput, 'OptionList Multiple Selectors');
}
我试图让 Modal 和 Textarea 的尺寸相同 就像现在一样,textarea 大约是 20 x 50。
【问题讨论】:
标签: javascript css google-apps-script modal-dialog