You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ta...@apache.org on 2023/12/05 22:40:12 UTC

(superset) 01/01: fix(dashboard): title formatting

This is an automated email from the ASF dual-hosted git repository.

tai pushed a commit to branch tai/fix-title
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 6394d2715d9fc32842a4a12f5705e94c7e4f3b26
Author: Tai Dupree <td...@gmail.com>
AuthorDate: Tue Dec 5 14:36:04 2023 -0800

    fix(dashboard): title formatting
---
 .../src/components/DynamicEditableTitle/index.tsx              | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/superset-frontend/src/components/DynamicEditableTitle/index.tsx b/superset-frontend/src/components/DynamicEditableTitle/index.tsx
index 86205bebc2..9c96a988de 100644
--- a/superset-frontend/src/components/DynamicEditableTitle/index.tsx
+++ b/superset-frontend/src/components/DynamicEditableTitle/index.tsx
@@ -113,10 +113,12 @@ export const DynamicEditableTitle = ({
   // then we can measure the width of that span to resize the input element
   useLayoutEffect(() => {
     if (sizerRef?.current) {
-      sizerRef.current.innerHTML = (currentTitle || placeholder).replace(
-        /\s/g,
-        '&nbsp;',
-      );
+      sizerRef.current.innerHTML = (currentTitle || placeholder)
+        .replaceAll('&', '&amp;')
+        .replaceAll('<', '&lt;')
+        .replaceAll('>', '&gt;')
+        .replaceAll('"', '&quot;')
+        .replaceAll("'", '&#039;');
     }
   }, [currentTitle, placeholder, sizerRef]);