Index: branches/5.3.x/core/units/helpers/fck_helper.php =================================================================== diff -u -N -r16519 -r16594 --- branches/5.3.x/core/units/helpers/fck_helper.php (.../fck_helper.php) (revision 16519) +++ branches/5.3.x/core/units/helpers/fck_helper.php (.../fck_helper.php) (revision 16594) @@ -1,6 +1,6 @@ lateLoad = array_key_exists('late_load', $tag_params) && $tag_params['late_load']; - list($styles_css, $styles_js) = $this->getStyles(); + list($styles_css, $styles_js, $templates_js) = $this->getStyles($tag_params); if ( isset($tag_params['toolbar']) ) { $toolbar = $tag_params['toolbar']; @@ -485,6 +485,10 @@ 'language' => $this->getLanguage(), ); + if ( $templates_js ) { + $editor->config['templates_files'] = array($templates_js); + } + $this->injectTransitParams($editor, $this->getTransitParams($tag_params)); return $editor; @@ -524,11 +528,13 @@ } /** - * Returns url to CSS and JS style configuration. + * Returns url to CSS, JS style configuration and HTML templates. * + * @param array $tag_params Tag params (useful during customizations). + * * @return array */ - protected function getStyles() + protected function getStyles(array $tag_params = array()) { /** @var ThemeItem $theme */ $theme = $this->Application->recallObject('theme.current'); @@ -555,7 +561,18 @@ $styles_js = $stylesheet_folder_url . 'styles.js'; - return array($styles_css, $styles_js); + /** @var FileHelper $file_helper */ + $file_helper = $this->Application->recallObject('FileHelper'); + $stylesheet_folder_path = $file_helper->urlToPath($stylesheet_folder_url); + + if ( file_exists($stylesheet_folder_path . 'templates.js') ) { + $templates_js = $stylesheet_folder_url . 'templates.js'; + } + else { + $templates_js = ''; + } + + return array($styles_css, $styles_js, $templates_js); } /**