Skip to content

Commit bdd2de7

Browse files
committed
set default lang attr for note to 'en'
Signed-off-by: BinotaLIU <binota@binota.org>
1 parent 2453b2a commit bdd2de7

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

public/js/extra.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -191,18 +191,15 @@ export function parseMeta (md, edit, view, toc, tocAffix) {
191191
dir = meta.dir
192192
breaks = meta.breaks
193193
}
194-
// text language
195-
if (lang && typeof lang === 'string') {
196-
view.attr('lang', lang)
197-
toc.attr('lang', lang)
198-
tocAffix.attr('lang', lang)
199-
if (edit) { edit.attr('lang', lang) }
200-
} else {
201-
view.removeAttr('lang')
202-
toc.removeAttr('lang')
203-
tocAffix.removeAttr('lang')
204-
if (edit) { edit.removeAttr('lang', lang) }
194+
if (!lang || typeof lang !== 'string') {
195+
lang = 'en'
205196
}
197+
// text language
198+
view.attr('lang', lang)
199+
toc.attr('lang', lang)
200+
tocAffix.attr('lang', lang)
201+
if (edit) { edit.attr('lang', lang) }
202+
206203
// text direction
207204
if (dir && typeof dir === 'string') {
208205
view.attr('dir', dir)

0 commit comments

Comments
 (0)