mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
Make the text color part of the base style in editor
This commit is contained in:
parent
af3753948a
commit
3eade1c64d
1 changed files with 10 additions and 3 deletions
|
@ -433,8 +433,8 @@ class EditingArea extends HTMLElement {
|
||||||
this.setAttribute("contenteditable", "true");
|
this.setAttribute("contenteditable", "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
initialize(color: string): void {
|
initialize(index: number): void {
|
||||||
this.style.color = color;
|
this.className = `editor-field-${index}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
set fieldHTML(content: string) {
|
set fieldHTML(content: string) {
|
||||||
|
@ -491,6 +491,7 @@ class EditingContainer extends HTMLDivElement {
|
||||||
font-family: initial;
|
font-family: initial;
|
||||||
font-size: initial;
|
font-size: initial;
|
||||||
direction: initial;
|
direction: initial;
|
||||||
|
color: initial;
|
||||||
}`,
|
}`,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
@ -507,10 +508,16 @@ class EditingContainer extends HTMLDivElement {
|
||||||
|
|
||||||
initialize(index: number, color: string, content: string): void {
|
initialize(index: number, color: string, content: string): void {
|
||||||
this.id = `f${index}`;
|
this.id = `f${index}`;
|
||||||
this.editingArea.initialize(color);
|
this.editingArea.initialize(index);
|
||||||
|
this.setBaseColor(color);
|
||||||
this.editingArea.fieldHTML = content;
|
this.editingArea.fieldHTML = content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setBaseColor(color: string): void {
|
||||||
|
const firstRule = this.baseStylesheet.cssRules[0] as CSSStyleRule;
|
||||||
|
firstRule.style.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
setBaseStyling(fontFamily: string, fontSize: string, direction: string): void {
|
setBaseStyling(fontFamily: string, fontSize: string, direction: string): void {
|
||||||
const firstRule = this.baseStylesheet.cssRules[0] as CSSStyleRule;
|
const firstRule = this.baseStylesheet.cssRules[0] as CSSStyleRule;
|
||||||
firstRule.style.fontFamily = fontFamily;
|
firstRule.style.fontFamily = fontFamily;
|
||||||
|
|
Loading…
Reference in a new issue