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

Toggle for welcome text #12

Open
ryanraposo opened this issue Nov 14, 2020 · 6 comments
Open

Toggle for welcome text #12

ryanraposo opened this issue Nov 14, 2020 · 6 comments

Comments

@ryanraposo
Copy link
Contributor

Currently, the welcome text is added to all pages. A new configuration toggle for this would be nice. Something like:

Untitled

@ryanraposo
Copy link
Contributor Author

@AssisrMatheus Working through this, hope you don't mind a couple questions. Trying to mimic your patterns if I can. So, unlike the leftMargin, welcome text is applied in main.js (via initialState or via the nextPage logic).

How do you recommend passing the config for use in in main.js? Any thoughts on the refactoring in general?

@AssisrMatheus
Copy link
Owner

@ryanraposo

hope you don't mind a couple questions

Not at all, shoot them! I just might take some time to answer

How do you recommend passing the config for use in in main.js?

The first idea I had is that when generating the HTML content here:

return `<!DOCTYPE html>

A new <script> tag could be added, which creates a global javascript variable with the config's values.

But that's because I'm not familiar with the extension API. If we could pass values with postMessage:

this._view.webview.postMessage({ type: 'togglePreview' });

Like we can on main.js. It could also be a possibility.

@ryanraposo
Copy link
Contributor Author

@AssisrMatheus for the tag. Does this look alright and does it need to be nested anywhere specific in _getHtmlForWebview()?

<script>var showWelcomeText =${this.config.get<boolean>('showWelcomeText')</script>

PS debugging webviews is so painful how have you been doing it?

@ryanraposo
Copy link
Contributor Author

See #13. (PS debugging still terrible pls send tips)

@AssisrMatheus
Copy link
Owner

AssisrMatheus commented Nov 20, 2020

Hey @ryanraposo sorry for the late reply. I'm usually taking time off the computer after work, so I'm not having much time to answer your questions.

Does this look alright and does it need to be nested anywhere specific in _getHtmlForWebview()?

Hmm I think that looks good enough to me! I was going to suggest you just giving the entire config object but I just saw you did that in the pr

PS debugging webviews is so painful how have you been doing it?

When in the sandbox environment(when you press F5 in the workspace and it opens a vscode view), and with the webview focused(just click on it), you can press CTRL + SHIFT + P to open the command tooltip(not the exact name for the feature haha), and type "Open webview developer tools". It'll then open a normal chrome/electron developer tools window but for the inner webview. Where you can see logs and put breakpoints in the html/main.js.

@ryanraposo
Copy link
Contributor Author

Hey @ryanraposo sorry for the late reply. I'm usually taking time off the computer after work, so I'm not having much time to answer your questions.

No rush, its all good.

When in the sandbox environment(when you press F5 in the workspace and it opens a vscode view), and with the webview focused(just click on it), you can press CTRL + SHIFT + P to open the command tooltip(not the exact name for the feature haha), and type "Open webview developer tools". It'll then open a normal chrome/electron developer tools window but for the inner webview. Where you can see logs and put breakpoints in the html/main.js.

Awesome, thanks.

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

2 participants