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

Merge pull request #255 from Stebalien/use-constants

Use class constants
This commit is contained in:
Neil Jenkins 2016-12-09 16:46:10 +11:00 committed by GitHub
commit e3059eda9f
4 changed files with 26 additions and 26 deletions

View file

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

File diff suppressed because one or more lines are too long

View file

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

View file

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