Update
This commit is contained in:
52
public/admin/js/manual-wordcount-fix.js
Normal file
52
public/admin/js/manual-wordcount-fix.js
Normal file
@@ -0,0 +1,52 @@
|
||||
// Manual fix for TinyMCE word count in Slovenian
|
||||
// Run this in browser console if automatic fixes don't work
|
||||
|
||||
function fixTinyMCEWordCount() {
|
||||
// Find all word count elements
|
||||
const wordCountElements = document.querySelectorAll('.tox-statusbar__wordcount, .mce-path-item, .mce-wordcount');
|
||||
|
||||
wordCountElements.forEach(function(element) {
|
||||
if (element.textContent) {
|
||||
let text = element.textContent;
|
||||
|
||||
// Replace various English word count patterns with Slovenian
|
||||
text = text.replace(/(\d+)\s+words?/gi, '$1 besed');
|
||||
text = text.replace(/Words?:\s*(\d+)/gi, 'Besed: $1');
|
||||
text = text.replace(/Word count/gi, 'Število besed');
|
||||
text = text.replace(/0 words/gi, '0 besed');
|
||||
text = text.replace(/1 word/gi, '1 beseda');
|
||||
text = text.replace(/(\d+) words/gi, '$1 besed');
|
||||
|
||||
if (text !== element.textContent) {
|
||||
element.textContent = text;
|
||||
console.log('Fixed word count text:', element.textContent);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Also check for any elements with "words" in their content
|
||||
const allElements = document.querySelectorAll('*');
|
||||
allElements.forEach(function(element) {
|
||||
if (element.childNodes) {
|
||||
element.childNodes.forEach(function(node) {
|
||||
if (node.nodeType === Node.TEXT_NODE && node.textContent) {
|
||||
let text = node.textContent;
|
||||
if (/\d+\s+words?/i.test(text)) {
|
||||
text = text.replace(/(\d+)\s+words?/gi, '$1 besed');
|
||||
text = text.replace(/Words?:\s*(\d+)/gi, 'Besed: $1');
|
||||
node.textContent = text;
|
||||
console.log('Fixed text node:', text);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Run the fix
|
||||
fixTinyMCEWordCount();
|
||||
|
||||
// Also set up an interval to fix it periodically
|
||||
setInterval(fixTinyMCEWordCount, 1000);
|
||||
|
||||
console.log('TinyMCE word count fix applied. Running every second...');
|
||||
Reference in New Issue
Block a user