Skip to content

Conversation

@edimitchel
Copy link
Contributor

@edimitchel edimitchel commented Jan 20, 2022

Description of Problem

Easy the switch without using mouse and keep focus on content

Proposed Solution

Add keyup event listener for API and SFC preference.
firefox_ZIBbwDdyPO

Ctrl+(Alt/Option)+A: toggle Options/Composition API
Ctrl+(Alt/Option)+T: toggle template (SFC or HTML)

Additional Information

Externalize logic into a composable

@netlify
Copy link

netlify bot commented Jan 20, 2022

✔️ Deploy Preview for vue-docs-preview ready!

🔨 Explore the source changes: 9113684

🔍 Inspect the deploy log: https://app.netlify.com/sites/vue-docs-preview/deploys/61f1291fc3d6000007ca34a6

😎 Browse the preview: https://deploy-preview-1449--vue-docs-preview.netlify.app

@edimitchel
Copy link
Contributor Author

@skirtles-code, this one!

@yyx990803
Copy link
Member

Can we get rid of the dotted underline? It looks a bit out of place. We can mention the shortcut at the end of the "Introduction - API Styles" section .

@edimitchel
Copy link
Contributor Author

Can we get rid of the dotted underline? It looks a bit out of place. We can mention the shortcut at the end of the "Introduction - API Styles" section .

Yes, I'll do that

Postpone preference changes when it's closed to the change in action
@edimitchel
Copy link
Contributor Author

I just tried on OSX, and shortcut doesn't work for an unknown reason..

@edimitchel
Copy link
Contributor Author

I just tried on OSX, and shortcut doesn't work for an unknown reason..

Fixed!

@dammy001
Copy link
Contributor

@edimitchel Great 👍

@edimitchel edimitchel changed the title feat: update API/SFC preference using shortcuts #1447 feat: update API/SFC preference using shortcuts Jan 26, 2022
@netlify
Copy link

netlify bot commented Feb 8, 2022

Deploy Preview for vuejs ready!

Name Link
🔨 Latest commit 8ff55a7
🔍 Latest deploy log https://app.netlify.com/sites/vuejs/deploys/6317e09f41ec890008030dc7
😎 Deploy Preview https://deploy-preview-1449--vuejs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@edimitchel
Copy link
Contributor Author

Preview URL: https://deploy-preview-1449--vuejs.netlify.app/
Netlify url in the comment above is not good

@bencodezen bencodezen added the state: review PR issued and under review label Jun 9, 2022
Copy link
Contributor

@skirtles-code skirtles-code left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are a few small suggestions from me based on an initial read through.

I'd also note that I'm on Ubuntu, which uses Ctrl+Alt+T to launch a terminal window, so I can't actually use that shortcut to toggle the API. But I'm not sure whether that's worth addressing for the relatively small number of people affected.

Copy link
Contributor

@skirtles-code skirtles-code left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub seems to be having a lot of problems today. For some reason this review comment didn't get included with my review, so here it is separately:

? JSON.parse(localStorage.getItem(key) || String(defaultValue))
: defaultValue

export const preferCompositionKey = 'vue-docs-prefer-composition'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could some of these uses of export const be switched to const? It looks like some of them aren't need outside this file.

@edimitchel edimitchel requested review from skirtles-code and yyx990803 and removed request for NataliaTepluhina, skirtles-code and yyx990803 September 7, 2022 00:08
@edimitchel
Copy link
Contributor Author

I'd also note that I'm on Ubuntu, which uses Ctrl+Alt+T to launch a terminal window, so I can't actually use that shortcut to toggle the API. But I'm not sure whether that's worth addressing for the relatively smaller number of people affected.

Decided to remove the SFC Preference shortcut which don't making sense, unlink the API Preference shortcut

@edimitchel edimitchel requested review from skirtles-code and yyx990803 and removed request for skirtles-code and yyx990803 September 7, 2022 00:11
@edimitchel edimitchel requested review from skirtles-code and yyx990803 and removed request for skirtles-code and yyx990803 October 24, 2022 07:10
isOpen,
shortcutInfo,
showPreference,
showSFC,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that showSFC is no longer being returned, so the second switch is currently missing on the Tutorial and Examples pages.

@@ -0,0 +1,9 @@
export default function usePlatform() {
const isMac = /(Mac OS X)/i.test(globalThis.navigator?.userAgent)
const altKey = isMac ? 'Option' : 'Alt';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const altKey = isMac ? 'Option' : 'Alt';
const altKey = isMac ? 'Option' : 'Alt'

@skirtles-code
Copy link
Contributor

@edimitchel I'd like to get this over the line. Could you take a look at my latest comments above? There are also merge conflicts with the current main branch. Thanks.

@edimitchel
Copy link
Contributor Author

Closing this PR as it's not adding as much functionality as I thought

@edimitchel edimitchel closed this Jul 6, 2023
@edimitchel edimitchel deleted the feat/update-preference-from-keyboard branch January 2, 2024 10:59
@edimitchel edimitchel restored the feat/update-preference-from-keyboard branch January 2, 2024 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new version state: review PR issued and under review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants