- removing font-size hack for hiding cursor flicker in Chrome because
it breaks height of inline document-node-element
DocumentElement.call(this, htmlElement, canvas);
};
DocumentElement.call(this, htmlElement, canvas);
};
+var getDisplayStyle = function(tag, klass) {
+ if(tag === 'metadata')
+ return 'none';
+ if(tag === 'span')
+ return 'inline';
+ return 'block';
+}
+
$.extend(DocumentNodeElement, {
createDOM: function(params) {
var dom = $('<div document-node-element>'),
$.extend(DocumentNodeElement, {
createDOM: function(params) {
var dom = $('<div document-node-element>'),
}
dom.data('other-attrs', params.others);
}
dom.data('other-attrs', params.others);
+ /* display style */
+ var displayStyle = getDisplayStyle(params.tag, params.klass);
+ dom.css('display', displayStyle);
+ container.css('display', displayStyle);
+
var widgets = $('<div class="canvas-widgets" contenteditable="false">');
widgets.append($('<span class="canvas-widget canvas-widget-label">').text(params.tag + (params.klass ? ' / ' + params.klass : '')));
dom.append(widgets);
var widgets = $('<div class="canvas-widgets" contenteditable="false">');
widgets.append($('<span class="canvas-widget canvas-widget-label">').text(params.tag + (params.klass ? ' / ' + params.klass : '')));
dom.append(widgets);
},
setWlxmlTag: function(tag) {
this._container().attr('wlxml-tag', tag);
},
setWlxmlTag: function(tag) {
this._container().attr('wlxml-tag', tag);
+ this._updateDisplayStyle();
},
getWlxmlClass: function() {
var klass = this._container().attr('wlxml-class');
},
getWlxmlClass: function() {
var klass = this._container().attr('wlxml-class');
this._container().attr('wlxml-class', klass.replace(/\./g, '-'));
else
this._container().removeAttr('wlxml-class');
this._container().attr('wlxml-class', klass.replace(/\./g, '-'));
else
this._container().removeAttr('wlxml-class');
+ this._updateDisplayStyle();
+ },
+ _updateDisplayStyle: function() {
+ var displayStyle = getDisplayStyle(this.getWlxmlTag, this.getWlxmlClass);
+ this.dom().css('display', displayStyle);
+ this._container().css('display', displayStyle);
},
is: function(what) {
if(what === 'list' && _.contains(['list.items', 'list.items.enum'], this.getWlxmlClass()))
},
is: function(what) {
if(what === 'list' && _.contains(['list.items', 'list.items.enum'], this.getWlxmlClass()))
-[document-node-element] {
- font-size: 1px;
-}
[document-text-element] {
font-size: 14px;
display: inline;
[document-text-element] {
font-size: 14px;
display: inline;