sidebar-markdown-notes icon indicating copy to clipboard operation
sidebar-markdown-notes copied to clipboard

Toggle for welcome text

Open ryanraposo opened this issue 5 years ago • 6 comments
trafficstars

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

Untitled

ryanraposo avatar Nov 14 '20 16:11 ryanraposo

@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?

ryanraposo avatar Nov 14 '20 17:11 ryanraposo

@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: https://github.com/AssisrMatheus/sidebar-markdown-notes/blob/50a2d6fc0a3bf39fab317b0b0a6105e83280aba8/src/webviewProvider.ts#L113

A new

But that's because I'm not familiar with the extension API. If we could pass values with postMessage: https://github.com/AssisrMatheus/sidebar-markdown-notes/blob/50a2d6fc0a3bf39fab317b0b0a6105e83280aba8/src/webviewProvider.ts#L67

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

AssisrMatheus avatar Nov 14 '20 18:11 AssisrMatheus

@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 avatar Nov 16 '20 02:11 ryanraposo

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

ryanraposo avatar Nov 17 '20 02:11 ryanraposo

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.

AssisrMatheus avatar Nov 20 '20 13:11 AssisrMatheus

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.

ryanraposo avatar Nov 20 '20 15:11 ryanraposo