Added image uploading via markdown using base64

This commit is contained in:
Tracker-Friendly 2024-07-02 19:04:13 +01:00
parent 818bdf6806
commit 16d544640c
1 changed files with 40 additions and 1 deletions

View File

@ -107,7 +107,46 @@ document.addEventListener("DOMContentLoaded", function() {
button: 'pell-button',
content: 'pell-content',
selected: 'pell-button-selected'
}
},
actions: [
"bold",
"italic",
"underline",
"strikethrough",
"heading1",
"heading2",
"paragraph",
"quote",
"olist",
"ulist",
"code",
"line",
"link",
{
name: 'uploadimage',
icon: '📁',
title: 'Upload image',
result: function result() {
async function doStuff() {
errorInput.classList.remove("hidden")
errorInput.type = "file"
errorInput.value = ""
displayError("Select an image to upload:")
await waitForConfirm()
let file = errorInput.files[0]
if (file) {
let reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = function () {
pell.exec('insertImage', reader.result);
}
}
}
doStuff();
}
},
"image",
],
})
let noteBox = document.getElementsByClassName("pell-content")[0]