mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 10:20:41 +00:00
Fix type highlighting when switching language
This commit is contained in:
parent
980b2d838d
commit
ed9cb6a3fa
@ -392,13 +392,7 @@ class MathjaxProofTree extends MathjaxAdapter {
|
||||
this.hoverStyles.id = "typicalc-hover-styles";
|
||||
root.querySelector("mjx-head")!.appendChild(this.hoverStyles);
|
||||
}
|
||||
const unificationEl = root.host.parentElement!.parentElement!.querySelector("tc-unification")!;
|
||||
this.hoverStylesUnification = unificationEl.shadowRoot!.querySelector("#typicalc-hover-styles");
|
||||
if (!this.hoverStylesUnification) {
|
||||
this.hoverStylesUnification = document.createElement('style');
|
||||
this.hoverStylesUnification.id = "typicalc-hover-styles";
|
||||
unificationEl.shadowRoot!.querySelector("mjx-head")!.appendChild(this.hoverStylesUnification);
|
||||
}
|
||||
this.setupUnificationStyles();
|
||||
// set the size of the rendered SVG to the size of the container element
|
||||
if (!root.querySelector("#style-fixes")) {
|
||||
const style = document.createElement('style');
|
||||
@ -449,6 +443,7 @@ class MathjaxProofTree extends MathjaxAdapter {
|
||||
const typeClass = typeTarget.classList[1];
|
||||
const css = "." + typeClass + " { color: red; }";
|
||||
this.hoverStyles!.innerHTML = css;
|
||||
this.setupUnificationStyles();
|
||||
this.hoverStylesUnification!.innerHTML = css;
|
||||
} else if (isLabel) {
|
||||
let stepTarget = typeTarget;
|
||||
@ -558,6 +553,17 @@ class MathjaxProofTree extends MathjaxAdapter {
|
||||
this.$server!.setStepCount(this.steps.length);
|
||||
}
|
||||
|
||||
// creates the mirrored style document in the unification element
|
||||
private setupUnificationStyles() {
|
||||
const unificationEl = this.shadowRoot!.host.parentElement!.parentElement!.querySelector("tc-unification")!;
|
||||
this.hoverStylesUnification = unificationEl.shadowRoot!.querySelector("#typicalc-hover-styles");
|
||||
if (!this.hoverStylesUnification) {
|
||||
this.hoverStylesUnification = document.createElement('style');
|
||||
this.hoverStylesUnification.id = "typicalc-hover-styles";
|
||||
unificationEl.shadowRoot!.querySelector("mjx-head")!.appendChild(this.hoverStylesUnification);
|
||||
}
|
||||
}
|
||||
|
||||
private destroyTooltip() {
|
||||
const svg = this.shadowRoot!.querySelector<SVGElement>("svg");
|
||||
if (!svg) {
|
||||
|
Loading…
Reference in New Issue
Block a user