Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
fab's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Fred Lefévère-Laoide authored and Fred Lefévère-Laoide committed Nov 23, 2023
1 parent 71417b2 commit 403deaf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions gui/src/components/Taipy/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface TaipyFieldProps extends TaipyBaseProps, TaipyHoverProps {
defaultValue?: string;
format?: string;
raw?: boolean;
code?: string;
mode?: string;
}

const unsetWeightSx = { fontWeight: "unset" };
Expand All @@ -39,7 +39,7 @@ const Field = (props: TaipyFieldProps) => {
const className = useClassNames(props.libClassName, props.dynamicClassName, props.className);
const hover = useDynamicProperty(props.hoverText, props.defaultHoverText, undefined);

const code = typeof props.code === "string" ? props.code.toLowerCase() : undefined;
const mode = typeof props.mode === "string" ? props.mode.toLowerCase() : undefined;

Check warning on line 42 in gui/src/components/Taipy/Field.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

const value = useMemo(() => {
return formatWSValue(
Expand All @@ -52,13 +52,13 @@ const Field = (props: TaipyFieldProps) => {

return (
<Tooltip title={hover || ""}>
{code == "text" ? (
{mode == "pre" ? (
<pre className={className} id={id}>
{value}
</pre>
) : code == "markdown" ? (
) : mode == "markdown" || mode == "md" ? (
<Markdown className={className}>{value}</Markdown>
) : raw || code == "raw" ? (
) : raw || mode == "raw" ? (
<span className={className} id={id}>
{value}
</span>
Expand Down
2 changes: 1 addition & 1 deletion src/taipy/gui/_renderers/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ class _Factory:
("id",),
("hover_text", PropertyType.dynamic_string),
("raw", PropertyType.boolean, False),
("code", PropertyType.string),
("mode", PropertyType.string),
]
),
"toggle": lambda gui, control_type, attrs: _Builder(
Expand Down
4 changes: 2 additions & 2 deletions src/taipy/gui/viselements.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"doc": "If set to True, the component renders as an HTML &lt;span&gt; element without any default style."
},
{
"name": "code",
"name": "mode",
"type": "str",
"doc": "Define the way the content is treated. text: will keep spaces and new lines; raw: as property raw=True; markdown: basic support for markdown."
"doc": "Define the way the text is processed:<ul><li>&quote;raw&quote;: synonym for setting the *raw* property to True</li><li>&quote;pre&quote;: keeps spaces and new lines</li><li>&quote;markdown&quote; or &quote;md&quote;: basic support for Markdown."
},
{
"name": "format",
Expand Down

0 comments on commit 403deaf

Please sign in to comment.