Refresh master with initial release/0.24 snapshot (#332)

* Initial port of release/0.24 source code

* Fix additional headers

* Fix a typo in launch.json
This commit is contained in:
Karl Burtram
2017-12-15 15:38:57 -08:00
committed by GitHub
parent 271b3a0b82
commit 6ad0df0e3e
7118 changed files with 107999 additions and 56466 deletions

View File

@@ -21,6 +21,10 @@
display: inline-block;
}
.monaco-action-bar.reverse .actions-container {
flex-direction: row-reverse;
}
.monaco-action-bar .action-item {
cursor: pointer;
display: inline-block;

View File

@@ -120,7 +120,7 @@ export class BaseActionItem extends EventEmitter implements IActionItem {
this.builder.on(DOM.EventType.MOUSE_DOWN, (e: MouseEvent) => {
if (!enableDragging) {
DOM.EventHelper.stop(e); // do not run when dragging is on because that would disable it
DOM.EventHelper.stop(e, true); // do not run when dragging is on because that would disable it
}
if (this._action.enabled && e.button === 0) {
@@ -350,8 +350,10 @@ export class ActionItem extends BaseActionItem {
}
export enum ActionsOrientation {
HORIZONTAL = 1,
VERTICAL = 2
HORIZONTAL,
HORIZONTAL_REVERSE,
VERTICAL,
VERTICAL_REVERSE,
}
export interface IActionItemProvider {
@@ -420,18 +422,38 @@ export class ActionBar extends EventEmitter implements IActionRunner {
DOM.addClass(this.domNode, 'animated');
}
let isVertical = this.options.orientation === ActionsOrientation.VERTICAL;
if (isVertical) {
this.domNode.className += ' vertical';
let previousKey: KeyCode;
let nextKey: KeyCode;
switch (this.options.orientation) {
case ActionsOrientation.HORIZONTAL:
previousKey = KeyCode.LeftArrow;
nextKey = KeyCode.RightArrow;
break;
case ActionsOrientation.HORIZONTAL_REVERSE:
previousKey = KeyCode.RightArrow;
nextKey = KeyCode.LeftArrow;
this.domNode.className += ' reverse';
break;
case ActionsOrientation.VERTICAL:
previousKey = KeyCode.UpArrow;
nextKey = KeyCode.DownArrow;
this.domNode.className += ' vertical';
break;
case ActionsOrientation.VERTICAL_REVERSE:
previousKey = KeyCode.DownArrow;
nextKey = KeyCode.UpArrow;
this.domNode.className += ' vertical reverse';
break;
}
$(this.domNode).on(DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
let event = new StandardKeyboardEvent(e);
let eventHandled = true;
if (event.equals(isVertical ? KeyCode.UpArrow : KeyCode.LeftArrow)) {
if (event.equals(previousKey)) {
this.focusPrevious();
} else if (event.equals(isVertical ? KeyCode.DownArrow : KeyCode.RightArrow)) {
} else if (event.equals(nextKey)) {
this.focusNext();
} else if (event.equals(KeyCode.Escape)) {
this.cancel();
@@ -573,6 +595,22 @@ export class ActionBar extends EventEmitter implements IActionRunner {
});
}
public getWidth(index: number): number {
if (index >= 0 && index < this.actionsList.children.length) {
return this.actionsList.children.item(index).clientWidth;
}
return 0;
}
public getHeight(index: number): number {
if (index >= 0 && index < this.actionsList.children.length) {
return this.actionsList.children.item(index).clientHeight;
}
return 0;
}
public pull(index: number): void {
if (index >= 0 && index < this.items.length) {
this.items.splice(index, 1);