From 51adf4920d475c1d0a10705522d35e44be91a618 Mon Sep 17 00:00:00 2001 From: movsb Date: Sun, 15 Dec 2024 22:22:29 +0800 Subject: [PATCH] remove tinymde for comments --- theme/blog/statics/scripts/comment.js | 44 +++------------------------ theme/blog/styles/comment.scss | 4 +-- theme/blog/templates/tweet.html | 2 -- 3 files changed, 6 insertions(+), 44 deletions(-) diff --git a/theme/blog/statics/scripts/comment.js b/theme/blog/statics/scripts/comment.js index 8e3e5001..b6f3efe3 100644 --- a/theme/blog/statics/scripts/comment.js +++ b/theme/blog/statics/scripts/comment.js @@ -458,9 +458,6 @@ class Comment { this.being_replied = 0; // 正在回复的评论。 this.being_edited = 0; // 正在被编辑的 ID,仅编辑时有效,> 0 时有效 - this.tiny_editor = undefined; - - this.api = new CommentAPI(this.post_id); // 预览操作对象。 @@ -504,9 +501,6 @@ class Comment { }); this.preload(); - - // 问题可能比较多,先不公开。 - // this.initEditor(); } preload() { const loaded = true; @@ -533,41 +527,15 @@ class Comment { } } - initEditor() { - class Editor { - constructor(container, textarea) { - // console.log(`Editor:`, container, textarea); - this.backend = new TinyMDE.Editor({ - element: container, // TODO: BUG! - textarea: textarea, - }); - this.element = document.querySelector('#comment-form .TinyMDE'); - } - } - - let textarea = document.querySelector('#comment-content'); - let mde = new Editor( - document.querySelector('.content-area'), - textarea, - ); - this.tiny_editor = mde; - } - setContent(value) { - if (this.tiny_editor) { - this.tiny_editor.setContent(value); - } else { - let content = document.querySelector('#comment-content'); - content.value = value; - } + let content = document.querySelector('#comment-content'); + content.value = value; } clearContent() { this.setContent(""); } showContent(yes) { - let elem = this.tiny_editor - ? this.tiny_editor.element - : document.querySelector('#comment-content'); + let elem = document.querySelector('#comment-content'); elem.style.display = yes ? 'block' : 'none'; if (yes) elem.focus(); } @@ -759,11 +727,7 @@ class Comment { }); } focus() { - if (this.tiny_editor) { - - } else { - document.querySelector('#comment-content').focus(); - } + document.querySelector('#comment-content').focus(); } move_to_center() { let div = document.querySelector('#comment-form-div'); diff --git a/theme/blog/styles/comment.scss b/theme/blog/styles/comment.scss index dd6f1b62..3218f3fc 100644 --- a/theme/blog/styles/comment.scss +++ b/theme/blog/styles/comment.scss @@ -248,7 +248,7 @@ body.signed-in { min-width: 50px; min-height: 100px; overflow: auto; - .overlay, .TinyMDE { + .overlay { width: 100%; height: 100%; margin: 0px; @@ -261,7 +261,7 @@ body.signed-in { textarea { line-height: inherit; } - #comment-preview, .TinyMDE { + #comment-preview { padding: var(--textarea-padding); border: 1px solid var(--border-color); border-radius: var(--border-radius); diff --git a/theme/blog/templates/tweet.html b/theme/blog/templates/tweet.html index d3141514..a5322757 100644 --- a/theme/blog/templates/tweet.html +++ b/theme/blog/templates/tweet.html @@ -7,8 +7,6 @@ {{ $.Title }} - {{ apply_site_theme_customs }}