This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 44d6b6a5139 fix(table): preserve line breaks in cell content modal
(#37036)
44d6b6a5139 is described below
commit 44d6b6a5139909d9025b060217501f240e8cae77
Author: Manoj S <[email protected]>
AuthorDate: Sat Feb 21 03:42:14 2026 +0530
fix(table): preserve line breaks in cell content modal (#37036)
---
.../src/components/JsonModal/index.tsx | 30 ++++++++--------------
1 file changed, 11 insertions(+), 19 deletions(-)
diff --git a/superset-frontend/src/components/JsonModal/index.tsx
b/superset-frontend/src/components/JsonModal/index.tsx
index f108c3dc19b..cc38d28454d 100644
--- a/superset-frontend/src/components/JsonModal/index.tsx
+++ b/superset-frontend/src/components/JsonModal/index.tsx
@@ -17,32 +17,23 @@
* under the License.
*/
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
import { FC, useMemo } from 'react';
import { JSONTree } from 'react-json-tree';
+import { styled } from '@apache-superset/core/ui';
import { useJsonTreeTheme } from 'src/hooks/useJsonTreeTheme';
import { Button, ModalTrigger } from '@superset-ui/core/components';
import { CopyToClipboard } from '../CopyToClipboard';
import { convertBigIntStrToNumber } from './utils';
import type { JsonModalProps } from './types';
+/**
+ * Preserve line breaks for multiline cell content (e.g. stack traces)
+ * while keeping the change scoped to this component only.
+ */
+const PreWrap = styled.span`
+ white-space: pre-wrap;
+`;
+
function renderBigIntStrToNumber(value: string | number) {
return <>{convertBigIntStrToNumber(value)}</>;
}
@@ -53,6 +44,7 @@ export const JsonModal: FC<JsonModalProps> = ({
jsonValue,
}) => {
const jsonTreeTheme = useJsonTreeTheme();
+
const content = useMemo(
() =>
typeof jsonValue === 'object' ? JSON.stringify(jsonValue) : jsonValue,
@@ -74,7 +66,7 @@ export const JsonModal: FC<JsonModalProps> = ({
</Button>
}
modalTitle={modalTitle}
- triggerNode={<>{content}</>}
+ triggerNode={<PreWrap>{content}</PreWrap>}
/>
);
};