- setWlxmlClass: function(klass) {
- if(klass === this.getWlxmlClass())
- return;
-
- this.getWlxmlMetaAttrs().forEach(function(attr) {
- if(!classAttributes.hasMetaAttr(klass, attr.name))
- this.dom().removeAttr('wlxml-meta-' + attr.name);
- }, this);
-
- if(klass)
- this._container().attr('wlxml-class', klass.replace(/\./g, '-'));
- else
- this._container().removeAttr('wlxml-class');
- if(!this.__updatingWlxml)
- this._updateWlxmlManager();
- },
- setWlxml: function(params) {
- this.__updatingWlxml = true;
- if(params.tag !== undefined)
- this.setWlxmlTag(params.tag);
- if(params.klass !== undefined)
- this.setWlxmlClass(params.klass);
- this._updateWlxmlManager();
- this.__updatingWlxml = false;
- },
- _updateWlxmlManager: function() {
- var manager = wlxmlManagers.getFor(this);
- this.data('_wlxmlManager', manager);
- manager.setup();
- },
- is: function(what) {
- if(what === 'list' && _.contains(['list.items', 'list.items.enum'], this.getWlxmlClass()))
- return true;
- return false;
- },
-
- getWlxmlMetaAttr: function(attr) {
- return this.dom().attr('wlxml-meta-'+attr);
- },
-
- getWlxmlMetaAttrs: function() {
- var toret = [];
- var attrList = classAttributes.getMetaAttrsList(this.getWlxmlClass());
- attrList.all.forEach(function(attr) {
- toret.push({name: attr.name, value: this.getWlxmlMetaAttr(attr.name) || ''});
- }, this);
- return toret;
- },
-
- setWlxmlMetaAttr: function(attr, value) {
- this.dom().attr('wlxml-meta-'+attr, value);
- },
-
- toggleLabel: function(toggle) {
- var displayCss = toggle ? 'inline-block' : 'none';
- var label = this.dom().children('.canvas-widgets').find('.canvas-widget-label');
- label.css('display', displayCss);
- this.toggleHighlight(toggle);
- },
-
- toggleHighlight: function(toggle) {
- this._container().toggleClass('highlighted-element', toggle);
- },
-
- toggle: function(toggle) {
- var mng = this.data('_wlxmlManager');
- if(mng) {
- mng.toggle(toggle);
- }
+ displayAs: function(what) {
+ // [this.dom(), this._container()].forEach(e) {
+ // var isBlock = window.getComputedStyle(e).display === 'block';
+ // if(!isBlock && what === 'block') {
+ // e.css('display', what);
+ // } else if(isBlock && what === 'inline') {
+ // e.css('display')
+ // }
+ // })
+ this.dom.css('display', what);
+ this._container().css('display', what);