Fixes in the Richeditor styling. Implemented parsed content caching for content blocks.

This commit is contained in:
alekseybobkov 2014-09-29 22:58:30 -07:00
parent dcf7bb7d4f
commit a534f7bc79
4 changed files with 62 additions and 11 deletions

View File

@ -55,13 +55,13 @@
z-index: auto !important;
}
.redactor_box_fullscreen {
z-index: 1060 !important;
z-index: 300 !important;
width: 100%!important;
}
#redactor_modal_overlay,
#redactor_modal,
.redactor_dropdown {
z-index: 1062 !important;
z-index: 302 !important;
}
body .redactor_air {
position: absolute;
@ -260,7 +260,7 @@ body .redactor_box_fullscreen .redactor_editor {
line-height: 1 !important;
border: none;
background: #dddddd;
z-index: 1061;
z-index: 301;
}
.redactor_toolbar:after {
content: "";
@ -1033,7 +1033,7 @@ body .redactor_air .redactor_toolbar {
font-family: 'Open Sans', Arial, sans-serif;
line-height: 20px;
font-style: normal;
z-index: 1560;
z-index: 800;
text-align: center;
}
.redactor_box .oc-figure-controls span {

View File

@ -1,7 +1,7 @@
@import "../../../../assets/less/core/boot.less";
@richeditor-toolbar-size: 30px;
@richeditor-zindex: 1060;
@richeditor-zindex: 300;
@richeditor-gutter: 20px;
@import "_redactor.less";

View File

@ -1,5 +1,8 @@
<?php namespace Cms\Classes;
use File;
use October\Rain\Support\Markdown;
/**
* The CMS content file class.
*
@ -10,6 +13,11 @@ class Content extends CmsCompoundObject
{
protected static $allowedExtensions = ['htm', 'txt', 'md'];
/**
* @var string Contains the parsed markup.
*/
public $parsedMarkup = null;
/**
* Returns the directory name corresponding to the object type.
* For pages the directory name is "pages", for layouts - "layouts", etc.
@ -19,4 +27,52 @@ class Content extends CmsCompoundObject
{
return 'content';
}
/**
* Loads the object from a file.
* @param \Cms\Classes\Theme $theme Specifies the theme the object belongs to.
* @param string $fileName Specifies the file name, with the extension.
* The file name can contain only alphanumeric symbols, dashes and dots.
* @return boolean Returns true if the object was successfully loaded. Otherwise returns false.
*/
public static function load($theme, $fileName)
{
$obj = parent::load($theme, $fileName);
$obj->parsedMarkup = $obj->parseMarkup();
return $obj;
}
/**
* Initializes the object properties from the cached data.
* @param array $cached The cached data array.
*/
protected function initFromCache($cached)
{
parent::initFromCache($cached);
$this->parsedMarkup = array_key_exists('parsed-markup', $cached) ?
$cached['parsed-markup'] :
$this->parseMarkup($this->markup);
}
/**
* Initializes a cache item.
* @param array &$item The cached item array.
*/
protected function initCacheItem(&$item)
{
parent::initCacheItem($item);
$item['parsed-markup'] = $this->parsedMarkup;
}
protected function parseMarkup()
{
$result = $this->markup;
if (strtolower(File::extension($this->fileName)) == 'md')
$result = Markdown::parse($this->markup);
return $result;
}
}

View File

@ -22,7 +22,6 @@ use System\Models\RequestLog;
use System\Classes\ErrorHandler;
use System\Classes\ApplicationException;
use System\Twig\Extension as SystemTwigExtension;
use October\Rain\Support\Markdown;
use October\Rain\Support\ValidationException;
use Illuminate\Http\RedirectResponse;
@ -727,11 +726,7 @@ class Controller extends BaseController
elseif (($content = Content::loadCached($this->theme, $name)) === null)
throw new CmsException(Lang::get('cms::lang.content.not_found', ['name'=>$name]));
$filePath = $content->getFullPath();
$fileContent = $content->markup;
if (strtolower(File::extension($filePath)) == 'md')
$fileContent = Markdown::parse($fileContent);
$fileContent = $content->parsedMarkup;
/*
* Extensibility