Merge remote-tracking branch 'origin/sortify' into HEAD

utilize canonical stringify function

Conflicts:
	www/_socket/main.js
pull/1/head
ansuz 9 years ago
commit fc77ef66b3

@ -28,6 +28,7 @@
"reconnectingWebsocket": "", "reconnectingWebsocket": "",
"diff-dom": "https://github.com/fiduswriter/diffDOM.git#6fdb82c8a4f2096c07c129797a313fe13769e094", "diff-dom": "https://github.com/fiduswriter/diffDOM.git#6fdb82c8a4f2096c07c129797a313fe13769e094",
"marked": "~0.3.5", "marked": "~0.3.5",
"rangy": "rangy-release#~1.3.0" "rangy": "rangy-release#~1.3.0",
"json.sortify": "~2.1.0"
} }
} }

@ -1,3 +1,4 @@
require.config({ paths: { 'json.sortify': '/bower_components/json.sortify/dist/JSON.sortify' } });
define([ define([
'/api/config?cb=' + Math.random().toString(16).substring(2), '/api/config?cb=' + Math.random().toString(16).substring(2),
'/common/messages.js', '/common/messages.js',
@ -9,15 +10,20 @@ define([
'/common/cursor.js', '/common/cursor.js',
'/common/json-ot.js', '/common/json-ot.js',
'/common/TypingTests.js', '/common/TypingTests.js',
'json.sortify',
'/bower_components/diff-dom/diffDOM.js', '/bower_components/diff-dom/diffDOM.js',
'/bower_components/jquery/dist/jquery.min.js', '/bower_components/jquery/dist/jquery.min.js',
'/customize/pad.js' '/customize/pad.js'
], function (Config, Messages, Crypto, realtimeInput, Hyperjson, Hyperscript, Toolbar, Cursor, JsonOT, TypingTest) { ], function (Config, Messages, Crypto, realtimeInput, Hyperjson, Hyperscript, Toolbar, Cursor, JsonOT, TypingTest, JSONSortify) {
var $ = window.jQuery; var $ = window.jQuery;
var ifrw = $('#pad-iframe')[0].contentWindow; var ifrw = $('#pad-iframe')[0].contentWindow;
var Ckeditor; // to be initialized later... var Ckeditor; // to be initialized later...
var DiffDom = window.diffDOM; var DiffDom = window.diffDOM;
var stringify = function (obj) {
return JSONSortify(obj);
};
window.Hyperjson = Hyperjson; window.Hyperjson = Hyperjson;
var hjsonToDom = function (H) { var hjsonToDom = function (H) {
@ -52,7 +58,7 @@ define([
}; };
var stringifyDOM = function (dom) { var stringifyDOM = function (dom) {
return JSON.stringify(Hyperjson.fromDOM(dom, isNotMagicLine, brFilter)); return stringify(Hyperjson.fromDOM(dom, isNotMagicLine, brFilter));
}; };
var andThen = function (Ckeditor) { var andThen = function (Ckeditor) {
@ -233,7 +239,6 @@ define([
applyHjson(shjson); applyHjson(shjson);
var shjson2 = stringifyDOM(inner); var shjson2 = stringifyDOM(inner);
if (shjson2 !== shjson) { if (shjson2 !== shjson) {
console.error("shjson2 !== shjson"); console.error("shjson2 !== shjson");
module.realtimeInput.patchText(shjson2); module.realtimeInput.patchText(shjson2);

Loading…
Cancel
Save