Skip to content

Commit

Permalink
Merge pull request #299 from guardian/soft-line-breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
twrichards authored Oct 23, 2023
2 parents 12c3e6d + a7f5025 commit 61775e6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions client/src/editItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const EditItem = ({ item, cancel }: EditItemProps) => {
variables: {
itemId: item.id,
input: {
message: message || null,
message: message?.trim() || null,
payload,
type,
},
Expand All @@ -76,7 +76,7 @@ export const EditItem = ({ item, cancel }: EditItemProps) => {
}
};

const canUpdate = message || payloadToBeSent;
const canUpdate = message?.trim() || payloadToBeSent;

const ref = useRef<HTMLDivElement | null>(null);

Expand Down
5 changes: 4 additions & 1 deletion client/src/itemInputBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,10 @@ export const ItemInputBox = ({
((event) => {
event.stopPropagation();
if (isHardReturn(event)) {
if (!isAsGridPayloadLoading && (message || payloadToBeSent)) {
if (
!isAsGridPayloadLoading &&
(message?.trim() || payloadToBeSent)
) {
sendItem();
}
event.preventDefault();
Expand Down
4 changes: 2 additions & 2 deletions client/src/sendMessageArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const SendMessageArea = ({
variables: {
input: {
type: payloadToBeSent?.type || "message-only",
message,
message: message?.trim(),
payload:
payloadToBeSent && JSON.stringify(payloadToBeSent.payload),
pinboardId,
Expand Down Expand Up @@ -219,7 +219,7 @@ export const SendMessageArea = ({
disabled={
isItemSending ||
isAsGridPayloadLoading ||
!(message || payloadToBeSent)
!(message?.trim() || payloadToBeSent)
}
>
{isItemSending ? (
Expand Down

0 comments on commit 61775e6

Please sign in to comment.