-
Notifications
You must be signed in to change notification settings - Fork 27
Scroll sync #15
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
Scroll sync #15
Conversation
This reverts commit b229d4b.
|
Any idea? @dark-flames |
src/components/DefaultConfig.js
Outdated
| KatexParser, | ||
| HighlightjsParser | ||
| HighlightjsParser, | ||
| InjectLnParser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InjectLnParser Should be import at MarkdownPalettes.vue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? We also import HighlightjsParser and KatexParser in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because Content Parser not only be used in editor, it can also be export as a function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But defaultConfig is just the config of the editor, right? e.g. defaultConfig.fullScreen. I don't think it will be used in other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I think get default config from defaultConfig is more properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, ContentParser and Editor use same rendering config.But InjectLnParser only used in editor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, getDefaultContentParser in src\module need update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I have understood it. 👌
| return this.$parent[name] | ||
| }, | ||
| set(val) { | ||
| this.$parent[name] = val |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Emit an event and handle it in parent component is better.
src/components/PreviewArea.vue
Outdated
| ...computeFromParent('cursorLine'), | ||
| ...computeFromParent('cursorOffset'), | ||
| ...computeFromParent('scrolled'), | ||
| ...computeFromParent('clickLine'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use props with watch is better.
|
I am rewriting and improving scroll sync. Please don't merge at present. |
|
Finished! 🎉 |
|
🎉 |
Support scroll sync.
When cursor moves, the preview scrolls automatically.
When clicking preview, the editor scrolls automatically.
Note that it's very naive and leak of user experience design. I just provide a way to implement it and you need to optimize it.