Skip to content

Commit

Permalink
FEATURE: Select metadata text onclick
Browse files Browse the repository at this point in the history
This then behaves the same as the nodeinfoview in the node inspector of the Neos.UI
  • Loading branch information
Sebobo committed Dec 11, 2023
1 parent 22e3934 commit ccb80d8
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import React from 'react';
import React, { useCallback, useRef } from 'react';

interface PropertyListItemProps {
label: string;
value: string;
}

const PropertyListItem: React.FC<PropertyListItemProps> = ({ label, value }: PropertyListItemProps) => {
const ref = useRef<HTMLElement>(null);
const handleClick = useCallback(() => {
ref.current && window.getSelection().selectAllChildren(ref.current);
}, [ref]);

return (
<>
<dt>{label}</dt>
<dd title={value}>{value}</dd>
<dd title={value} ref={ref} onClick={handleClick}>
{value}
</dd>
</>
);
};
Expand Down

0 comments on commit ccb80d8

Please sign in to comment.