0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 15:23:29 -05:00

Interpret null value for set font/size/colour methods correctly.

Removes any current formatting of the given type.
This commit is contained in:
Neil Jenkins 2016-06-08 15:38:13 +10:00
parent 048a7296b2
commit 84ae8a05f5
3 changed files with 17 additions and 17 deletions

View file

@ -4086,27 +4086,27 @@ proto.removeLink = function () {
};
proto.setFontFace = function ( name ) {
this.changeFormat({
this.changeFormat( name ? {
tag: 'SPAN',
attributes: {
'class': 'font',
style: 'font-family: ' + name + ', sans-serif;'
}
}, {
} : null, {
tag: 'SPAN',
attributes: { 'class': 'font' }
});
return this.focus();
};
proto.setFontSize = function ( size ) {
this.changeFormat({
this.changeFormat( size ? {
tag: 'SPAN',
attributes: {
'class': 'size',
style: 'font-size: ' +
( typeof size === 'number' ? size + 'px' : size )
}
}, {
} : null, {
tag: 'SPAN',
attributes: { 'class': 'size' }
});
@ -4114,13 +4114,13 @@ proto.setFontSize = function ( size ) {
};
proto.setTextColour = function ( colour ) {
this.changeFormat({
this.changeFormat( colour ? {
tag: 'SPAN',
attributes: {
'class': 'colour',
style: 'color:' + colour
}
}, {
} : null, {
tag: 'SPAN',
attributes: { 'class': 'colour' }
});
@ -4128,13 +4128,13 @@ proto.setTextColour = function ( colour ) {
};
proto.setHighlightColour = function ( colour ) {
this.changeFormat({
this.changeFormat( colour ? {
tag: 'SPAN',
attributes: {
'class': 'highlight',
style: 'background-color:' + colour
}
}, {
} : colour, {
tag: 'SPAN',
attributes: { 'class': 'highlight' }
});

File diff suppressed because one or more lines are too long

View file

@ -1818,27 +1818,27 @@ proto.removeLink = function () {
};
proto.setFontFace = function ( name ) {
this.changeFormat({
this.changeFormat( name ? {
tag: 'SPAN',
attributes: {
'class': 'font',
style: 'font-family: ' + name + ', sans-serif;'
}
}, {
} : null, {
tag: 'SPAN',
attributes: { 'class': 'font' }
});
return this.focus();
};
proto.setFontSize = function ( size ) {
this.changeFormat({
this.changeFormat( size ? {
tag: 'SPAN',
attributes: {
'class': 'size',
style: 'font-size: ' +
( typeof size === 'number' ? size + 'px' : size )
}
}, {
} : null, {
tag: 'SPAN',
attributes: { 'class': 'size' }
});
@ -1846,13 +1846,13 @@ proto.setFontSize = function ( size ) {
};
proto.setTextColour = function ( colour ) {
this.changeFormat({
this.changeFormat( colour ? {
tag: 'SPAN',
attributes: {
'class': 'colour',
style: 'color:' + colour
}
}, {
} : null, {
tag: 'SPAN',
attributes: { 'class': 'colour' }
});
@ -1860,13 +1860,13 @@ proto.setTextColour = function ( colour ) {
};
proto.setHighlightColour = function ( colour ) {
this.changeFormat({
this.changeFormat( colour ? {
tag: 'SPAN',
attributes: {
'class': 'highlight',
style: 'background-color:' + colour
}
}, {
} : colour, {
tag: 'SPAN',
attributes: { 'class': 'highlight' }
});