Skip to content

Commit

Permalink
feat: selectable comments text added for comments
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 52c7a1ca7a370c05f6225730098c219c18f15719
  • Loading branch information
abbas-nazar authored and actions-user committed Nov 6, 2024
1 parent d6a2472 commit bdfd14a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ function CommentPost_(props: CommentPostProps, ref: HTMLElementRefOf<"div">) {
body={
<EditableLabel
value={comment.body}
isTextSelectable={!isThread}
doubleClickToEdit
disabled={appCtx.selfInfo?.id !== comment.createdById}
onEdit={(newBody) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export type EditableLabelProps = {
children?: React.ReactNode;
onAbort?: () => void;
allowEmptyString?: boolean;
isTextSelectable?: boolean;
};

export type EditableLabelHandles = { setEditing(editing: boolean): void };
Expand Down Expand Up @@ -80,6 +81,7 @@ const EditableLabel_: ForwardRefRenderFunction<
children,
inputBoxClassName,
allowEmptyString,
isTextSelectable = false,
...restProps
} = props;

Expand Down Expand Up @@ -202,7 +204,8 @@ const EditableLabel_: ForwardRefRenderFunction<
className: cn(
"flex-fill",
"text-ellipsis-wrappable",
_editing && styles.fullWidthLabelEditing
_editing && styles.fullWidthLabelEditing,
{ "selectable-text": isTextSelectable }
),
onClick: handleClick,
onDoubleClick: handleDoubleClick,
Expand Down
5 changes: 5 additions & 0 deletions platform/wab/src/wab/styles/main.sass
Original file line number Diff line number Diff line change
Expand Up @@ -5873,3 +5873,8 @@ a, button.link-like
flex-direction: row
align-items: flex-start
gap: 8px

.selectable-text
user-select: text
cursor: text

0 comments on commit bdfd14a

Please sign in to comment.