From fd311ea90e488fa8821887df1883658fa125b9e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Do=CC=88rr?= Date: Thu, 21 Mar 2019 19:45:34 +0100 Subject: [PATCH] show ever, and is no provider set disable all --- lang/de_de.lang | 1 + lang/en_gb.lang | 1 + lang/es_es.lang | 1 + lang/sv_se.lang | 1 + lib/Cke5/Creator/Cke5ProfilesCreator.php | 20 ++++++++------------ pages/profiles.php | 4 ---- 6 files changed, 12 insertions(+), 16 deletions(-) diff --git a/lang/de_de.lang b/lang/de_de.lang index a2a0e58..094c070 100755 --- a/lang/de_de.lang +++ b/lang/de_de.lang @@ -50,6 +50,7 @@ cke5_media_category = Medienkagetorie cke5_upload_default = Image-Drag&Drop-Upload cke5_upload_default_description = Bilder können via drag+drop in das Textfeld gesetzt werden cke5_mediapath = Medienpfad +cke5_mediaembed = MediaEmbed Provider # profiles list & form actions rex_cke5_profiles_cloned = Profile wurde dupliziert diff --git a/lang/en_gb.lang b/lang/en_gb.lang index 08ba798..a82c300 100755 --- a/lang/en_gb.lang +++ b/lang/en_gb.lang @@ -50,6 +50,7 @@ cke5_media_category = Media-category cke5_upload_default = Image-Drag&Drop-Upload cke5_upload_default_description = Pictures can be put into the textarea via drag + drop cke5_mediapath = Mediapath +cke5_mediaembed = MediaEmbed Provider # profiles list & form actions rex_cke5_profiles_cloned = Profile was duplicated diff --git a/lang/es_es.lang b/lang/es_es.lang index bf3c092..cf8d646 100644 --- a/lang/es_es.lang +++ b/lang/es_es.lang @@ -50,6 +50,7 @@ cke5_media_category = Categoría de medios cke5_upload_default = Imagen-Arrastrar y Soltar-Subir cke5_upload_default_description = Las imágenes se pueden poner en textarea a través de arrastrar + soltar cke5_mediapath = Mediapath +cke5_mediaembed = MediaEmbed Provider # profiles list & form actions rex_cke5_profiles_cloned = El perfil fue duplicado diff --git a/lang/sv_se.lang b/lang/sv_se.lang index cb2c9a3..55475f4 100644 --- a/lang/sv_se.lang +++ b/lang/sv_se.lang @@ -50,6 +50,7 @@ cke5_media_category = Mediakagetori cke5_upload_default = Image-Drag&Drop-Upload cke5_upload_default_description = Bilder kan läggas i textfältet via drag + drop cke5_mediapath = Mediapath +cke5_mediaembed = MediaEmbed Provider # profiles list & form actions rex_cke5_profiles_cloned = Profilen duplicerades diff --git a/lib/Cke5/Creator/Cke5ProfilesCreator.php b/lib/Cke5/Creator/Cke5ProfilesCreator.php index 64e7b9a..944d447 100644 --- a/lib/Cke5/Creator/Cke5ProfilesCreator.php +++ b/lib/Cke5/Creator/Cke5ProfilesCreator.php @@ -20,12 +20,12 @@ class Cke5ProfilesCreator const TRANSLATION_PATH = 'vendor/ckeditor5-classic/translations/%s.js'; const EDITOR_SETTINGS = [ - 'cktypes' => ['heading', 'fontSize', 'fontFamily', 'alignment', 'link', 'highlight', 'insertTable', 'mediaEmbed'], + 'cktypes' => ['heading', 'fontSize', 'fontFamily', 'alignment', 'link', 'highlight', 'insertTable'], 'ckimgtypes' => ['rexImage', 'imageUpload'] ]; const ALLOWED_FIELDS = [ - 'toolbar' => ['|', 'heading', 'fontSize', 'fontFamily', 'alignment', 'bold', 'italic', 'underline', 'strikethrough', 'subscript','superscript', 'insertTable', 'code', 'link', 'rexImage', 'imageUpload', 'mediaEmbed', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo', 'highlight', 'emoji'], + 'toolbar' => ['|', 'heading', 'fontSize', 'fontFamily', 'alignment', 'bold', 'italic', 'underline', 'strikethrough', 'subscript', 'superscript', 'insertTable', 'code', 'link', 'rexImage', 'imageUpload', 'mediaEmbed', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo', 'highlight', 'emoji'], 'alignment' => ['left', 'right', 'center', 'justify'], 'table_toolbar' => ['tableColumn', 'tableRow', 'mergeTableCells'], 'heading' => ['paragraph', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'], @@ -140,11 +140,7 @@ public static function mapProfile(array $profile) $jsonProfile['highlight'] = ['options' => self::getHighlight(self::toArray($profile['highlight']))]; } - // "mediaEmbed": { - // "removeProviders": [ 'instagram', 'twitter', 'googleMaps', 'flickr', 'facebook' ] - // } - - if (in_array('mediaEmbed', $toolbar) && !empty($profile['mediaembed'])) { + if (!empty($profile['mediaembed'])) { $remove = array(); $hold = self::toArray($profile['mediaembed']); foreach (self::ALLOWED_FIELDS['providers'] as $value) { @@ -152,17 +148,17 @@ public static function mapProfile(array $profile) $remove[] = $value; } } - $jsonProfile['mediaEmbed'] = ['removeProviders' => $remove]; + $provider = $remove; + } else { + $provider = self::ALLOWED_FIELDS['providers']; } - - // "rexImage": {"media_type" : "testtype"}, - // "ckfinder": {"uploadUrl": ".\/index.php?cke5upload=1&media_type=testtype&media_category=2"} + $jsonProfile['mediaEmbed'] = ['removeProviders' => $provider]; if (in_array('rexImage', $toolbar)) { if (!empty($profile['mediatype'])) { $jsonProfile['rexImage'] = ['media_type' => $profile['mediatype']]; } else { - $jsonProfile['rexImage'] = ['media_path' => '/'. $profile['mediapath'] . '/']; + $jsonProfile['rexImage'] = ['media_path' => '/' . $profile['mediapath'] . '/']; } } diff --git a/pages/profiles.php b/pages/profiles.php index b61c08d..5bf2785 100644 --- a/pages/profiles.php +++ b/pages/profiles.php @@ -105,7 +105,6 @@ $profile = ''; $in_mediapath = ''; $mediapath = str_replace(['../', '/'], '', rex_url::media()); - $in_mediaembed = ''; if ($func == 'add') { $in_heading = 'in'; @@ -130,7 +129,6 @@ if (in_array('fontSize', $toolbar)) $in_fontsize = 'in'; if (in_array('link', $toolbar)) $in_rexlink = 'in'; if (in_array('highlight', $toolbar)) $in_highlight = 'in'; - if (in_array('mediaEmbed', $toolbar)) $in_mediaembed = 'in'; if (in_array('rexImage', $toolbar) || in_array('imageUpload', $toolbar)) $in_imagetoolbar = 'in'; $min_height = (int)$result[$prefix . 'min_height']; @@ -245,7 +243,6 @@ $form->addRawField(''); // mediaEmbed - $form->addRawField('
'); $field = $form->addTextField('mediaembed'); $field->setAttribute('id', 'cke5mediaEmbed-input'); $field->setAttribute('data-tag-init', 1); @@ -253,7 +250,6 @@ $field->setAttribute('data-tags', '["' . implode('","', Cke5ProfilesCreator::ALLOWED_FIELDS['providers']) . '"]'); $field->setLabel(rex_i18n::msg('cke5_mediaembed')); if ($default_value) $field->setAttribute('data-default-tags', 1); - $form->addRawField('
'); // default height $field = $form->addCheckboxField('height_default');