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:
commit
e3059eda9f
4 changed files with 26 additions and 26 deletions
|
@ -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
|
@ -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 );
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue