Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump reveal.js to 5.1.0, add support for scroll view #307

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
"jest": "^27.4.5",
"mathjax": "^3.2.0",
"obsidian": "^0.16.3",
"reveal.js": "^4.5.0",
"reveal.js": "^5.1.0",
"reveal.js-menu": "^2.1.0",
"reveal.js-mermaid-plugin": "^1.0.0",
"reveal.js-mermaid-plugin": "^2.1.0",
"reveal.js-plugins": "^4.1.5",
"reveal.js-elapsed-time-bar": "https://github.com/tkrkt/reveal.js-elapsed-time-bar.git",
"reveal-pointer": "https://github.com/burnpiro/reveal-pointer.git",
Expand Down
16 changes: 15 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export interface AdvancedSlidesSettings {
autoComplete: string;
paneMode: PaneType;
motm: string;
scrollView: boolean;
}

const DEFAULT_SETTINGS: AdvancedSlidesSettings = {
Expand All @@ -79,7 +80,8 @@ const DEFAULT_SETTINGS: AdvancedSlidesSettings = {
showGrid: false,
autoComplete: 'inPreview',
paneMode: 'split',
motm: ''
motm: '',
scrollView: false
};

export default class AdvancedSlidesPlugin extends Plugin {
Expand Down Expand Up @@ -651,6 +653,18 @@ class AdvancedSlidesSettingTab extends PluginSettingTab {
);
});

new Setting(containerEl)
.setName('Scroll View')
.setDesc('Display presentation using scroll view')
.addToggle(value =>
value.setValue(this.plugin.settings.scrollView).onChange(
_.debounce(async value => {
this.plugin.settings.scrollView = value;
await this.plugin.saveSettings();
}, 750),
),
);

containerEl.createEl('h2', { text: 'Plugins' });

new Setting(containerEl)
Expand Down
13 changes: 12 additions & 1 deletion src/revealRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,18 @@ export class RevealRenderer {
async render(input: string, renderForPrint: boolean, renderEmbedded: boolean) {
const { yamlOptions, markdown } = this.yaml.parseYamlFrontMatter(input);
const options = this.yaml.getSlideOptions(yamlOptions, renderForPrint);
const revealOptions = this.yaml.getRevealOptions(options);
let revealOptions = this.yaml.getRevealOptions(options);

// Switching to scroll view requires some additional properties.
// We need this login in reveal.html and embed.html
// so we tweak the value to get the right revealOptionsStr.
if (revealOptions.scrollView) {
revealOptions.view = "scroll";
revealOptions.scrollLayout = "compact";
revealOptions.scrollProgress = true;
revealOptions.center = false;
}
delete revealOptions["scrollView"];

const { title } = options;
const themeUrl = this.getThemeUrl(options.theme);
Expand Down
3 changes: 3 additions & 0 deletions src/scss/theme/source/beige.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ $linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: rgba(79, 64, 28, 0.99);
$heading1TextShadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0,0,0,.1), 0 0 5px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.3), 0 3px 5px rgba(0,0,0,.2), 0 5px 10px rgba(0,0,0,.25), 0 20px 20px rgba(0,0,0,.15);

$overlayElementBgColor: 0, 0, 0;
$overlayElementFgColor: 240, 240, 240;

