marktext/docs/dev/code/renderer/editor.md
Mitch Capper b6754741f9 Remember the file's scroll position as long as it stays open
By default returns the user to the same scroll position on a document where they left off (except if changed to code editing before switching back, or vice versa). Only saved in memory could be added to future session saves for #998.
2022-03-16 15:53:27 -07:00

1.8 KiB

Editor

TBD

Internal

Raw markdown document

interface IMarkdownDocumentRaw
{
  // Markdown content
  markdown: string,
  // Filename
  filename: string,
  // Full path (may be empty?)
  pathname: string,

  // Document encoding
  encoding: string,
  // "lf" or "crlf"
  lineEnding: string,
  // Convert document ("lf") to `lineEnding` when saving
  adjustLineEndingOnSave: boolean

  // Whether the document has mixed line endings (lf and crlf) and was converted to lf.
  isMixedLineEndings: boolean
}

Markdowm document

A markdown document (IMarkdownDocument) represent a file.

interface IMarkdownDocument
{
  // Markdown content
  markdown: string,
  // Filename
  filename: string,
  // Full path (may be empty?)
  pathname: string,

  // Document encoding
  encoding: string,
  // "lf" or "crlf"
  lineEnding: string,
  // Convert document ("lf") to `lineEnding` when saving
  adjustLineEndingOnSave: boolean
}
interface IMarkdownDocumentOptions
{
  // Document encoding
  encoding: string,
  // "lf" or "crlf"
  lineEnding: string,
  // Convert document ("lf") to `lineEnding` when saving
  adjustLineEndingOnSave: boolean
}

File State

Internal state of a markdown document. IMarkdownDocument is used to create a IFileState.

interface IDocumentState
{
  isSaved: boolean,
  pathname: string,
  filename: string,
  markdown: string,
  encoding: string,
  lineEnding: string,
  adjustLineEndingOnSave: boolean,
  history: {
    stack: Array<any>,
    index: number
  },
  cursor: any,
  firstViewportVisibleItem: any,
  wordCount: {
    paragraph: number,
    word: number,
    character: number,
    all: number
  },
  searchMatches: {
    index: number,
    matches: Array<any>,
    value: string
  }
}

...

TBD

View

TBD

Sidebar

TBD

Tabs

TBD

Document

TBD