Skip to content

Commit

Permalink
Add a context menu behavior choice for tree parents which behave same…
Browse files Browse the repository at this point in the history
…ly to the one for individual tabs
  • Loading branch information
piroor committed Nov 14, 2023
1 parent 1db5e42 commit c100e57
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 14 deletions.
1 change: 1 addition & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
"config_modeForNoSelection_label": { "message": "Regular Operation" },
"config_modeForNoSelection_nothing_label": { "message": "(do nothing)" },
"config_modeForNoSelection_choose_label": { "message": "Choose from menu always" },
"config_modeForNoSelection_inherit_label": { "message": "Behave samely to the choice for individual tabs" },
"config_modeForNoSelection_individualTab_label": { "message": "Copy Individual Tab" },
"config_modeForNoSelection_all_label": { "message": "Copy All Tabs" },
"config_modeForNoSelection_tree_label": { "message": "Copy Whole Tree" },
Expand Down
1 change: 1 addition & 0 deletions _locales/ja/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
"config_modeForNoSelection_label": { "message": "通常の操作" },
"config_modeForNoSelection_nothing_label": { "message": "(何もしない)" },
"config_modeForNoSelection_choose_label": { "message": "その都度メニューから選択する" },
"config_modeForNoSelection_inherit_label": { "message": "単独のタブに対する選択と同様に振る舞う" },
"config_modeForNoSelection_individualTab_label": { "message": "単独のタブをコピー" },
"config_modeForNoSelection_all_label": { "message": "すべてのタブをコピー" },
"config_modeForNoSelection_tree_label": { "message": "ツリーをコピー" },
Expand Down
31 changes: 21 additions & 10 deletions common/Context.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,31 @@ export class Context {

log('resolving mode, isTreeParent=', this.isTreeParent, ', modified=', this.modified);

return this.$mode = this.isTreeParent ? // detect tree parent at first
(this.modified ?
// detect tree parent at first
if (this.isTreeParent &&
configs.modeForNoSelectionTree != Constants.kCOPY_INHERIT) {
return this.$mode = this.modified ?
configs.modeForNoSelectionTreeModified :
configs.modeForNoSelectionTree) :
(this.modified ?
configs.modeForNoSelectionModified :
configs.modeForNoSelection);
configs.modeForNoSelectionTree;
}

return this.$mode = this.modified ?
configs.modeForNoSelectionModified :
configs.modeForNoSelection;
}

get menuItemTitleKey() {
return this.isTreeParent ? 'context_copyTree_label' : // detect tree parent at first
this.shouldCopyOnlyDescendants ? 'context_copyTreeDescendants_label' :
this.shouldCopyAll ? 'context_copyAllTabs_label' :
'context_copyTab_label';
// detect tree parent at first
if (this.isTreeParent &&
configs.modeForNoSelectionTree != Constants.kCOPY_INHERIT) {
return this.shouldCopyOnlyDescendants ?
'context_copyTreeDescendants_label' :
'context_copyTree_label';
}

return this.shouldCopyAll ?
'context_copyAllTabs_label' :
'context_copyTab_label';
}

get isTreeParent() {
Expand Down
1 change: 1 addition & 0 deletions common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const kCOPY_TREE = 2;
export const kCOPY_TREE_DESCENDANTS = 3;
export const kCOPY_ALL = 4;
export const kCOPY_CHOOSE_FROM_MENU = 5;
export const kCOPY_INHERIT = 6;

export const kDELIMITER_LINE_BREAK = 0;
export const kDELIMITER_SPACE = 1;
Expand Down
16 changes: 12 additions & 4 deletions options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
</thead>
<tbody>
<tr>
<td><label><input id="modeForNoSelection_choose"
<td colspan="2"
><label><input id="modeForNoSelection_choose"
name="modeForNoSelection"
value="5"
type="radio"></label></td>
<td></td>
<th><label for="modeForNoSelection_choose">__MSG_config_modeForNoSelection_choose_label__</label></th>
</tr>
<tr>
Expand Down Expand Up @@ -93,11 +93,19 @@
</thead>
<tbody>
<tr>
<td><label><input id="modeForNoSelectionTree_choose"
<td colspan="2"
><label><input id="modeForNoSelectionTree_inherit"
name="modeForNoSelectionTree"
value="6"
type="radio"></label></td>
<th><label for="modeForNoSelectionTree_inherit">__MSG_config_modeForNoSelection_inherit_label__</label></th>
</tr>
<tr>
<td colspan="2"
><label><input id="modeForNoSelectionTree_choose"
name="modeForNoSelectionTree"
value="5"
type="radio"></label></td>
<td></td>
<th><label for="modeForNoSelectionTree_choose">__MSG_config_modeForNoSelection_choose_label__</label></th>
</tr>
<tr>
Expand Down

0 comments on commit c100e57

Please sign in to comment.