Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit bb3e75d

Browse files
committed
Fixes after last review
1 parent 25ee232 commit bb3e75d

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

src/view/ViewCommandHandlers.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,25 @@ define(function (require, exports, module) {
5656
* @const
5757
* @private
5858
* The smallest font size in pixels
59-
* @type {int}
59+
* @type {number}
6060
*/
6161
var MIN_FONT_SIZE = 1;
6262

6363
/**
6464
* @const
6565
* @private
6666
* The largest font size in pixels
67-
* @type {int}
67+
* @type {number}
6868
*/
6969
var MAX_FONT_SIZE = 72;
7070

7171
/**
7272
* @const
7373
* @private
74-
* The ratio of line-height to font-size when they use the same units
75-
* @type {float}
74+
* The default font size used only to convert the old fontSizeAdjustment view state to the new fontSizeStyle
75+
* @type {number}
7676
*/
77-
var LINE_HEIGHT = 1.25;
77+
var DEFAULT_FONT_SIZE = 12;
7878

7979

8080
/**
@@ -125,7 +125,7 @@ define(function (require, exports, module) {
125125
/**
126126
* @private
127127
* Increases or decreases the editor's font size.
128-
* @param {number} adjustment Negative number to make the font smaller; positive number to make it bigger
128+
* @param {number} adjustment Negative number to make the font smaller; positive number to make it bigger
129129
* @return {boolean} true if adjustment occurred, false if it did not occur
130130
*/
131131
function _adjustFontSize(adjustment) {
@@ -196,7 +196,8 @@ define(function (require, exports, module) {
196196
}
197197

198198
/**
199-
* Restores the Font Size and Line Height using the saved strings
199+
* Restores the font size using the saved style and migrates the old fontSizeAdjustment
200+
* view state to the new fontSizeStyle, when required
200201
*/
201202
function restoreFontSize() {
202203
var fsStyle = PreferencesManager.getViewState("fontSizeStyle"),
@@ -208,7 +209,7 @@ define(function (require, exports, module) {
208209

209210
if (!fsStyle) {
210211
// Migrate the old view state to the new one.
211-
fsStyle = (12 + fsAdjustment) + "px";
212+
fsStyle = (DEFAULT_FONT_SIZE + fsAdjustment) + "px";
212213
PreferencesManager.setViewState("fontSizeStyle", fsStyle);
213214
}
214215
}
@@ -309,16 +310,16 @@ define(function (require, exports, module) {
309310

310311
/**
311312
* @private
312-
* Convert the old "fontSizeAdjustment" preference to the new view states.
313+
* Convert the old "fontSizeAdjustment" preference to the new view state.
313314
*
314-
* @param {string} key The key of the preference to be examined for migration
315+
* @param {string} key The key of the preference to be examined for migration
315316
* of old preferences. Not used since we only have one in this module.
316-
* @param {string} value The value of "fontSizeAdjustment" preference
317-
* @return {Object} - JSON object for the new view states equivalent to
317+
* @param {string} value The value of "fontSizeAdjustment" preference
318+
* @return {Object} JSON object for the new view state equivalent to
318319
* the old "fontSizeAdjustment" preference.
319320
*/
320321
function _convertToNewViewStates(key, value) {
321-
return { "fontSizeStyle": (12 + value) + "px" };
322+
return { "fontSizeStyle": (DEFAULT_FONT_SIZE + value) + "px" };
322323
}
323324

324325
// Register command handlers

0 commit comments

Comments
 (0)