chore(editor): remove marked usages
This commit is contained in:
parent
22223a56bd
commit
37af478811
@ -104,7 +104,6 @@
|
|||||||
"flatpickr": "4.6.13",
|
"flatpickr": "4.6.13",
|
||||||
"flexsearch": "0.7.31",
|
"flexsearch": "0.7.31",
|
||||||
"floating-vue": "2.0.0-beta.24",
|
"floating-vue": "2.0.0-beta.24",
|
||||||
"highlight.js": "11.9.0",
|
|
||||||
"is-touch-device": "1.0.1",
|
"is-touch-device": "1.0.1",
|
||||||
"klona": "2.0.6",
|
"klona": "2.0.6",
|
||||||
"lodash.debounce": "4.0.8",
|
"lodash.debounce": "4.0.8",
|
||||||
|
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
@ -187,9 +187,6 @@ dependencies:
|
|||||||
floating-vue:
|
floating-vue:
|
||||||
specifier: 2.0.0-beta.24
|
specifier: 2.0.0-beta.24
|
||||||
version: 2.0.0-beta.24(vue@3.3.6)
|
version: 2.0.0-beta.24(vue@3.3.6)
|
||||||
highlight.js:
|
|
||||||
specifier: 11.9.0
|
|
||||||
version: 11.9.0
|
|
||||||
is-touch-device:
|
is-touch-device:
|
||||||
specifier: 1.0.1
|
specifier: 1.0.1
|
||||||
version: 1.0.1
|
version: 1.0.1
|
||||||
@ -7665,11 +7662,6 @@ packages:
|
|||||||
engines: {node: '>=12.0.0'}
|
engines: {node: '>=12.0.0'}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/highlight.js@11.9.0:
|
|
||||||
resolution: {integrity: sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw==}
|
|
||||||
engines: {node: '>=12.0.0'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/histoire@0.17.2(@types/node@18.18.6)(sass@1.69.4)(terser@5.10.0)(vite@4.5.0):
|
/histoire@0.17.2(@types/node@18.18.6)(sass@1.69.4)(terser@5.10.0)(vite@4.5.0):
|
||||||
resolution: {integrity: sha512-Mz+4AWBs+P2TeopXJ0qG4ZsrpuLggNPNF3yG4Q8yg8kXcd6a9DXUWuEElYbglod/xP5XB8efaDy2nibLTybJzg==}
|
resolution: {integrity: sha512-Mz+4AWBs+P2TeopXJ0qG4ZsrpuLggNPNF3yG4Q8yg8kXcd6a9DXUWuEElYbglod/xP5XB8efaDy2nibLTybJzg==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
@ -159,7 +159,6 @@ import {Node} from '@tiptap/pm/model'
|
|||||||
import Commands from './commands'
|
import Commands from './commands'
|
||||||
import suggestionSetup from './suggestion'
|
import suggestionSetup from './suggestion'
|
||||||
|
|
||||||
// load all highlight.js languages
|
|
||||||
import {lowlight} from 'lowlight'
|
import {lowlight} from 'lowlight'
|
||||||
|
|
||||||
import type {BottomAction, UploadCallback} from './types'
|
import type {BottomAction, UploadCallback} from './types'
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
import {marked} from 'marked'
|
|
||||||
import hljs from 'highlight.js/lib/common'
|
|
||||||
|
|
||||||
export function setupMarkdownRenderer(checkboxId: string) {
|
|
||||||
const renderer = new marked.Renderer()
|
|
||||||
const linkRenderer = renderer.link
|
|
||||||
|
|
||||||
let checkboxNum = -1
|
|
||||||
marked.use({
|
|
||||||
renderer: {
|
|
||||||
image(src: string, title: string, text: string) {
|
|
||||||
|
|
||||||
title = title ? ` title="${title}` : ''
|
|
||||||
|
|
||||||
// If the url starts with the api url, the image is likely an attachment and
|
|
||||||
// we'll need to download and parse it properly.
|
|
||||||
if (src.slice(0, window.API_URL.length + 7) === `${window.API_URL}/tasks/`) {
|
|
||||||
return `<img data-src="${src}" alt="${text}" ${title} class="attachment-image"/>`
|
|
||||||
}
|
|
||||||
|
|
||||||
return `<img src="${src}" alt="${text}" ${title}/>`
|
|
||||||
},
|
|
||||||
checkbox(checked: boolean) {
|
|
||||||
let checkedString = ''
|
|
||||||
if (checked) {
|
|
||||||
checkedString = 'checked'
|
|
||||||
}
|
|
||||||
|
|
||||||
checkboxNum++
|
|
||||||
return `<input type="checkbox" data-checkbox-num="${checkboxNum}" ${checkedString} class="text-checkbox-${checkboxId}"/>`
|
|
||||||
},
|
|
||||||
link(href: string, title: string, text: string) {
|
|
||||||
const isLocal = href.startsWith(`${location.protocol}//${location.hostname}`)
|
|
||||||
const html = linkRenderer.call(renderer, href, title, text)
|
|
||||||
return isLocal ? html : html.replace(/^<a /, '<a target="_blank" rel="noreferrer noopener nofollow" ')
|
|
||||||
},
|
|
||||||
},
|
|
||||||
highlight(code: string, language: string) {
|
|
||||||
const validLanguage = hljs.getLanguage(language) ? language : 'plaintext'
|
|
||||||
return hljs.highlight(code, {language: validLanguage}).value
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
return renderer
|
|
||||||
}
|
|
@ -15,9 +15,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {computed} from 'vue'
|
import {computed} from 'vue'
|
||||||
import {setupMarkdownRenderer} from '@/helpers/markdownRenderer'
|
|
||||||
import DOMPurify from 'dompurify'
|
import DOMPurify from 'dompurify'
|
||||||
import {createRandomID} from '@/helpers/randomId'
|
|
||||||
import {useProjectStore} from '@/stores/projects'
|
import {useProjectStore} from '@/stores/projects'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -35,7 +33,6 @@ const htmlDescription = computed(() => {
|
|||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
setupMarkdownRenderer(createRandomID())
|
|
||||||
return DOMPurify.sanitize(description, {ADD_ATTR: ['target']})
|
return DOMPurify.sanitize(description, {ADD_ATTR: ['target']})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user