summaryrefslogtreecommitdiffstats
path: root/src/modules/Fridge.ts
diff options
context:
space:
mode:
authorMaksymilian Jopek <maks@jopek.eu>2021-10-26 16:49:09 +0200
committerMaksymilian Jopek <maks@jopek.eu>2021-10-26 16:49:09 +0200
commitdbb66972ebd987f60e10939bfb4493f87bbc73c3 (patch)
treef951d36871d12089775e79a57c73855c21a2e72e /src/modules/Fridge.ts
parent55d0e202677253ecf893bd52649871f10b52d3de (diff)
downloadisiqandisi-dbb66972ebd987f60e10939bfb4493f87bbc73c3.tar.gz
isiqandisi-dbb66972ebd987f60e10939bfb4493f87bbc73c3.tar.zst
isiqandisi-dbb66972ebd987f60e10939bfb4493f87bbc73c3.zip
Quick commit with sort-of working WYSiWYG and moving chit
Diffstat (limited to 'src/modules/Fridge.ts')
-rw-r--r--src/modules/Fridge.ts16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/modules/Fridge.ts b/src/modules/Fridge.ts
index 79da4dc..c12bc53 100644
--- a/src/modules/Fridge.ts
+++ b/src/modules/Fridge.ts
@@ -1,24 +1,34 @@
import Chit, { ChitFromDb } from "Modules/Chit"
+import WYSiWYG from "./WYSiWYG";
export default class Fridge {
#chits: Chit[] = [];
+ //@ts-expect-error
+ #wysiwyg: WYSiWYG;
- constructor() {
+ constructor(wysiwyg: WYSiWYG) {
const f = sessionStorage.fridge;
if (f === null) {
location.href = "/"
return;
}
+
const cs = JSON.parse(f) as ChitFromDb[];
for (const c of cs) {
- this.#chits.push(new Chit(this, c))
+ this.#chits.push(new Chit(this, wysiwyg, c));
}
+
+
+ this.#wysiwyg = wysiwyg;
}
setChitZIAuto() {
for (const c of this.#chits)
c.div.style.zIndex = "auto"
}
+ removeChit(ch: Chit) {
+ this.#chits = this.#chits.filter(c => c !== ch);
+ }
// moveChit(coord: { top: number, left: number }) {
// for (const c of this.#chits) {
// if (c.isMoving) {
@@ -35,7 +45,7 @@ export default class Fridge {
// }
createChit() {
- this.#chits.push(new Chit(this))
+ this.#chits.push(new Chit(this, this.#wysiwyg))
}
get chits(): Chit[] {