From 1887d5d01e8a96688a63ecc8d2cabd9c8c417579 Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Fri, 18 Feb 2022 19:28:24 +0530 Subject: [PATCH] fix: plain editor revision rendering and revision list sorting (#878) --- .../javascripts/components/NotesOptions/NotesOptions.tsx | 2 +- .../RevisionHistoryModal/SelectedRevisionContent.tsx | 2 +- .../javascripts/components/RevisionHistoryModal/utils.ts | 6 +++++- app/assets/stylesheets/_sn.scss | 4 ++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/components/NotesOptions/NotesOptions.tsx b/app/assets/javascripts/components/NotesOptions/NotesOptions.tsx index d896ea11251..f0cb15b59af 100644 --- a/app/assets/javascripts/components/NotesOptions/NotesOptions.tsx +++ b/app/assets/javascripts/components/NotesOptions/NotesOptions.tsx @@ -560,7 +560,7 @@ export const NotesOptions = observer( }} > - Move to Trash + Move to trash ))} {trashed && ( diff --git a/app/assets/javascripts/components/RevisionHistoryModal/SelectedRevisionContent.tsx b/app/assets/javascripts/components/RevisionHistoryModal/SelectedRevisionContent.tsx index 42e8de68bda..487f7e90808 100644 --- a/app/assets/javascripts/components/RevisionHistoryModal/SelectedRevisionContent.tsx +++ b/app/assets/javascripts/components/RevisionHistoryModal/SelectedRevisionContent.tsx @@ -66,7 +66,7 @@ export const SelectedRevisionContent: FunctionComponent {selectedRevision.payload.content.text.length ? ( -

+

{selectedRevision.payload.content.text}

) : ( diff --git a/app/assets/javascripts/components/RevisionHistoryModal/utils.ts b/app/assets/javascripts/components/RevisionHistoryModal/utils.ts index c1996723d0f..5c1ff599367 100644 --- a/app/assets/javascripts/components/RevisionHistoryModal/utils.ts +++ b/app/assets/javascripts/components/RevisionHistoryModal/utils.ts @@ -84,13 +84,17 @@ export const sortRevisionListIntoGroups = ( }, ]; + const addBeforeLastGroup = (group: ListGroup) => { + sortedGroups.splice(sortedGroups.length - 1, 0, group); + }; + revisionList?.forEach((entry) => { const groupIndex = getGroupIndexForEntry(entry, sortedGroups); if (groupIndex > -1) { sortedGroups[groupIndex]?.entries?.push(entry); } else { - sortedGroups.push({ + addBeforeLastGroup({ title: formatDateAsMonthYearString( new Date( (entry as RevisionListEntry).created_at ?? diff --git a/app/assets/stylesheets/_sn.scss b/app/assets/stylesheets/_sn.scss index 8c9eeef343d..76550ef02e5 100644 --- a/app/assets/stylesheets/_sn.scss +++ b/app/assets/stylesheets/_sn.scss @@ -946,3 +946,7 @@ .sn-component .border-t-0 { border-top-width: 0; } + +.text-editor { + font-size: var(--sn-stylekit-font-size-editor); +}