进行了一些小修复

This commit is contained in:
2026-08-26 19:51:31 +08:00
parent 02cbff1ddf
commit fbada8bd6a
20 changed files with 294 additions and 191 deletions
+35
View File
@@ -531,6 +531,39 @@
});
}
function bindCharacterCount(editor) {
var counter = null;
function getCounter() {
var container = editor.getContainer();
var statusbar = container && container.querySelector('.mce-statusbar .mce-container-body');
if (!statusbar) {
return null;
}
counter = counter || statusbar.querySelector('[data-submit-word-count]');
if (!counter) {
counter = document.createElement('span');
counter.className = 'mce-wordcount aksrt-submit-word-count';
counter.setAttribute('data-submit-word-count', '');
counter.setAttribute('aria-live', 'polite');
statusbar.appendChild(counter);
}
return counter;
}
function updateCount() {
var count = String((editor.getBody() && editor.getBody().textContent) || '')
.replace(/\s+/g, '').length;
var element = getCounter();
if (element) {
element.textContent = '字数:' + count;
}
}
editor.on('init SetContent input keyup change Undo Redo', updateCount);
}
function openCodeModal(editor) {
var selected = editor.dom.getParent(editor.selection.getNode(), 'pre.enlighter-pre');
var code = selected ? selected.querySelector('code') : null;
@@ -591,6 +624,8 @@
}
window.tinymce.PluginManager.add('aksrt_editor_tools', function (editor) {
bindCharacterCount(editor);
if (editorCfg.canUploadImage) {
editor.addButton('aksrt_image', {
text: '',