mirror of
https://github.com/marktext/marktext.git
synced 2025-05-08 10:31:38 +08:00
Merge pull request #1590 from marktext/fix-1582
Fix: unexpected load all languages
This commit is contained in:
commit
a2bad06d3c
@ -45,7 +45,10 @@ const codeBlockCtrl = ContentState => {
|
|||||||
* @param lang Language identifier
|
* @param lang Language identifier
|
||||||
*/
|
*/
|
||||||
ContentState.prototype.updateCodeLanguage = function (block, lang) {
|
ContentState.prototype.updateCodeLanguage = function (block, lang) {
|
||||||
|
if (lang && typeof lang === 'string') {
|
||||||
loadLanguage(lang)
|
loadLanguage(lang)
|
||||||
|
}
|
||||||
|
|
||||||
if (block.functionType === 'languageInput') {
|
if (block.functionType === 'languageInput') {
|
||||||
const preBlock = this.getParent(block)
|
const preBlock = this.getParent(block)
|
||||||
const nextSibling = this.getNextSibling(block)
|
const nextSibling = this.getNextSibling(block)
|
||||||
@ -102,7 +105,9 @@ const codeBlockCtrl = ContentState => {
|
|||||||
functionType: 'languageInput'
|
functionType: 'languageInput'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (language) {
|
||||||
loadLanguage(language)
|
loadLanguage(language)
|
||||||
|
}
|
||||||
|
|
||||||
block.type = 'pre'
|
block.type = 'pre'
|
||||||
block.functionType = 'fencecode'
|
block.functionType = 'fencecode'
|
||||||
|
Loading…
Reference in New Issue
Block a user