Compare commits

..

No commits in common. "e3702878cd6d286edf3145cf18d34724b9aea3f7" and "3e20e41565ad0b62b5581b52ff6ed613225e58c5" have entirely different histories.

2 changed files with 4 additions and 14 deletions

View File

@ -67,12 +67,12 @@ class UI {
*/ */
public static updateUI(element?: Element) { public static updateUI(element?: Element) {
element = element || document.body; element = element || document.body;
UI.unescapeMarkTags(element);
UI.addLineNumbers(element); UI.addLineNumbers(element);
UI.addHighlighting(element); UI.addHighlighting(element);
UI.addBootstrapTooltips(element); UI.addBootstrapTooltips(element);
UI.renderTeX(element); UI.renderTeX(element);
UI.renderTimestamps(element); UI.renderTimestamps(element);
UI.unescapeMarkTags(element);
} }
/** /**
@ -81,10 +81,6 @@ class UI {
*/ */
public static addBootstrapTooltips(element?: Element) { public static addBootstrapTooltips(element?: Element) {
element = element || document.body; 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) => { element.querySelectorAll("[title]").forEach((el) => {
el.setAttribute("data-bs-toggle", "tooltip"); el.setAttribute("data-bs-toggle", "tooltip");
el.setAttribute("data-bs-placement", "bottom"); el.setAttribute("data-bs-placement", "bottom");
@ -199,6 +195,9 @@ class UI {
let content = block.innerHTML; let content = block.innerHTML;
// but ugly fucking hack. I hate this // but ugly fucking hack. I hate this
content = content.replaceAll('<span class="token operator">&lt;</span>mark<span class="token operator">&gt;</span>', "<mark>");
content = content.replaceAll('<span class="token operator">&lt;</span><span class="token operator">/</span>mark<span class="token operator">&gt;</span>', "</mark>");
content = content.replaceAll("&lt;mark&gt;", "<mark>"); content = content.replaceAll("&lt;mark&gt;", "<mark>");
content = content.replaceAll("&lt;/mark&gt;", "</mark>"); content = content.replaceAll("&lt;/mark&gt;", "</mark>");
block.innerHTML = content; block.innerHTML = content;

View File

@ -5,17 +5,8 @@ import Input from "./Input";
const pkg = require("../../package.json"); const pkg = require("../../package.json");
declare const Handlebars: any; 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; let isCtrl = false;
document.addEventListener('keyup', (e) => { document.addEventListener('keyup', (e) => {
if (e.ctrlKey) isCtrl = false; if (e.ctrlKey) isCtrl = false;