FriendsOfSymfony / FOSCKEditorBundle

Provides a CKEditor integration for your Symfony project.
Other
518 stars 83 forks source link

Full/default toolbar not working #186

Closed kubaceg closed 5 years ago

kubaceg commented 5 years ago

I have problem with default toolbar config. I see only really basic toolbar but I want to see full version: image

Here is my ck_editor.yaml

fos_ck_editor:
  default_config: default
  configs:
    default:
      filebrowserBrowseRoute: elfinder
      filebrowserBrowseRouteParameters: []

fm_elfinder.yaml:

fm_elfinder:
    instances:
        default:
            locale: '%locale%'
            editor: 'ckeditor'
            include_assets: true
            relative_path: true
            fullscreen: true
            connector:
                roots:
                    uploads:
                        driver: LocalFileSystem
                        path: "%kernel.project_dir%/public/wyswig"
                        url: "%env(APP_URL)%/wyswig/"

Here is generated HTML:

<div class="col-xs-12 ">
                <div class="form-group  field-ckeditor"><label class="col-sm-2 control-label required" for="article_content">Content</label><div class="col-sm-10"><textarea id="article_content" name="article[content]" style="visibility: hidden; display: none;"></textarea><div id="cke_article_content" class="cke_1 cke cke_reset cke_chrome cke_editor_article_content cke_ltr cke_browser_webkit" dir="ltr" lang="en" role="application" aria-labelledby="cke_article_content_arialbl"><span id="cke_article_content_arialbl" class="cke_voice_label">Rich Text Editor, article_content</span><div class="cke_inner cke_reset" role="presentation"><span id="cke_1_top" class="cke_top cke_reset_all" role="presentation" style="height: auto; user-select: none;"><span id="cke_11" class="cke_voice_label">Editor toolbars</span><span id="cke_1_toolbox" class="cke_toolbox" role="group" aria-labelledby="cke_11" onmousedown="return false;"><span id="cke_12" class="cke_toolbar" aria-labelledby="cke_12_label" role="toolbar"><span id="cke_12_label" class="cke_voice_label">Styles</span><span class="cke_toolbar_start"></span><span class="cke_toolgroup" role="presentation"><a id="cke_13" class="cke_button cke_button__bold cke_button_off" href="javascript:void('Bold')" title="Bold (Ctrl+B)" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_13_label" aria-describedby="cke_13_description" aria-haspopup="false" aria-disabled="false" onkeydown="return CKEDITOR.tools.callFunction(2,event);" onfocus="return CKEDITOR.tools.callFunction(3,event);" onclick="CKEDITOR.tools.callFunction(4,this);return false;"><span class="cke_button_icon cke_button__bold_icon" style="background-image:url('https://zeremi.com/bundles/fosckeditor/plugins/icons.png?t=J39A');background-position:0 -24px;background-size:auto;">&nbsp;</span><span id="cke_13_label" class="cke_button_label cke_button__bold_label" aria-hidden="false">Bold</span><span id="cke_13_description" class="cke_button_label" aria-hidden="false">Keyboard shortcut Ctrl+B</span></a><a id="cke_14" class="cke_button cke_button__italic cke_button_off" href="javascript:void('Italic')" title="Italic (Ctrl+I)" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_14_label" aria-describedby="cke_14_description" aria-haspopup="false" aria-disabled="false" onkeydown="return CKEDITOR.tools.callFunction(5,event);" onfocus="return CKEDITOR.tools.callFunction(6,event);" onclick="CKEDITOR.tools.callFunction(7,this);return false;"><span class="cke_button_icon cke_button__italic_icon" style="background-image:url('https://zeremi.com/bundles/fosckeditor/plugins/icons.png?t=J39A');background-position:0 -48px;background-size:auto;">&nbsp;</span><span id="cke_14_label" class="cke_button_label cke_button__italic_label" aria-hidden="false">Italic</span><span id="cke_14_description" class="cke_button_label" aria-hidden="false">Keyboard shortcut Ctrl+I</span></a><a id="cke_15" class="cke_button cke_button__strike cke_button_off" href="javascript:void('Strikethrough')" title="Strikethrough" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_15_label" aria-describedby="cke_15_description" aria-haspopup="false" aria-disabled="false" onkeydown="return CKEDITOR.tools.callFunction(8,event);" onfocus="return CKEDITOR.tools.callFunction(9,event);" onclick="CKEDITOR.tools.callFunction(10,this);return false;"><span class="cke_button_icon cke_button__strike_icon" style="background-image:url('https://zeremi.com/bundles/fosckeditor/plugins/icons.png?t=J39A');background-position:0 -72px;background-size:auto;">&nbsp;</span><span id="cke_15_label" class="cke_button_label cke_button__strike_label" aria-hidden="false">Strikethrough</span><span id="cke_15_description" class="cke_button_label" aria-hidden="false"></span></a><a id="cke_16" class="cke_button cke_button__link cke_button_off" href="javascript:void('Link')" title="Link (Ctrl+K)" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_16_label" aria-describedby="cke_16_description" aria-haspopup="false" aria-disabled="false" onkeydown="return CKEDITOR.tools.callFunction(11,event);" onfocus="return CKEDITOR.tools.callFunction(12,event);" onclick="CKEDITOR.tools.callFunction(13,this);return false;"><span class="cke_button_icon cke_button__link_icon" style="background-image:url('https://zeremi.com/bundles/fosckeditor/plugins/icons.png?t=J39A');background-position:0 -1272px;background-size:auto;">&nbsp;</span><span id="cke_16_label" class="cke_button_label cke_button__link_label" aria-hidden="false">Link</span><span id="cke_16_description" class="cke_button_label" aria-hidden="false">Keyboard shortcut Ctrl+K</span></a></span><span class="cke_toolbar_end"></span></span><span id="cke_17" class="cke_toolbar" aria-labelledby="cke_17_label" role="toolbar"><span id="cke_17_label" class="cke_voice_label">lists</span><span class="cke_toolbar_start"></span><span class="cke_toolgroup" role="presentation"><a id="cke_18" class="cke_button cke_button__bulletedlist cke_button_off" href="javascript:void('Insert/Remove Bulleted List')" title="Insert/Remove Bulleted List" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_18_label" aria-describedby="cke_18_description" aria-haspopup="false" aria-disabled="false" onkeydown="return CKEDITOR.tools.callFunction(14,event);" onfocus="return CKEDITOR.tools.callFunction(15,event);" onclick="CKEDITOR.tools.callFunction(16,this);return false;"><span class="cke_button_icon cke_button__bulletedlist_icon" style="background-image:url('https://zeremi.com/bundles/fosckeditor/plugins/icons.png?t=J39A');background-position:0 -1344px;background-size:auto;">&nbsp;</span><span id="cke_18_label" class="cke_button_label cke_button__bulletedlist_label" aria-hidden="false">Insert/Remove Bulleted List</span><span id="cke_18_description" class="cke_button_label" aria-hidden="false"></span></a><a id="cke_19" class="cke_button cke_button__numberedlist cke_button_off" href="javascript:void('Insert/Remove Numbered List')" title="Insert/Remove Numbered List" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_19_label" aria-describedby="cke_19_description" aria-haspopup="false" aria-disabled="false" onkeydown="return CKEDITOR.tools.callFunction(17,event);" onfocus="return CKEDITOR.tools.callFunction(18,event);" onclick="CKEDITOR.tools.callFunction(19,this);return false;"><span class="cke_button_icon cke_button__numberedlist_icon" style="background-image:url('https://zeremi.com/bundles/fosckeditor/plugins/icons.png?t=J39A');background-position:0 -1392px;background-size:auto;">&nbsp;</span><span id="cke_19_label" class="cke_button_label cke_button__numberedlist_label" aria-hidden="false">Insert/Remove Numbered List</span><span id="cke_19_description" class="cke_button_label" aria-hidden="false"></span></a><span class="cke_toolbar_separator" role="separator"></span><a id="cke_20" class="cke_button cke_button__outdent cke_button_disabled " href="javascript:void('Decrease Indent')" title="Decrease Indent" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_20_label" aria-describedby="cke_20_description" aria-haspopup="false" aria-disabled="true" onkeydown="return CKEDITOR.tools.callFunction(20,event);" onfocus="return CKEDITOR.tools.callFunction(21,event);" onclick="CKEDITOR.tools.callFunction(22,this);return false;"><span class="cke_button_icon cke_button__outdent_icon" style="background-image:url('https://zeremi.com/bundles/fosckeditor/plugins/icons.png?t=J39A');background-position:0 -1056px;background-size:auto;">&nbsp;</span><span id="cke_20_label" class="cke_button_label cke_button__outdent_label" aria-hidden="false">Decrease Indent</span><span id="cke_20_description" class="cke_button_label" aria-hidden="false"></span></a><a id="cke_21" class="cke_button cke_button__indent cke_button_off" href="javascript:void('Increase Indent')" title="Increase Indent" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_21_label" aria-describedby="cke_21_description" aria-haspopup="false" aria-disabled="false" onkeydown="return CKEDITOR.tools.callFunction(23,event);" onfocus="return CKEDITOR.tools.callFunction(24,event);" onclick="CKEDITOR.tools.callFunction(25,this);return false;"><span class="cke_button_icon cke_button__indent_icon" style="background-image:url('https://zeremi.com/bundles/fosckeditor/plugins/icons.png?t=J39A');background-position:0 -1008px;background-size:auto;">&nbsp;</span><span id="cke_21_label" class="cke_button_label cke_button__indent_label" aria-hidden="false">Increase Indent</span><span id="cke_21_description" class="cke_button_label" aria-hidden="false"></span></a></span><span class="cke_toolbar_end"></span></span><span id="cke_22" class="cke_toolbar" aria-labelledby="cke_22_label" role="toolbar"><span id="cke_22_label" class="cke_voice_label">Clipboard/Undo</span><span class="cke_toolbar_start"></span><span class="cke_toolgroup" role="presentation"><a id="cke_23" class="cke_button cke_button__copy cke_button_disabled " href="javascript:void('Copy')" title="Copy (Ctrl+C)" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_23_label" aria-describedby="cke_23_description" aria-haspopup="false" aria-disabled="true" onkeydown="return CKEDITOR.tools.callFunction(26,event);" onfocus="return CKEDITOR.tools.callFunction(27,event);" onclick="CKEDITOR.tools.callFunction(28,this);return false;"><span class="cke_button_icon cke_button__copy_icon" style="background-image:url('https://zeremi.com/bundles/fosckeditor/plugins/icons.png?t=J39A');background-position:0 -264px;background-size:auto;">&nbsp;</span><span id="cke_23_label" class="cke_button_label cke_button__copy_label" aria-hidden="false">Copy</span><span id="cke_23_description" class="cke_button_label" aria-hidden="false">Keyboard shortcut Ctrl+C</span></a><a id="cke_24" class="cke_button cke_button__paste cke_button_off" href="javascript:void('Paste')" title="Paste (Ctrl+V)" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_24_label" aria-describedby="cke_24_description" aria-haspopup="false" aria-disabled="false" onkeydown="return CKEDITOR.tools.callFunction(29,event);" onfocus="return CKEDITOR.tools.callFunction(30,event);" onclick="CKEDITOR.tools.callFunction(31,this);return false;"><span class="cke_button_icon cke_button__paste_icon" style="background-image:url('https://zeremi.com/bundles/fosckeditor/plugins/icons.png?t=J39A');background-position:0 -360px;background-size:auto;">&nbsp;</span><span id="cke_24_label" class="cke_button_label cke_button__paste_label" aria-hidden="false">Paste</span><span id="cke_24_description" class="cke_button_label" aria-hidden="false">Keyboard shortcut Ctrl+V</span></a><a id="cke_25" class="cke_button cke_button__pastefromword cke_button_off" href="javascript:void('Paste from Word')" title="Paste from Word" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_25_label" aria-describedby="cke_25_description" aria-haspopup="false" aria-disabled="false" onkeydown="return CKEDITOR.tools.callFunction(32,event);" onfocus="return CKEDITOR.tools.callFunction(33,event);" onclick="CKEDITOR.tools.callFunction(34,this);return false;"><span class="cke_button_icon cke_button__pastefromword_icon" style="background-image:url('https://zeremi.com/bundles/fosckeditor/plugins/icons.png?t=J39A');background-position:0 -1608px;background-size:auto;">&nbsp;</span><span id="cke_25_label" class="cke_button_label cke_button__pastefromword_label" aria-hidden="false">Paste from Word</span><span id="cke_25_description" class="cke_button_label" aria-hidden="false"></span></a><span class="cke_toolbar_separator" role="separator"></span><a id="cke_26" class="cke_button cke_button__undo cke_button_disabled " href="javascript:void('Undo')" title="Undo (Ctrl+Z)" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_26_label" aria-describedby="cke_26_description" aria-haspopup="false" aria-disabled="true" onkeydown="return CKEDITOR.tools.callFunction(35,event);" onfocus="return CKEDITOR.tools.callFunction(36,event);" onclick="CKEDITOR.tools.callFunction(37,this);return false;"><span class="cke_button_icon cke_button__undo_icon" style="background-image:url('https://zeremi.com/bundles/fosckeditor/plugins/icons.png?t=J39A');background-position:0 -2016px;background-size:auto;">&nbsp;</span><span id="cke_26_label" class="cke_button_label cke_button__undo_label" aria-hidden="false">Undo</span><span id="cke_26_description" class="cke_button_label" aria-hidden="false">Keyboard shortcut Ctrl+Z</span></a><a id="cke_27" class="cke_button cke_button__redo cke_button_disabled " href="javascript:void('Redo')" title="Redo (Ctrl+Y)" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_27_label" aria-describedby="cke_27_description" aria-haspopup="false" aria-disabled="true" onkeydown="return CKEDITOR.tools.callFunction(38,event);" onfocus="return CKEDITOR.tools.callFunction(39,event);" onclick="CKEDITOR.tools.callFunction(40,this);return false;"><span class="cke_button_icon cke_button__redo_icon" style="background-image:url('https://zeremi.com/bundles/fosckeditor/plugins/icons.png?t=J39A');background-position:0 -1968px;background-size:auto;">&nbsp;</span><span id="cke_27_label" class="cke_button_label cke_button__redo_label" aria-hidden="false">Redo</span><span id="cke_27_description" class="cke_button_label" aria-hidden="false">Keyboard shortcut Ctrl+Y</span></a></span><span class="cke_toolbar_end"></span></span><span id="cke_28" class="cke_toolbar cke_toolbar_last" aria-labelledby="cke_28_label" role="toolbar"><span id="cke_28_label" class="cke_voice_label">advanced</span><span class="cke_toolbar_start"></span><span class="cke_toolgroup" role="presentation"><a id="cke_29" class="cke_button cke_button__source cke_button_off" href="javascript:void('Source')" title="Source" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_29_label" aria-describedby="cke_29_description" aria-haspopup="false" aria-disabled="false" onkeydown="return CKEDITOR.tools.callFunction(41,event);" onfocus="return CKEDITOR.tools.callFunction(42,event);" onclick="CKEDITOR.tools.callFunction(43,this);return false;"><span class="cke_button_icon cke_button__source_icon" style="background-image:url('https://zeremi.com/bundles/fosckeditor/plugins/icons.png?t=J39A');background-position:0 -1848px;background-size:auto;">&nbsp;</span><span id="cke_29_label" class="cke_button_label cke_button__source_label" aria-hidden="false">Source</span><span id="cke_29_description" class="cke_button_label" aria-hidden="false"></span></a></span><span class="cke_toolbar_end"></span></span></span></span><div id="cke_1_contents" class="cke_contents cke_reset" role="presentation" style="height: 200px;"><span id="cke_34" class="cke_voice_label">Press ALT 0 for help</span><iframe src="" frameborder="0" class="cke_wysiwyg_frame cke_reset" style="width: 100%; height: 100%;" title="Rich Text Editor, article_content" aria-describedby="cke_34" tabindex="0" allowtransparency="true"></iframe></div><span id="cke_1_bottom" class="cke_bottom cke_reset_all" role="presentation" style="user-select: none;"><span id="cke_1_resizer" class="cke_resizer cke_resizer_vertical cke_resizer_ltr" title="Resize" onmousedown="CKEDITOR.tools.callFunction(0, event)">◢</span><span id="cke_1_path_label" class="cke_voice_label">Elements path</span><span id="cke_1_path" class="cke_path" role="group" aria-labelledby="cke_1_path_label"><a id="cke_elementspath_10_1" href="javascript:void('body')" tabindex="-1" class="cke_path_item" title="body element" hidefocus="true" draggable="false" ondragstart="return false;" onkeydown="return CKEDITOR.tools.callFunction(45,1, event );" onclick="CKEDITOR.tools.callFunction(44,1); return false;" role="button" aria-label="body element">body</a><a id="cke_elementspath_10_0" href="javascript:void('p')" tabindex="-1" class="cke_path_item" title="p element" hidefocus="true" draggable="false" ondragstart="return false;" onkeydown="return CKEDITOR.tools.callFunction(45,0, event );" onclick="CKEDITOR.tools.callFunction(44,0); return false;" role="button" aria-label="p element">p</a><span class="cke_path_empty">&nbsp;</span></span></span></div></div><script type="text/javascript">
            var CKEDITOR_BASEPATH = "/bundles/fosckeditor/";
        </script><script type="text/javascript" src="/bundles/fosckeditor/ckeditor.js"></script><script type="text/javascript">

        if (CKEDITOR.instances["article_content"]) { CKEDITOR.instances["article_content"].destroy(true); delete CKEDITOR.instances["article_content"]; }

        CKEDITOR.replace("article_content", {"toolbar":[{"name":"styles","items":["Bold","Italic","Strike","Link"]},{"name":"lists","items":["BulletedList","NumberedList","-","Outdent","Indent"]},{"name":"clipboard","items":["Copy","Paste","PasteFromWord","-","Undo","Redo"]},{"name":"advanced","items":["Source"]}],"language":"en","filebrowserBrowseUrl":"\/elfinder"});

            </script></div></div>
            </div>

