Skip to content
Snippets Groups Projects
Commit 9d9e974f authored by Alex Arnaud's avatar Alex Arnaud
Browse files

dev#160166 : CkEditor placeholders plugin

This plugin adds 2 buttons (records and articles)
that print a corresponding placeholder.
parent 65de9ccc
Branches
Tags
No related merge requests found
Pipeline #25512 failed with stage
in 22 minutes and 45 seconds
......@@ -3,6 +3,7 @@
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.addExternal('bokeh_kiosk' , CKEDITOR.basePath+'../public/opac/js/ckeditor_plugins/bokeh_kiosk/','plugin.js');
CKEDITOR.plugins.addExternal('bokeh_placeholders' , CKEDITOR.basePath+'../public/opac/js/ckeditor_plugins/bokeh_placeholders/','plugin.js');
CKEDITOR.stylesSet.add('default',[
{ name:'Normal', element:'p' },
......
......@@ -46,7 +46,7 @@ class ZendAfi_Form_Admin_Newsletter extends ZendAfi_Form {
->addElement('checkbox', 'draft',
['label' => $this->_('Brouillon ?')])
->addElement('ckeditor', 'contenu',
->addElement('ckeditor', 'newsletter_content',
['required' => true,
'allowEmpty' => false])
......@@ -73,7 +73,7 @@ class ZendAfi_Form_Admin_Newsletter extends ZendAfi_Form {
'letter',
['legend' => $this->_('Lettre')])
->addDisplayGroup(['contenu'],
->addDisplayGroup(['newsletter_content'],
'contenu_html',
['legend' => $this->_('Contenu HTML')])
......
......@@ -50,16 +50,18 @@ class ZendAfi_View_Helper_CkEditor extends ZendAfi_View_Helper_BaseHelper {
$config['contentsCss'] = Class_Template::current()->getContentsCss();
$config['toolbar'] = [
['Preview', 'Templates', 'Source','Maximize'],
['Cut','Copy','Paste','PasteFromWord'],
['Undo','Redo','-','SelectAll','RemoveFormat'],
['Scayt'],
'/',
['HorizontalRule'],
['Link','Unlink','Anchor'],
['Image','Table','Iframe','oembed','Slideshow', 'SpecialChar','Kiosk'],
];
$config['toolbar'] = [['Preview', 'Templates', 'Source','Maximize'],
['Cut','Copy','Paste','PasteFromWord'],
['Undo','Redo','-','SelectAll','RemoveFormat'],
['Scayt'],
'/',
['HorizontalRule'],
['Link','Unlink','Anchor'],
['Image','Table','Iframe','oembed','Slideshow', 'SpecialChar','Kiosk']];
if ($editorId == 'newsletter_content')
foreach (['Records', 'Articles'] as $button)
$config['toolbar'][7][] = $button;
$config['extraAllowedContent'] = [
'audio video' => [
......@@ -105,7 +107,7 @@ class ZendAfi_View_Helper_CkEditor extends ZendAfi_View_Helper_BaseHelper {
'action' => 'get-form',
'code' => Class_Systeme_ModulesAccueil_Kiosque::CODE,
'render' => 'popup']);
$config['extraPlugins'] = 'colordialog,bokeh_kiosk';
$config['extraPlugins'] = 'colordialog,bokeh_kiosk,bokeh_placeholders';
$config = (new Class_AdminVar_CkEditorConfig)->injectInto($config);
......
public/opac/js/ckeditor_plugins/bokeh_placeholders/icons/articles.png

200 B

public/opac/js/ckeditor_plugins/bokeh_placeholders/icons/records.png

209 B

CKEDITOR.plugins.setLang( 'bokeh_placeholders', 'en', {
insertRecords: 'Insert the records linked to the newsletter',
insertArticles: 'Insert the records linked to the newsletter',
});
CKEDITOR.plugins.setLang( 'bokeh_placeholders', 'fr', {
insertRecords: 'Insérer les notices liées à la lettre d\'information',
insertArticles: 'Insérer les articles liés à la lettre d\'information',
});
CKEDITOR.plugins.add('bokeh_placeholders', {
lang : [ 'en', 'fr' ],
init: function(editor) {
var lang = editor.lang['bokeh_placeholders'];
editor.addCommand('insertRecords', {
exec: function(editor) {
editor.insertHtml('[newsletter_records]');
}
});
editor.addCommand('insertArticles', {
exec: function(editor) {
editor.insertHtml('[newsletter_articles]');
}
});
editor.ui.addButton('Records', {
label: lang.insertRecords,
icon: this.path + 'icons/records.png',
command: 'insertRecords',
toolbar: 'insert'
});
editor.ui.addButton('Articles', {
label: lang.insertArticles,
icon: this.path + 'icons/articles.png',
command: 'insertArticles',
toolbar: 'insert'
});
}
});
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment