ScrollManager(sectionManager, cm, $previewContainerEl)

Class ScrollManager
manage scroll sync between markdown editor and preview

new ScrollManager(sectionManager, cm, $previewContainerEl)

Creates an instance of ScrollManager.

Parameters:
Name Type Description
sectionManager SectionManager

sectionManager

cm CodeMirror

CodeMirror

$previewContainerEl jQuery

preview container

Members

_currentTimeoutId :number

current timeout id needs animation

_savedScrollInfo :object

Saved scrollInfo object of CodeMirror

Methods

_getScrollTopForPreviewBaseCursor() → {number}

_getScrollTopForPreviewBaseCursor
Return scrollTop value for preview according cursor position

Returns:
number -

scrollTop value

saveScrollInfo()

Save Codemirror's scrollInfo for alternative use
memberOf ScrollManager

syncMarkdownScrollTopToPreview()

syncMarkdownScrollTopToPreview
sync markdown scroll to preview

syncPreviewScrollTopToMarkdown(isCursorBase)

syncPreviewScrollTopToMarkdown
sync preview scroll to markdown

Parameters:
Name Type Description
isCursorBase boolean

whether sync according to cursor position