评论区硬切换实现
This commit is contained in:
1 parent
ed914d2eec
commit
b8ef4d81a4
32 files changed
+946
-1008
No files matched your search
+21
-10
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Comment expand tools — legacy-style shortcode inserts ([code] [img=] quick).
|
||||
* Comment expand tools — legacy-style shortcode inserts ([code] [img=]).
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
@@ -39,6 +39,26 @@
|
||||
}
|
||||
|
||||
document.addEventListener('click', function (e) {
|
||||
var linkBtn = e.target && e.target.closest ? e.target.closest('.input-link-submit') : null;
|
||||
if (linkBtn) {
|
||||
e.preventDefault();
|
||||
var lbox = linkBtn.closest('.dropdown-link');
|
||||
var lta = lbox ? lbox.querySelector('textarea.link-textarea') : null;
|
||||
var url = lta ? (lta.value || '').trim() : '';
|
||||
if (!/^https?:\/\/\S+$/i.test(url)) {
|
||||
notyf('请输入有效链接地址', 'warning');
|
||||
return;
|
||||
}
|
||||
var ltext = lbox ? (lbox.querySelector('.link-text') || {}).value || '' : '';
|
||||
insertAtCursor(findTextarea(linkBtn), '[link=' + url + ']' + (ltext.trim() || url) + '[/link]');
|
||||
if (lta) lta.value = '';
|
||||
var lt = lbox ? lbox.querySelector('.link-text') : null;
|
||||
if (lt) lt.value = '';
|
||||
var lw = linkBtn.closest('span.dropup');
|
||||
if (lw) lw.classList.remove('open');
|
||||
return;
|
||||
}
|
||||
|
||||
var codeBtn = e.target && e.target.closest ? e.target.closest('.input-code-submit') : null;
|
||||
if (codeBtn) {
|
||||
e.preventDefault();
|
||||
@@ -96,15 +116,6 @@
|
||||
fileInput.click();
|
||||
return;
|
||||
}
|
||||
|
||||
var q = e.target && e.target.closest ? e.target.closest('.quick-reply-item') : null;
|
||||
if (q) {
|
||||
e.preventDefault();
|
||||
var phrase = q.getAttribute('data-text') || q.textContent || '';
|
||||
insertAtCursor(findTextarea(q), phrase);
|
||||
var qw = q.closest('span.dropup');
|
||||
if (qw) qw.classList.remove('open');
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', function (e) {
|
||||
|
||||
Reference in new issue
Block a user