From f5f2e6f037c8c9308bfcab0d4d206b8996900b48 Mon Sep 17 00:00:00 2001 From: Hayden Maudsley-Barton <97900328+hayden-MB@users.noreply.github.com> Date: Fri, 25 Oct 2024 15:52:05 +0100 Subject: [PATCH] Update inst/resources/gitbook/js/plugin-fontsettings.js Co-authored-by: Yihui Xie --- inst/resources/gitbook/js/plugin-fontsettings.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/inst/resources/gitbook/js/plugin-fontsettings.js b/inst/resources/gitbook/js/plugin-fontsettings.js index 0e20cc1d..f0017920 100644 --- a/inst/resources/gitbook/js/plugin-fontsettings.js +++ b/inst/resources/gitbook/js/plugin-fontsettings.js @@ -60,17 +60,10 @@ gitbook.require(["gitbook", "lodash", "jQuery"], function(gitbook, _, $) { saveFontSettings(); }; - // Increase line spacing - function increaseSpacing(e) { + // Increase or decrease line spacing + function changeSpacing(e, inc = true) { e.preventDefault(); - fontState.spacing++; - saveFontSettings(); - } - -// Decrease line spacing - function decreaseSpacing(e) { - e.preventDefault(); - fontState.spacing > 10 && fontState.spacing--; + inc ? fontState.spacing++ : (fontState.spacing > 10 && fontState.spacing--); saveFontSettings(); }