本站使用的积分插件是哪个啊?求指明求推荐
Tillreetree 兔兔积分
Tillreetree https://www.xiunobbs.cn/thread-5617.htm
zackma 这个版本v1.21.2好像插入付费内容没反应
Tillreetree 可能是整个xiuno界的老大难问题了,每个人用不一样的编辑器,插件却只能对其中一种做适配
zackma 我找了本论坛里关于适配编辑器的教程,有些编辑器适配也不成功。比如,你那个大白TinyMCE编辑器 v3.0.0和tiny编辑器可以适配成功,本论坛的 修罗中国TinyMCE编辑器(本地图片版) v1. ...
那这就说来话长了。你可以看一眼我怎么实现的。
function insertSticker(pack, name) { const shortcode = `[em_${pack}:${name}]`; // 1. 尝试获取文本输入框 const textInput = $('textarea[name="message"]'); // 2. 根据不同的编辑器类型进行处理 if (textInput.length > 0) { // 原生文本区域处理 if (typeof textInput.insertAtCaret === 'function') { textInput.insertAtCaret(shortcode); } else { const start = textInput[0].selectionStart; const end = textInput[0].selectionEnd; const value = textInput.val(); textInput.val(value.substring(0, start) + shortcode + value.substring(end)); textInput[0].selectionStart = textInput[0].selectionEnd = start + shortcode.length; } textInput.trigger('focus').trigger('input'); } else if (typeof um !== 'undefined' && um) { // UMEditor 编辑器处理 um.execCommand('insertHtml', shortcode); } else if (typeof tinymce !== 'undefined' && tinymce.activeEditor) { // TinyMCE 编辑器处理 tinymce.activeEditor.insertContent(shortcode); } else { // 通用处理方案 const activeElement = document.activeElement; if (activeElement && (activeElement.tagName === 'TEXTAREA' || activeElement.isContentEditable)) { if (activeElement.isContentEditable) { document.execCommand('insertText', false, shortcode); } else { const start = activeElement.selectionStart; const end = activeElement.selectionEnd; activeElement.value = activeElement.value.substring(0, start) + shortcode + activeElement.value.substring(end); activeElement.selectionStart = activeElement.selectionEnd = start + shortcode.length; } } else { // 最后备选方案 alert(`表情短代码已复制到剪贴板:${shortcode}`); navigator.clipboard?.writeText(shortcode).catch(() => { prompt('请手动复制表情短代码:', shortcode); }); } } }
Tillreetree 现在要开发个什么插件,得考虑tinymce 5、tinymce 6、umeditor、纯粹的文本框作为后备方案;不仅累还得背负指责“为什么不好使!!!”
Tillreetree 那这就说来话长了。你可以看一眼我怎么实现的。 function insertSticker(pack, name) { const shortcode = `[em_${pack}:${n ...