blob: cc985093d80aecec0d2f9a04912b43fa2db9a627 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_container_shadow_behavior.html">
<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/cr_elements/md_select_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
<link rel="import" href="item_behavior.html">
<link rel="import" href="keyboard_shortcut_delegate.html">
<link rel="import" href="shortcut_input.html">
<dom-module id="extensions-keyboard-shortcuts">
<template>
<style include="md-select cr-shared-style">
:host {
height: 100%;
}
.shortcut-card {
@apply --cr-card-elevation;
background-color: var(--cr-card-background-color);
border-radius: var(--cr-card-border-radius);
color: var(--cr-primary-text-color);
margin: 0 auto 16px auto;
padding-bottom: 8px;
width: var(--cr-toolbar-field-width);
}
.shortcut-card:last-of-type {
margin-bottom: 64px;
}
#container {
box-sizing: border-box;
height: 100%;
overflow: overlay;
padding-top: 24px;
}
.command-entry {
align-items: start;
display: flex;
/* Makes top/bottom spacing of each row more even, while leaving
space for cr-input error message in between rows. */
margin-bottom: -8px;
padding-top: 16px;
}
.command-name {
/* Align with cr-input by matching the field's top padding. */
flex: 1;
margin-top: 6px;
}
.command-entry .md-select {
/* TODO(johntlee): line-height needs adjustment to fix large fonts. */
line-height: 22px;
margin-inline-start: var(--cr-section-padding);
}
.card-title {
align-items: center;
border-bottom: var(--cr-separator-line);
display: flex;
margin-bottom: 9px;
padding: 16px var(--cr-section-padding);
}
.icon {
height: 20px;
margin-inline-end: 20px;
width: 20px;
}
.card-controls {
/* We line up the controls with the name, which is after the
20px left padding + 20px icon + 20px margin on the icon. */
margin-inline-end: 20px;
margin-inline-start: 60px;
}
</style>
<div id="container">
<template is="dom-repeat" items="[[calculateShownItems_(items.*)]]">
<div class="shortcut-card">
<div class="card-title cr-title-text">
<img class="icon" src="[[item.iconUrl]]"
alt$="[[appOrExtension(
item.type,
'$i18nPolymer{appIcon}',
'$i18nPolymer{extensionIcon}')]]">
<span>[[item.name]]</span>
</div>
<div class="card-controls">
<template is="dom-repeat" items="[[item.commands]]" as="command">
<div class="command-entry" command="[[command]]">
<span class="command-name">[[command.description]]</span>
<extensions-shortcut-input delegate="[[delegate]]"
item="[[item.id]]" shortcut="[[command.keybinding]]"
command-name="[[command.name]]">
</extensions-shortcut-input>
<!-- Binding "value" to triggerScopeChange_ to trigger update
only after CommandScope_ becomes available. -->
<select class="md-select" on-change="onScopeChanged_"
disabled$="[[computeScopeDisabled_(command)]]"
value="[[
triggerScopeChange_(command.scope, CommandScope_)]]">
<option value$="[[CommandScope_.CHROME]]">
$i18n{shortcutScopeInChrome}
</option>
<option value$="[[CommandScope_.GLOBAL]]">
$i18n{shortcutScopeGlobal}
</option>
</select>
</div>
</template>
</div>
</div>
</template>
</div>
</template>
<script src="keyboard_shortcuts.js"></script>
</dom-module>
|