import unused functions from /p/, to be integrated later

pull/1/head
ansuz 9 years ago
parent 626ecaffcd
commit 32d1807350

@ -47,7 +47,7 @@ define([
var isNotMagicLine = function (el) { var isNotMagicLine = function (el) {
// factor as: // factor as:
// return !(el.tagName === 'SPAN' && el.contentEditable === 'false'); // return !(el.tagName === 'SPAN' && el.contentEditable === 'false');
var filter = (el.tagName === 'SPAN' && el.contentEditable === 'false'); var filter = (el.tagName === 'SPAN' && el.getAttribute('contentEditable') === 'false');
if (filter) { if (filter) {
console.log("[hyperjson.serializer] prevented an element" + console.log("[hyperjson.serializer] prevented an element" +
"from being serialized:", el); "from being serialized:", el);
@ -62,6 +62,20 @@ define([
return hj; return hj;
}; };
/* TODO integrate into flow to prevent browser fights over style */
var setStyle = function (elem, newStyleAttr) {
elem.setAttribute("data-chainpad-origstyle", newStyleAttr);
elem.setAttribute("style", newStyleAttr);
elem.setAttribute("data-chainpad-styleclone", elem.getAttribute("style"));
};
/* TODO integrate into flow to prevent browser fights over style */
var getStyle = function (elem) {
var st = elem.getAttribute("style");
if (elem.getAttribute("data-chainpad-styleclone") !== st) { return st; }
return elem.getAttribute("data-chainpad-origstyle");
};
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.
@ -225,6 +239,9 @@ define([
// 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));
// we *might* be able to remove this now
// changes to hyperscript fixed this bug *maybe* --ansuz
userDocStateDom.setAttribute("contenteditable", "true"); // lol wtf userDocStateDom.setAttribute("contenteditable", "true"); // lol wtf
var patch = (DD).diff(inner, userDocStateDom); var patch = (DD).diff(inner, userDocStateDom);
(DD).apply(inner, patch); (DD).apply(inner, patch);

Loading…
Cancel
Save