Skip to content

Commit

Permalink
remove tinymde for comments
Browse files Browse the repository at this point in the history
  • Loading branch information
movsb committed Dec 15, 2024
1 parent 2fb8056 commit 51adf49
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 44 deletions.
44 changes: 4 additions & 40 deletions theme/blog/statics/scripts/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

// 预览操作对象。
Expand Down Expand Up @@ -504,9 +501,6 @@ class Comment {
});

this.preload();

// 问题可能比较多,先不公开。
// this.initEditor();
}
preload() {
const loaded = true;
Expand All @@ -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();
}
Expand Down Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions theme/blog/styles/comment.scss
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ body.signed-in {
min-width: 50px;
min-height: 100px;
overflow: auto;
.overlay, .TinyMDE {
.overlay {
width: 100%;
height: 100%;
margin: 0px;
Expand All @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions theme/blog/templates/tweet.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
<title>{{ $.Title }}</title>
<link rel="stylesheet" type="text/css" href="/style.css" />
<link rel="stylesheet" type="text/css" href="/v3/dynamic/style" />
<!-- <script src="/admin/tinymde.js"></script>
<link rel="stylesheet" type="text/css" href="/admin/tinymde.css" /> -->
{{ apply_site_theme_customs }}
<script src="/scripts/header.js"></script>
<script src="/v3/dynamic/script"></script>
Expand Down

0 comments on commit 51adf49

Please sign in to comment.