Fix template namespace

This commit is contained in:
nathangray 2020-02-10 14:14:17 -07:00
parent 444f98fe34
commit b5af403238
4 changed files with 16 additions and 12 deletions

View File

@ -161,7 +161,7 @@ var et2_widget = /** @class */ (function (_super) {
if (_attrs["id"]) {
// Create a namespace for this object
if (_this._createNamespace()) {
_this.checkCreateNamespace();
_this.checkCreateNamespace(_attrs);
}
}
if (_this.id) {
@ -783,8 +783,10 @@ var et2_widget = /** @class */ (function (_super) {
* Checks whether a namespace exists for this element in the content array.
* If yes, an own perspective of the content array is created. If not, the
* parent content manager is used.
*
* Constructor attributes are passed in case a child needs to make decisions
*/
et2_widget.prototype.checkCreateNamespace = function () {
et2_widget.prototype.checkCreateNamespace = function (_attrs) {
// Get the content manager
var mgrs = this.getArrayMgrs();
for (var key in mgrs) {

View File

@ -233,7 +233,7 @@ export class et2_widget extends ClassWithAttributes
if (_attrs["id"]) {
// Create a namespace for this object
if (this._createNamespace()) {
this.checkCreateNamespace();
this.checkCreateNamespace(_attrs);
}
}
@ -967,8 +967,10 @@ Comment this out (for now)
* Checks whether a namespace exists for this element in the content array.
* If yes, an own perspective of the content array is created. If not, the
* parent content manager is used.
*
* Constructor attributes are passed in case a child needs to make decisions
*/
checkCreateNamespace()
checkCreateNamespace(_attrs? : any)
{
// Get the content manager
var mgrs = this.getArrayMgrs();

View File

@ -139,10 +139,10 @@ var et2_template = /** @class */ (function (_super) {
* Templates always have ID set, but seldom do we want them to
* create a namespace based on their ID.
*/
et2_template.prototype.checkCreateNamespace = function () {
if (this.content) {
var old_id = this.id;
this.id = this.content;
et2_template.prototype.checkCreateNamespace = function (_attrs) {
if (_attrs.content) {
var old_id = _attrs.id;
this.id = _attrs.content;
_super.prototype.checkCreateNamespace.apply(this, arguments);
this.id = old_id;
}

View File

@ -191,12 +191,12 @@ class et2_template extends et2_DOMWidget
* Templates always have ID set, but seldom do we want them to
* create a namespace based on their ID.
*/
checkCreateNamespace()
checkCreateNamespace(_attrs)
{
if(this.content)
if(_attrs.content)
{
var old_id = this.id;
this.id = this.content;
var old_id = _attrs.id;
this.id = _attrs.content;
super.checkCreateNamespace.apply(this, arguments);
this.id = old_id;
}