-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#9 | Ability to open navigation commands in new window
- Loading branch information
Alan Plocieniak
committed
Jun 22, 2016
1 parent
9c6dbd7
commit e32dfcd
Showing
7 changed files
with
60 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 3 additions & 24 deletions
27
app/sc_ext/modules/launcher/providers/AdminShortcutsCommandsProvider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 3 additions & 24 deletions
27
app/sc_ext/modules/launcher/providers/LaunchPadCommandsProvider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
app/sc_ext/modules/launcher/providers/NavigationCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/// <reference path='../../../_all.ts'/> | ||
|
||
namespace SitecoreExtensions.Modules.Launcher.Providers { | ||
export class NavigationCommand implements ICommand { | ||
id: number; | ||
name: string; | ||
description: string; | ||
url: string; | ||
|
||
constructor(name: string, description: string, url: string) { | ||
this.id = 0; | ||
this.name = name; | ||
this.description = description; | ||
this.url = url; | ||
} | ||
|
||
private openInCurrentTab(): void { | ||
window.top.document.location.href = this.url; | ||
} | ||
|
||
private openInNewTab(): void { | ||
var virtualLink = HTMLHelpers.createElement("a", { | ||
target: "_blank", | ||
href: this.url | ||
}) as HTMLLinkElement; | ||
virtualLink.click(); | ||
} | ||
|
||
canExecute(): boolean { | ||
return true; | ||
} | ||
|
||
execute(evt: KeyboardEvent): void { | ||
if (evt && evt.ctrlKey) { | ||
this.openInNewTab(); | ||
} else { | ||
this.openInCurrentTab(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters