more xml
This commit is contained in:
@@ -122,7 +122,7 @@
|
||||
return initialized_him = true;
|
||||
}
|
||||
} else {
|
||||
throw new Error("Can't parse this operation " + data);
|
||||
throw new Error("Can't parse this operation: " + data);
|
||||
}
|
||||
};
|
||||
})(this));
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -51,8 +51,9 @@
|
||||
return this.getSharedObject().toJson();
|
||||
};
|
||||
|
||||
JsonFramework.prototype.val = function(name, content, mutable) {
|
||||
return this.getSharedObject().val(name, content, mutable);
|
||||
JsonFramework.prototype.val = function() {
|
||||
var _ref;
|
||||
return (_ref = this.getSharedObject()).val.apply(_ref, arguments);
|
||||
};
|
||||
|
||||
JsonFramework.prototype.on = function() {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -142,7 +142,7 @@
|
||||
HB.addOperation(json).execute();
|
||||
this.replace_manager.replace(json);
|
||||
return this;
|
||||
} else if ((name != null) && ((content != null) || content === null)) {
|
||||
} else if ((name != null) && arguments.length > 1) {
|
||||
if (mutable != null) {
|
||||
if (mutable === true || mutable === 'mutable') {
|
||||
mutable = true;
|
||||
@@ -154,7 +154,7 @@
|
||||
}
|
||||
if (typeof content === 'function') {
|
||||
return this;
|
||||
} else if (content === null || (((!mutable) || typeof content === 'number') && content.constructor !== Object)) {
|
||||
} else if ((content == null) || (((!mutable) || typeof content === 'number') && content.constructor !== Object)) {
|
||||
obj = HB.addOperation(new types.ImmutableObject(void 0, content)).execute();
|
||||
return JsonType.__super__.val.call(this, name, obj);
|
||||
} else {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -25,7 +25,11 @@
|
||||
__extends(TextInsert, _super);
|
||||
|
||||
function TextInsert(content, uid, prev, next, origin) {
|
||||
this.content = content;
|
||||
if ((content != null ? content.creator : void 0) != null) {
|
||||
this.saveOperation('content', content);
|
||||
} else {
|
||||
this.content = content;
|
||||
}
|
||||
if (!((prev != null) && (next != null))) {
|
||||
throw new Error("You must define prev, and next for TextInsert-types!");
|
||||
}
|
||||
@@ -56,14 +60,18 @@
|
||||
};
|
||||
|
||||
TextInsert.prototype._encode = function() {
|
||||
var json;
|
||||
var json, _ref;
|
||||
json = {
|
||||
'type': "TextInsert",
|
||||
'content': this.content,
|
||||
'uid': this.getUid(),
|
||||
'prev': this.prev_cl.getUid(),
|
||||
'next': this.next_cl.getUid()
|
||||
};
|
||||
if (((_ref = this.content) != null ? _ref.getUid : void 0) != null) {
|
||||
json['content'] = this.content.getUid();
|
||||
} else {
|
||||
json['content'] = this.content;
|
||||
}
|
||||
if (this.origin !== this.prev_cl) {
|
||||
json["origin"] = this.origin.getUid();
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,21 +1,27 @@
|
||||
(function() {
|
||||
var json_types_uninitialized,
|
||||
var json_types_uninitialized, proxy_token,
|
||||
__hasProp = {}.hasOwnProperty,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
||||
|
||||
json_types_uninitialized = require("./JsonTypes");
|
||||
|
||||
proxy_token = false;
|
||||
|
||||
if (typeof Element !== "undefined" && Element !== null) {
|
||||
Element.prototype._proxy = function(f_name, f) {
|
||||
var old_f;
|
||||
old_f = this[f_name];
|
||||
if (old_f != null) {
|
||||
return this[f_name] = function() {
|
||||
f.apply(this, arguments);
|
||||
return old_f.apply(this, arguments);
|
||||
if (!proxy_token) {
|
||||
proxy_token = true;
|
||||
old_f.apply(this, arguments);
|
||||
f.apply(this, arguments);
|
||||
return proxy_token = false;
|
||||
} else {
|
||||
return old_f.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return this[f_name] = f;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -95,8 +101,10 @@
|
||||
};
|
||||
|
||||
XmlType.prototype.setXmlProxy = function() {
|
||||
var insertBefore, that;
|
||||
this.xml._yatta = this;
|
||||
return this.xml._proxy('insertBefore', function(insertedNode, adjacentNode) {
|
||||
that = this;
|
||||
insertBefore = function(insertedNode, adjacentNode) {
|
||||
var element, next, prev;
|
||||
next = adjacentNode != null ? adjacentNode._yatta : void 0;
|
||||
prev = null;
|
||||
@@ -105,10 +113,16 @@
|
||||
} else {
|
||||
prev = this._yatta.elements.end.prev_cl;
|
||||
}
|
||||
element = new XmlType(void 0, void 0, void 0, void 0);
|
||||
element = new XmlType(void 0, void 0, void 0, void 0, insertedNode);
|
||||
HB.addOperation(element).execute();
|
||||
return this.elements.insertAfter(prev, element);
|
||||
return that.elements.insertAfter(prev, element);
|
||||
};
|
||||
this.xml._proxy('insertBefore', insertBefore);
|
||||
this.xml._proxy('appendChild', insertBefore);
|
||||
this.xml._proxy('removeAttribute', function(name) {
|
||||
return that.attributes.val(name, void 0);
|
||||
});
|
||||
return this.xml._proxy('removeChild', function(node) {});
|
||||
};
|
||||
|
||||
XmlType.prototype.val = function(enforce) {
|
||||
@@ -122,9 +136,11 @@
|
||||
attr = this.attributes.val();
|
||||
for (attr_name in attr) {
|
||||
value = attr[attr_name];
|
||||
a = document.createAttribute(attr_name);
|
||||
a.value = value;
|
||||
this.xml.setAttributeNode(a);
|
||||
if (value != null) {
|
||||
a = document.createAttribute(attr_name);
|
||||
a.value = value;
|
||||
this.xml.setAttributeNode(a);
|
||||
}
|
||||
}
|
||||
e = this.elements.beginning.next_cl;
|
||||
while (e.type !== "Delimiter") {
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user