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 content tabs #27

Closed
antonlukin opened this issue Dec 4, 2019 · 11 comments
Closed

Add content tabs #27

antonlukin opened this issue Dec 4, 2019 · 11 comments
Labels
not do This will not be worked on
Milestone

Comments

@antonlukin
Copy link

What do you think about adding tabs?
For example I want to keep different pages with notes and quickly switch between them.

Something like this:

image

image

If that sounds like a good idea I can help to implement

@penge
Copy link
Owner

penge commented Dec 7, 2019

Hi @antonlukin

Thank you for the suggestion.

What do you think about this preview?

Preview

my notes preview

Let's say you can click (or tap) the page number, and it will go to the next page.
Pages will be 3 and after then, you would get back to the beginning, that is page 1.

For fast navigation, commands like Ctrl+Shift+1, Ctrl+Shift+2, and Ctrl+Shift+3 can be added (on Mac, let's say Command+Shift+1, and so on).

The app would remember which page you had open last time, it would be the page it will open once you come back (re-open the tab).

Need to decide

This feature is something I am considering for quite some time now.
Not many require it (2 or 3 requests).

Simple separation of content can be achieved by placing a few #, or blank lines, or anything else, depends on everyone's style. This is the reason why I hesitate.
The second reason is searching (Ctrl+F), which is easier when there is only 1 page.
Then, need to remember what is on which page.

If this feature is valuable or not, it is up to consideration. If yes, I think about what would be the best way to add it, to be simple, not intrusive (check preview), while satisfying both groups: those who need it, and those who might never use it.

Thank you very much for the help you could provide. Once this gets some approval, I might release it quickly (2-3 days). But in future on bigger tasks, help might be welcome!

Let me know your use cases. How much difference it would make for you to have this.
How do you feel about the feature? Is it very important? What do you think about the preview?

@antonlukin
Copy link
Author

Thanks for reply!

Speaking in essence I believe that splitting into tabs would be useful. For example, if I want to keep passwords on one tab (it's not the smartest idea, but still) and keep my todo list on the other. Or if I need a tab as a temporary storage and it's easier for me to copy all the content using cmd+a than select part by part. I often paste text from the clipboard, edit something and quickly copy to another location. it is much more convenient to see the full inserted text without extraneous entries.

Anyway, I do not think it is superfluous if you make an unobtrusive interface.
I really like your idea with hotkeys and small numbers.

Thanks again for such a useful extension

@penge
Copy link
Owner

penge commented Dec 9, 2019

Hi @antonlukin

I am very glad you like the plugin.

I have decided I will implement the feature as in preview. I'll also add the keyboard shortcuts.

To satisfy also basic users, I will add to Options page a toggle if to use 1 page only, or 3 page setting.

I will also add Focus mode, that will be available as another keyboard shortcut. This will be for advanced users to simply hide all the controls.

I also plan to add recognition if My Notes are already open in a different tab. If so. There will be on next instances just a simple text saying so. This will help to avoid any cross editing.

Expect this to be here as a pre-release this Wednesday about 12:00 UTC.

I hope I might then invite you to do a local test before I make the final release. I suppose you have Mac, and Mac's shortcuts need to be tested. I have Chromebook btw.

Pavel

@penge penge added this to the 2.0 milestone Dec 9, 2019
This was referenced Dec 10, 2019
@penge
Copy link
Owner

penge commented Dec 11, 2019

@antonlukin

It is now here ready to try. The branch is "pages".

The PR is here #34

So far so good. It should work on Mac too.

@antonlukin
Copy link
Author

Thanks a lot, I will try it ASAP

@antonlukin
Copy link
Author

antonlukin commented Dec 11, 2019

I found some bugs.

  1. For some reason content is not saved when switching tabs video

  2. Strage bug Uncaught TypeError: Cannot read property 'debounce' of undefined screenshot

  3. cmd+shift+3 reserved hotkey on macOS. Maybe change with option+1, option+2, option+3?

@penge
Copy link
Owner

penge commented Dec 11, 2019

  1. Nice catch! I will fix this.
  2. Haven't experienced this so far. What steps did you do?
  3. I see. On Mac it's screen capture. I will change it.

I'll be here in about an hour. After fixed I will rewrite then branch and let you know.

@penge
Copy link
Owner

penge commented Dec 11, 2019

@antonlukin

It should be fixed now. Try the new "pages" branch.

1 and 2

1 and 2 are related.

I guess your background script just unloaded itself (because it is not persistent, which is good).
In that case, Uncaught TypeError: Cannot read property 'debounce' of undefined would be caused because chrome.extension.getBackgroundPage would return undefined (background script is no longer running).

So here's what I did.
I used chrome.runtime.getBackgroundPage instead of chrome.extension.getBackgroundPage.
That should ensure background script is loaded when needed. In this case, debounce.js is needed. It is needed only once, to wrap the function that is saving notes.
This in the end, should solve both 1 and 2.

3

I tried to change OSX keyboard shortcuts to:

  • Option-1
  • Option-2
  • Option-3
  • Option-F

Please, try this out. I hope it works.

If not (some other shortcut conflict), we might need to test Option-Shift-? combinations.

Note: Keyboard shortcuts are defined in the manifest.json file. You may see Alt-? combinations there. They should be converted to Option-? on the Mac. You can also try to change the combinations (in case the above wouldn't work).

Here are the official docs:
https://developer.chrome.com/extensions/commands

Let me know.

@antonlukin
Copy link
Author

Excellent work! Thank you so much for your concern.

It seems that all bugs fixed and hotkeys work properly.
One small remark. In this extension version the font size option does not save on tab switching.
I checked on the stable version, and found out that the feature works there.

Just 2 new gifs for you:

@penge
Copy link
Owner

penge commented Dec 11, 2019

That's great! Cool!


Regarding the font size.

Great you brought this up! I now know how to fix it!
I will put a fix here in about 1 hour.


I'll explain why I have changed it. And then how to fix it.

Why

The reason why I have changed it and why it behaves how it behaves now is following.

Before:
Font size is saved on every change (same in new tab).

Now:
Font size is saved when the tab is closed (NOT same in new tab).

Reasons:

  • To minimize the number of write operations (keep it within limits, described in next point).
  • So far I was using Chrome Sync (chrome.storage.sync) for everything and there is a limit of write operations (120 per minute).
  • The most important thing to save are notes (those are saved every second), and font size as not that essential, would be good enough to save once the work is done, before closing the tab.
  • I am considering to disable editing in multiple tabs (and to put a link instead to jump straight into already open My Notes, can be great if there is 30-50 tabs, no need to search). Also, working on the same page in different tabs creates a mess. Conflicts. Overriding page with different content.

Chrome Sync

So the great news about Chrome Sync is, if you open My Notes from 2 different computers, with the same Gmail account, you should see the same content on both computers. And copy paste content between them. The funny is, I haven't tried this yet. But received words it works.

How to fix

Now I just realized it is not necessary to save everything to Chrome Sync (just notes). Everything else (font type, font size, current page, mode - light/dark) I will now save to Chrome Local. Those "everything else category" are computer specific anyway.

I put notes to Sync, and everything else to Local (there are no such limits).
That would be the fix.

@penge
Copy link
Owner

penge commented Dec 11, 2019

This one is solved. Closing.

Next one is font size.

@penge penge closed this as completed Dec 11, 2019
@penge penge added the not do This will not be worked on label May 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not do This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants