mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-09 17:52:34 -05:00
Merge from vscode 8a997f7321ae6612fc0e6eb3eac4f358a6233bfb
This commit is contained in:
@@ -9,7 +9,7 @@ import * as strings from 'vs/base/common/strings';
|
||||
import { IActionRunner, IAction, Action, IActionViewItem } from 'vs/base/common/actions';
|
||||
import { ActionBar, IActionViewItemProvider, ActionsOrientation, Separator, ActionViewItem, IActionViewItemOptions, BaseActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { ResolvedKeybinding, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { addClass, EventType, EventHelper, EventLike, removeTabIndexAndUpdateFocus, isAncestor, hasClass, addDisposableListener, removeClass, append, $, addClasses, removeClasses } from 'vs/base/browser/dom';
|
||||
import { addClass, EventType, EventHelper, EventLike, removeTabIndexAndUpdateFocus, isAncestor, hasClass, addDisposableListener, removeClass, append, $, addClasses, removeClasses, clearNode } from 'vs/base/browser/dom';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
@@ -464,7 +464,13 @@ class BaseMenuActionViewItem extends BaseActionViewItem {
|
||||
}
|
||||
|
||||
updateLabel(): void {
|
||||
if (!this.label) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.options.label) {
|
||||
clearNode(this.label);
|
||||
|
||||
let label = this.getAction().label;
|
||||
if (label) {
|
||||
const cleanLabel = cleanMnemonic(label);
|
||||
@@ -472,9 +478,7 @@ class BaseMenuActionViewItem extends BaseActionViewItem {
|
||||
label = cleanLabel;
|
||||
}
|
||||
|
||||
if (this.label) {
|
||||
this.label.setAttribute('aria-label', cleanLabel.replace(/&&/g, '&'));
|
||||
}
|
||||
this.label.setAttribute('aria-label', cleanLabel.replace(/&&/g, '&'));
|
||||
|
||||
const matches = MENU_MNEMONIC_REGEX.exec(label);
|
||||
|
||||
@@ -490,22 +494,25 @@ class BaseMenuActionViewItem extends BaseActionViewItem {
|
||||
escMatch = MENU_ESCAPED_MNEMONIC_REGEX.exec(label);
|
||||
}
|
||||
|
||||
const replaceDoubleEscapes = (str: string) => str.replace(/&&/g, '&');
|
||||
|
||||
if (escMatch) {
|
||||
label = `${label.substr(0, escMatch.index)}<u aria-hidden="true">${escMatch[3]}</u>${label.substr(escMatch.index + escMatch[0].length)}`;
|
||||
this.label.append(
|
||||
strings.ltrim(replaceDoubleEscapes(label.substr(0, escMatch.index)), ' '),
|
||||
$('u', { 'aria-hidden': 'true' },
|
||||
escMatch[3]),
|
||||
strings.rtrim(replaceDoubleEscapes(label.substr(escMatch.index + escMatch[0].length)), ' '));
|
||||
} else {
|
||||
this.label.innerText = replaceDoubleEscapes(label).trim();
|
||||
}
|
||||
|
||||
label = label.replace(/&&/g, '&');
|
||||
if (this.item) {
|
||||
this.item.setAttribute('aria-keyshortcuts', (!!matches[1] ? matches[1] : matches[3]).toLocaleLowerCase());
|
||||
}
|
||||
} else {
|
||||
label = label.replace(/&&/g, '&');
|
||||
this.label.innerText = label.replace(/&&/g, '&').trim();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.label) {
|
||||
this.label.innerHTML = label.trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user