Skip to content

Commit

Permalink
[7.17] [data views] Improve preview pane (#126013) (#126099)
Browse files Browse the repository at this point in the history
* [data views] Improve preview pane (#126013)

* fix preview pane

* fix preview pane

* one less span tag

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 7dbe341)

* Update field_preview_context.tsx

Co-authored-by: Matthew Kime <matt@mattki.me>
  • Loading branch information
kibanamachine and mattkime committed Feb 22, 2022
1 parent 3c9ce4a commit 664eff8
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import React, {
useRef,
FunctionComponent,
} from 'react';
import { renderToString } from 'react-dom/server';
import useDebounce from 'react-use/lib/useDebounce';
import { i18n } from '@kbn/i18n';
import { get } from 'lodash';
Expand Down Expand Up @@ -107,8 +108,10 @@ const defaultParams: Params = {
format: null,
};

export const defaultValueFormatter = (value: unknown) =>
`<span>${typeof value === 'object' ? JSON.stringify(value) : value ?? '-'}</span>`;
export const defaultValueFormatter = (value: unknown) => {
const content = typeof value === 'object' ? JSON.stringify(value) : value ?? '-';
return renderToString(<>{content}</>);
};

export const FieldPreviewProvider: FunctionComponent = ({ children }) => {
const previewCount = useRef(0);
Expand Down

0 comments on commit 664eff8

Please sign in to comment.