(domRoot: JQuery, state: FontScaleState & any, fontSelectorOrEditor: JQuery | string | IEditor)
| 97 | private isFontOfStr: boolean; |
| 98 | |
| 99 | constructor(domRoot: JQuery, state: FontScaleState & any, fontSelectorOrEditor: JQuery | string | IEditor) { |
| 100 | super(); |
| 101 | this.domRoot = domRoot; |
| 102 | // Old scale went from 0.3 to 3. New one uses 8 up to 30, so we can convert the old ones to the new format |
| 103 | this.scale = state.fontScale || getDefaultFontScale(); |
| 104 | // The check seems pointless, but it ensures a false in case it's undefined |
| 105 | // FontScale assumes it's an old state if it does not see a fontUsePx in the state, so at first it will use pt. |
| 106 | // So the second condition is there to make new objects actually use px |
| 107 | this.usePxUnits = state.fontUsePx === true || !state.fontScale; |
| 108 | if (this.scale < 8) { |
| 109 | this.scale = convertOldScale(this.scale); |
| 110 | } |
| 111 | this.setTarget(fontSelectorOrEditor); |
| 112 | this.apply(); |
| 113 | this.fontSizeList = this.domRoot.find('.font-size-list'); |
| 114 | makeFontSizeDropdown(this.fontSizeList, this, this.domRoot.find('.fs-button')); |
| 115 | } |
| 116 | |
| 117 | apply() { |
| 118 | if (this.isFontOfStr) { |
nothing calls this directly
no test coverage detected