forked from MapComplete/MapComplete
UX: fix #1873, allow SvelteUIElements to be a span
This commit is contained in:
parent
6812ab3890
commit
9163d57039
2 changed files with 9 additions and 3 deletions
|
@ -22,6 +22,7 @@ export default class SvelteUIElement<
|
|||
private readonly _props: Props
|
||||
private readonly _events: Events
|
||||
private readonly _slots: Slots
|
||||
private tag : "div" | "span" = "div"
|
||||
|
||||
constructor(svelteElement, props?: Props, events?: Events, slots?: Slots) {
|
||||
super()
|
||||
|
@ -31,8 +32,13 @@ export default class SvelteUIElement<
|
|||
this._slots = slots
|
||||
}
|
||||
|
||||
public setSpan(){
|
||||
this.tag = "span"
|
||||
return this
|
||||
}
|
||||
|
||||
protected InnerConstructElement(): HTMLElement {
|
||||
const el = document.createElement("div")
|
||||
const el = document.createElement(this.tag)
|
||||
new this._svelteComponent({
|
||||
target: el,
|
||||
props: this._props,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue