0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 07:13:08 -05:00

Use class constants

This commit is contained in:
Steven Allen 2016-12-01 14:52:42 -08:00
parent 09b7a35632
commit fcb8a4a63c
No known key found for this signature in database
GPG key ID: C125ECFD1713943C
4 changed files with 26 additions and 26 deletions

View file

@ -1895,7 +1895,7 @@ var stylesRewriters = {
newTreeBottom, newTreeTop;
if ( face ) {
fontSpan = createElement( doc, 'SPAN', {
'class': 'font',
'class': FONT_FAMILY_CLASS,
style: 'font-family:' + face
});
newTreeTop = fontSpan;
@ -1903,7 +1903,7 @@ var stylesRewriters = {
}
if ( size ) {
sizeSpan = createElement( doc, 'SPAN', {
'class': 'size',
'class': FONT_SIZE_CLASS,
style: 'font-size:' + fontSizes[ size ] + 'px'
});
if ( !newTreeTop ) {
@ -1919,7 +1919,7 @@ var stylesRewriters = {
colour = '#' + colour;
}
colourSpan = createElement( doc, 'SPAN', {
'class': 'colour',
'class': COLOUR_CLASS,
style: 'color:' + colour
});
if ( !newTreeTop ) {
@ -1939,7 +1939,7 @@ var stylesRewriters = {
},
TT: function ( node, parent ) {
var el = createElement( node.ownerDocument, 'SPAN', {
'class': 'font',
'class': FONT_FAMILY_CLASS,
style: 'font-family:menlo,consolas,"courier new",monospace'
});
parent.replaceChild( el, node );
@ -4299,12 +4299,12 @@ proto.setFontFace = function ( name ) {
this.changeFormat( name ? {
tag: 'SPAN',
attributes: {
'class': 'font',
'class': FONT_FAMILY_CLASS,
style: 'font-family: ' + name + ', sans-serif;'
}
} : null, {
tag: 'SPAN',
attributes: { 'class': 'font' }
attributes: { 'class': FONT_FAMILY_CLASS }
});
return this.focus();
};
@ -4312,13 +4312,13 @@ proto.setFontSize = function ( size ) {
this.changeFormat( size ? {
tag: 'SPAN',
attributes: {
'class': 'size',
'class': FONT_SIZE_CLASS,
style: 'font-size: ' +
( typeof size === 'number' ? size + 'px' : size )
}
} : null, {
tag: 'SPAN',
attributes: { 'class': 'size' }
attributes: { 'class': FONT_SIZE_CLASS }
});
return this.focus();
};
@ -4327,12 +4327,12 @@ proto.setTextColour = function ( colour ) {
this.changeFormat( colour ? {
tag: 'SPAN',
attributes: {
'class': 'colour',
'class': COLOUR_CLASS,
style: 'color:' + colour
}
} : null, {
tag: 'SPAN',
attributes: { 'class': 'colour' }
attributes: { 'class': COLOUR_CLASS }
});
return this.focus();
};
@ -4341,12 +4341,12 @@ proto.setHighlightColour = function ( colour ) {
this.changeFormat( colour ? {
tag: 'SPAN',
attributes: {
'class': 'highlight',
'class': HIGHLIGHT_CLASS,
style: 'background-color:' + colour
}
} : colour, {
tag: 'SPAN',
attributes: { 'class': 'highlight' }
attributes: { 'class': HIGHLIGHT_CLASS }
});
return this.focus();
};

File diff suppressed because one or more lines are too long

View file

@ -125,7 +125,7 @@ var stylesRewriters = {
newTreeBottom, newTreeTop;
if ( face ) {
fontSpan = createElement( doc, 'SPAN', {
'class': 'font',
'class': FONT_FAMILY_CLASS,
style: 'font-family:' + face
});
newTreeTop = fontSpan;
@ -133,7 +133,7 @@ var stylesRewriters = {
}
if ( size ) {
sizeSpan = createElement( doc, 'SPAN', {
'class': 'size',
'class': FONT_SIZE_CLASS,
style: 'font-size:' + fontSizes[ size ] + 'px'
});
if ( !newTreeTop ) {
@ -149,7 +149,7 @@ var stylesRewriters = {
colour = '#' + colour;
}
colourSpan = createElement( doc, 'SPAN', {
'class': 'colour',
'class': COLOUR_CLASS,
style: 'color:' + colour
});
if ( !newTreeTop ) {
@ -169,7 +169,7 @@ var stylesRewriters = {
},
TT: function ( node, parent ) {
var el = createElement( node.ownerDocument, 'SPAN', {
'class': 'font',
'class': FONT_FAMILY_CLASS,
style: 'font-family:menlo,consolas,"courier new",monospace'
});
parent.replaceChild( el, node );

View file

@ -1905,12 +1905,12 @@ proto.setFontFace = function ( name ) {
this.changeFormat( name ? {
tag: 'SPAN',
attributes: {
'class': 'font',
'class': FONT_FAMILY_CLASS,
style: 'font-family: ' + name + ', sans-serif;'
}
} : null, {
tag: 'SPAN',
attributes: { 'class': 'font' }
attributes: { 'class': FONT_FAMILY_CLASS }
});
return this.focus();
};
@ -1918,13 +1918,13 @@ proto.setFontSize = function ( size ) {
this.changeFormat( size ? {
tag: 'SPAN',
attributes: {
'class': 'size',
'class': FONT_SIZE_CLASS,
style: 'font-size: ' +
( typeof size === 'number' ? size + 'px' : size )
}
} : null, {
tag: 'SPAN',
attributes: { 'class': 'size' }
attributes: { 'class': FONT_SIZE_CLASS }
});
return this.focus();
};
@ -1933,12 +1933,12 @@ proto.setTextColour = function ( colour ) {
this.changeFormat( colour ? {
tag: 'SPAN',
attributes: {
'class': 'colour',
'class': COLOUR_CLASS,
style: 'color:' + colour
}
} : null, {
tag: 'SPAN',
attributes: { 'class': 'colour' }
attributes: { 'class': COLOUR_CLASS }
});
return this.focus();
};
@ -1947,12 +1947,12 @@ proto.setHighlightColour = function ( colour ) {
this.changeFormat( colour ? {
tag: 'SPAN',
attributes: {
'class': 'highlight',
'class': HIGHLIGHT_CLASS,
style: 'background-color:' + colour
}
} : colour, {
tag: 'SPAN',
attributes: { 'class': 'highlight' }
attributes: { 'class': HIGHLIGHT_CLASS }
});
return this.focus();
};