mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-26 04:47:42 +08:00
Fix:修复导入Markdown文件时对于加粗、代码等语法识别错误的问题
This commit is contained in:
parent
0f6f714303
commit
70cc88efbd
@ -1,19 +1,17 @@
|
||||
import { fromMarkdown } from 'mdast-util-from-markdown'
|
||||
|
||||
const getNodeText = node => {
|
||||
// 优先找出其中的text类型的子节点
|
||||
let textChild = (node.children || []).find(item => {
|
||||
return item.type === 'text'
|
||||
})
|
||||
// 没有找到,那么直接使用第一个子节点
|
||||
textChild = textChild || node.children[0]
|
||||
if (textChild) {
|
||||
if (textChild.value !== undefined) {
|
||||
return textChild.value
|
||||
let textStr = ''
|
||||
|
||||
;(node.children || []).forEach(item => {
|
||||
if (['inlineCode', 'text'].includes(item.type)) {
|
||||
textStr += item.value || ''
|
||||
} else {
|
||||
textStr += getNodeText(item)
|
||||
}
|
||||
return getNodeText(textChild)
|
||||
}
|
||||
return ''
|
||||
})
|
||||
|
||||
return textStr
|
||||
}
|
||||
|
||||
// 处理list的情况
|
||||
|
||||
@ -359,7 +359,7 @@ export default {
|
||||
'Current: Left click to box select nodes, right click to drag the canvas'
|
||||
},
|
||||
search: {
|
||||
searchPlaceholder: 'Please enter the search content',
|
||||
searchPlaceholder: 'Enter the search content and press Enter',
|
||||
replacePlaceholder: 'Please enter replacement content',
|
||||
replace: 'Replace',
|
||||
replaceAll: 'Replace all',
|
||||
|
||||
@ -347,7 +347,7 @@ export default {
|
||||
tip2: '当前:左键框选节点,右键拖动画布'
|
||||
},
|
||||
search: {
|
||||
searchPlaceholder: '请输入查找内容',
|
||||
searchPlaceholder: '输入查找内容后按回车键',
|
||||
replacePlaceholder: '请输入替换内容',
|
||||
replace: '替换',
|
||||
replaceAll: '全部替换',
|
||||
|
||||
@ -346,7 +346,7 @@ export default {
|
||||
tip2: '目前:左鍵框選節點,右鍵拖曳畫布'
|
||||
},
|
||||
search: {
|
||||
searchPlaceholder: '請輸入搜尋內容',
|
||||
searchPlaceholder: '輸入查找內容後按回車鍵',
|
||||
replacePlaceholder: '請輸入取代內容',
|
||||
replace: '取代',
|
||||
replaceAll: '全部取代',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user