As You see there is something like CKEDITOR.replace which sets basic toolbar. I have no idea where this code is generated.

Symfony packages

`` symfony/asset v4.2.6 v4.2.7 Symfony Asset Component symfony/browser-kit v4.1.7 v4.2.7 Symfony BrowserKit Component symfony/cache v4.2.4 v4.2.7 Symfony Cache component with PSR-6, PSR-16, and tags symfony/config v4.1.6 v4.2.7 Symfony Config Component symfony/console v3.4.17 v4.2.7 Symfony Console Component symfony/contracts v1.0.2 v1.0.2 A set of abstractions extracted out of the Symfony components symfony/css-selector v4.1.7 v4.2.7 Symfony CssSelector Component symfony/debug v4.1.6 v4.2.7 Symfony Debug Component symfony/dependency-injection v4.1.6 v4.2.7 Symfony DependencyInjection Component symfony/doctrine-bridge v4.1.6 v4.2.7 Symfony Doctrine Bridge symfony/dom-crawler v4.1.6 v4.2.7 Symfony DomCrawler Component symfony/dotenv v3.4.17 v4.2.7 Registers environment variables from a .env file symfony/event-dispatcher v4.2.4 v4.2.7 Symfony EventDispatcher Component symfony/expression-language v4.1.6 v4.2.7 Symfony ExpressionLanguage Component symfony/filesystem v4.2.6 v4.2.7 Symfony Filesystem Component symfony/finder v4.2.6 v4.2.7 Symfony Finder Component symfony/flex v1.1.1 v1.2.3 Composer plugin for Symfony symfony/form v4.1.6 v4.2.7 Symfony Form Component symfony/framework-bundle v4.1.6 v4.2.7 Symfony FrameworkBundle symfony/http-foundation v4.1.6 v4.2.7 Symfony HttpFoundation Component symfony/http-kernel v4.1.6 v4.2.7 Symfony HttpKernel Component symfony/inflector v4.1.6 v4.2.7 Symfony Inflector Component symfony/intl v4.1.6 v4.2.7 A PHP replacement layer for the C intl extension that includes additional data from the ICU library. symfony/maker-bundle v1.8.0 v1.11.6 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code. symfony/monolog-bridge v4.1.6 v4.2.7 Symfony Monolog Bridge symfony/monolog-bundle v3.3.0 v3.3.1 Symfony MonologBundle symfony/options-resolver v4.2.6 v4.2.7 Symfony OptionsResolver Component symfony/orm-pack v1.0.5 v1.0.6 A pack for the Doctrine ORM symfony/panther v0.2.0 v0.3.0 A browser testing and web scraping library for PHP and Symfony. symfony/phpunit-bridge v4.1.7 v4.2.7 Symfony PHPUnit Bridge symfony/polyfill-ctype v1.11.0 v1.11.0 Symfony polyfill for ctype functions symfony/polyfill-intl-icu v1.9.0 v1.11.0 Symfony polyfill for intl's ICU-related data and classes symfony/polyfill-mbstring v1.9.0 v1.11.0 Symfony polyfill for the Mbstring extension symfony/polyfill-php56 v1.9.0 v1.11.0 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions symfony/polyfill-php72 v1.9.0 v1.11.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions symfony/polyfill-util v1.9.0 v1.11.0 Symfony utilities for portability of PHP codes symfony/process v3.4.25 v4.2.7 Symfony Process Component symfony/property-access v4.1.6 v4.2.7 Symfony PropertyAccess Component symfony/property-info v4.1.6 v4.2.7 Symfony Property Info Component symfony/routing v4.1.6 v4.2.7 Symfony Routing Component symfony/security v4.1.6 v4.2.7 Symfony Security Component symfony/security-bundle v4.1.6 v4.2.7 Symfony SecurityBundle symfony/serializer v4.1.6 v4.2.7 Symfony Serializer Component symfony/stopwatch v4.1.6 v4.2.7 Symfony Stopwatch Component symfony/swiftmailer-bundle v3.2.3 v3.2.6 Symfony SwiftmailerBundle symfony/templating v4.2.6 v4.2.7 Symfony Templating Component symfony/test-pack v1.0.4 v1.0.5 A pack for functional and end-to-end testing within a Symfony app symfony/thanks v1.1.0 v1.1.0 Give thanks (in the form of a GitHub ⭐) to your fellow PHP package maintainers (not limited to Symfony components)! symfony/translation v4.1.6 v4.2.7 Symfony Translation Component symfony/twig-bridge v4.1.6 v4.2.7 Symfony Twig Bridge symfony/twig-bundle v4.1.6 v4.2.7 Symfony TwigBundle symfony/validator v4.1.6 v4.2.7 Symfony Validator Component symfony/var-dumper v4.1.6 v4.2.7 Symfony mechanism for exploring and dumping PHP variables symfony/var-exporter v4.2.4 v4.2.7 A blend of var_export() + serialize() to turn any serializable data structure to plain PHP code symfony/workflow v4.1.6 v4.2.7 Symfony Workflow Component symfony/yaml v4.1.6 v4.2.7 Symfony Yaml Component

kubaceg commented 5 years ago

Ok so problem was in configuration of easyadmin entity forms. I've solved it by adding additional type_options in field config:

        - { property: 'content', type: 'FOS\CKEditorBundle\Form\Type\CKEditorType', type_options: { config: {toolbar: 'full'}} }

Reason why default it sets simple toolbar instead of full is in \EasyCorp\Bundle\EasyAdminBundle\Form\Type\Configurator\FOSCKEditorTypeConfigurator class (https://github.com/EasyCorp/EasyAdminBundle/blob/master/src/Form/Type/Configurator/FOSCKEditorTypeConfigurator.php) where easyadmin sets default values for toolbar when configuration is empty.

I've no idea why I had before full toolbar without any additional config. I do not remember to upgrade my bundles :)