Skip to content

Commit abd91cc

Browse files
author
Bizley
committed
1.2.0.1
Proper component uses for older php version with empty() (fixes #2 ) Fixed configuration of toolbar as array.
1 parent 7fcfb49 commit abd91cc

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

Quill.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* See the documentation for more details.
2323
*
2424
* @author Paweł Bizley Brzozowski
25-
* @version 1.2.0
25+
* @version 1.2.0.1
2626
* @license Apache 2.0
2727
* https://github.com/bizley/yii2-quill
2828
*
@@ -115,7 +115,7 @@ public function addModule($name)
115115
public function addModules()
116116
{
117117
if ($this->quillToolbar) {
118-
foreach ($this->quillToolbar->getModules() as $module) {
118+
foreach ($this->quillToolbar->modules as $module) {
119119
$this->addModule($module);
120120
}
121121
}
@@ -190,7 +190,7 @@ public function run()
190190
*/
191191
public function registerClientScript()
192192
{
193-
$view = $this->getView();
193+
$view = $this->view;
194194
$asset = Asset::register($view);
195195
$asset->theme = $this->_css;
196196

@@ -247,7 +247,7 @@ public function renderEditor($toolbar)
247247
*/
248248
public function renderToolbar()
249249
{
250-
if (!empty($this->quillToolbar->getElements())) {
250+
if (!empty($this->quillToolbar->elements)) {
251251
$toolbarId = 'toolbar-' . $this->id;
252252

253253
if (empty($this->configs['modules'])) {
@@ -318,7 +318,7 @@ public function addToolbar()
318318
*/
319319
public function getColors()
320320
{
321-
return $this->quillToolbar->getColors();
321+
return $this->quillToolbar->colors;
322322
}
323323

324324
/**

QuillToolbar.php

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Quill Toolbar helper class.
1212
*
1313
* @author Paweł Bizley Brzozowski
14-
* @version 1.2.0
14+
* @version 1.2.0.1
1515
* @license Apache 2.0
1616
* https://github.com/bizley/yii2-quill
1717
*
@@ -48,17 +48,20 @@ public function __construct($configuration, $componentConfig = [])
4848
if (!is_string($configuration) && !is_array($configuration)) {
4949
throw new InvalidConfigException('Toolbar configuration must be a string or an array!');
5050
}
51-
}
52-
if (is_string($configuration)) {
53-
switch ($configuration) {
54-
case Quill::TOOLBAR_FULL:
55-
$this->prepareFullToolbar();
56-
break;
57-
case Quill::TOOLBAR_BASIC:
58-
$this->prepareBasicToolbar();
59-
break;
60-
default:
61-
$this->_elements = (array)$configuration;
51+
if (is_string($configuration)) {
52+
switch ($configuration) {
53+
case Quill::TOOLBAR_FULL:
54+
$this->prepareFullToolbar();
55+
break;
56+
case Quill::TOOLBAR_BASIC:
57+
$this->prepareBasicToolbar();
58+
break;
59+
default:
60+
$this->_elements = (array)$configuration;
61+
}
62+
}
63+
if (is_array($configuration)) {
64+
$this->_elements = $configuration;
6265
}
6366
}
6467
parent::__construct($componentConfig);
@@ -209,7 +212,7 @@ public function renderAlignment()
209212
*/
210213
public function renderBackColor()
211214
{
212-
return $this->renderDropdown('rgb(0, 0, 0)', $this->getColors(),
215+
return $this->renderDropdown('rgb(0, 0, 0)', $this->colors,
213216
[
214217
'title' => Yii::t('app', 'Background Color'),
215218
'class' => 'ql-background'
@@ -470,7 +473,7 @@ public function renderStrikethrough()
470473
*/
471474
public function renderTextColor()
472475
{
473-
return $this->renderDropdown('rgb(0, 0, 0)', $this->getColors(),
476+
return $this->renderDropdown('rgb(0, 0, 0)', $this->colors,
474477
[
475478
'title' => Yii::t('app', 'Text Color'),
476479
'class' => 'ql-color'

0 commit comments

Comments
 (0)