more testing and crap

This commit is contained in:
Caleb James DeLisle
2016-03-25 12:45:51 +01:00
parent 4b35a145e3
commit 420a7098a6
5 changed files with 68 additions and 44 deletions

View File

@@ -46,27 +46,28 @@ var attachTextarea = function(config) {
var content = {};
// FIXME this is only necessary because we need to be able to update the
// textarea. This is being deprecated, however. Instead
// textarea. This is being deprecated, however. Instead
var replaceText = function(newText) {
content = newText;
};
// *** remote -> local changes
ctx.onRemove(function(pos, length) {
replaceText(ctx.getUserDoc());
});
ctx.onInsert(function(pos, text) {
ctx.onPatch(function(pos, length) {
replaceText(ctx.getUserDoc());
});
// propogate()
return function (newContent) {
if (newContent !== content) {
applyChange(ctx, ctx.getUserDoc(), newContent);
if (ctx.getUserDoc() !== newContent) {
console.log("Expected that: `ctx.getUserDoc() === newContent`!");
}
console.log("1: " + ctx.Sha.hex_sha256(ctx.getUserDoc()));
return true;
}
console.log("no change");
return false;
};
};