aboutsummaryrefslogtreecommitdiff
path: root/static/components/vevent-block.ts
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-12-13 02:26:36 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-12-13 02:26:51 +0100
commit3ddbd37ade2e03e4fc3a6f5ba52234bc286fded3 (patch)
treea5559af37dfacc447f35289ebda31d1b36973e1b /static/components/vevent-block.ts
parentMerge draggable into popup-element. (diff)
downloadcalp-3ddbd37ade2e03e4fc3a6f5ba52234bc286fded3.tar.gz
calp-3ddbd37ade2e03e4fc3a6f5ba52234bc286fded3.tar.xz
Made VEventComponent template optional.
Diffstat (limited to 'static/components/vevent-block.ts')
-rw-r--r--static/components/vevent-block.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/static/components/vevent-block.ts b/static/components/vevent-block.ts
index 95c72592..8cf61d30 100644
--- a/static/components/vevent-block.ts
+++ b/static/components/vevent-block.ts
@@ -13,6 +13,10 @@ class ComponentBlock extends ComponentVEvent {
constructor(uid?: string) {
super(uid);
+ if (!this.template) {
+ throw 'vevent-block template required';
+ }
+
this.addEventListener('click', () => {
let uid = this.uid
/* TODO is it better to find the popup through a query selector, or
@@ -24,7 +28,7 @@ class ComponentBlock extends ComponentVEvent {
}
redraw(data: VEvent) {
- let body = (this.template.content.cloneNode(true) as DocumentFragment).firstElementChild!;
+ let body = (this.template!.content.cloneNode(true) as DocumentFragment).firstElementChild!;
for (let el of body.querySelectorAll('[data-property]')) {
if (!(el instanceof HTMLElement)) continue;