fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
smartxml: support for setting data on text nodes
[fnpeditor.git]
/
src
/
editor
/
modules
/
documentCanvas
/
canvas
/
elementsRegister.js
diff --git
a/src/editor/modules/documentCanvas/canvas/elementsRegister.js
b/src/editor/modules/documentCanvas/canvas/elementsRegister.js
index
0d31c7d
..
9a44514
100644
(file)
--- a/
src/editor/modules/documentCanvas/canvas/elementsRegister.js
+++ b/
src/editor/modules/documentCanvas/canvas/elementsRegister.js
@@
-5,35
+5,27
@@
var _ = require('libs/underscore'),
wlxml = require('wlxml/wlxml');
wlxml = require('wlxml/wlxml');
-var ElementsRegister = function(
basePrototype, defaultProtot
ype) {
+var ElementsRegister = function(
BaseType, NullT
ype) {
this._register = {};
this._register = {};
- this.
basePrototype = baseProtot
ype;
- this.
DefaultType = this.createCanvasElementType(defaultPrototype)
;
+ this.
BaseType = BaseT
ype;
+ this.
NullType = NullType
;
};
_.extend(ElementsRegister.prototype, {
};
_.extend(ElementsRegister.prototype, {
- createCanvasElementType: function(elementPrototype, extending) {
- var inheritFrom = this.basePrototype;
- if(extending && extending.tag) {
- inheritFrom = this.getElement(extending);
- }
+ createCanvasElementType: function(elementPrototype) {
+ var register = this;
var Constructor = function() {
var Constructor = function() {
- if(!this.super) {
- this.super = inheritFrom.prototype;
- }
- inheritFrom.apply(this, Array.prototype.slice.call(arguments, 0));
-
+ register.BaseType.apply(this, Array.prototype.slice.call(arguments, 0));
};
};
- Constructor.prototype = Object.create(inheritFrom.prototype);
- _.extend(Constructor.prototype, elementPrototype);
+ Constructor.prototype = elementPrototype;
return Constructor;
},
register: function(params) {
params.klass = params.klass || '';
return Constructor;
},
register: function(params) {
params.klass = params.klass || '';
- params.prototype = params.prototype ||
Object.create({})
;
+ params.prototype = params.prototype ||
this.NullType
;
this._register[params.tag] = this._register[params.tag] || {};
this._register[params.tag] = this._register[params.tag] || {};
- this._register[params.tag][params.klass] = this.createCanvasElementType(params.prototype
, params.extending
);
+ this._register[params.tag][params.klass] = this.createCanvasElementType(params.prototype);
},
getElement: function(params) {
params.klass = params.klass || '';
},
getElement: function(params) {
params.klass = params.klass || '';
@@
-47,7
+39,7
@@
_.extend(ElementsRegister.prototype, {
}.bind(this));
}
if(!Factory) {
}.bind(this));
}
if(!Factory) {
- Factory = this.
Default
Type;
+ Factory = this.
Base
Type;
}
return Factory;
}
}
return Factory;
}