|
|
@ -299,6 +299,13 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var DD = new DiffDom(diffOptions);
|
|
|
|
var DD = new DiffDom(diffOptions);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var openLink = function (e) {
|
|
|
|
|
|
|
|
var el = e.currentTarget;
|
|
|
|
|
|
|
|
if (!el || el.nodeName !== 'A') { return; }
|
|
|
|
|
|
|
|
var href = el.getAttribute('href');
|
|
|
|
|
|
|
|
if (href) { window.open(href, '_blank'); }
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// apply patches, and try not to lose the cursor in the process!
|
|
|
|
// apply patches, and try not to lose the cursor in the process!
|
|
|
|
var applyHjson = function (shjson) {
|
|
|
|
var applyHjson = function (shjson) {
|
|
|
|
var userDocStateDom = hjsonToDom(JSON.parse(shjson));
|
|
|
|
var userDocStateDom = hjsonToDom(JSON.parse(shjson));
|
|
|
@ -308,6 +315,11 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var patch = (DD).diff(inner, userDocStateDom);
|
|
|
|
var patch = (DD).diff(inner, userDocStateDom);
|
|
|
|
(DD).apply(inner, patch);
|
|
|
|
(DD).apply(inner, patch);
|
|
|
|
|
|
|
|
if (readOnly) {
|
|
|
|
|
|
|
|
var $links = $(inner).find('a');
|
|
|
|
|
|
|
|
// off so that we don't end up with multiple identical handlers
|
|
|
|
|
|
|
|
$links.off('click', openLink).on('click', openLink);
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var stringifyDOM = module.stringifyDOM = function (dom) {
|
|
|
|
var stringifyDOM = module.stringifyDOM = function (dom) {
|
|
|
|