Skip to content

Commit

Permalink
Bug 1923651 - implement "move group to new window" in tabgroup edit m…
Browse files Browse the repository at this point in the history
…enu. r=dao,tabbrowser-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D226325

UltraBlame original commit: bcfcf33d929969655a57da5176bc247c4c9ba982
  • Loading branch information
marco-c committed Nov 1, 2024
1 parent d0945af commit acd53c7
Show file tree
Hide file tree
Showing 4 changed files with 752 additions and 12 deletions.
159 changes: 158 additions & 1 deletion browser/components/tabbrowser/content/tabbrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -11377,6 +11377,9 @@ addTabGroup
(
tabs
{
id
=
null
color
=
null
Expand Down Expand Up @@ -11433,7 +11436,12 @@ tabGroupMenu
nextUnusedColor
;
}
let
if
(
!
id
)
{
id
=
{
Expand All @@ -11459,6 +11467,7 @@ random
)
}
;
}
let
group
=
Expand Down Expand Up @@ -20667,6 +20676,154 @@ return
win
;
}
replaceGroupWithWindow
(
group
)
{
let
selectedIndex
=
group
.
tabs
.
indexOf
(
gBrowser
.
selectedTab
)
;
if
(
selectedIndex
<
0
)
{
selectedIndex
=
0
;
}
let
firstTab
=
group
.
tabs
[
selectedIndex
]
;
let
newWindow
=
this
.
replaceTabWithWindow
(
firstTab
)
;
newWindow
.
addEventListener
(
"
before
-
initial
-
tab
-
adopted
"
(
)
=
>
{
let
tabsToGroup
=
group
.
tabs
.
map
(
(
tab
i
)
=
>
{
if
(
i
=
=
selectedIndex
)
{
return
newWindow
.
gBrowser
.
visibleTabs
[
0
]
;
}
return
tab
;
}
)
;
newWindow
.
gBrowser
.
addTabGroup
(
tabsToGroup
{
color
:
group
.
color
label
:
group
.
label
id
:
group
.
id
}
)
;
}
{
once
:
true
}
)
;
return
newWindow
;
}
_updateTabsAfterInsert
(
)
Expand Down
70 changes: 68 additions & 2 deletions browser/components/tabbrowser/content/tabgroup-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,11 @@ only
>
<
toolbarbutton
tabindex
=
"
1
"
id
=
"
Expand Down Expand Up @@ -537,10 +542,10 @@ toolbarbutton
>
<
toolbarbutton
disabled
tabindex
=
"
true
1
"
id
=
Expand Down Expand Up @@ -617,6 +622,11 @@ toolbarbutton
>
<
toolbarbutton
tabindex
=
"
1
"
id
=
"
Expand Down Expand Up @@ -1057,6 +1067,37 @@ document
getElementById
(
"
tabGroupEditor_moveGroupToNewWindow
"
)
.
addEventListener
(
"
command
"
(
)
=
>
{
gBrowser
.
replaceGroupWithWindow
(
this
.
activeGroup
)
;
}
)
;
document
.
getElementById
(
"
tabGroupEditor_ungroupTabs
"
)
Expand Down Expand Up @@ -1686,6 +1727,31 @@ topleft
}
)
;
document
.
getElementById
(
"
tabGroupEditor_moveGroupToNewWindow
"
)
.
disabled
=
gBrowser
.
openTabCount
=
=
this
.
activeGroup
?
.
tabs
.
length
;
}
on_popupshown
(
Expand Down
5 changes: 4 additions & 1 deletion browser/components/tabbrowser/content/tabgroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ gBrowser
adoptTab
(
tab
this
gBrowser
.
tabs
.
Expand All @@ -754,6 +754,9 @@ at
_tPos
+
1
tab
.
selected
)
;
gBrowser
Expand Down
Loading

0 comments on commit acd53c7

Please sign in to comment.