Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Jul 3, 2018

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.

@ghost
Copy link
Author

ghost commented Jul 4, 2018

Any idea? @dark-flames

KatexParser,
HighlightjsParser
HighlightjsParser,
InjectLnParser
Copy link
Member

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

Copy link
Author

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.

Copy link
Member

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.

Copy link
Author

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.

Copy link
Member

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.

Copy link
Member

@dark-flames dark-flames Jul 6, 2018

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

Copy link
Member

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.

Copy link
Author

@ghost ghost Jul 6, 2018

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
Copy link
Member

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.

...computeFromParent('cursorLine'),
...computeFromParent('cursorOffset'),
...computeFromParent('scrolled'),
...computeFromParent('clickLine'),
Copy link
Member

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.

@ghost
Copy link
Author

ghost commented Jul 6, 2018

I am rewriting and improving scroll sync. Please don't merge at present.

@ghost
Copy link
Author

ghost commented Jul 7, 2018

Finished! 🎉

@ghost ghost changed the title Scroll sync Scroll sync and fix #8 Jul 8, 2018
@ghost ghost changed the title Scroll sync and fix #8 Scroll sync and (fix #8?) Jul 8, 2018
@ghost ghost changed the title Scroll sync and (fix #8?) Scroll sync Jul 8, 2018
@dark-flames dark-flames merged commit bde8c0c into luogu-dev:master Jul 8, 2018
@ghost
Copy link
Author

ghost commented Jul 8, 2018

🎉

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant