mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
refactor(read_only_code): split up the last TEMPPRE repalcement step
make it a bit more easy to read
This commit is contained in:
parent
f5cb845659
commit
622945ab18
@ -105,7 +105,11 @@ export default class ReadOnlyCodeTypeWidget extends AbstractCodeTypeWidget {
|
||||
});
|
||||
|
||||
for (i = pre.length; i--; ) {
|
||||
html = html.replace("<--TEMPPRE" + i + "/-->", pre[i].tag.replace("<pre>", "<pre>\n").replace("</pre>", pre[i].indent + "</pre>"));
|
||||
const formattedPreTag = pre[i].tag
|
||||
.replace("<pre>", "<pre>\n")
|
||||
.replace("</pre>", pre[i].indent + "</pre>");
|
||||
|
||||
html = html.replace(`<--TEMPPRE${i}/-->`, formattedPreTag);
|
||||
}
|
||||
|
||||
return html.charAt(0) === "\n" ? html.substr(1, html.length - 1) : html;
|
||||
|
Loading…
x
Reference in New Issue
Block a user