I am trying to retrieve both the original (may be modified as I am allowing it) as well as the data I am comparing to (which might also be modified).
The documentation doesn't explain how to do it, there is references to origLeft and origRight, but they seem to not work properly - one is NULL (left) and the other doesn't appear to contain the modified data.
Here is the code I am using:
<div id=editor></div>
<script>
var original = 'Original text';
var compareTo = 'Modified text';
hilight= true;
var target = document.getElementById("editor");
dv = CodeMirror.MergeView(target, {
value: original ,
origLeft: null,
orig: compareTo ,
lineNumbers: true,
mode: "text/html",
highlightDifferences: hilight,
lineWrapping : true,
});
</script>
I tried doing dv.getValue(), dv.leftOriginal(), dv.rightOriginal(), etc. no luck
Your help is appreciated
I think dv.rightOriginal().getValue() and dv.editor().getValue() (for the edited content) are what you are looking for. (These methods, leftOriginal, rightOriginal, and editor, return CodeMirror instances.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With