Skip to content

Commit

Permalink
fix(cm6.js): 处理一类已知错误 (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhsd-harry committed Mar 17, 2024
1 parent 362d972 commit 6f4970b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/plugins/code-mirror/cm6.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,14 @@ mw.hook('InPageEdit').add(() =>
})
}

return await CodeMirror6.fromTextArea(target[0], mode, page.namespace)
const cm = await CodeMirror6.fromTextArea(target[0], mode, page.namespace)
if (mode === 'mediawiki') {
const config = mw.config.get('extCodeMirrorConfig')
if (config.urlProtocols.includes('\\:')) {
config.urlProtocols = config.urlProtocols.replace(/\\:/g, ':')
cm.setLanguage('mediawiki', config)
}
}
}
}

Expand Down

0 comments on commit 6f4970b

Please sign in to comment.