Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F804041
D247.id801.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Feb 26, 9:04 AM
Size
6 KB
Mime Type
text/x-diff
Expires
Thu, Feb 27, 9:04 AM (4 h, 48 m)
Engine
blob
Format
Raw Data
Handle
576755
Attached To
D247: INP-1583 - Add support for "Content Templates" inside CKEditor
D247.id801.diff
View Options
Index: branches/5.3.x/admin/system_presets/simple/inp_ckconfig.js
===================================================================
--- branches/5.3.x/admin/system_presets/simple/inp_ckconfig.js
+++ branches/5.3.x/admin/system_presets/simple/inp_ckconfig.js
@@ -40,12 +40,12 @@
['Styles'],
['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'],
['NumberedList', 'BulletedList', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
- ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Image', 'Document', 'MediaEmbed', 'Link', '-', 'Undo', 'Redo'],
+ ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', /*'Templates', '-',*/ 'Image', 'Document', 'MediaEmbed', 'Link', '-', 'Undo', 'Redo'],
['Find', 'Replace', 'Scayt']
];
CKEDITOR.config.toolbar_DebugMode = [
- ['Cut','Copy','Paste','PasteText','PasteFromWord','-','NewPage','SelectAll','-','Find','Replace','-','Print','Preview','-',/*My*/ 'Link','Unlink','Anchor','HorizontalRule','-',/*My*/ 'Image','Flash','MediaEmbed','Document','Table','SpecialChar'],
+ ['Cut','Copy','Paste','PasteText','PasteFromWord','-',/*'Templates','-',*/'NewPage','SelectAll','-','Find','Replace','-','Print','Preview','-',/*My*/ 'Link','Unlink','Anchor','HorizontalRule','-',/*My*/ 'Image','Flash','MediaEmbed','Document','Table','SpecialChar'],
'/',
['Bold','Italic','Underline','Strike','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','NumberedList','BulletedList','Outdent','Indent','-','Subscript','Superscript','-','TextColor','BGColor','-','Undo','Redo'],
'/',
@@ -54,7 +54,7 @@
CKEDITOR.config.toolbar_Inline = [
['InlineSave', 'InlineCancel'],
- ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Image', 'Document', 'MediaEmbed', 'Link', '-', 'Undo', 'Redo'],
+ ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', /*'Templates', '-',*/ 'Image', 'Document', 'MediaEmbed', 'Link', '-', 'Undo', 'Redo'],
['Find', 'Replace', 'Scayt'],
'/',
['Styles'], ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'],
@@ -129,3 +129,5 @@
// add ability to browse for documents
//CKEDITOR.config.documentsBrowser = true ;
+
+CKEDITOR.config.templates_replaceContent = false;
Index: branches/5.3.x/core/admin_templates/js/inp_ckconfig.js
===================================================================
--- branches/5.3.x/core/admin_templates/js/inp_ckconfig.js
+++ branches/5.3.x/core/admin_templates/js/inp_ckconfig.js
@@ -37,7 +37,7 @@
CKEDITOR.config.documentIconsUrl = '/system/user_files/icons'; // for document custom plugin
CKEDITOR.config.toolbar_Default = [
- ['Cut','Copy','Paste','PasteText','PasteFromWord','-','NewPage','SelectAll','-','Find','Replace','-','Print','Preview','-',/*My*/ 'Link','Unlink','Anchor','HorizontalRule','-',/*My*/ 'Image','Flash','MediaEmbed','Document','Table','SpecialChar'],
+ ['Cut','Copy','Paste','PasteText','PasteFromWord','-',/*'Templates','-',*/'NewPage','SelectAll','-','Find','Replace','-','Print','Preview','-',/*My*/ 'Link','Unlink','Anchor','HorizontalRule','-',/*My*/ 'Image','Flash','MediaEmbed','Document','Table','SpecialChar'],
'/',
['Bold','Italic','Underline','Strike','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','NumberedList','BulletedList','Outdent','Indent','-','Subscript','Superscript','-','TextColor','BGColor','-','Undo','Redo'],
'/',
@@ -45,7 +45,7 @@
];
CKEDITOR.config.toolbar_DebugMode = [
- ['Cut','Copy','Paste','PasteText','PasteFromWord','-','NewPage','SelectAll','-','Find','Replace','-','Print','Preview','-',/*My*/ 'Link','Unlink','Anchor','HorizontalRule','-',/*My*/ 'Image','Flash','MediaEmbed','Document','Table','SpecialChar'],
+ ['Cut','Copy','Paste','PasteText','PasteFromWord','-',/*'Templates','-',*/'NewPage','SelectAll','-','Find','Replace','-','Print','Preview','-',/*My*/ 'Link','Unlink','Anchor','HorizontalRule','-',/*My*/ 'Image','Flash','MediaEmbed','Document','Table','SpecialChar'],
'/',
['Bold','Italic','Underline','Strike','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','NumberedList','BulletedList','Outdent','Indent','-','Subscript','Superscript','-','TextColor','BGColor','-','Undo','Redo'],
'/',
@@ -54,7 +54,7 @@
CKEDITOR.config.toolbar_Inline = [
['InlineSave', 'InlineCancel'],
- ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Image', 'Document', 'MediaEmbed', 'Link', '-', 'Undo', 'Redo'],
+ ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', /*'Templates', '-',*/ 'Image', 'Document', 'MediaEmbed', 'Link', '-', 'Undo', 'Redo'],
['Find', 'Replace', 'Scayt'],
'/',
['Styles'], ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'],
@@ -129,3 +129,5 @@
// add ability to browse for documents
//CKEDITOR.config.documentsBrowser = true ;
+
+CKEDITOR.config.templates_replaceContent = false;
Index: branches/5.3.x/core/units/helpers/fck_helper.php
===================================================================
--- branches/5.3.x/core/units/helpers/fck_helper.php
+++ branches/5.3.x/core/units/helpers/fck_helper.php
@@ -462,7 +462,7 @@
{
$editor->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);
}
/**
Event Timeline
Log In to Comment