Compare commits
3 Commits
3e20e41565
...
e3702878cd
Author | SHA1 | Date | |
---|---|---|---|
e3702878cd | |||
4cc9efce42 | |||
d1eeea3c85 |
@ -67,12 +67,12 @@ class UI {
|
||||
*/
|
||||
public static updateUI(element?: Element) {
|
||||
element = element || document.body;
|
||||
UI.unescapeMarkTags(element);
|
||||
UI.addLineNumbers(element);
|
||||
UI.addHighlighting(element);
|
||||
UI.addBootstrapTooltips(element);
|
||||
UI.renderTeX(element);
|
||||
UI.renderTimestamps(element);
|
||||
UI.unescapeMarkTags(element);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -81,6 +81,10 @@ class UI {
|
||||
*/
|
||||
public static addBootstrapTooltips(element?: Element) {
|
||||
element = element || document.body;
|
||||
|
||||
const list = element.querySelectorAll('[data-bs-toggle="tooltip"]');
|
||||
list.forEach((el: Element) => new bootstrap.Tooltip(el));
|
||||
|
||||
element.querySelectorAll("[title]").forEach((el) => {
|
||||
el.setAttribute("data-bs-toggle", "tooltip");
|
||||
el.setAttribute("data-bs-placement", "bottom");
|
||||
@ -195,9 +199,6 @@ class UI {
|
||||
let content = block.innerHTML;
|
||||
|
||||
// but ugly fucking hack. I hate this
|
||||
content = content.replaceAll('<span class="token operator"><</span>mark<span class="token operator">></span>', "<mark>");
|
||||
content = content.replaceAll('<span class="token operator"><</span><span class="token operator">/</span>mark<span class="token operator">></span>', "</mark>");
|
||||
|
||||
content = content.replaceAll("<mark>", "<mark>");
|
||||
content = content.replaceAll("</mark>", "</mark>");
|
||||
block.innerHTML = content;
|
||||
|
@ -5,8 +5,17 @@ import Input from "./Input";
|
||||
const pkg = require("../../package.json");
|
||||
|
||||
declare const Handlebars: any;
|
||||
declare const Prism: any;
|
||||
|
||||
(() => {
|
||||
Prism.languages.extend('markup', {});
|
||||
Prism.languages.insertBefore('custom', 'tag', {
|
||||
'mark': {
|
||||
pattern: /<\/?mark(?:\s+\w+(?:=(?:"[^"]*"|'[^']*'|[^\s'">=]+))?\s*|\s*)\/?>/,
|
||||
greedy: true
|
||||
}
|
||||
});
|
||||
|
||||
let isCtrl = false;
|
||||
document.addEventListener('keyup', (e) => {
|
||||
if (e.ctrlKey) isCtrl = false;
|
||||
|
Loading…
Reference in New Issue
Block a user