进行了一些小修复
This commit is contained in:
1 parent
b80ac46147
commit
5121b33ad5
8 files changed
+663
-86
No files matched your search
@@ -32,21 +32,6 @@
|
||||
return ta ? ta.value : '';
|
||||
}
|
||||
|
||||
function insertEditorContent(html) {
|
||||
if (window.tinymce) {
|
||||
var ed = window.tinymce.get('post_content');
|
||||
if (ed) {
|
||||
ed.focus();
|
||||
ed.insertContent(html);
|
||||
return;
|
||||
}
|
||||
}
|
||||
var ta = qs('#post_content') || qs('[name="post_content"]');
|
||||
if (ta) {
|
||||
ta.value += html;
|
||||
}
|
||||
}
|
||||
|
||||
function serializeForm(form) {
|
||||
var data = {};
|
||||
var fd = new FormData(form);
|
||||
@@ -106,7 +91,6 @@
|
||||
this.bindDraftDelete();
|
||||
this.bindFeatured();
|
||||
this.bindPay();
|
||||
this.bindShortcodes();
|
||||
this.bindLeaveWarning();
|
||||
this.bindAi();
|
||||
this.bindTagActive();
|
||||
@@ -659,41 +643,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
bindShortcodes: function () {
|
||||
document.addEventListener('click', function (e) {
|
||||
var btn = e.target.closest('[data-insert-shortcode]');
|
||||
if (!btn) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
if (btn.hasAttribute('data-insert-upload-image')) {
|
||||
var toastId = 'aksrt-front-submit-editor-image-toast';
|
||||
App.pickUpload('image', 'image/*').then(function (file) {
|
||||
if (!file) return null;
|
||||
notyf(i18n.uploading || '正在上传正文图片…', 'load', '', toastId);
|
||||
return App.uploadFile('image', file);
|
||||
}).then(function (file) {
|
||||
if (!file || !file.url) return;
|
||||
insertEditorContent('<img src="' + file.url.replace(/"/g, '"') + '" alt="">');
|
||||
notyf(i18n.uploaded || '正文图片上传成功', 'success', 5, toastId);
|
||||
}).catch(function (error) {
|
||||
notyf(error.message || i18n.error || '正文图片上传失败', 'danger', 5, toastId);
|
||||
});
|
||||
return;
|
||||
}
|
||||
var type = btn.getAttribute('data-insert-shortcode');
|
||||
if (type === 'hide') {
|
||||
insertEditorContent('[hidecontent type="login"]' + (i18n.hidePlaceholder || '隐藏内容') + '[/hidecontent]');
|
||||
} else if (type === 'payshow') {
|
||||
insertEditorContent('[hidecontent type="payshow"]' + (i18n.payPlaceholder || '付费可见内容') + '[/hidecontent]');
|
||||
} else if (type === 'reply') {
|
||||
insertEditorContent('[hidecontent type="reply"]' + (i18n.replyPlaceholder || '回复后可见') + '[/hidecontent]');
|
||||
} else if (type === 'vip') {
|
||||
insertEditorContent('[vip]' + (i18n.vipPlaceholder || 'VIP 可见内容') + '[/vip]');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
bindAi: function () {
|
||||
var ai = cfg.ai || {};
|
||||
if (!ai.available) {
|
||||
|
||||
Reference in new issue
Block a user