Skip to content

Commit

Permalink
1.2.0.1
Browse files Browse the repository at this point in the history
Proper component uses for older php version with empty() (fixes #2 )
Fixed configuration of toolbar as array.
  • Loading branch information
Bizley committed Aug 1, 2016
1 parent 7fcfb49 commit abd91cc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
10 changes: 5 additions & 5 deletions Quill.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* See the documentation for more details.
*
* @author Paweł Bizley Brzozowski
* @version 1.2.0
* @version 1.2.0.1
* @license Apache 2.0
* https://github.com/bizley/yii2-quill
*
Expand Down Expand Up @@ -115,7 +115,7 @@ public function addModule($name)
public function addModules()
{
if ($this->quillToolbar) {
foreach ($this->quillToolbar->getModules() as $module) {
foreach ($this->quillToolbar->modules as $module) {
$this->addModule($module);
}
}
Expand Down Expand Up @@ -190,7 +190,7 @@ public function run()
*/
public function registerClientScript()
{
$view = $this->getView();
$view = $this->view;
$asset = Asset::register($view);
$asset->theme = $this->_css;

Expand Down Expand Up @@ -247,7 +247,7 @@ public function renderEditor($toolbar)
*/
public function renderToolbar()
{
if (!empty($this->quillToolbar->getElements())) {
if (!empty($this->quillToolbar->elements)) {
$toolbarId = 'toolbar-' . $this->id;

if (empty($this->configs['modules'])) {
Expand Down Expand Up @@ -318,7 +318,7 @@ public function addToolbar()
*/
public function getColors()
{
return $this->quillToolbar->getColors();
return $this->quillToolbar->colors;
}

/**
Expand Down
31 changes: 17 additions & 14 deletions QuillToolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Quill Toolbar helper class.
*
* @author Paweł Bizley Brzozowski
* @version 1.2.0
* @version 1.2.0.1
* @license Apache 2.0
* https://github.com/bizley/yii2-quill
*
Expand Down Expand Up @@ -48,17 +48,20 @@ public function __construct($configuration, $componentConfig = [])
if (!is_string($configuration) && !is_array($configuration)) {
throw new InvalidConfigException('Toolbar configuration must be a string or an array!');
}
}
if (is_string($configuration)) {
switch ($configuration) {
case Quill::TOOLBAR_FULL:
$this->prepareFullToolbar();
break;
case Quill::TOOLBAR_BASIC:
$this->prepareBasicToolbar();
break;
default:
$this->_elements = (array)$configuration;
if (is_string($configuration)) {
switch ($configuration) {
case Quill::TOOLBAR_FULL:
$this->prepareFullToolbar();
break;
case Quill::TOOLBAR_BASIC:
$this->prepareBasicToolbar();
break;
default:
$this->_elements = (array)$configuration;
}
}
if (is_array($configuration)) {
$this->_elements = $configuration;
}
}
parent::__construct($componentConfig);
Expand Down Expand Up @@ -209,7 +212,7 @@ public function renderAlignment()
*/
public function renderBackColor()
{
return $this->renderDropdown('rgb(0, 0, 0)', $this->getColors(),
return $this->renderDropdown('rgb(0, 0, 0)', $this->colors,
[
'title' => Yii::t('app', 'Background Color'),
'class' => 'ql-background'
Expand Down Expand Up @@ -470,7 +473,7 @@ public function renderStrikethrough()
*/
public function renderTextColor()
{
return $this->renderDropdown('rgb(0, 0, 0)', $this->getColors(),
return $this->renderDropdown('rgb(0, 0, 0)', $this->colors,
[
'title' => Yii::t('app', 'Text Color'),
'class' => 'ql-color'
Expand Down

0 comments on commit abd91cc

Please sign in to comment.