parent
7f52c5de98
commit
d4c73bae29
|
@ -25,5 +25,5 @@ textarea.thought {
|
|||
font-size: 32px;
|
||||
color: var(--text-color);
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
font-family: Georgia, Libre Baskerville, serif;
|
||||
}
|
||||
|
|
|
@ -68,6 +68,23 @@
|
|||
//textEl.style.width = textEl.scrollWidth + "px";
|
||||
});
|
||||
|
||||
//Allow pasting images into the extended text text-box
|
||||
textExtEl.addEventListener("paste", (evt) => {
|
||||
const items = evt.clipboardData.items;
|
||||
const el = evt.target;
|
||||
for (const item of items) {
|
||||
//Mac clipboard at least only handles PNGs
|
||||
if ("image/png" === item.type) {
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener("load", evt => {
|
||||
const newText = `![](${evt.target.result})`;
|
||||
el.value = el.value.slice(0, el.selectionStart) + newText + el.value.slice(el.selectionEnd);
|
||||
});
|
||||
reader.readAsDataURL(item.getAsFile());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const textboxes = document.getElementsByClassName("thought");
|
||||
for (const box of textboxes) {
|
||||
//style.height doesn't include padding, .scrollHeight does
|
||||
|
|
Loading…
Reference in New Issue