Skip to content

Commit e80cd5b

Browse files
committed
Fix MODX 2.5.1 issue
* origin/pr/20: Fixing MODX 2.5.1 issue
2 parents 32e4e43 + 4649e3a commit e80cd5b

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

core/components/tinymce/docs/changelog.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
This file shows the changes in recent releases of TinyMCE for MODx. The most current release is usually the
33
development release, and is only shown to give an idea of what's currently in the pipeline.
44

5+
TinyMCE 4.3.4
6+
====================================
7+
- Use modx->controller->addJavascript/addHtml/etc to fix issue in MODX Revolution 2.5.1
8+
59
TinyMCE 4.3.3
610
====================================
711
- Change popup windows to more convenient modals

core/components/tinymce/tinymce.class.php

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -148,21 +148,19 @@ public function initialize() {
148148
$this->modx->getVersionData();
149149
$inRevo20 = (boolean)version_compare($this->modx->version['full_version'],'2.1.0-rc1','<');
150150

151-
$this->modx->regClientStartupScript($this->config['assetsUrl'].'jscripts/tiny_mce/'.$scriptFile);
152-
$this->modx->regClientStartupScript($this->config['assetsUrl'].'xconfig.js');
151+
$this->modx->controller->addJavascript($this->config['assetsUrl'].'jscripts/tiny_mce/'.$scriptFile);
152+
$this->modx->controller->addJavascript($this->config['assetsUrl'].'xconfig.js');
153153
if ($compressJs) {
154-
$this->modx->regClientStartupScript($this->config['assetsUrl'].'tiny.min.js');
154+
$this->modx->controller->addJavascript($this->config['assetsUrl'].'tiny.min.js');
155155
} else {
156-
$this->modx->regClientStartupScript($this->config['assetsUrl'].'tiny.js');
156+
$this->modx->controller->addJavascript($this->config['assetsUrl'].'tiny.js');
157157
}
158158

159159
$source = $this->context->getOption('default_media_source',1);
160-
$this->modx->regClientStartupHTMLBlock('<script type="text/javascript">' . "\n//<![CDATA[" . "\nvar inRevo20 = ".($inRevo20 ? 1 : 0).";MODx.source = '".$source."';Tiny.lang = " . $this->modx->toJSON($lang). ';' . "\n//]]>" . "\n</script>");
160+
$this->modx->controller->addHtml('<script type="text/javascript">' . "\n//<![CDATA[" . "\nvar inRevo20 = ".($inRevo20 ? 1 : 0).";MODx.source = '".$source."';Tiny.lang = " . $this->modx->toJSON($lang). ';' . "\n//]]>" . "\n</script>");
161161
if (!$compressJs) {
162-
$this->modx->regClientStartupScript($this->config['assetsUrl'].'tinymce.panel.js');
162+
$this->modx->controller->addJavascript($this->config['assetsUrl'].'tinymce.panel.js');
163163
}
164-
165-
166164
$this->jsLoaded = true;
167165
}
168166
return $this->getScript();
@@ -228,21 +226,17 @@ public function getScript() {
228226
unset($this->properties['elements']);
229227
$richtextResource = false; /* workaround for modx ui bug with rte tvs */
230228
}
231-
$this->config['resource'] = $this->config['resource']->toArray();
232229
}
233230
$templates = $this->getTemplateList();
234231

235-
/* get formats */
236-
//$this->properties['formats'] = $this->getFormats();
237232
/* get JS */
238233
unset($this->properties['resource']);
239234
ob_start();
240235
include_once dirname(__FILE__).'/templates/script.tpl';
241236
$script = ob_get_contents();
242237
ob_end_clean();
243238

244-
/* will need to do $this->modx->controller->addHtml() for Revo 2.2+ */
245-
$this->modx->regClientStartupHTMLBlock($script);
239+
$this->modx->controller->addHtml($script);
246240
return '';
247241
}
248242

@@ -354,4 +348,4 @@ public function getFormats() {
354348
),
355349
),
356350
);
357-
*/
351+
*/

0 commit comments

Comments
 (0)