forked from vikunja/frontend
chore(editor): remove converting markdown
This commit is contained in:
parent
c367b70ccc
commit
22223a56bd
@ -97,11 +97,9 @@
|
||||
"blurhash": "2.0.5",
|
||||
"bulma-css-variables": "0.9.33",
|
||||
"camel-case": "4.1.2",
|
||||
"codemirror": "5.65.15",
|
||||
"date-fns": "2.30.0",
|
||||
"dayjs": "1.11.10",
|
||||
"dompurify": "3.0.6",
|
||||
"easymde": "2.18.0",
|
||||
"fast-deep-equal": "3.1.3",
|
||||
"flatpickr": "4.6.13",
|
||||
"flexsearch": "0.7.31",
|
||||
@ -111,7 +109,6 @@
|
||||
"klona": "2.0.6",
|
||||
"lodash.debounce": "4.0.8",
|
||||
"lowlight": "2.7.0",
|
||||
"marked": "9.1.2",
|
||||
"pinia": "2.1.7",
|
||||
"register-service-worker": "1.7.2",
|
||||
"snake-case": "3.0.4",
|
||||
|
51
pnpm-lock.yaml
generated
51
pnpm-lock.yaml
generated
@ -166,9 +166,6 @@ dependencies:
|
||||
camel-case:
|
||||
specifier: 4.1.2
|
||||
version: 4.1.2
|
||||
codemirror:
|
||||
specifier: 5.65.15
|
||||
version: 5.65.15
|
||||
date-fns:
|
||||
specifier: 2.30.0
|
||||
version: 2.30.0
|
||||
@ -178,9 +175,6 @@ dependencies:
|
||||
dompurify:
|
||||
specifier: 3.0.6
|
||||
version: 3.0.6
|
||||
easymde:
|
||||
specifier: 2.18.0
|
||||
version: 2.18.0
|
||||
fast-deep-equal:
|
||||
specifier: 3.1.3
|
||||
version: 3.1.3
|
||||
@ -208,9 +202,6 @@ dependencies:
|
||||
lowlight:
|
||||
specifier: 2.7.0
|
||||
version: 2.7.0
|
||||
marked:
|
||||
specifier: 9.1.2
|
||||
version: 9.1.2
|
||||
pinia:
|
||||
specifier: 2.1.7
|
||||
version: 2.1.7(typescript@5.2.2)(vue@3.3.6)
|
||||
@ -4628,6 +4619,7 @@ packages:
|
||||
resolution: {integrity: sha512-SFSj5Tb/mtQoVgaltsipdRGG1PkcFu/L0OXPNBGCXYUQtwsNoAGRNNHOTl1jYcQUcEI77EiUfk94bgETTbSo/A==}
|
||||
dependencies:
|
||||
'@types/tern': 0.23.4
|
||||
dev: true
|
||||
|
||||
/@types/dompurify@3.0.4:
|
||||
resolution: {integrity: sha512-1Jk8S/IRzNSbwQRbuGuLFHviwxQ8pX81ZEW3INY9432Cwb4VedkBYan8gSIXVLOLHBtimOmUTEYphjRVmo+30g==}
|
||||
@ -4716,10 +4708,6 @@ packages:
|
||||
'@types/mdurl': 1.0.2
|
||||
dev: true
|
||||
|
||||
/@types/marked@4.3.1:
|
||||
resolution: {integrity: sha512-vSSbKZFbNktrQ15v7o1EaH78EbWV+sPQbPjHG+Cp8CaNcPFUEfjZ0Iml/V0bFDwsTlYe8o6XC5Hfdp91cqPV2g==}
|
||||
dev: false
|
||||
|
||||
/@types/marked@5.0.2:
|
||||
resolution: {integrity: sha512-OucS4KMHhFzhz27KxmWg7J+kIYqyqoW5kdIEI319hqARQQUTqhao3M/F+uFnDXD0Rg72iDDZxZNxq5gvctmLlg==}
|
||||
dev: true
|
||||
@ -4791,6 +4779,7 @@ packages:
|
||||
resolution: {integrity: sha512-JAUw1iXGO1qaWwEOzxTKJZ/5JxVeON9kvGZ/osgZaJImBnyjyn0cjovPsf6FNLmyGY8Vw9DoXZCMlfMkMwHRWg==}
|
||||
dependencies:
|
||||
'@types/estree': 1.0.0
|
||||
dev: true
|
||||
|
||||
/@types/throttle-debounce@2.1.0:
|
||||
resolution: {integrity: sha512-5eQEtSCoESnh2FsiLTxE121IiE60hnMqcb435fShf4bpLRjEu1Eoekht23y6zXS9Ts3l+Szu3TARnTsA0GkOkQ==}
|
||||
@ -6151,16 +6140,6 @@ packages:
|
||||
engines: {node: '>=0.8'}
|
||||
dev: true
|
||||
|
||||
/codemirror-spell-checker@1.1.2:
|
||||
resolution: {integrity: sha1-HGYPkIlIPMtRE7m6nKGcP0mTNx4=}
|
||||
dependencies:
|
||||
typo-js: 1.2.1
|
||||
dev: false
|
||||
|
||||
/codemirror@5.65.15:
|
||||
resolution: {integrity: sha512-YC4EHbbwQeubZzxLl5G4nlbLc1T21QTrKGaOal/Pkm9dVDMZXMH7+ieSPEOZCtO9I68i8/oteJKOxzHC2zR+0g==}
|
||||
dev: false
|
||||
|
||||
/color-convert@1.9.3:
|
||||
resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==}
|
||||
dependencies:
|
||||
@ -6753,16 +6732,6 @@ packages:
|
||||
resolution: {integrity: sha512-GJRqdiy2h+EXy6a8E6R+ubmqUM08BK0FWNq41k24fup6045biQ8NXxoXimiwegMQvFFV3t1emADdGNL1TlS61A==}
|
||||
dev: false
|
||||
|
||||
/easymde@2.18.0:
|
||||
resolution: {integrity: sha512-IxVVUxNWIoXLeqtBU4BLc+eS/ScYhT1Dcb6yF5Wchoj1iXAV+TIIDWx+NCaZhY7RcSHqDPKllbYq7nwGKILnoA==}
|
||||
dependencies:
|
||||
'@types/codemirror': 5.60.12
|
||||
'@types/marked': 4.3.1
|
||||
codemirror: 5.65.15
|
||||
codemirror-spell-checker: 1.1.2
|
||||
marked: 4.3.0
|
||||
dev: false
|
||||
|
||||
/ecc-jsbn@0.1.2:
|
||||
resolution: {integrity: sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==}
|
||||
dependencies:
|
||||
@ -8633,18 +8602,6 @@ packages:
|
||||
uc.micro: 1.0.6
|
||||
dev: false
|
||||
|
||||
/marked@4.3.0:
|
||||
resolution: {integrity: sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==}
|
||||
engines: {node: '>= 12'}
|
||||
hasBin: true
|
||||
dev: false
|
||||
|
||||
/marked@9.1.2:
|
||||
resolution: {integrity: sha512-qoKMJqK0w6vkLk8+KnKZAH6neUZSNaQqVZ/h2yZ9S7CbLuFHyS2viB0jnqcWF9UKjwsAbMrQtnQhdmdvOVOw9w==}
|
||||
engines: {node: '>= 16'}
|
||||
hasBin: true
|
||||
dev: false
|
||||
|
||||
/mdn-data@2.0.28:
|
||||
resolution: {integrity: sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==}
|
||||
dev: true
|
||||
@ -10845,10 +10802,6 @@ packages:
|
||||
engines: {node: '>=14.17'}
|
||||
hasBin: true
|
||||
|
||||
/typo-js@1.2.1:
|
||||
resolution: {integrity: sha512-bTGLjbD3WqZDR3CgEFkyi9Q/SS2oM29ipXrWfDb4M74ea69QwKAECVceYpaBu0GfdnASMg9Qfl67ttB23nePHg==}
|
||||
dev: false
|
||||
|
||||
/uc.micro@1.0.6:
|
||||
resolution: {integrity: sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==}
|
||||
|
||||
|
@ -116,14 +116,8 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
export const TIPTAP_TEXT_VALUE_PREFIX = '<!-- VIKUNJA TIPTAP -->\n'
|
||||
const tiptapRegex = new RegExp(`${TIPTAP_TEXT_VALUE_PREFIX}`, 's')
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {ref, watch, onBeforeUnmount, nextTick, onMounted, computed} from 'vue'
|
||||
import {marked} from 'marked'
|
||||
import {refDebounced} from '@vueuse/core'
|
||||
|
||||
import EditorToolbar from './EditorToolbar.vue'
|
||||
@ -277,18 +271,7 @@ const inputHTML = ref('')
|
||||
watch(
|
||||
() => modelValue,
|
||||
() => {
|
||||
if (modelValue === '') {
|
||||
inputHTML.value = TIPTAP_TEXT_VALUE_PREFIX
|
||||
return
|
||||
}
|
||||
|
||||
if (!modelValue.startsWith(TIPTAP_TEXT_VALUE_PREFIX)) {
|
||||
// convert Markdown to HTML
|
||||
inputHTML.value = TIPTAP_TEXT_VALUE_PREFIX + marked.parse(modelValue)
|
||||
return
|
||||
}
|
||||
|
||||
inputHTML.value = modelValue.replace(tiptapRegex, '')
|
||||
inputHTML.value = modelValue
|
||||
},
|
||||
{immediate: true},
|
||||
)
|
||||
@ -307,12 +290,12 @@ const debouncedInputHTML = refDebounced(inputHTML, 1000)
|
||||
watch(debouncedInputHTML, () => bubbleNow())
|
||||
|
||||
function bubbleNow() {
|
||||
emit('update:modelValue', TIPTAP_TEXT_VALUE_PREFIX + inputHTML.value)
|
||||
emit('update:modelValue', inputHTML.value)
|
||||
}
|
||||
|
||||
function bubbleSave() {
|
||||
bubbleNow()
|
||||
emit('save', TIPTAP_TEXT_VALUE_PREFIX + inputHTML.value)
|
||||
emit('save', inputHTML.value)
|
||||
if (initialMode === 'preview' && isEditing.value) {
|
||||
internalMode.value = 'preview'
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
<script lang="ts" setup>
|
||||
import {computed} from 'vue'
|
||||
import {setupMarkdownRenderer} from '@/helpers/markdownRenderer'
|
||||
import {marked} from 'marked'
|
||||
import DOMPurify from 'dompurify'
|
||||
import {createRandomID} from '@/helpers/randomId'
|
||||
import {useProjectStore} from '@/stores/projects'
|
||||
@ -37,6 +36,6 @@ const htmlDescription = computed(() => {
|
||||
}
|
||||
|
||||
setupMarkdownRenderer(createRandomID())
|
||||
return DOMPurify.sanitize(marked(description), {ADD_ATTR: ['target']})
|
||||
return DOMPurify.sanitize(description, {ADD_ATTR: ['target']})
|
||||
})
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user