// Background generator
@mixin bodyBackground() {
@include radial-gradient( rgba(247,242,211,1), rgba(255,255,255,1) );
Expand Down
3 changes: 3 additions & 0 deletions src/scss/theme/source/serif.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ $linkColor: #51483D;
$linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: #26351C;

$overlayElementBgColor: 0, 0, 0;
$overlayElementFgColor: 240, 240, 240;

.reveal a {
line-height: 1.3em;
}
Expand Down
3 changes: 3 additions & 0 deletions src/scss/theme/source/simple.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ $linkColor: #00008B;
$linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: rgba(0, 0, 0, 0.99);

$overlayElementBgColor: 0, 0, 0;
$overlayElementFgColor: 240, 240, 240;

// Change text colors against dark slide backgrounds
@include dark-bg-text-color(#fff);

Expand Down
3 changes: 3 additions & 0 deletions src/scss/theme/source/sky.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ $linkColor: #3b759e;
$linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: #134674;

$overlayElementBgColor: 0, 0, 0;
$overlayElementFgColor: 240, 240, 240;

// Fix links so they are not cut off
.reveal a {
line-height: 1.3em;
Expand Down
3 changes: 3 additions & 0 deletions src/scss/theme/source/solarized.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ $linkColor: $blue;
$linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: $magenta;

$overlayElementBgColor: 0, 0, 0;
$overlayElementFgColor: 240, 240, 240;

// Background generator
// @mixin bodyBackground() {
// @include radial-gradient( rgba($base3,1), rgba(lighten($base3, 20%),1) );
Expand Down
3 changes: 3 additions & 0 deletions src/scss/theme/source/white.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ $heading2Size: 1.6em;
$heading3Size: 1.3em;
$heading4Size: 1.0em;

$overlayElementBgColor: 0, 0, 0;
$overlayElementFgColor: 240, 240, 240;

// Change text colors against dark slide backgrounds
@include dark-bg-text-color(#fff);

Expand Down
4 changes: 3 additions & 1 deletion src/scss/theme/template/exposer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@
--r-link-color-hover: #{$linkColorHover};
--r-selection-background-color: #{$selectionBackgroundColor};
--r-selection-color: #{$selectionColor};
}
--r-overlay-element-bg-color: #{$overlayElementBgColor};
--r-overlay-element-fg-color: #{$overlayElementFgColor};
}
5 changes: 5 additions & 0 deletions src/scss/theme/template/settings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ $linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: #FF5E99;
$selectionColor: #fff;

// Colors used for UI elements that are overlaid on top of
// the presentation
$overlayElementBgColor: 240, 240, 240;
$overlayElementFgColor: 0, 0, 0;

// Generates the presentation background, can be overridden
// to return a background image or gradient
@mixin bodyBackground() {
Expand Down
3 changes: 2 additions & 1 deletion src/yamlParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ export class YamlParser {
'hideInactiveCursor',
'hideCursorTime',
'markdown',
'mermaid'
'mermaid',
'scrollView'
];
const globalSettings = _.pick(_.omitBy(this.settings, _.isEmpty), revealProps);
const slideSettings = _.pick(options, revealProps);
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6072,10 +6072,10 @@ reveal.js-menu@^2.1.0:
resolved "https://registry.npmjs.org/reveal.js-menu/-/reveal.js-menu-2.1.0.tgz"
integrity sha512-35zp4fHSMyWd15+3CvQ8LrpS+4Gj2qvlkxX3lo5LpITDe6ZkA4A9y1E5fE63YlQl5fp7W1mNgNJr4kCU0s14lA==

reveal.js-mermaid-plugin@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/reveal.js-mermaid-plugin/-/reveal.js-mermaid-plugin-1.0.0.tgz"
integrity sha512-AGwin9D93IALLZKt7gxcBIn0om0P+XXmX/T66n+gq87DOqalnSABYbuOldjy7kQBKLMaORx4249C5QFQhvBdBg==
reveal.js-mermaid-plugin@^2.1.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/reveal.js-mermaid-plugin/-/reveal.js-mermaid-plugin-2.3.0.tgz#da8a8cb387b6f499eec0c18cc354d24536bc69df"
integrity sha512-61t2jWPCB0+PYsO1lpoUXX7NfhcRwavpEi5r20Au7dEdoYzA3aYwP/vP90mBc+bvCcCPIAgulcixllGob59jkA==

reveal.js-plugins@^4.1.5:
version "4.1.5"
Expand All @@ -6084,10 +6084,10 @@ reveal.js-plugins@^4.1.5:
dependencies:
npm "^6.13.4"

reveal.js@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/reveal.js/-/reveal.js-4.5.0.tgz#fc04329aee58dd88862bf1f8e8f85f7993287763"
integrity sha512-Lx1hUWhJR7Y7ScQNyGt7TFzxeviDAswK2B0cn9RwbPZogTMRgS8+FTr+/12KNHOegjvWKH0H0EGwBARNDPTgWQ==
reveal.js@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/reveal.js/-/reveal.js-5.1.0.tgz#dfaa4631127e739aa8ebbaa425d653e72d799e66"
integrity sha512-KDt7m0+xwKV6nAZt4CNPVFBf42sTKRQapg0bGGKB5PKO5XvChnMfwlZkybydHiQJ7p5+6LbHKRGrhXODdoNIaA==

reveal.js@~3.1.0:
version "3.1.0"
Expand Down