Merge pull request #1590 from marktext/fix-1582

Fix: unexpected load all languages
This commit is contained in:
Ran Luo 2019-11-06 22:41:09 +08:00 committed by GitHub
commit a2bad06d3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,7 +45,10 @@ const codeBlockCtrl = ContentState => {
* @param lang Language identifier
*/
ContentState.prototype.updateCodeLanguage = function (block, lang) {
loadLanguage(lang)
if (lang && typeof lang === 'string') {
loadLanguage(lang)
}
if (block.functionType === 'languageInput') {
const preBlock = this.getParent(block)
const nextSibling = this.getNextSibling(block)
@ -102,7 +105,9 @@ const codeBlockCtrl = ContentState => {
functionType: 'languageInput'
})
loadLanguage(language)
if (language) {
loadLanguage(language)
}
block.type = 'pre'
block.functionType = 'fencecode'