From 27075885e95bd0efc062920685e04287feb4b556 Mon Sep 17 00:00:00 2001 From: Maksymilian Jopek Date: Sun, 31 Oct 2021 14:31:29 +0100 Subject: Almost the end --- src/modules/WYSiWYG.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/modules/WYSiWYG.ts') diff --git a/src/modules/WYSiWYG.ts b/src/modules/WYSiWYG.ts index 1161cde..39b627e 100644 --- a/src/modules/WYSiWYG.ts +++ b/src/modules/WYSiWYG.ts @@ -8,6 +8,7 @@ export default class WYSiWYG { #id = 'tinymce' #bSave: HTMLButtonElement #bCancel: HTMLButtonElement + #whoClicked?: Chit; constructor() { tinymce.init({ @@ -29,7 +30,8 @@ export default class WYSiWYG { this.#bCancel.id = "cancel" tf.append(this.#bSave, this.#bCancel) - this.#bSave.onclick = () => this.setContent(this.content + "asd"); + // this.#bSave.onclick = () => this.setContent(this.content + "asd"); + this.#bSave.onclick = () => this.hide(); this.#bCancel.onclick = () => this.hide(); this.hide() } @@ -38,11 +40,13 @@ export default class WYSiWYG { return tinymce.get(this.#id); } show(c: Chit) { - console.log(c.txt) this.#tmce.show(); this.setContent(c.txt) + this.#whoClicked = c; } hide() { + if (this.#whoClicked != null) + this.#whoClicked.txt = this.content; this.#tmce.hide(); } setContent(c: string) { -- cgit v1.3.1