* tidy * Add title to HTML export * fix: Add compatability for documents without collab state * Add HTML download option to UI * docs * fix nodes that required document to render * Refactor to allow for styling of HTML export * div>article for easier programatic content extraction * Allow DocumentHelper to be used with Revisions * Add revisions.diff endpoint, first version * Allow arbitrary revisions to be compared * test * HTML driven revision viewer * fix: Dark mode styles for document diffs * Add revision restore button to header * test * Support RTL languages in revision history viewer * fix: RTL support Remove unneccessary API requests * Prefetch revision data * Animate history sidebar * fix: Cannot toggle history from timestamp fix: Animation on each revision click * Clarify currently editing history item
42 lines
837 B
TypeScript
42 lines
837 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;
|
|
|
|
/** 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;
|