Skip to content

Commit

Permalink
Update RoxyMceWidget.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Jennifer Melzer authored Mar 2, 2022
1 parent 87f81aa commit e69a9cb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/widgets/RoxyMceWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class RoxyMceWidget extends Widget {
* @var string function callback of setup.
* @see https://www.tiny.cloud/docs-4x/demo/custom-toolbar-menu-button/
*/
public $setup = '{}';
public $setup = null;

/**
* @var array function callback of setup.
Expand Down Expand Up @@ -174,9 +174,15 @@ public function init() {
* @throws InvalidParamException
*/
public function run() {
$this->view->registerJs('$(function() {
if ($this->setup != null) {
$this->view->registerJs('$(function() {
tinyMCE.init({' . substr(Json::encode($this->clientOptions), 1, - 1) . ', "setup": ' . $this->setup . ', "file_browser_callback": RoxyFileBrowser});
});', View::POS_HEAD);
} else {
$this->view->registerJs('$(function() {
tinyMCE.init({' . substr(Json::encode($this->clientOptions), 1, - 1) . ', "file_browser_callback": RoxyFileBrowser});
});', View::POS_HEAD);
}
$this->view->registerJs('function RoxyFileBrowser(field_name, url, type, win) {
var roxyMce = "' . $this->action . '";
if(roxyMce.indexOf("?") < 0) {
Expand Down

0 comments on commit e69a9cb

Please sign in to comment.