forked from MapComplete/MapComplete
More refactoring, stuff kindoff works
This commit is contained in:
parent
62f471df1e
commit
3943100e54
52 changed files with 635 additions and 1010 deletions
|
@ -6,18 +6,18 @@ import {UIEventSource} from "../../Logic/UIEventSource";
|
|||
export default class Link extends BaseUIElement {
|
||||
private readonly _element: HTMLElement;
|
||||
|
||||
constructor(embeddedShow: BaseUIElement | string, target: string | UIEventSource<string>, newTab: boolean = false) {
|
||||
constructor(embeddedShow: BaseUIElement | string, href: string | UIEventSource<string>, newTab: boolean = false) {
|
||||
super();
|
||||
const _embeddedShow = Translations.W(embeddedShow);
|
||||
|
||||
|
||||
const el = document.createElement("a")
|
||||
|
||||
if(typeof target === "string"){
|
||||
el.href = target
|
||||
if(typeof href === "string"){
|
||||
el.href = href
|
||||
}else{
|
||||
target.addCallbackAndRun(target => {
|
||||
el.target = target;
|
||||
href.addCallbackAndRun(href => {
|
||||
el.href = href;
|
||||
})
|
||||
}
|
||||
if (newTab) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue