From fc8dc8221b129775d2778687772469c083a67fbe Mon Sep 17 00:00:00 2001 From: Anika Henke <anika@selfthinker.org> Date: Sun, 1 Jul 2012 14:48:01 +0100 Subject: [PATCH] improved preview to have same width as resulting page if it would have a sidebar --- inc/html.php | 4 ++-- lib/tpl/dokuwiki/css/design.css | 14 ++++++++++++-- lib/tpl/dokuwiki/css/mobile.css | 8 ++++---- lib/tpl/dokuwiki/css/structure.css | 8 ++++---- lib/tpl/dokuwiki/main.php | 6 ++++-- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/inc/html.php b/inc/html.php index a20ee5c39..738b1f1b4 100644 --- a/inc/html.php +++ b/inc/html.php @@ -229,12 +229,12 @@ function html_show($txt=null){ //PreviewHeader echo '<br id="scroll__here" />'; echo p_locale_xhtml('preview'); - echo '<div class="preview">'; + echo '<div class="preview"><div class="pad">'; $html = html_secedit(p_render('xhtml',p_get_instructions($txt),$info),$secedit); if($INFO['prependTOC']) $html = tpl_toc(true).$html; echo $html; echo '<div class="clearer"></div>'; - echo '</div>'; + echo '</div></div>'; }else{ if ($REV) print p_locale_xhtml('showrev'); diff --git a/lib/tpl/dokuwiki/css/design.css b/lib/tpl/dokuwiki/css/design.css index 9466481c5..d1a00ce0a 100644 --- a/lib/tpl/dokuwiki/css/design.css +++ b/lib/tpl/dokuwiki/css/design.css @@ -426,7 +426,17 @@ .dokuwiki div.preview { margin: 0 -2em; - padding: 1.556em 2em 2em; + padding: 0 2em; +} +.dokuwiki.hasSidebar div.preview { + border-right: __sidebar_width__ solid __background_alt__; +} +[dir=rtl] .dokuwiki.hasSidebar div.preview { + border-right-width: 0; + border-left: __sidebar_width__ solid __background_alt__; +} +.dokuwiki div.preview div.pad { + padding: 1.556em 0 2em; } @@ -440,7 +450,7 @@ color: inherit; } [dir=rtl] #dw__toc { - margin: -2em 1.4em .5em -2em; + margin: -1.556em 1.4em .5em -2em; border-left-width: 0; border-right: 1px solid __border__; } diff --git a/lib/tpl/dokuwiki/css/mobile.css b/lib/tpl/dokuwiki/css/mobile.css index 4d18113ac..5a72ed095 100644 --- a/lib/tpl/dokuwiki/css/mobile.css +++ b/lib/tpl/dokuwiki/css/mobile.css @@ -28,17 +28,17 @@ margin-bottom: .5em; } -.hasSidebar #dokuwiki__content { +.showSidebar #dokuwiki__content { float: none; margin-left: 0; width: 100%; } -.hasSidebar #dokuwiki__content > .pad { +.showSidebar #dokuwiki__content > .pad { margin-left: 0; } -[dir=rtl] .hasSidebar #dokuwiki__content, -[dir=rtl] .hasSidebar #dokuwiki__content > .pad { +[dir=rtl] .showSidebar #dokuwiki__content, +[dir=rtl] .showSidebar #dokuwiki__content > .pad { margin-right: 0; } diff --git a/lib/tpl/dokuwiki/css/structure.css b/lib/tpl/dokuwiki/css/structure.css index 5e2eab3bc..00642e90b 100644 --- a/lib/tpl/dokuwiki/css/structure.css +++ b/lib/tpl/dokuwiki/css/structure.css @@ -56,20 +56,20 @@ body { margin: 0 0 0 1.5em; } - .hasSidebar #dokuwiki__content { + .showSidebar #dokuwiki__content { float: right; margin-left: -__sidebar_width__; width: 100%; } - [dir=rtl] .hasSidebar #dokuwiki__content { + [dir=rtl] .showSidebar #dokuwiki__content { float: left; margin-left: 0; margin-right: -__sidebar_width__; } - .hasSidebar #dokuwiki__content > .pad { + .showSidebar #dokuwiki__content > .pad { margin-left: __sidebar_width__; } - [dir=rtl] .hasSidebar #dokuwiki__content > .pad { + [dir=rtl] .showSidebar #dokuwiki__content > .pad { margin-left: 0; margin-right: __sidebar_width__; } diff --git a/lib/tpl/dokuwiki/main.php b/lib/tpl/dokuwiki/main.php index e0b046574..effbad64c 100644 --- a/lib/tpl/dokuwiki/main.php +++ b/lib/tpl/dokuwiki/main.php @@ -10,7 +10,8 @@ if (!defined('DOKU_INC')) die(); /* must be run from within DokuWiki */ -$showSidebar = page_findnearest($conf['sidebar']) && ($ACT=='show'); +$hasSidebar = page_findnearest($conf['sidebar']); +$showSidebar = $hasSidebar && ($ACT=='show'); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $conf['lang'] ?>" @@ -28,7 +29,8 @@ $showSidebar = page_findnearest($conf['sidebar']) && ($ACT=='show'); <body> <!--[if lte IE 7 ]><div id="IE7"><![endif]--><!--[if IE 8 ]><div id="IE8"><![endif]--> <div id="dokuwiki__site"><div id="dokuwiki__top" - class="dokuwiki site mode_<?php echo $ACT ?> <?php echo ($showSidebar) ? 'hasSidebar' : ''; ?>"> + class="dokuwiki site mode_<?php echo $ACT ?> <?php echo ($showSidebar) ? 'showSidebar' : ''; + ?> <?php echo ($hasSidebar) ? 'hasSidebar' : ''; ?>"> <?php include('tpl_header.php') ?> -- GitLab