Commit Graph

41 Commits

Author SHA1 Message Date
Matt Bierner
cfcc5c8121 Annotate param with jsdoc type 2018-02-26 17:46:25 -08:00
Matt Bierner
68c21cde76 Prevent out of range line acecss on markdown preview scrolling when user scrolls to end of document 2018-02-26 17:17:22 -08:00
Matt Bierner
2279b4d252 Scroll sync markdown editor with markdown preview (#44454)
Fixes #19459

Syncs the markdown preview's viewport with the markdown editor's using the proposed visible ranges API
2018-02-26 16:46:54 -08:00
Matt Bierner
2038b8fc7f Webview API prototype 3 (#44307)
* Webview API prototype 3

Part of #43713

Third try at refining the webview api. This pass reworks  #44165.  Major changes:

- Adds an `id` field to webviews. The id is provided by the extension and identifies the webview. It is used with the new event handling apis.

- Adds a new `onDidChangeActiveEditor` api. This is similar to `onDidChangeActiveTextEditor` but is also fired when you change webviews. It replaces the old `onFocus` and `onBlur` events on the webview itself

- Adds an `onDispose` event ot webviews. This is fired when a webview is closed by the user

- Perist webview state when the editor group changes. This is enabled for all webviews, not just those with keep alive.

* Throw error when trying to access disposed webview

* Improving webview documentation

* Clean up dispose management

* Throw if we receive a bad handle

* Move more event handling to input

* Simplify input updating

* Remove extra container property

* Fixing md security alert button

* Remove extra update container call

* Restore syncing of preview to active editor

* Fixing posting to webview

* Debounce preview updates

* Remove previewUri

* Enable direct window.postMessage instead of window.parent.postMessage

* Fixing scroll position not preserved when updating previews

* Revert parent.postMessage change.

Old behavior was correct

* Properly hide webview container on tab switch

* Make sure we only handle scroll events for the correct document

* Don't try setting negative scroll

* Revert vs code whitespace change
2018-02-26 10:06:50 -08:00
Matt Bierner
cc19497c49 Remove unnecessary toLowerCase 2018-02-16 17:26:13 -08:00
Matt Bierner
f5849bebec Fix markdown preview links back to workspace resource
Fixes #43869
2018-02-16 17:19:36 -08:00
Matt Bierner
e44ca4211c Add jscheck casts 2018-02-16 13:50:09 -08:00
Matt Bierner
f9765ffb9f Fix bad old command form being sent from markdown preview 2018-02-16 13:49:09 -08:00
Matt Bierner
7398d3be89 Clean up reveal line logic 2018-02-16 13:48:02 -08:00
Keisuke KATO
d17652218a Fixed an error when previewing the first line with Markdown extension (#43835) 2018-02-16 12:59:33 -08:00
Matt Bierner
3412eab2ec Webview Api Prototype (#42690)
* Webview api

* Cleaning up markdown webview

* Hooking up dispose

* Fix some merge errors

* Use custom context key to show markdown title bar contributions

* Add basic on focus and on blur events

* Fixing find widget in webview

* Hookup _isDisposed

* Use new extension resource scheme to load markdown extension resources

* Documenting keep alive
2018-02-14 18:52:26 -08:00
Matt Bierner
0532a3429a Fix markdown preview section links
Fixes #40877
2018-01-02 10:43:16 -08:00
Matt Bierner
55382a106f Cache code-line elements for md scroll-sync
Fixes #19092
2017-12-18 14:25:39 -08:00
SteVen Batten
f929c1bff4 updating the md scroll sync to use binary search over linear search (#40401) 2017-12-18 10:45:45 -08:00
Matt Bierner
6ccc79823d Fix fragment name 2017-12-12 18:12:57 -08:00
Matt Bierner
4d42f3d7af Support extension-less links in the markdown preview
Fixes #39945
2017-12-12 17:04:29 -08:00
Matt Bierner
cb1797f1ef Revert "Don't scroll to factional line positions in the markdown preview when wordwrap is off"
This reverts commit 5055bb7ba4.
2017-08-16 14:54:53 -07:00
Matt Bierner
5055bb7ba4 Don't scroll to factional line positions in the markdown preview when wordwrap is off 2017-08-16 14:50:53 -07:00
Matt Bierner
75eadfbd4b Fix scroll restoration in webviews 2017-08-03 22:22:29 -07:00
Matt Bierner
799fa528db Load script async in markdown preview 2017-05-17 17:39:00 -07:00
Matt Bierner
736e09ab7c Use load event listener instead of onload in markdown preview 2017-04-10 17:14:42 -07:00
Matt Bierner
62e989849b better support nested lists for markdown scroll sync 2017-03-07 17:07:22 -08:00
Matt Bierner
4ebfc2fc18 Add Enhanced Security Settings to Markdown Preview
Adds enhanced security settings for the markdown preview. The new flow disable all scripts within the preview itself. Users can enable scripts on a per workspace basis.

When a markdown document that uses scripts is loaded, a warning is shown inside the document itself. This warning triggers a new security selector quick pick which allows users to enable or disable enahanced security in the workspace.
2017-03-03 13:56:23 -08:00
Matt Bierner
3da42e5659 Debounce markdown selection update events Fixes #19827 2017-02-09 17:55:59 -08:00
Matt Bierner
6fe2bae3b5 Fixes Webview reload Flickering (#19394)
**Bug**
When refreshing a webview, a slight flicker can sometime be seen. This is especially noticable when using the markdown preview.

**Fix**
Instead of replacing the content of the iframe for refresh, create a new iframe with the new content and do a swap to update.
2017-01-25 13:00:58 -08:00
Matt Bierner
fbea777a88 Fixes #19196 - Disable double click on links in markdown preview 2017-01-24 22:51:24 -08:00
Matt Bierner
dbb77f1eef Smooth markdown scrolling 2017-01-24 22:22:51 -08:00
Matt Bierner
042285d5e1 Fixes active selection line now showing is slection tracking is disabled in markdown preview] 2017-01-24 19:41:34 -08:00
Matt Bierner
eba0fc96ff Fixes #19192 - markdown scroll selection sync setting disabling double click and other features 2017-01-24 19:37:13 -08:00
Matt Bierner
8396a11dab Remove markdown logic to maintain position on resize since it is too choppy 2017-01-24 18:15:24 -08:00
Matt Bierner
c8196b5ee5 Fixes #19126 2017-01-24 13:58:52 -08:00
Matt Bierner
93c4b5f077 Fixes #19093 2017-01-23 14:12:52 -08:00
Matt Bierner
a18fe04303 Add throttle for markdown scroll sync 2017-01-23 13:51:28 -08:00
Matt Bierner
6053021a6c Split up and rename Markdown Scroll Sync Settings (#19077)
Splits the markdown scroll sync settings to be more granular.
2017-01-23 11:59:12 -08:00
Matt Bierner
bc27d5c88e Restore double click to switch to editor behavior 2017-01-22 01:04:18 -08:00
Matt Bierner
5bf8cc7618 Add Markdown Preview to Editor Scroll Syncronization
Adds an initial implementation of scroll synrconization from the markdown preview to the editor. When the preview is scrolled, automatically scrolls the editor to reveal the same location.

This required adding a new supported reveal type `AtTop` in our API. This is already supported and used internally, but not really exposed in the public apis (except for the `revealLine` command).
2017-01-22 00:47:06 -08:00
Matt Bierner
a02320ba80 Fixes md preview to editor sync when before first element in preview (#18959)
* Fixes md preview to editor sync when before first element in preview

* Fix potential undef reference
2017-01-20 17:23:21 -08:00
Matt Bierner
242affa6e7 Fix reveal of source line on load in markdown preview 2017-01-19 18:13:07 -08:00
Matt Bierner
cc4833d868 Improve preview to editor mapping (#18816) 2017-01-19 16:11:34 -08:00
Matt Bierner
b29ef9b4e8 Prototyping Markdown Preview Synchronization With Editors (#18762)
* Adds command to post a message to an html preview

**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:

* Remove logging

* proto

Continue proto

* clean up rendering

* Gate prototype

* Fix gating

* Remove public command

* Change setting name

* Added current position indicator

* Reveal center
2017-01-18 17:58:45 -08:00
Matt Bierner
5dc2fb8c30 Maintain Markdown Preview Scroll Position on Window Resize (#18760)
* proto

Continue proto

* Basic implementation
2017-01-18 15:42:32 -08:00