Skip to content

Commit 679eb22

Browse files
Yu Leng (from Dev Box)claude
andcommitted
[KBM] Add Expand (text replacement) action type to EditorUI
Add a new "Expand" trigger type that allows users to define text expansion mappings (type abbreviation → expand to full text) in the Keyboard Manager editor. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 549b32e commit 679eb22

File tree

11 files changed

+624
-6
lines changed

11 files changed

+624
-6
lines changed

src/modules/keyboardmanager/KeyboardManagerEditorUI/Controls/IconLabelControl.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ private void UpdateIcon()
8181
ActionType.Shortcut => "\uEDA7",
8282
ActionType.MouseClick => "\uE962",
8383
ActionType.Url => "\uE774",
84+
ActionType.Expand => "\uE8C8",
8485
_ => "\uE8A5",
8586
};
8687
}

src/modules/keyboardmanager/KeyboardManagerEditorUI/Controls/UnifiedMappingControl.xaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@
4646
<TextBlock x:Uid="TriggerType_KeyOrShortcut_Text" />
4747
</StackPanel>
4848
</ComboBoxItem>
49+
<ComboBoxItem x:Uid="TriggerType_Expand" Tag="Expand">
50+
<StackPanel Orientation="Horizontal" Spacing="8">
51+
<FontIcon FontSize="14" Glyph="&#xE8C8;" />
52+
<TextBlock x:Uid="TriggerType_Expand_Text" />
53+
</StackPanel>
54+
</ComboBoxItem>
4955
<!--
5056
<ComboBoxItem x:Uid="TriggerType_Mouse" Tag="Mouse">
5157
<StackPanel Orientation="Horizontal" Spacing="8">
@@ -111,6 +117,44 @@
111117
IsChecked="True" />
112118
</StackPanel>
113119
</tkcontrols:Case>
120+
<!-- Expand Trigger -->
121+
<tkcontrols:Case Value="Expand">
122+
<StackPanel Orientation="Vertical" Spacing="8">
123+
<TextBox
124+
x:Name="ExpandAbbreviationBox"
125+
x:Uid="ExpandAbbreviationBox"
126+
Background="{ThemeResource TextControlBackgroundFocused}"
127+
BorderBrush="{ThemeResource ControlStrokeColorDefaultBrush}"
128+
GotFocus="ExpandAbbreviationBox_GotFocus"
129+
TextChanged="ExpandAbbreviationBox_TextChanged" />
130+
<TextBlock
131+
x:Uid="ExpandTriggerKeyLabel"
132+
Margin="0,8,0,0"
133+
FontWeight="SemiBold" />
134+
<ToggleButton
135+
x:Name="ExpandTriggerKeyToggleBtn"
136+
MinHeight="48"
137+
Padding="8,12,8,12"
138+
HorizontalAlignment="Stretch"
139+
HorizontalContentAlignment="Center"
140+
VerticalContentAlignment="Center"
141+
Checked="ExpandTriggerKeyToggleBtn_Checked"
142+
Style="{StaticResource CustomShortcutToggleButtonStyle}"
143+
Unchecked="ExpandTriggerKeyToggleBtn_Unchecked">
144+
<ToggleButton.Content>
145+
<commoncontrols:KeyVisual
146+
x:Name="ExpandTriggerKeyVisual"
147+
Padding="8"
148+
Background="{ThemeResource ControlFillColorDefaultBrush}"
149+
BorderThickness="1"
150+
Content="Space"
151+
CornerRadius="{StaticResource OverlayCornerRadius}"
152+
FontSize="16"
153+
Style="{StaticResource DefaultKeyVisualStyle}" />
154+
</ToggleButton.Content>
155+
</ToggleButton>
156+
</StackPanel>
157+
</tkcontrols:Case>
114158
<!-- Mouse Button Trigger -->
115159
<tkcontrols:Case Value="Mouse">
116160
<ComboBox
@@ -365,6 +409,20 @@
365409
</ComboBox>
366410
</StackPanel>
367411
</tkcontrols:Case>
412+
<!-- Replace With Action (for Expand trigger) -->
413+
<tkcontrols:Case Value="ReplaceWith">
414+
<TextBox
415+
x:Name="ExpandedTextBox"
416+
x:Uid="ExpandedTextBox"
417+
MinHeight="120"
418+
MaxHeight="240"
419+
AcceptsReturn="True"
420+
Background="{ThemeResource TextControlBackgroundFocused}"
421+
BorderBrush="{ThemeResource ControlStrokeColorDefaultBrush}"
422+
GotFocus="ExpandedTextBox_GotFocus"
423+
TextChanged="ExpandedTextBox_TextChanged"
424+
TextWrapping="Wrap" />
425+
</tkcontrols:Case>
368426
<!-- Mouse Click Action (Placeholder) -->
369427
<tkcontrols:Case Value="MouseClick">
370428
<TextBlock

0 commit comments

Comments
 (0)