From 6d8fb35fab913976dbb27cedd4700e4093f3a8a4 Mon Sep 17 00:00:00 2001
From: Matthias Metelka <62722460+kleinerpirat@users.noreply.github.com>
Date: Fri, 17 Jun 2022 03:02:30 +0200
Subject: [PATCH] Make field description a placeholder inside EditingArea
(#1912)
* Move field description into EditingArea as placeholder
* Prevent insertion of breaks into empty fields
to allow :empty CSS selector to also work on fields other than the first one.
* Remove redundant setContext from EditingArea
* Fix import order
* Revert "Prevent insertion of breaks into empty fields"
This reverts commit 1615fd5cf441b1047dae6a34265acb9c5cae50b2.
* Use class:empty instead of :empty CSS pseudo-class
* Restrict description to single line, ellipse overflow
* Make description in field dialog a bit clearer
---
ftl/core/fields.ftl | 2 +-
ts/editable/ContentEditable.svelte | 25 ++++++++++++++++++-
ts/editor/EditorField.svelte | 13 +++++-----
ts/editor/LabelDescription.svelte | 39 ------------------------------
ts/editor/icons.ts | 1 -
ts/lib/context-keys.ts | 1 +
6 files changed, 33 insertions(+), 48 deletions(-)
delete mode 100644 ts/editor/LabelDescription.svelte
diff --git a/ftl/core/fields.ftl b/ftl/core/fields.ftl
index 12f3f79e9..3f8b3581f 100644
--- a/ftl/core/fields.ftl
+++ b/ftl/core/fields.ftl
@@ -4,7 +4,7 @@ fields-editing-font = Editing Font
fields-field = Field:
fields-field-name = Field name:
fields-description = Description
-fields-description-placeholder = Tooltip to show next to the field's name in the editing screen
+fields-description-placeholder = Text to show inside the field when it's empty
fields-fields-for = Fields for { $val }
fields-font = Font:
fields-new-position-1 = New position (1...{ $val }):
diff --git a/ts/editable/ContentEditable.svelte b/ts/editable/ContentEditable.svelte
index dd0a9bdad..25ad000d6 100644
--- a/ts/editable/ContentEditable.svelte
+++ b/ts/editable/ContentEditable.svelte
@@ -7,9 +7,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
diff --git a/ts/editor/icons.ts b/ts/editor/icons.ts
index f05de24b0..701483237 100644
--- a/ts/editor/icons.ts
+++ b/ts/editor/icons.ts
@@ -12,4 +12,3 @@ export { default as richTextOn } from "@mdi/svg/svg/eye-outline.svg";
export { default as stickyOff } from "@mdi/svg/svg/pin-off-outline.svg";
export { default as stickyOn } from "@mdi/svg/svg/pin-outline.svg";
export { default as htmlOff } from "@mdi/svg/svg/xml.svg";
-export { default as descriptionIcon } from "bootstrap-icons/icons/info-circle.svg";
diff --git a/ts/lib/context-keys.ts b/ts/lib/context-keys.ts
index 34f27aaf7..506c18d38 100644
--- a/ts/lib/context-keys.ts
+++ b/ts/lib/context-keys.ts
@@ -4,3 +4,4 @@
export const fontFamilyKey = Symbol("fontFamily");
export const fontSizeKey = Symbol("fontSize");
export const directionKey = Symbol("direction");
+export const descriptionKey = Symbol("description");