|
193 | 193 |
|
194 | 194 | @if (ShowSaveFileAction) |
195 | 195 | { |
196 | | - <button type="button" |
197 | | - class="btn-ghost app-header-native-export" |
198 | | - @onclick="HandleSaveFileClickAsync" |
199 | | - data-test="@UiTestIds.Header.EditorSaveFile"> |
200 | | - <UiIcon Kind="UiIconKind.ExportArrow" Size="15" /> |
201 | | - <span class="app-header-action-label">@SaveFileLabel</span> |
202 | | - </button> |
203 | | - <button type="button" |
204 | | - class="btn-ghost app-header-format-export" |
205 | | - @onclick="HandleExportMarkdownClickAsync" |
206 | | - data-test="@UiTestIds.Header.EditorExportMarkdown"> |
207 | | - <UiIcon Kind="UiIconKind.DocumentLines" Size="15" /> |
208 | | - <span class="app-header-action-label">@ExportMarkdownLabel</span> |
209 | | - </button> |
210 | | - <button type="button" |
211 | | - class="btn-ghost app-header-format-export" |
212 | | - @onclick="HandleExportPlainTextClickAsync" |
213 | | - data-test="@UiTestIds.Header.EditorExportPlainText"> |
214 | | - <UiIcon Kind="UiIconKind.TextLines" Size="15" /> |
215 | | - <span class="app-header-action-label">@ExportPlainTextLabel</span> |
216 | | - </button> |
| 196 | + <div class="app-header-export" |
| 197 | + data-test="@UiTestIds.Header.EditorExportMenu"> |
| 198 | + <button type="button" |
| 199 | + class="btn-ghost app-header-export-trigger" |
| 200 | + aria-haspopup="menu" |
| 201 | + aria-expanded="@(_isExportMenuOpen ? EnabledStateValue : DisabledStateValue)" |
| 202 | + @onclick="ToggleExportMenu" |
| 203 | + data-test="@UiTestIds.Header.EditorSaveFile"> |
| 204 | + <UiIcon Kind="UiIconKind.ExportArrow" Size="15" /> |
| 205 | + <span class="app-header-action-label">@SaveFileLabel</span> |
| 206 | + <UiIcon Kind="UiIconKind.ChevronDown" Size="13" StrokeWidth="2.2m" /> |
| 207 | + </button> |
| 208 | + |
| 209 | + @if (_isExportMenuOpen) |
| 210 | + { |
| 211 | + <div class="app-header-export-menu" |
| 212 | + role="menu"> |
| 213 | + <button type="button" |
| 214 | + class="app-header-export-option" |
| 215 | + role="menuitem" |
| 216 | + @onclick="HandleSaveFileClickAsync" |
| 217 | + data-test="@UiTestIds.Header.EditorExportNative"> |
| 218 | + <UiIcon Kind="UiIconKind.ExportArrow" Size="15" /> |
| 219 | + <span>@ExportNativeLabel</span> |
| 220 | + </button> |
| 221 | + <button type="button" |
| 222 | + class="app-header-export-option" |
| 223 | + role="menuitem" |
| 224 | + @onclick="HandleExportMarkdownClickAsync" |
| 225 | + data-test="@UiTestIds.Header.EditorExportMarkdown"> |
| 226 | + <UiIcon Kind="UiIconKind.DocumentLines" Size="15" /> |
| 227 | + <span>@ExportMarkdownLabel</span> |
| 228 | + </button> |
| 229 | + <button type="button" |
| 230 | + class="app-header-export-option" |
| 231 | + role="menuitem" |
| 232 | + @onclick="HandleExportPlainTextClickAsync" |
| 233 | + data-test="@UiTestIds.Header.EditorExportPlainText"> |
| 234 | + <UiIcon Kind="UiIconKind.TextLines" Size="15" /> |
| 235 | + <span>@ExportPlainTextLabel</span> |
| 236 | + </button> |
| 237 | + </div> |
| 238 | + } |
| 239 | + </div> |
217 | 240 | } |
218 | 241 |
|
219 | 242 | @if (ShowLearnAction) |
|
251 | 274 | private const string DisabledStateValue = "false"; |
252 | 275 | private const string EnabledStateValue = "true"; |
253 | 276 | private const decimal HomeIconStrokeWidth = 1.9m; |
| 277 | + private bool _isExportMenuOpen; |
254 | 278 |
|
255 | 279 | [Parameter, EditorRequired] public string CssClass { get; set; } = string.Empty; |
256 | 280 | [Parameter] public bool IsReaderMuted { get; set; } |
|
292 | 316 | [Parameter, EditorRequired] public string ReadLabel { get; set; } = string.Empty; |
293 | 317 | [Parameter, EditorRequired] public string RestartTourLabel { get; set; } = string.Empty; |
294 | 318 | [Parameter, EditorRequired] public string ExportMarkdownLabel { get; set; } = string.Empty; |
| 319 | + [Parameter, EditorRequired] public string ExportNativeLabel { get; set; } = string.Empty; |
295 | 320 | [Parameter, EditorRequired] public string ExportPlainTextLabel { get; set; } = string.Empty; |
296 | 321 | [Parameter, EditorRequired] public string SaveFileLabel { get; set; } = string.Empty; |
297 | 322 | [Parameter, EditorRequired] public string SearchPlaceholder { get; set; } = string.Empty; |
|
333 | 358 |
|
334 | 359 | private Task HandleOpenReadClickAsync() => OnOpenReadClick.InvokeAsync(); |
335 | 360 |
|
336 | | - private Task HandleExportMarkdownClickAsync() => OnExportMarkdownClick.InvokeAsync(); |
| 361 | + private void ToggleExportMenu() => _isExportMenuOpen = !_isExportMenuOpen; |
| 362 | + |
| 363 | + private async Task HandleExportMarkdownClickAsync() |
| 364 | + { |
| 365 | + _isExportMenuOpen = false; |
| 366 | + await OnExportMarkdownClick.InvokeAsync(); |
| 367 | + } |
337 | 368 |
|
338 | | - private Task HandleExportPlainTextClickAsync() => OnExportPlainTextClick.InvokeAsync(); |
| 369 | + private async Task HandleExportPlainTextClickAsync() |
| 370 | + { |
| 371 | + _isExportMenuOpen = false; |
| 372 | + await OnExportPlainTextClick.InvokeAsync(); |
| 373 | + } |
339 | 374 |
|
340 | | - private Task HandleSaveFileClickAsync() => OnSaveFileClick.InvokeAsync(); |
| 375 | + private async Task HandleSaveFileClickAsync() |
| 376 | + { |
| 377 | + _isExportMenuOpen = false; |
| 378 | + await OnSaveFileClick.InvokeAsync(); |
| 379 | + } |
341 | 380 | } |
0 commit comments