fix: markdown parser link issue
This commit is contained in:
@@ -132,7 +132,7 @@ const renderEditor = (holder) => {
|
|||||||
holder: holder,
|
holder: holder,
|
||||||
tools: getEditorTools(true),
|
tools: getEditorTools(true),
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
defaultBlock: 'markdownParser',
|
defaultBlock: 'markdown',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { toast } from 'frappe-ui'
|
|||||||
import { useTimeAgo } from '@vueuse/core'
|
import { useTimeAgo } from '@vueuse/core'
|
||||||
import { Quiz } from '@/utils/quiz'
|
import { Quiz } from '@/utils/quiz'
|
||||||
import { Upload } from '@/utils/upload'
|
import { Upload } from '@/utils/upload'
|
||||||
import { MarkdownParser } from '@/utils/markdownParser'
|
import { Markdown } from '@/utils/markdownParser'
|
||||||
import Header from '@editorjs/header'
|
import Header from '@editorjs/header'
|
||||||
import Paragraph from '@editorjs/paragraph'
|
import Paragraph from '@editorjs/paragraph'
|
||||||
import { CodeBox } from '@/utils/code'
|
import { CodeBox } from '@/utils/code'
|
||||||
@@ -156,12 +156,12 @@ export function getEditorTools() {
|
|||||||
},
|
},
|
||||||
quiz: Quiz,
|
quiz: Quiz,
|
||||||
upload: Upload,
|
upload: Upload,
|
||||||
markdownParser: MarkdownParser,
|
markdown: Markdown,
|
||||||
image: SimpleImage,
|
image: SimpleImage,
|
||||||
table: Table,
|
table: Table,
|
||||||
paragraph: {
|
paragraph: {
|
||||||
class: Paragraph,
|
class: Paragraph,
|
||||||
inlineToolbar: false,
|
inlineToolbar: true,
|
||||||
config: {
|
config: {
|
||||||
preserveBlank: true,
|
preserveBlank: true,
|
||||||
},
|
},
|
||||||
@@ -187,7 +187,7 @@ export function getEditorTools() {
|
|||||||
},
|
},
|
||||||
embed: {
|
embed: {
|
||||||
class: Embed,
|
class: Embed,
|
||||||
inlineToolbar: true,
|
inlineToolbar: false,
|
||||||
config: {
|
config: {
|
||||||
services: {
|
services: {
|
||||||
youtube: {
|
youtube: {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export class MarkdownParser {
|
export class Markdown {
|
||||||
constructor({ data, api, readOnly, config }) {
|
constructor({ data, api, readOnly, config }) {
|
||||||
this.api = api
|
this.api = api
|
||||||
this.data = data || {}
|
this.data = data || {}
|
||||||
@@ -65,6 +65,8 @@ export class MarkdownParser {
|
|||||||
} else if (previousLine && this.hasLink(previousLine)) {
|
} else if (previousLine && this.hasLink(previousLine)) {
|
||||||
const { text, url } = this.extractLink(previousLine)
|
const { text, url } = this.extractLink(previousLine)
|
||||||
const anchorTag = `<a href="${url}" target="_blank">${text}</a>`
|
const anchorTag = `<a href="${url}" target="_blank">${text}</a>`
|
||||||
|
console.log(previousLine.replace(/\[.+?\]\(.+?\)/, anchorTag))
|
||||||
|
debugger
|
||||||
this.convertBlock('paragraph', {
|
this.convertBlock('paragraph', {
|
||||||
text: previousLine.replace(/\[.+?\]\(.+?\)/, anchorTag),
|
text: previousLine.replace(/\[.+?\]\(.+?\)/, anchorTag),
|
||||||
})
|
})
|
||||||
@@ -149,4 +151,4 @@ export class MarkdownParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default MarkdownParser
|
export default Markdown
|
||||||
|
|||||||
Reference in New Issue
Block a user