mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-09 10:50:42 +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";
|
this.hoverStyles.id = "typicalc-hover-styles";
|
||||||
root.querySelector("mjx-head")!.appendChild(this.hoverStyles);
|
root.querySelector("mjx-head")!.appendChild(this.hoverStyles);
|
||||||
}
|
}
|
||||||
const unificationEl = root.host.parentElement!.parentElement!.querySelector("tc-unification")!;
|
this.setupUnificationStyles();
|
||||||
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);
|
|
||||||
}
|
|
||||||
// set the size of the rendered SVG to the size of the container element
|
// set the size of the rendered SVG to the size of the container element
|
||||||
if (!root.querySelector("#style-fixes")) {
|
if (!root.querySelector("#style-fixes")) {
|
||||||
const style = document.createElement('style');
|
const style = document.createElement('style');
|
||||||
@ -449,6 +443,7 @@ class MathjaxProofTree extends MathjaxAdapter {
|
|||||||
const typeClass = typeTarget.classList[1];
|
const typeClass = typeTarget.classList[1];
|
||||||
const css = "." + typeClass + " { color: red; }";
|
const css = "." + typeClass + " { color: red; }";
|
||||||
this.hoverStyles!.innerHTML = css;
|
this.hoverStyles!.innerHTML = css;
|
||||||
|
this.setupUnificationStyles();
|
||||||
this.hoverStylesUnification!.innerHTML = css;
|
this.hoverStylesUnification!.innerHTML = css;
|
||||||
} else if (isLabel) {
|
} else if (isLabel) {
|
||||||
let stepTarget = typeTarget;
|
let stepTarget = typeTarget;
|
||||||
@ -558,6 +553,17 @@ class MathjaxProofTree extends MathjaxAdapter {
|
|||||||
this.$server!.setStepCount(this.steps.length);
|
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() {
|
private destroyTooltip() {
|
||||||
const svg = this.shadowRoot!.querySelector<SVGElement>("svg");
|
const svg = this.shadowRoot!.querySelector<SVGElement>("svg");
|
||||||
if (!svg) {
|
if (!svg) {
|
||||||
|
Loading…
Reference in New Issue
Block a user