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

Improve native commands #511

Merged
merged 7 commits into from Oct 27, 2017

Conversation

Projects
None yet
1 participant
@50Wliu
Member

50Wliu commented Oct 27, 2017

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • All new code requires tests to ensure against regressions

Description of the Change

  • Remove native-key-bindings class from Markdown Preview to give us finer control over core:copy
  • When there is a selection, core:copy copies the selected text
    • Context menu reads "Copy"
  • When there isn't a selection, core:copy copies the Markdown as HTML
    • Context menu reads "Copy as HTML"
  • A new markdown-preview:select-all command has been added that does pretty much what you expect it to do
  • console.warns have been changed to Notifications, though I also highly doubt that those will ever be encountered

Alternate Designs

None.

Benefits

  • Less confusion over core:copy
  • A convenient away to select all

Possible Drawbacks

The Selection APIs are a bit weird. I ended up having to add onselectionchange to document because that's the only place where events are emitted. I don't think it'll be a performance problem though.
I also have to look into some potential select-all wonkiness when there's a selection elsewhere.

Applicable Issues

Closes #251
Fixes #259
Fixes #257

50Wliu added some commits Oct 27, 2017

Make core:copy work as expected
* When nothing is selected, copy document as HTML
* When something is selected, copy selection as plain text

@50Wliu 50Wliu merged commit dcdf312 into master Oct 27, 2017

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details

@50Wliu 50Wliu deleted the wl-native-commands branch Oct 27, 2017

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