In the Drupal settings page for the Editor you have the possibility add and remove icons the way you want.
The problem is that the icons that are set as "default" in the javascript library ignore the settings coming from Drupal. Since the JS library automatically adds those set with default: true, value.

Witch creates some confusion since you can remove some icons and some not and often you don't want all of the default ones to be active.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Kopin created an issue. See original summary.

kopin’s picture

Status: Active » Needs review
FileSize
1.01 KB

I am now doing the same thing as for the selected icons, but I am filtering for the "Not selected" ones. Then i am passing them as an argument 'hideIcons' to the JS library, as specified in the library API.

I am not sure that this is the best way to do it but it seems to work nicely.

Patchfile attached

ademarco’s picture

Thank you for your contribution! I'm ok with the approach (i.e. hiding those icons that are not selected). Please find below my review:

+++ b/src/Plugin/Editor/SimpleMDE.php
@@ -145,11 +145,24 @@ class SimpleMDE extends EditorBase implements ContainerFactoryPluginInterface {
+    $js_settings['hideIcons']= array_keys(array_filter($settings['showIcons'], 'self::filterHiddenIcons'));

Could we use an anonymous function for callback instead? http://php.net/manual/en/functions.anonymous.php

ademarco’s picture

Status: Needs review » Needs work
kopin’s picture

Status: Needs work » Needs review
FileSize
743 bytes

Adding patch with anonymous function

ademarco’s picture

@Kopin you might want to actually always post the full patch containing all changes, like in this case remove_default_icons-2820307-5.patch should have contained remove_default_icons-2820307-1.patch for more info please check https://www.drupal.org/node/707484

I'll take care of merging them this time, so no need for extra work here, thanks! :)

  • ademarco committed 8041a37 on 8.x-1.x
    Issue #2820307 by Kopin: Removing icons from Editor.
    
ademarco’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.