Switch to html_notes
This commit is contained in:
@@ -8,7 +8,7 @@ async function handleClick(tab, e) {
|
|||||||
const store = {};
|
const store = {};
|
||||||
store[`create_${crypto.randomUUID()}`] = {
|
store[`create_${crypto.randomUUID()}`] = {
|
||||||
name: tab.title,
|
name: tab.title,
|
||||||
notes: tab.url,
|
html_notes: `<body><a href="${encodeURI(tab.url)}">${escapeHTML(tab.url)}</a></body>`,
|
||||||
attach: imgURL,
|
attach: imgURL,
|
||||||
filename: 'screenshot.png',
|
filename: 'screenshot.png',
|
||||||
};
|
};
|
||||||
@@ -22,6 +22,7 @@ async function handleClick(tab, e) {
|
|||||||
let inHandleChange = false;
|
let inHandleChange = false;
|
||||||
|
|
||||||
async function handleChange(e) {
|
async function handleChange(e) {
|
||||||
|
// async functions allow concurrency. Add sketchy mutex.
|
||||||
if (inHandleChange) {
|
if (inHandleChange) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -61,7 +62,7 @@ async function create(cfg, task) {
|
|||||||
workspace: cfg['workspace'],
|
workspace: cfg['workspace'],
|
||||||
assignee: cfg['assignee'],
|
assignee: cfg['assignee'],
|
||||||
name: task.name,
|
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([
|
const typeHandlers = new Map([
|
||||||
['create', create],
|
['create', create],
|
||||||
['attach', attach],
|
['attach', attach],
|
||||||
|
|||||||
Reference in New Issue
Block a user