From ec9f95e5929ad7fd86909002b851e3fa71d2a46b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 15 Nov 2021 01:32:29 +0100 Subject: Fix calendar for popup. --- static/components/popup-element.ts | 9 ++++++--- static/event-creator.ts | 2 ++ static/script.ts | 6 ++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/static/components/popup-element.ts b/static/components/popup-element.ts index bad7476a..2f019f4d 100644 --- a/static/components/popup-element.ts +++ b/static/components/popup-element.ts @@ -4,6 +4,7 @@ import { gensym } from '../lib' import { VEvent } from '../vevent' import { bind_popup_control } from '../dragable' import { close_popup, event_from_popup } from '../popup' +import { vcal_objects } from '../globals' import { ComponentVEvent } from './vevent' import { TabElement } from './tab-element' @@ -23,12 +24,14 @@ class PopupElement extends ComponentVEvent { this.tabgroup_id = gensym(); this.tabcount = 0 + + let obj = vcal_objects.get(this.uid); + if (obj && obj.calendar) { + this.dataset.calendar = obj.calendar; + } } redraw(data: VEvent) { - // console.warn('IMPLEMENT ME'); - - console.log('popup', data.calendar); if (data.calendar) { this.dataset.calendar = data.calendar; } diff --git a/static/event-creator.ts b/static/event-creator.ts index cf3468ce..74ba4235 100644 --- a/static/event-creator.ts +++ b/static/event-creator.ts @@ -67,9 +67,11 @@ class EventCreator { that.ev = new VEvent(); that.ev.setProperty('summary', 'Created Event'); that.ev.setProperty('uid', uuid()) + that.ev.calendar = btoa('Calendar'); // let ev_block = document.createElement('vevent-block') as ComponentBlock; let ev_block = new ComponentBlock(that.ev.getProperty('uid')); + ev_block.classList.add('generated'); that.event = ev_block; that.ev.register(ev_block); diff --git a/static/script.ts b/static/script.ts index 490e8ba6..2f418918 100644 --- a/static/script.ts +++ b/static/script.ts @@ -42,6 +42,12 @@ window.addEventListener('load', function() { initialize_components(); + /* A full redraw here is WAY to slow */ + // for (let [_, obj] of vcal_objects) { + // for (let registered of obj.registered) { + // registered.redraw(obj); + // } + // } -- cgit v1.2.3