Remove deleted annotation from sets

Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
2024-11-12 20:26:12 -07:00
parent 9c77018a8d
commit 6787cdf00a

View File

@@ -182,7 +182,13 @@ onAnnotation = function(e) {
if (deleteHotspot) { if (deleteHotspot) {
deleteHotspot = null deleteHotspot = null
enableViewer() enableViewer()
const anName = e.target.childNodes[0].innerText
let purgeAnnotation = new RegExp('(?<="annotationSets"[\\S\\s]*?)(^.*?' + anName + '.*\n)','gm')
e.target.remove() e.target.remove()
const editText = $('#wpTextbox1').val()
const newText = editText.replace(purgeAnnotation,'')
const finalText = newText.replace(/(,)(\n\s+])/gm,'$2')
$('#wpTextbox1').val(finalText)
writeMetadata() writeMetadata()
readMetadata() readMetadata()
return return