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

Feature: Add shortcut to enable Rearrange View #3035

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

maxthyron
Copy link

Read the comments about adding a new shortcut, hope this is how it should be done.
Added some checks for opened split view menu and that split view is enabled.

I don't know how to properly add the name for the shortcut in the menu and translations for it, since they seem to be in a separate repo.

Additionally while testing I needed to create a new profile for new shortcut to show up, is this intended behavior? Or do I need to remove some cached files for changes to apply?

There are also a typos:

  1. in the function's name afterRearangeAction -> afterRearrangeAction
  2. this._thumnailCanvas -> this._thumbnailCanvas

Not sure if it's suitable to add here too.

Lastly, I had to disable Prettier for the project because applying the default prettier config from the repo messed up some files I opened, at least ZenViewSplitter.mjs has some inconsistencies(e.g. _swapField function has some strange whitespaces)

@maxthyron maxthyron requested a review from mr-cheff as a code owner November 15, 2024 16:34
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. Feature labels Nov 15, 2024
@mr-cheff
Copy link
Member

Hi! Could this be updated into version 5 instead of 4? Since it's already taken...😅

@maxthyron
Copy link
Author

Done. Was familiarizing myself with the codebase and forgot to move this to a separate version clause.

@mr-cheff
Copy link
Member

mr-cheff commented Dec 1, 2024

I was wondering if it should also close the rearange view if it's enabled?

@maxthyron
Copy link
Author

As far as I could understand at the moment the only way to toggle rearrange view on is with the button inside split view menu:

<toolbarbutton id="zenSplitViewModifierActivateReallocation"
class="panel-info-button"
oncommand="gZenViewSplitter.enableTabRearrangeView();"
data-l10n-id="zen-split-view-modifier-activate-reallocation">

And disabling it by pressing ESC:
disableTabRearrangeView = (event = null) => {
if (!this.rearrangeViewEnabled) return;
if (event) {
// Click or "ESC" key
if (event.type === 'click' && event.button !== 0
|| event.type === 'keydown' && event.key !== 'Escape') {
return;
}

Since my intention was to add a key shortcut for enabling the rearrange view without the need to click 3 times, I'm just using functions already present and just skipping a popup.

If the rearrange view was already toggled on through regular means, shortcut won't do anything because there's already a check for that:

enableTabRearrangeView() {
if (this.rearrangeViewEnabled) return;
this.rearrangeViewEnabled = true;

With all that in mind, I can't quite get the intention of your suggestion and what's needed of me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants