mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 17:56:46 +00:00
RTL fixes for raw config editor and card editor -> card preview (#2532)
* RTL fixes for raw config editor and card editor -> card preview * Fixed missing line break * Fixed weird vscode line break problems * Refactored to LitElement + addressed updating RTL only when needed * Refactor * Fixed forgotten import * Reverted to HTMLElement + added RTL check in set hass * Added conditional update
This commit is contained in:
parent
25a579f7ed
commit
e2ff51f425
@ -7,3 +7,7 @@ export function computeRTL(hass: HomeAssistant) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function computeRTLDirection(hass: HomeAssistant) {
|
||||
return computeRTL(hass) ? "rtl" : "ltr";
|
||||
}
|
||||
|
@ -9,15 +9,20 @@ import { LovelaceCard } from "../../types";
|
||||
import { ConfigError } from "../types";
|
||||
import { getCardElementTag } from "../../common/get-card-element-tag";
|
||||
import { createErrorCardConfig } from "../../cards/hui-error-card";
|
||||
import { computeRTL } from "../../../../common/util/compute_rtl";
|
||||
|
||||
export class HuiCardPreview extends HTMLElement {
|
||||
private _hass?: HomeAssistant;
|
||||
private _element?: LovelaceCard;
|
||||
|
||||
set hass(value: HomeAssistant) {
|
||||
this._hass = value;
|
||||
set hass(hass: HomeAssistant) {
|
||||
if (!this._hass || this._hass.language !== hass.language) {
|
||||
this.style.direction = computeRTL(hass) ? "rtl" : "ltr";
|
||||
}
|
||||
|
||||
this._hass = hass;
|
||||
if (this._element) {
|
||||
this._element.hass = value;
|
||||
this._element.hass = hass;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,6 +99,7 @@ class LovelaceFullConfigEditor extends LitElement {
|
||||
|
||||
.content {
|
||||
height: calc(100vh - 68px);
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
hui-code-editor {
|
||||
|
Loading…
x
Reference in New Issue
Block a user