Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuell1 committed Jul 5, 2018
2 parents 26e0e63 + 876ba48 commit d08ab59
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ http://octobercms.com/plugin/samuell-contenteditor
* file - Content block filename to edit, optional. If doesnt exists it will autocreate
* fixture - Fixed name for content block, useful for inline texts (headers, spans...)
* tools - List of enabled tools, comma separated (for all default tools use `*` or leave empty to get all tools defined in settings of Content Editor)
* class - Class for element, mostly useful for fixtures

*Example:*
```
{% component 'contenteditor' file="filename_in_content.htm" fixture="h3" tools="bold,italic" %}
{% component 'contenteditor' file="filename_in_content.htm" fixture="h3" tools="bold,italic" class="my-class" %}
```

##### Tools list
Expand Down
6 changes: 4 additions & 2 deletions components/ContentEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class ContentEditor extends ComponentBase
public $file;
public $fixture;
public $tools;
public $class;
public $buttons;
public $palettes;

Expand Down Expand Up @@ -46,7 +47,7 @@ public function defineProperties()
'title' => 'List of enabled tools',
'description' => 'List of enabled tools for selected content (for all use *)',
'default' => ''
]
],
];
}

Expand All @@ -73,11 +74,12 @@ public function onRun()
public function onRender()
{
$this->additional_styles = Settings::renderCss();
$this->renderCount += 1;
$this->renderCount = $this->page['renderCount'] += 1;

$this->file = $this->setFile($this->property('file'));
$this->fixture = $this->property('fixture');
$this->tools = $this->property('tools');
$this->class = $this->property('class');

$content = $this->getFile();

Expand Down
3 changes: 2 additions & 1 deletion components/contenteditor/default.htm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
{% if __SELF__.fixture %}data-fixture data-ce-tag="p"{% else %}data-editable{% endif %}
data-component="{{ __SELF__ }}::onSave"
data-file="{{ __SELF__.file }}"
data-tools="{{ __SELF__.tools }}">
data-tools="{{ __SELF__.tools }}"
{% if __SELF__.class %}class="{{ class }}"{% endif %}>
{{ __SELF__.content|raw }}
</{% if __SELF__.fixture %}{{ __SELF__.fixture }}{% else %}div{% endif %}>

Expand Down
2 changes: 1 addition & 1 deletion components/contenteditor/render.htm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

{% if __SELF__.fixture %}<{{ __SELF__.fixture }}>{% endif %}
{% if __SELF__.fixture %}<{{ __SELF__.fixture }} {% if __SELF__.class %}class="__SELF__.class"{% endif %}>{% endif %}
{{ content|raw }}
{% if __SELF__.fixture %}</{{ __SELF__.fixture }}>{% endif %}

Expand Down
10 changes: 7 additions & 3 deletions models/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ class Settings extends Model

const CACHE_KEY = 'samuell:contenteditor.additional_styles';

public function initSettingsData() {
public function initSettingsData()
{
$this->additional_styles = File::get(plugins_path().'/samuell/contenteditor/assets/additional-css.css');
}

// list of buttons
public function getEnabledButtonsOptions() {
public function getEnabledButtonsOptions()
{
return [
'bold' => 'Bold (b)',
'italic' => 'Italic (i)',
Expand Down Expand Up @@ -54,7 +56,8 @@ public function getEnabledButtonsOptions() {
}

// list of allowed tags
public function getAllowedTagsOptions() {
public function getAllowedTagsOptions()
{
return [
'p',
'img',
Expand Down Expand Up @@ -95,6 +98,7 @@ public static function renderCss()
}
return $customCss;
}

public static function compileCss()
{
$parser = new Less_Parser(['compress' => true]);
Expand Down
3 changes: 3 additions & 0 deletions updates/version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@
1.0.8: Fix BackendAuth issue for build 420
1.0.9: Fix missing fixture in render component
1.1.0: Fix SELF prefix for fixtures
1.2.0:
- Support classes for fixture
- Fix renderCount if component using other alias name

0 comments on commit d08ab59

Please sign in to comment.