Skip to content

Commit

Permalink
CKEditor: Set vimeo_embed in toolbars
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFQC committed Jun 3, 2020
1 parent 9aab29a commit 96683ea
Show file tree
Hide file tree
Showing 25 changed files with 54 additions and 30 deletions.
Expand Up @@ -36,7 +36,7 @@ protected function getNormalToolbar()
return [
['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'],
['Link', 'Unlink', 'Anchor', 'inserthtml'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
['Table', 'SpecialChar'],
[
'NumberedList',
Expand Down
Expand Up @@ -36,7 +36,7 @@ protected function getNormalToolbar()
return [
['Save', 'Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'],
['Link', 'Unlink', 'Anchor'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
['Table', 'SpecialChar'],
['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'TextColor', 'BGColor'],
'/',
Expand Down
13 changes: 10 additions & 3 deletions src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php
Expand Up @@ -64,7 +64,6 @@ class Basic extends Toolbar
'inserthtml',
'xml',
'qmarkersrolls',
'ckeditor_vimeo_embed',
];

/**
Expand All @@ -82,6 +81,9 @@ public function __construct(
$config = [],
$prefix = null
) {
$isAllowedToEdit = api_is_allowed_to_edit();
$isPlatformAdmin = api_is_platform_admin();

// Adding plugins depending of platform conditions
$plugins = [];

Expand All @@ -92,7 +94,7 @@ public function __construct(
if (api_get_setting('youtube_for_students') == 'true') {
$plugins[] = 'youtube';
} else {
if (api_is_allowed_to_edit() || api_is_platform_admin()) {
if ($isAllowedToEdit || $isPlatformAdmin) {
$plugins[] = 'youtube';
}
}
Expand Down Expand Up @@ -140,6 +142,10 @@ public function __construct(
$plugins[] = 'scayt';
}

if (api_get_configuration_sub_value('ckeditor_vimeo_embed/config') && ($isAllowedToEdit || $isPlatformAdmin)) {
$plugins[] = 'ckeditor_vimeo_embed';
}

$this->defaultPlugins = array_unique(array_merge($this->defaultPlugins, $plugins));

parent::__construct($toolbar, $config, $prefix);
Expand Down Expand Up @@ -241,7 +247,7 @@ protected function getMinimizedToolbar()
return [
$this->getNewPageBlock(),
['Undo', 'Redo'],
['Link', 'Image', 'Video', 'Oembed', 'Flash', 'Youtube', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
['Link', 'Image', 'Video', 'Oembed', 'Flash', 'Youtube', 'VimeoEmbed', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
Expand Down Expand Up @@ -269,6 +275,7 @@ protected function getMaximizedToolbar()
'Oembed',
'Flash',
'Youtube',
'VimeoEmbed',
'Audio',
'leaflet',
'Smiley',
Expand Down
Expand Up @@ -45,6 +45,7 @@ protected function getMaximizedToolbar()
'Video',
'Oembed',
'Youtube',
'VimeoEmbed',
'Flash',
'Audio',
'leaflet',
Expand Down Expand Up @@ -91,7 +92,7 @@ protected function getMinimizedToolbar()
return [
$this->getNewPageBlock(),
['Undo', 'Redo'],
['Link', 'Image', 'Video', 'Flash', 'Youtube', 'Audio', 'Table'],
['Link', 'Image', 'Video', 'Flash', 'Youtube', 'VimeoEmbed', 'Audio', 'Table'],
['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'],
Expand Down
Expand Up @@ -64,6 +64,7 @@ protected function getNormalToolbar()
'Flash',
'Oembed',
'Youtube',
'VimeoEmbed',
'Audio',
'Asciimath',
'Asciisvg',
Expand Down Expand Up @@ -108,6 +109,7 @@ protected function getMaximizedToolbar()
'Oembed',
'Flash',
'Youtube',
'VimeoEmbed',
'Audio',
'leaflet',
'Smiley',
Expand Down Expand Up @@ -156,6 +158,7 @@ protected function getMinimizedToolbar()
'Video',
'Flash',
'Youtube',
'VimeoEmbed',
'Audio',
'Table',
'Asciimath',
Expand Down
Expand Up @@ -48,6 +48,7 @@ protected function getMaximizedToolbar()
'Video',
'Oembed',
'Youtube',
'VimeoEmbed',
'Flash',
'Audio',
'leaflet',
Expand Down Expand Up @@ -104,6 +105,7 @@ protected function getNormalToolbar()
'Flash',
'Oembed',
'Youtube',
'VimeoEmbed',
'Audio',
'Asciimath',
],
Expand Down
Expand Up @@ -46,6 +46,7 @@ protected function getMaximizedToolbar()
'Video',
'Oembed',
'Youtube',
'VimeoEmbed',
'Flash',
'Audio',
'leaflet',
Expand Down
Expand Up @@ -36,7 +36,7 @@ protected function getNormalToolbar()
return [
['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'],
['Link', 'Unlink', 'Anchor'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
['Table', 'SpecialChar'],
[
'NumberedList',
Expand Down Expand Up @@ -71,7 +71,7 @@ protected function getMinimizedToolbar()
return [
$this->getNewPageBlock(),
['Undo', 'Redo'],
['Link', 'Image', 'Video', 'Oembed', 'Flash', 'Youtube', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
['Link', 'Image', 'Video', 'Oembed', 'Flash', 'Youtube', 'VimeoEmbed', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'],
Expand Down
Expand Up @@ -55,8 +55,6 @@ public function getConditionalPlugins()
*/
protected function getNormalToolbar()
{
$config = api_get_configuration_sub_value('ckeditor_vimeo_embed/config');

return [
['Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'],
['Link', 'Unlink', 'Anchor', 'inserthtml', 'Glossary'],
Expand All @@ -66,10 +64,10 @@ protected function getNormalToolbar()
'Flash',
'Oembed',
'Youtube',
'VimeoEmbed',
'Audio',
'Asciimath',
'Asciisvg',
empty($config) ? null : 'VimeoEmbed',
],
['Table', 'SpecialChar'],
[
Expand Down Expand Up @@ -101,8 +99,6 @@ protected function getNormalToolbar()
*/
protected function getMinimizedToolbar()
{
$config = api_get_configuration_sub_value('ckeditor_vimeo_embed/config');

return [
$this->getNewPageBlock(),
['Undo', 'Redo'],
Expand All @@ -112,7 +108,7 @@ protected function getMinimizedToolbar()
'Video',
'Flash',
'Youtube',
empty($config) ? null : 'VimeoEmbed',
'VimeoEmbed',
'Audio',
'Table',
'Asciimath',
Expand Down Expand Up @@ -157,6 +153,7 @@ protected function getMaximizedToolbar()
'Oembed',
'Flash',
'Youtube',
'VimeoEmbed',
'Audio',
'leaflet',
'Smiley',
Expand Down
Expand Up @@ -47,6 +47,7 @@ protected function getMaximizedToolbar()
'Video',
'Oembed',
'Youtube',
'VimeoEmbed',
'Flash',
'Audio',
'leaflet',
Expand Down Expand Up @@ -83,6 +84,7 @@ protected function getNormalToolbar()
'Flash',
'Oembed',
'Youtube',
'VimeoEmbed',
'Audio',
'Asciimath',
'Asciisvg',
Expand Down Expand Up @@ -117,7 +119,7 @@ protected function getMinimizedToolbar()
return [
$this->getNewPageBlock(),
['Undo', 'Redo'],
['Link', 'Image', 'Video', 'Youtube', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
['Link', 'Image', 'Video', 'Youtube', 'VimeoEmbed', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
['Toolbarswitch'],
Expand Down
Expand Up @@ -48,6 +48,7 @@ protected function getMaximizedToolbar()
'Video',
'Oembed',
'Youtube',
'VimeoEmbed',
'Flash',
'Audio',
'leaflet',
Expand Down Expand Up @@ -78,7 +79,7 @@ protected function getNormalToolbar()
{
return [
['Link', 'Unlink'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
['Table', 'Smiley'],
['TextColor', 'BGColor'],
['Source'],
Expand Down
Expand Up @@ -45,6 +45,7 @@ protected function getMaximizedToolbar()
'Video',
'Oembed',
'Youtube',
'VimeoEmbed',
'Flash',
'Audio',
'leaflet',
Expand Down Expand Up @@ -75,7 +76,7 @@ protected function getNormalToolbar()
return [
['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'],
['Link', 'Unlink', 'Anchor'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
['Table', 'SpecialChar'],
['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'TextColor', 'BGColor'],
'/',
Expand Down
Expand Up @@ -45,6 +45,7 @@ protected function getMaximizedToolbar()
'Video',
'Oembed',
'Youtube',
'VimeoEmbed',
'Flash',
'Audio',
'leaflet',
Expand Down Expand Up @@ -76,7 +77,7 @@ protected function getNormalToolbar()
return [
['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'],
['Link', 'Unlink', 'Anchor'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
['Table', 'SpecialChar'],
['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'TextColor', 'BGColor', '-', 'Source'],
'/',
Expand Down
Expand Up @@ -45,6 +45,7 @@ protected function getMaximizedToolbar()
'Video',
'Oembed',
'Youtube',
'VimeoEmbed',
'Flash',
'Audio',
'leaflet',
Expand Down Expand Up @@ -73,7 +74,7 @@ protected function getNormalToolbar()
return [
['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'],
['Link', 'Unlink', 'Anchor'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
['Table', 'Smiley'],
'/',
['Font', 'FontSize'],
Expand Down
Expand Up @@ -45,6 +45,7 @@ protected function getMaximizedToolbar()
'Video',
'Oembed',
'Youtube',
'VimeoEmbed',
'Flash',
'Audio',
'leaflet',
Expand Down Expand Up @@ -74,7 +75,7 @@ protected function getNormalToolbar()
return [
['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'],
['Link', 'Unlink', 'Anchor'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
['Table', 'leaflet'],
['Font', 'FontSize'],
['Bold', 'Italic', 'Underline'],
Expand Down
Expand Up @@ -45,6 +45,7 @@ protected function getMaximizedToolbar()
'Video',
'Oembed',
'Youtube',
'VimeoEmbed',
'Flash',
'Audio',
'leaflet',
Expand Down Expand Up @@ -74,7 +75,7 @@ protected function getNormalToolbar()
return [
['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'],
['Link', 'Unlink'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
['Table', 'leaflet'],
['Bold', 'Italic', 'Underline'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
Expand Down
Expand Up @@ -45,6 +45,7 @@ protected function getMaximizedToolbar()
'Video',
'Oembed',
'Youtube',
'VimeoEmbed',
'Flash',
'Audio',
'leaflet',
Expand Down
Expand Up @@ -46,6 +46,7 @@ protected function getMaximizedToolbar()
'Oembed',
'Flash',
'Youtube',
'VimeoEmbed',
'Audio',
'leaflet',
'Smiley',
Expand Down Expand Up @@ -88,7 +89,7 @@ protected function getMinimizedToolbar()
return [
$this->getNewPageBlock(),
['Undo', 'Redo'],
['Link', 'Image', 'Video', 'Oembed', 'Flash', 'Youtube', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
['Link', 'Image', 'Video', 'Oembed', 'Flash', 'Youtube', 'VimeoEmbed', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
[
Expand Down
Expand Up @@ -67,7 +67,7 @@ protected function getMaximizedToolbar()
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
['Link', 'Unlink', 'Anchor', 'Glossary'],
['Image', 'Mapping', 'Video', 'Oembed', 'Youtube', 'Flash', 'Audio', 'leaflet', 'Smiley', 'SpecialChar'],
['Image', 'Mapping', 'Video', 'Oembed', 'Youtube', 'VimeoEmbed', 'Flash', 'Audio', 'leaflet', 'Smiley', 'SpecialChar'],
'/',
['Table', '-', 'CreateDiv'],
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
Expand Down
Expand Up @@ -56,7 +56,7 @@ protected function getMaximizedToolbar()
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
['Link', 'Unlink', 'Anchor', 'Glossary'],
['Image', 'Mapping', 'Video', 'Oembed', 'Youtube', 'Flash', 'Audio', 'leaflet', 'Smiley', 'SpecialChar'],
['Image', 'Mapping', 'Video', 'Oembed', 'Youtube', 'VimeoEmbed', 'Flash', 'Audio', 'leaflet', 'Smiley', 'SpecialChar'],
['Asciimath', 'Asciisvg'],
'/',
['Table', '-', 'CreateDiv'],
Expand Down
Expand Up @@ -54,7 +54,7 @@ protected function getMaximizedToolbar()
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
['Link', 'Unlink', 'Anchor', 'Glossary'],
['Image', 'Mapping', 'Video', 'Oembed', 'Youtube', 'Flash', 'Audio', 'leaflet', 'Smiley', 'SpecialChar'],
['Image', 'Mapping', 'Video', 'Oembed', 'Youtube', 'VimeoEmbed', 'Flash', 'Audio', 'leaflet', 'Smiley', 'SpecialChar'],
['Asciimath', 'Asciisvg'],
'/',
['Table', '-', 'CreateDiv'],
Expand Down
Expand Up @@ -77,6 +77,7 @@ protected function getMaximizedToolbar()
'Video',
'Flash',
'Youtube',
'VimeoEmbed',
'Oembed',
'Audio',
'leaflet',
Expand Down Expand Up @@ -119,7 +120,7 @@ protected function getNormalToolbar()
return [
['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'],
['Link', 'Unlink'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'],
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
['Table', 'SpecialChar'],
[
'NumberedList',
Expand Down

0 comments on commit 96683ea

Please sign in to comment.