Hi, I am writing a plugin to sync the content across block. The content on the viewer side is not updated as editor side. For example, I edit the last "test2" block to test12345
, the content of another 2 "test2" blocks will be changed to test12345
. But the content on the viewer side is not updated until I make another change. It is like one step behind. Is it a known bug? How can I resolve it?
<label for="test2"></label>test1234<label>
<label for="test2"></label>test1234<label>
<label for="test1"></label>end
newline
<label>
<label for="test2"></label>test1234<label>
CodeMirror.defineExtension("updateContent", function (regex: RegExp, replace_text: string) {
let cm = this;
let doc = cm.getDoc();
console.log(doc);
cm.operation(function () {
var cursor = cm.getCursor();
var note_content = doc.getValue();
var new_note_content = note_content.replace(regex, replace_text);
doc.setValue(new_note_content);
cm.setCursor(cursor);
cm.refresh()
})
});
Joplin 2.8.8 (prod, win32)
Client ID: 18f3292857b948518bbaafd25b4218b0
Sync Version: 3
Profile Version: 41
Keychain Supported: Yes
Revision: c2a6a13