Remove user styling in editor again for now

This commit is contained in:
Henrik Giesel 2021-01-29 13:36:48 +01:00
parent 594fc9bebd
commit fe87f986d3
2 changed files with 1 additions and 27 deletions

View File

@ -460,7 +460,6 @@ class EditingContainer extends HTMLDivElement {
editingArea: EditingArea; editingArea: EditingArea;
baseStylesheet: CSSStyleSheet; baseStylesheet: CSSStyleSheet;
userStyle: HTMLStyleElement;
connectedCallback(): void { connectedCallback(): void {
this.className = "field"; this.className = "field";
@ -497,11 +496,6 @@ class EditingContainer extends HTMLDivElement {
0 0
); );
this.userStyle = this.editingShadow.appendChild(
document.createElement("style")
);
this.userStyle.setAttribute("rel", "stylesheet");
this.editingArea = this.editingShadow.appendChild( this.editingArea = this.editingShadow.appendChild(
document.createElement("editing-area") document.createElement("editing-area")
) as EditingArea; ) as EditingArea;
@ -526,11 +520,6 @@ class EditingContainer extends HTMLDivElement {
firstRule.style.direction = direction; firstRule.style.direction = direction;
} }
setUserStyling(css: HTMLStyleElement): void {
this.userStyle.parentNode.replaceChild(css, this.userStyle);
this.userStyle = css;
}
isRightToLeft(): boolean { isRightToLeft(): boolean {
return this.editingArea.style.direction === "rtl"; return this.editingArea.style.direction === "rtl";
} }
@ -584,10 +573,6 @@ class EditorField extends HTMLDivElement {
setBaseStyling(fontFamily: string, fontSize: string, direction: string): void { setBaseStyling(fontFamily: string, fontSize: string, direction: string): void {
this.editingContainer.setBaseStyling(fontFamily, fontSize, direction); this.editingContainer.setBaseStyling(fontFamily, fontSize, direction);
} }
setUserStyling(css: HTMLStyleElement): void {
this.editingContainer.setUserStyling(css);
}
} }
customElements.define("editor-field", EditorField, { extends: "div" }); customElements.define("editor-field", EditorField, { extends: "div" });
@ -648,16 +633,6 @@ function setFonts(fonts: [string, number, boolean][]): void {
}); });
} }
function setUserStyling(css: string): void {
const userStyle = document.createElement("style");
userStyle.setAttribute("rel", "stylesheet");
userStyle.innerHTML = css;
forField([], (_, field) => {
field.setUserStyling(userStyle.cloneNode(true) as HTMLStyleElement);
});
}
function setNoteId(id: number): void { function setNoteId(id: number): void {
currentNoteId = id; currentNoteId = id;
} }

View File

@ -504,10 +504,9 @@ class Editor:
self.web.setFocus() self.web.setFocus()
gui_hooks.editor_did_load_note(self) gui_hooks.editor_did_load_note(self)
js = "setFields(%s); setFonts(%s); setUserStyling(%s); focusField(%s); setNoteId(%s)" % ( js = "setFields(%s); setFonts(%s); focusField(%s); setNoteId(%s)" % (
json.dumps(data), json.dumps(data),
json.dumps(self.fonts()), json.dumps(self.fonts()),
json.dumps(self.note.model()["css"]),
json.dumps(focusTo), json.dumps(focusTo),
json.dumps(self.note.id), json.dumps(self.note.id),
) )