Skip to content

Prototyping Markdown Preview Synchronization With Editors - #18762

Merged
Matt Bierner (mjbvz) merged 10 commits into
microsoft:masterfrom
mjbvz:proto-scroll-sync-md
Jan 19, 2017
Merged

Matt Bierner (mjbvz) merged 10 commits into
microsoft:masterfrom
mjbvz:proto-scroll-sync-md

Conversation

@mjbvz

@mjbvz Matt Bierner (mjbvz) commented Jan 19, 2017 •

Copy link
Copy Markdown
Contributor

Builds on #18422 to implement basic synchronization between markdown editor and its preview. Adds the following:

  • When opening the md preview for the first time, automatically scrolls to view the current selected line from the markdown editor.
  • When changing the selection in the markdown editor, updates the markdown preview scroll to reveal this element.
  • When double clicking an element on the markdown preview page, opens an editor and reveals this line.
  • Indicator in preview to show currently selected line

Functionality can be disabled using markdown.preview.experimentalSyncronizationEnabled

Matt Bierner added 6 commits January 18, 2017 15:44
**Bug**
There is currently no easy way to communicate with an html preview document after the preview has been created.

**Fix**
Adds a command called `vscode.htmlPreview.postMessage` to post a message to a visible html preview. This message will only be posted if the target preview is visible.

Inside the preview, the event is recieved using the standard dom event:
Continue proto
const line = +nearest.getAttribute('data-line');
const args = [window.initialData.source, line];
window.parent.postMessage({
command: "did-click-link",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This functionality is something we would probably want to standardize, similar to the postMessage command. Emulating clicks is pretty iffy.

@mjbvz
Matt Bierner (mjbvz) merged commit b29ef9b into microsoft:master Jan 19, 2017
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants