fix: plain editor revision rendering and revision list sorting (#878)

This commit is contained in:
Aman Harwara
2022-02-18 19:28:24 +05:30
committed by GitHub
parent 1c57b52183
commit 1887d5d01e
4 changed files with 11 additions and 3 deletions

View File

@@ -560,7 +560,7 @@ export const NotesOptions = observer(
}} }}
> >
<Icon type="trash" className={iconClass} /> <Icon type="trash" className={iconClass} />
Move to Trash Move to trash
</button> </button>
))} ))}
{trashed && ( {trashed && (

View File

@@ -66,7 +66,7 @@ export const SelectedRevisionContent: FunctionComponent<SelectedRevisionContentP
{!componentViewer && ( {!componentViewer && (
<div className="relative flex-grow min-h-0 overflow-x-hidden overflow-y-auto"> <div className="relative flex-grow min-h-0 overflow-x-hidden overflow-y-auto">
{selectedRevision.payload.content.text.length ? ( {selectedRevision.payload.content.text.length ? (
<p className="p-4 pt-0"> <p className="p-4 pt-0 color-text text-editor font-editor">
{selectedRevision.payload.content.text} {selectedRevision.payload.content.text}
</p> </p>
) : ( ) : (

View File

@@ -84,13 +84,17 @@ export const sortRevisionListIntoGroups = <EntryType extends RevisionEntry>(
}, },
]; ];
const addBeforeLastGroup = (group: ListGroup<EntryType>) => {
sortedGroups.splice(sortedGroups.length - 1, 0, group);
};
revisionList?.forEach((entry) => { revisionList?.forEach((entry) => {
const groupIndex = getGroupIndexForEntry(entry, sortedGroups); const groupIndex = getGroupIndexForEntry(entry, sortedGroups);
if (groupIndex > -1) { if (groupIndex > -1) {
sortedGroups[groupIndex]?.entries?.push(entry); sortedGroups[groupIndex]?.entries?.push(entry);
} else { } else {
sortedGroups.push({ addBeforeLastGroup({
title: formatDateAsMonthYearString( title: formatDateAsMonthYearString(
new Date( new Date(
(entry as RevisionListEntry).created_at ?? (entry as RevisionListEntry).created_at ??

View File

@@ -946,3 +946,7 @@
.sn-component .border-t-0 { .sn-component .border-t-0 {
border-top-width: 0; border-top-width: 0;
} }
.text-editor {
font-size: var(--sn-stylekit-font-size-editor);
}