Skip to content

Commit

Permalink
Backport
Browse files Browse the repository at this point in the history
  • Loading branch information
OleVik committed Feb 9, 2020
2 parents 385a6f9 + f53e916 commit 9d3cc67
Show file tree
Hide file tree
Showing 7 changed files with 199 additions and 194 deletions.
6 changes: 3 additions & 3 deletions blueprints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,10 @@ form:
data-options@:
- "\\Grav\\Plugin\\PresentationPlugin::getClassNamesBlueprintOptions"
- Parser
styles:
transport:
type: select
label: PLUGIN_PRESENTATION.ADMIN.ADVANCED.STYLES.LABEL
description: PLUGIN_PRESENTATION.ADMIN.ADVANCED.STYLES.DESCRIPTION
label: PLUGIN_PRESENTATION.ADMIN.ADVANCED.TRANSPORT.LABEL
description: PLUGIN_PRESENTATION.ADMIN.ADVANCED.TRANSPORT.DESCRIPTION
data-options@:
- "\\Grav\\Plugin\\PresentationPlugin::getClassNamesBlueprintOptions"
- Transport
Expand Down
6 changes: 5 additions & 1 deletion classes/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ public function __construct($grav, $config, $parser, $transport)
$this->config = $config;
$this->parser = $parser;
$this->transport = $transport;
$this->parsedown = new \Parsedown();
if ($this->grav['config']->get('system.pages.markdown.extra')) {
$this->parsedown = new \ParsedownExtra();
} else {
$this->parsedown = new \Parsedown();
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion languages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ en:
PARSER:
LABEL: Parser
DESCRIPTION: Use a custom parser for content.
STYLES:
TRANSPORT:
LABEL: Transport
DESCRIPTION: Use a custom getter/setter for transporting data.
REVEAL:
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"codemirror": "^5.43.0",
"js-base64": "^2.5.1",
"localforage": "^1.7.3",
"reveal.js": "^3.8.0"
"reveal.js": "^3.9.2"
},
"devDependencies": {
"include-media": "^1.4.9",
Expand Down
18 changes: 9 additions & 9 deletions presentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ public function pageIteration()
$options = Utilities::parseAmbiguousArrayValues($config['options']);
$options = json_encode($options, JSON_PRETTY_PRINT);
$breakpoints = json_encode($config['breakpoints']);
$this->grav['twig']->twig_vars['reveal_init'] = $options;
/* Deprecated v3.1.0 */
// $this->grav['twig']->twig_vars['reveal_init'] = $options;
$grav['assets']->addInlineJs('const reveal_init = ' . $options . ';', null, 'presentation');
$this->grav['twig']->twig_vars['presentation_menu'] = $menu;
$this->grav['twig']->twig_vars['presentation_breakpoints'] = $breakpoints;
$grav['assets']->addInlineCss($this->transport->getStyles(), null, 'presentation');
Expand Down Expand Up @@ -485,24 +487,22 @@ public function onShortcodeHandlers()
public function onAdminPagesAssetsInitialized()
{
$uri = $this->grav['uri'];
$config = $this->config();
$page = $this->grav['page'];
$res = Grav::instance()['locator'];
$path = $res->findResource('plugin://' . $this->name, false);
$adminRoute = $this->config->get('plugins')['admin']['route'];
$adminRoute = $this->config->get('plugins.admin.route');
if (!Utils::contains($uri->path(), $adminRoute . '/pages')) {
return;
}
if ($config['admin_async_save'] !== true) {
if ($this->config->get('plugins.presentation.admin_async_save') !== true) {
return;
}
$adminRoute = $uri->rootUrl(true) . $adminRoute;
$inlineJsConstants = array(
'presentationAPIRoute = "' . $adminRoute . '/' . $config['api_route'] . '"',
'presentationAPITimeout = ' . ($config['poll_timeout'] ?: 2000) * 2.5,
'presentationAPIRetryLimit = ' . ($config['poll_retry_limit'] ?: 10),
'presentationAdminAsyncSave = ' . ($config['admin_async_save'] ?: 0),
'presentationAdminAsyncSaveTyping = ' . ($config['admin_async_save_typing'] ?: 0)
'presentationAPITimeout = ' . ($this->config->get('plugins.presentation.poll_timeout') ?: 2000) * 2.5,
'presentationAPIRetryLimit = ' . ($this->config->get('plugins.presentation.poll_retry_limit') ?: 10),
'presentationAdminAsyncSave = ' . ($this->config->get('plugins.presentation.admin_async_save') ?: 0),
'presentationAdminAsyncSaveTyping = ' . ($this->config->get('plugins.presentation.admin_async_save_typing') ?: 0)
);
$inlineJs = '';
foreach ($inlineJsConstants as $constant) {
Expand Down
Loading

0 comments on commit 9d3cc67

Please sign in to comment.