JoomlaPolska / jezyk-J4

Język polski dla Joomla 4
GNU General Public License v2.0
3 stars 5 forks source link

[5.2] Added link class selection to TinyMCE dialog #510

Open joomlapl-bot opened 4 months ago

joomlapl-bot commented 4 months ago

PR w związku ze zmianą oryginału https://github.com/joomla/joomla-cms/pull/43260 Poniżej zmiany w oryginale:

Click to expand the diff! ```diff diff --git a/administrator/language/en-GB/plg_editors_tinymce.ini b/administrator/language/en-GB/plg_editors_tinymce.ini index 7359a2b846992..162458329c143 100644 --- a/administrator/language/en-GB/plg_editors_tinymce.ini +++ b/administrator/language/en-GB/plg_editors_tinymce.ini @@ -44,6 +44,11 @@ PLG_TINY_FIELD_HTMLWIDTH_LABEL="HTML Width" PLG_TINY_FIELD_LABEL_ADVANCEDPARAMS="Advanced" PLG_TINY_FIELD_LANGCODE_LABEL="Language Code" PLG_TINY_FIELD_LANGSELECT_LABEL="Automatic Language Selection" +PLG_TINY_FIELD_LINK_CLASS_LIST_LABEL="Class List" +PLG_TINY_FIELD_LINK_CLASS_NAME_LABEL="Name" +PLG_TINY_FIELD_LINK_CLASS_NONE="None" +PLG_TINY_FIELD_LINK_CLASSES_LIST_DESC="Add default classes to the class dropdown in the create link dialog." +PLG_TINY_FIELD_LINK_CLASSES_LIST_LABEL="Link Classes List" PLG_TINY_FIELD_NEWLINES_LABEL="New Lines" PLG_TINY_FIELD_NUMBER_OF_SETS_LABEL="Number of Sets" PLG_TINY_FIELD_PASTE_AS_TEXT_LABEL="Paste As Text" diff --git a/plugins/editors/tinymce/forms/setoptions.xml b/plugins/editors/tinymce/forms/setoptions.xml index 8179e5772e684..5ac9971c11688 100644 --- a/plugins/editors/tinymce/forms/setoptions.xml +++ b/plugins/editors/tinymce/forms/setoptions.xml @@ -403,5 +403,33 @@ + +
+ + + + diff --git a/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php b/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php index be10b339218d4..4686bd6905d59 100644 --- a/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php +++ b/plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php @@ -382,6 +382,23 @@ public function display(string $name, string $content = '', array $attributes = // Merge the two toolbars for backwards compatibility $toolbar = array_merge($toolbar1, $toolbar2); + // Set default classes to empty + $linkClasses = []; + + // Load the link classes list + if (isset($extraOptions->link_classes_list) && $extraOptions->link_classes_list) { + $linksClassesList = $extraOptions->link_classes_list; + + if ($linksClassesList) { + $linkClasses = [['title' => TEXT::_('PLG_TINY_FIELD_LINK_CLASS_NONE'), 'value' => '']]; + + // Create an array for the link classes + foreach ($linksClassesList as $linksClassList) { + array_push($linkClasses, ['title' => $linksClassList->class_name, 'value' => $linksClassList->class_list]); + } + } + } + // Build the final options set $scriptOptions = array_merge( $scriptOptions, @@ -424,6 +441,9 @@ public function display(string $name, string $content = '', array $attributes = 'relative_urls' => (bool) $levelParams->get('relative_urls', true), 'remove_script_host' => false, + // Link classes + 'link_class_list' => $linkClasses, + // Drag and drop Images always FALSE, reverting this allows for inlining the images 'paste_data_images' => false, ```