mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
Merge pull request #816 from asmsuechan/iss-809
iss #809 normalize text works only in img tag
This commit is contained in:
@@ -291,8 +291,9 @@ export default class MarkdownPreview extends React.Component {
|
|||||||
})
|
})
|
||||||
|
|
||||||
_.forEach(this.refs.root.contentWindow.document.querySelectorAll('img'), (el) => {
|
_.forEach(this.refs.root.contentWindow.document.querySelectorAll('img'), (el) => {
|
||||||
|
el.src = markdown.normalizeLinkText(el.src)
|
||||||
if (!/\/:storage/.test(el.src)) return
|
if (!/\/:storage/.test(el.src)) return
|
||||||
el.src = `file:///${path.join(storagePath, 'images', path.basename(el.src))}`
|
el.src = `file:///${markdown.normalizeLinkText(path.join(storagePath, 'images', path.basename(el.src)))}`
|
||||||
})
|
})
|
||||||
|
|
||||||
codeBlockTheme = consts.THEMES.some((_theme) => _theme === codeBlockTheme)
|
codeBlockTheme = consts.THEMES.some((_theme) => _theme === codeBlockTheme)
|
||||||
|
|||||||
@@ -165,12 +165,17 @@ function strip (input) {
|
|||||||
return output
|
return output
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normalizeLinkText (linkText) {
|
||||||
|
return md.normalizeLinkText(linkText)
|
||||||
|
}
|
||||||
|
|
||||||
const markdown = {
|
const markdown = {
|
||||||
render: function markdown (content) {
|
render: function markdown (content) {
|
||||||
if (!_.isString(content)) content = ''
|
if (!_.isString(content)) content = ''
|
||||||
const renderedContent = md.render(content)
|
const renderedContent = md.render(content)
|
||||||
return md.normalizeLinkText(renderedContent)
|
return renderedContent
|
||||||
},
|
},
|
||||||
strip
|
strip,
|
||||||
|
normalizeLinkText
|
||||||
}
|
}
|
||||||
export default markdown
|
export default markdown
|
||||||
|
|||||||
Reference in New Issue
Block a user