Files
outline/app/models/Revision.ts
Apoorv Mishra 1c7bb65c7a Document emoji picker (#4338)
Co-authored-by: Tom Moor <tom.moor@gmail.com>
2023-09-03 06:11:14 -07:00

45 lines
927 B
TypeScript

import { computed } from "mobx";
import { isRTL } from "@shared/utils/rtl";
import BaseModel from "./BaseModel";
import User from "./User";
class Revision extends BaseModel {
id: string;
documentId: string;
/** The document title when the revision was created */
title: string;
/** Markdown string of the content when revision was created */
text: string;
/** The emoji of the document when the revision was created */
emoji: string | null;
/** HTML string representing the revision as a diff from the previous version */
html: string;
createdAt: string;
createdBy: User;
/**
* Returns the direction of the revision text, either "rtl" or "ltr"
*/
@computed
get dir(): "rtl" | "ltr" {
return this.rtl ? "rtl" : "ltr";
}
/**
* Returns true if the revision text is right-to-left
*/
@computed
get rtl() {
return isRTL(this.title);
}
}
export default Revision;