Open TuningGuide opened 8 years ago
Hmm, it also is problematic with the localautosave plugin as it also call the getContent function obviously.
I have rewritten the cleanup function so it operates on an unhinged dom element:
, cleanup = function(e) {
var html = editor.getBody().innerHTML;
var div = document.createElement('div');
div.innerHTML = html;
var emptyNode = div.querySelectorAll('#MathJax_Hidden,#MathJax_Message,#MathJax_Font_Test')
, nodes = div.querySelectorAll('span.asciimath4-root-node');
tinymce.each(emptyNode, function(node) {
var parent = node.parentNode;
// already at highlevel dom element
if(parent.parentNode == null) {
parent.removeChild(node);
}
else {
parent.parentNode.removeChild(parent);
}
});
tinymce.each(nodes, function(node) {
node.outerHTML = '`' + node.getAttribute(attrData) + '`';
});
if (e.format === 'text') {
e.content = div.innerText || div.textContent;
} else {
e.content = div.innerHTML;
}
return e.content;
}
Hi, i use the wordcount and asciimath plugins (among others).
The wordcount plugin triggers the editor.on('GetContent', cleanup). The cleanup method resets the cursor to the beginning of the editor.
Do you have any idea how a fix could look like? (Except disabling wordcount or asciimath ;)