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

Add the ability to show custom nav-buttons to the kiln menu in view mode #1441

Open
scottnash opened this issue Jun 13, 2019 · 0 comments
Open

Comments

@scottnash
Copy link
Contributor

scottnash commented Jun 13, 2019

Currently, window.kiln.navButtons are only shown in the menu in edit mode because a minimal amount of kiln is loaded in view mode and the drawers those buttons open wouldn't work in view mode. However, there might be certain instances when you would want a nav button to show up in view mode.

Could be as simple as adding a window.kiln.viewNavButtons object, then in the plugin's index file you could use the same button in navButtons and viewNavButtons if it wouldn't break anything in View mode, or you could use different buttons for each mode. The viewNavButton could be as simple as a deepLink to edit mode with the plugins drawer open. Or if you don't add it to the kiln.viewNavButtons object, it just wouldn't show up in view mode at all.

So in the index.js file you could have

// If the edit nav button wouldn't throw an error in view mode, reuse the same button
window.kiln.navButtons['myPlugin'] = require('./nav-button.vue');
window.kiln.viewNavButtons['myPlugin'] = require('./nav-button.vue');

or

// If the edit nav button would throw an error in view mode, create two versions of button
window.kiln.navButtons['myPlugin'] = require('./nav-button.vue');
window.kiln.viewNavButtons['myPlugin'] = require('.view-nav-button.vue');
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

No branches or pull requests

1 participant