Added feature to open links in new tab

This commit is contained in:
sairaj mote 2022-03-30 15:44:19 +05:30
parent e68489717a
commit fba92592aa

View File

@ -1803,7 +1803,7 @@
if (contentArea.textContent.trim() === '') {
contentCard.querySelector('.submit-entry').classList.add('hide-completely')
} else {
const cleanHTML = DOMPurify.sanitize(contentArea.innerHTML.split('\n').map(v => v.trim()).filter(v => v).join('\n'), { FORBID_ATTR: ['style'] })
const cleanHTML = DOMPurify.sanitize(contentArea.innerHTML.split('\n').map(v => v.trim()).filter(v => v).join('\n'), { FORBID_ATTR: ['style'], ADD_ATTR: ['target'] })
const hash = Crypto.SHA256(cleanHTML)
let previousHash
if (!isUniqueEntry) {
@ -1836,7 +1836,7 @@
contentArea.firstChild.remove()
contentArea.prepend(p)
}
const cleanHTML = DOMPurify.sanitize(contentArea.innerHTML.split('\n').map(v => v.trim()).filter(v => v).join('\n'), { FORBID_ATTR: ['style'] })
const cleanHTML = DOMPurify.sanitize(contentArea.innerHTML.split('\n').map(v => v.trim()).filter(v => v).join('\n'), { FORBID_ATTR: ['style'], ADD_ATTR: ['target'] })
const hash = Crypto.SHA256(cleanHTML)
let previousVersion, previousHash
if (!isUniqueEntry) {
@ -1994,7 +1994,7 @@
selectedContent.delete(contentID)
} else {
const sectionID = contentCard.closest('.article-section').dataset.sectionId
const content = DOMPurify.sanitize(contentCard.querySelector('.content__area').innerHTML.split('\n').map(v => v.trim()).filter(v => v).join('\n'), { FORBID_ATTR: ['style'] })
const content = DOMPurify.sanitize(contentCard.querySelector('.content__area').innerHTML.split('\n').map(v => v.trim()).filter(v => v).join('\n'), { FORBID_ATTR: ['style'], ADD_ATTR: ['target'] })
.replace(/b>/gi, 'strong>').replace(/i>/gi, 'em>')
const contributors = Object.keys(getIterationDetails(contentID).contributors)
selectedContent.set(contentID, { content, sectionID, contributors })