|
|
@ -44,6 +44,16 @@ define([
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* catch `type="_moz"` before it goes over the wire */
|
|
|
|
|
|
|
|
var brFilter = function (hj) {
|
|
|
|
|
|
|
|
if (hj[1].type === '_moz') { hj[1].type = undefined; }
|
|
|
|
|
|
|
|
return hj;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var stringifyDOM = function (dom) {
|
|
|
|
|
|
|
|
return JSON.stringify(Hyperjson.fromDOM(dom, isNotMagicLine, brFilter));
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var andThen = function (Ckeditor) {
|
|
|
|
var andThen = function (Ckeditor) {
|
|
|
|
/* This is turned off because we prefer that the channel name
|
|
|
|
/* This is turned off because we prefer that the channel name
|
|
|
|
be chosen by the server, not generated by the client.
|
|
|
|
be chosen by the server, not generated by the client.
|
|
|
@ -189,7 +199,7 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var realtimeOptions = {
|
|
|
|
var realtimeOptions = {
|
|
|
|
// provide initialstate...
|
|
|
|
// provide initialstate...
|
|
|
|
initialState: JSON.stringify(Hyperjson.fromDOM(inner, isNotMagicLine)),
|
|
|
|
initialState: stringifyDOM(inner) || '{}',
|
|
|
|
|
|
|
|
|
|
|
|
// the websocket URL
|
|
|
|
// the websocket URL
|
|
|
|
websocketURL: Config.websocketURL,
|
|
|
|
websocketURL: Config.websocketURL,
|
|
|
@ -241,8 +251,7 @@ define([
|
|
|
|
// Build a new stringified Chainpad hyperjson without metadata to compare with the one build from the dom
|
|
|
|
// Build a new stringified Chainpad hyperjson without metadata to compare with the one build from the dom
|
|
|
|
shjson = JSON.stringify(hjson);
|
|
|
|
shjson = JSON.stringify(hjson);
|
|
|
|
|
|
|
|
|
|
|
|
var hjson2 = Hyperjson.fromDOM(inner);
|
|
|
|
var shjson2 = stringifyDOM(inner);
|
|
|
|
var shjson2 = JSON.stringify(hjson2);
|
|
|
|
|
|
|
|
if (shjson2 !== shjson) {
|
|
|
|
if (shjson2 !== shjson) {
|
|
|
|
console.error("shjson2 !== shjson");
|
|
|
|
console.error("shjson2 !== shjson");
|
|
|
|
module.realtimeInput.patchText(shjson2);
|
|
|
|
module.realtimeInput.patchText(shjson2);
|
|
|
@ -283,12 +292,6 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var rti = module.realtimeInput = realtimeInput.start(realtimeOptions);
|
|
|
|
var rti = module.realtimeInput = realtimeInput.start(realtimeOptions);
|
|
|
|
|
|
|
|
|
|
|
|
/* catch `type="_moz"` before it goes over the wire */
|
|
|
|
|
|
|
|
var brFilter = function (hj) {
|
|
|
|
|
|
|
|
if (hj[1].type === '_moz') { hj[1].type = undefined; }
|
|
|
|
|
|
|
|
return hj;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* It's incredibly important that you assign 'rti.onLocal'
|
|
|
|
/* It's incredibly important that you assign 'rti.onLocal'
|
|
|
|
It's used inside of realtimeInput to make sure that all changes
|
|
|
|
It's used inside of realtimeInput to make sure that all changes
|
|
|
|
make it into chainpad.
|
|
|
|
make it into chainpad.
|
|
|
|