diff --git a/examples/09_synchronize_two_editors.html b/examples/09_synchronize_two_editors.html
index 091de74..1277d56 100644
--- a/examples/09_synchronize_two_editors.html
+++ b/examples/09_synchronize_two_editors.html
@@ -18,6 +18,10 @@
height: 500px;
margin-right: 24px;
}
+
+ code {
+ background: #e5e5e5;
+ }
@@ -25,7 +29,7 @@
Synchronize two editors
This example demonstrates how to keep two editors synchronized by listening for
- the onChange event.
+ the onPatch
event. Other related events are onChange
and onChangeText
.
@@ -42,14 +46,14 @@
}
var editor1 = jsoneditor(document.getElementById('jsoneditor1'), {
- onChange: function (patch, revert) {
+ onPatch: function (patch, revert) {
editor2.patch(patch)
}
})
editor1.set(json)
var editor2 = jsoneditor(document.getElementById('jsoneditor2'), {
- onChange: function (patch, revert) {
+ onPatch: function (patch, revert) {
editor1.patch(patch)
}
})
diff --git a/src/develop.html b/src/develop.html
index 7dcf870..a9ce00e 100644
--- a/src/develop.html
+++ b/src/develop.html
@@ -56,13 +56,20 @@
const container = document.getElementById('container')
const options = {
name: 'myObject',
- onChange: function (patch, revert) {
- console.log('onChange patch=', patch, ', revert=', revert)
+ onPatch: function (patch, revert) {
+ console.log('onPatch patch=', patch, ', revert=', revert)
window.patch = patch
window.revert = revert
},
- onChangeText: function () {
- console.log('onChangeText')
+ onPatchText: function (patch, revert) {
+ // FIXME: implement onPatchText
+ console.log('onPatchText patch=', patch, ', revert=', revert)
+ },
+ onChange: function (json) {
+ console.log('onChange json=', json)
+ },
+ onChangeText: function (text) {
+ console.log('onChangeText', text)
},
onChangeMode: function (mode, prevMode) {
console.log('switched mode from', prevMode, 'to', mode)