Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added observer to Discourse.PagedownEditor value to refresh previewer #414

Merged
merged 1 commit into from
Mar 11, 2013

Conversation

awbergs
Copy link

@awbergs awbergs commented Mar 11, 2013

Added an observer to the Discourse.PagedownEditor class so that any changes to the value refresh the Markdown preview.

@discoursebot
Copy link

You've signed the CLA, awbergs. Thank you! This pull request is ready for review.

@awbergs
Copy link
Author

awbergs commented Mar 11, 2013

This is in response to issue #357.

@SamSaffron
Copy link
Member

I see what you did there, but how does this avoid double updates, is there something that need unwiring?

@awbergs
Copy link
Author

awbergs commented Mar 11, 2013

At the very most this behaves the same as the composer view. The Markdown.Editor wiring that handles calling refresh is actually commented out (and has been since the initial commit). We could presumably remove that code now and just use the Discourse.PagedownEditor control now.

There is also a debouncer in front of the preview generation. The only place where I could see there possibly being a double update is if any keyboard undo action is performed. The undo control that is initialized inside of Markdown.Editor calls refresh on undo/redo.

@SamSaffron
Copy link
Member

Sounds good to me!

On Monday, 11 March 2013 at 3:47 PM, Austin Bergstrom wrote:

At the very most this behaves the same as the composer view. The Markdown.Editor wiring that handles calling refresh is actually commented out (https://github.com/discourse/discourse/blob/master/app/assets/javascripts/external/Markdown.Editor.js#L1069) (and has been since the initial commit). We could presumably remove that code now and just use the Discourse.PagedownEditor control now.
There is also a debouncer in front of the preview generation. The only place where I could see there possibly being a double update is if any keyboard undo action is performed. The undo control that is initialized inside of Markdown.Editor (https://github.com/discourse/discourse/blob/master/app/assets/javascripts/external/Markdown.Editor.js#L149) calls refresh on undo/redo.


Reply to this email directly or view it on GitHub (#414 (comment)).

eviltrout added a commit that referenced this pull request Mar 11, 2013
added observer to Discourse.PagedownEditor value to refresh previewer
@eviltrout eviltrout merged commit dad71a7 into discourse:master Mar 11, 2013
@eviltrout
Copy link
Contributor

Thanks this looks good 🐟

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants