Switch to html_notes

This commit is contained in:
Ian Gulliver
2022-10-18 23:14:37 -07:00
parent 9a5125b3e9
commit afc76487e5

View File

@@ -8,7 +8,7 @@ async function handleClick(tab, e) {
const store = {};
store[`create_${crypto.randomUUID()}`] = {
name: tab.title,
notes: tab.url,
html_notes: `<body><a href="${encodeURI(tab.url)}">${escapeHTML(tab.url)}</a></body>`,
attach: imgURL,
filename: 'screenshot.png',
};
@@ -22,6 +22,7 @@ async function handleClick(tab, e) {
let inHandleChange = false;
async function handleChange(e) {
// async functions allow concurrency. Add sketchy mutex.
if (inHandleChange) {
return;
}
@@ -61,7 +62,7 @@ async function create(cfg, task) {
workspace: cfg['workspace'],
assignee: cfg['assignee'],
name: task.name,
notes: task.notes,
html_notes: task.html_notes,
},
};
@@ -131,6 +132,12 @@ async function attach(cfg, task) {
}
}
function escapeHTML(unsafe) {
const div = document.createElement('div');
div.innerText = unsafe;
return div.innerHTML;
}
const typeHandlers = new Map([
['create', create],
['attach', attach],