overleaf-textarea icon indicating copy to clipboard operation
overleaf-textarea copied to clipboard

Add button to control plugin on page

Open Caian opened this issue 3 years ago • 11 comments

This PR implements the suggestion from #21. It creates a button in the toolbar-pdf-left that allows the plugin to be toggled on and off. Additionally, the code has been refactored so the toggle only affects its own page.

Screenshot from 2022-01-07 13-36-02

Possible TODOs:

  • A better icon (currently Font Awesome, already used by overleaf);
  • Proper tooltip (my attempt at imitating overleaf's tooltips failed);

Caian avatar Jan 07 '22 16:01 Caian

Could use the same icon as the plugin does.

robindijkhof avatar Jan 07 '22 18:01 robindijkhof

Could use the same icon as the plugin does.

Done:

Screenshot from 2022-01-07 16-49-37

But it is hard to see. Maybe a new asset should be created instead of one of the icons.

Caian avatar Jan 07 '22 19:01 Caian

Hi, guess you are right. You can download a white version over here: https://fonts.google.com/icons?selected=Material+Icons&icon.query=spellcheck

robindijkhof avatar Jan 10 '22 08:01 robindijkhof

I added the white icon to the button and also linked it with the dark theme, so the light theme will show the standard black icon:

Screenshot from 2022-01-13 09-59-15

Screenshot from 2022-01-13 09-59-31

Caian avatar Jan 13 '22 13:01 Caian

This is indeed a critical feature, when will it be available? Or how to use it now?

qingping95 avatar Jan 24 '22 10:01 qingping95

The button now has a global behavior, like the active checkbox.

Caian avatar Jan 29 '22 13:01 Caian

For anyone that can't wait till this PR gets merged, it's also possible to add a bookmarklet which toggles the visibility of the textarea. Benefit of this method is that toggling is instant. For easy acces you can put it in your bookmarks toolbar, this way toggling is only one click away.

Just add a new bookmark and give the following as if it is the url: javascript: (() => { var element = document.getElementById("spellcheck"); element.style.display = element.style.display === 'none' ? '' : 'none'; })();

mo6zes avatar Mar 01 '22 09:03 mo6zes

I finally had the time to check this out. However, I'm not seeing the icon when building/running local. Am I missing anything?

robindijkhof avatar Mar 05 '22 20:03 robindijkhof

Also, I think buttons are never cleaned up. For example, when switching tex files, a new button is added.

robindijkhof avatar Mar 05 '22 20:03 robindijkhof

Also, I think buttons are never cleaned up. For example, when switching tex files, a new button is added.

Buttons are not cleaned up otherwise trying to toggle the text area off would make the button disappear. Nonetheless the button element is named and it is created only if it does not exist. Unfortunately I could not reproduce this scenario, here I can only see one button even switching .tex files.

Caian avatar Mar 21 '22 07:03 Caian

very excellent pull request. I hope to have it soon.

modaresimr avatar Jun 08 '22 16:06 modaresimr