forked from highmountain12321/react-textfit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request highmountain12321#1 from highmountain12321/branch_…
…0413 feat: beautify white.js, index.js., innerSize.js
- Loading branch information
Showing
3 changed files
with
29 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import Textfit from './Textfit'; | ||
import Textfit from "./Textfit"; | ||
export { Textfit }; | ||
export default Textfit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
// Calculate height without padding. | ||
export function innerHeight(el) { | ||
const style = window.getComputedStyle(el, null); | ||
// Hidden iframe in Firefox returns null, https://github.com/malte-wessel/react-textfit/pull/34 | ||
if (!style) return el.clientHeight; | ||
return ( | ||
el.clientHeight - | ||
parseInt(style.getPropertyValue('padding-top'), 10) - | ||
parseInt(style.getPropertyValue('padding-bottom'), 10) | ||
); | ||
const style = window.getComputedStyle(el, null); | ||
// Hidden iframe in Firefox returns null, https://github.com/malte-wessel/react-textfit/pull/34 | ||
if (!style) return el.clientHeight; | ||
return ( | ||
el.clientHeight - | ||
parseInt(style.getPropertyValue("padding-top"), 10) - | ||
parseInt(style.getPropertyValue("padding-bottom"), 10) | ||
); | ||
} | ||
|
||
// Calculate width without padding. | ||
export function innerWidth(el) { | ||
const style = window.getComputedStyle(el, null); | ||
// Hidden iframe in Firefox returns null, https://github.com/malte-wessel/react-textfit/pull/34 | ||
if (!style) return el.clientWidth; | ||
return ( | ||
el.clientWidth - | ||
parseInt(style.getPropertyValue('padding-left'), 10) - | ||
parseInt(style.getPropertyValue('padding-right'), 10) | ||
); | ||
const style = window.getComputedStyle(el, null); | ||
// Hidden iframe in Firefox returns null, https://github.com/malte-wessel/react-textfit/pull/34 | ||
if (!style) return el.clientWidth; | ||
return ( | ||
el.clientWidth - | ||
parseInt(style.getPropertyValue("padding-left"), 10) - | ||
parseInt(style.getPropertyValue("padding-right"), 10) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters