Skip to content

Commit

Permalink
Allow to copy uncut string in object browser: #2924
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Jan 27, 2025
1 parent 8362b28 commit 2b488df
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/adapter-react-v5/src/Components/ObjectBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1974,6 +1974,8 @@ function formatValue(options: FormatValueOptions): {
u?: string;
/** value not replaced by `common.states` */
s?: string;
/** Text for copy to clipboard */
c?: string;
};
valFull:
| {
Expand Down Expand Up @@ -2057,6 +2059,8 @@ function formatValue(options: FormatValueOptions): {
u?: string;
/** value not replaced by `common.states` */
s?: string;
/** Text for copy to clipboard */
c?: string;
} = { v: v as string };

// try to replace number with "common.states"
Expand All @@ -2070,6 +2074,7 @@ function formatValue(options: FormatValueOptions): {

if (valText.v?.length > 40) {
valText.v = `${valText.v.substring(0, 40)}...`;
valText.c = valText.v;
}

if (isCommon?.unit) {
Expand Down Expand Up @@ -5795,7 +5800,6 @@ export class ObjectBrowserClass extends Component<ObjectBrowserProps, ObjectBrow
const valTextRx: JSX.Element[] = [];
item.data.state = { valTextRx };

const copyText = valText.v || '';
valTextRx.push(
<span
className={`newValueBrowser-${this.props.themeType || 'light'}`}
Expand Down Expand Up @@ -5833,6 +5837,7 @@ export class ObjectBrowserClass extends Component<ObjectBrowserProps, ObjectBrow
);
}
if (!narrowStyleWithDetails) {
const copyText = valText.c !== undefined ? valText.c : valText.v || '';
valTextRx.push(
<IconCopy
className="copyButton"
Expand Down Expand Up @@ -7333,7 +7338,7 @@ export class ObjectBrowserClass extends Component<ObjectBrowserProps, ObjectBrow
? this.systemConfig.common.isFloatComma
: this.props.isFloatComma,
});
this.onCopy(e, valText.v.toString());
this.onCopy(e, valText.c !== undefined ? valText.c : valText.v.toString());
}}
key="cc"
/>
Expand Down

0 comments on commit 2b488df

Please sign in to comment.