Home > 8 > "Cannot read property 'icons' of null"

"Cannot read property 'icons' of null"

November 3Hits:1
Advertisement

With Drupal 8.0.0-rc2, no matter what, I get this error in the JS console:

Uncaught TypeError: Cannot read property 'icons' of null

I think I have defined everything correctly, so I don't know what causes this error or what I missed.

Plugin definition:

/**   * @file  * Contains \Drupal\codesnippet\Plugin\CKEditorPlugin\CodeSnippet.  */  namespace Drupal\codesnippet\Plugin\CKEditorPlugin;  use Drupal\ckeditor\CKEditorPluginBase; use Drupal\ckeditor\CKEditorPluginConfigurableInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\editor\Entity\Editor; use Drupal\Core\Url;  /**  * Defines the "codesnippet" plugin.  *  * @CKEditorPlugin(  *   id = "codesnippet",  *   label = @Translation("CodeSnippet"),  * )  */ class CodeSnippet extends CKEditorPluginBase implements CKEditorPluginConfigurableInterface {   /**    * [email protected]}    */   public function getFile() {     return drupal_get_path('module', 'codesnippet') . '/js/plugins/codesnippet/plugin.js';   }    /**    * [email protected]}    */   public function getConfig(Editor $editor) {     return array(       'codeSnippet_dialogTitleAdd' => t('Insert Code'),       'codeSnippet_dialogTitleEdit' => t('Edit Code'),     );   }    /**    * [email protected]}    */   public function getButtons() {     return array(       'CodeSnippet' => array(         'label' => t('CodeSnippet'),         'image' => drupal_get_path('module', 'codesnippet') . '/js/plugins/codesnippet/codesnippet.png',       ),     );   }    /**    * [email protected]}    */   public function settingsForm(array $form, FormStateInterface $form_state, Editor $editor) {     $form_state->loadInclude('editor', 'admin.inc');      $styles = $this->getStyles();      $form['highlight_style'] = array(       '#type' => 'select',       '#title' => 'Highlightjs Style',       '#description' => t('Select a style to apply to all highlighted code snippets. You can preview the styles at !link.', array('!link' => \Drupal::l('https://highlightjs.org/static/demo', Url::fromUri('https://highlightjs.org/static/demo/')))),       '#options' => $styles,       '#default_value' => !empty($form_state->storage['editor']->settings['plugins']['codesnippet']['highlight_style']) ? $form_state->storage['editor']->settings['plugins']['codesnippet']['highlight_style'] : 'arta.css',     );      return $form;   }    /**    * Returns available stylesheets to use for code syntax highlighting.    */   private function getStyles() {     $styles = preg_grep('/\.css/', scandir(drupal_get_path('module', 'codesnippet') . '/js/plugins/codesnippet/lib/highlight/styles'));     $style_options = array();      foreach ($styles as $stylesheet) {       $style_options[$stylesheet] = $stylesheet;     }      return $style_options;   } } 

The icon on the toolbar when editing the text format appears just fine, I can drag it in and out of the active toolbar, and my settings form shows. But due to the JS error generated, it does not work.

The plugin used is available on ckeditor.com, I dropped it into the plugins/codesnippet/js folder untouched.

I can't find any other examples of custom plugins using anything called 'icons'.

Answers

Latest release of Drupal (8.0.0-rc3) fixes this. CKEditor was upgraded.

Tags:ckeditor

Related Articles

  • Cannot read property 'wrapDateLine' of null - Open layers

    Cannot read property 'wrapDateLine' of null - Open layersMarch 24

    My code is giving the error: Uncaught TypeError: Cannot read property 'wrapDateLine' of null OpenLayers.js:192 OpenLayers.Map.OpenLayers.Class.isValidLonLat OpenLayers.js:192 OpenLayers.Map.OpenLayers.Class.moveTo OpenLayers.js:187 OpenLayers.Map.Ope

  • The value of the property 'MSOTlPn_ShowToolPane2' is null or undefined, not a Function object

    The value of the property 'MSOTlPn_ShowToolPane2' is null or undefined, not a Function objectNovember 7

    I have a problem with SharePoint 2010 and Internet Explorer 11. The following error message appears when I try to open the webpart menu. In Internet Explorer 8 the wepart menu works as expected: In Internet Explorer 11 the wepart menu fails to open:

  • Attach file throws 'Uncaught TypeError: Cannot read property 'insertRow' of null'June 11

    When attaching a file to a list item the following error is thrown when clicking on the OK button: > Uncaught TypeError: Cannot read property 'insertRow' of null The edit button is greyed out (unsure as to why) but I've added the attach file button t

  • Getting "TypeError: Cannot set property 'onclick' of null"June 15

    I have a Visualforce error that's driving me crazy. My Javascript file ui.js (see blow) is just defining an onclick event on a DOM element. Here is my javascript : (function (window, document) { var layout = document.getElementById('layout'); var men

  • CSR Error: Cannot read property 'style' of nullJuly 31

    Trying to color rows based off of the value of the "Status" column However I cannot get it working as it keeps giving the following errors: TypeError: Cannot read property 'style' of null TypeError: Cannot read property 'style' of nullTypeError:

  • Uncaught error in actionCallback : Cannot read property 'namespace__Amount__c' of nullOctober 2

    I am facing this error when doing tutorial on step saving Expense. Uncaught error in actionCallback : Cannot read property 'namespace__Amount__c' of null Also other related question is here but no answer yet.Here my code form.cmp <aura:component cont

  • chatterAnswers:SearchAsk Cannot read property 'ACTION' of null

    chatterAnswers:SearchAsk Cannot read property 'ACTION' of nullOctober 5

    I have a simple page that's using the chatteranswers:searchask component: <apex:page > <body> <div> <chatteranswers:searchask id="mySearchAskComponent" communityId="MY_ID_HERE" /> </div> </body> If I

  • "Cannot read property 'icons' of null"November 3

    With Drupal 8.0.0-rc2, no matter what, I get this error in the JS console: Uncaught TypeError: Cannot read property 'icons' of null I think I have defined everything correctly, so I don't know what causes this error or what I missed. Plugin definitio

  • JS - Cannot read property 'setAttribute' of null January 15

    This question already has an answer here: Why does jQuery or a DOM method such as getElementById not find the element? 6 answers I am pretty new to javascript and want to code a header of an html site. JS: when the window width is smaller than 1215px

  • Uncaught TypeError: Cannot set property 'className' of null.activeJanuary 16

    It's a sign in button and a form which both contain in one id mainButton box, but each of them has different z-index. When click the signIn-btn, the form will show out. But I occur a problem that it doesn't work when click the button, and the chrome

  • jQuery button click attr('src') returns 'Cannot read property 'on' of null'January 19

    I'm trying to click on the image and capture the url: $(".imageitemaddt").on("click", function() { imgitem = $(this).attr('src'); alert(imgitem); }); fabric.Object.prototype.transparentCorners = false; var $ = function(id){return docum

  • cannot read property 'channel' of null with simpleweather.jsJanuary 21

    I am using simpleweather plugin for displaying current weather and worked fine till yesterday. Now it shows error as 'cannot read property 'channel' of null'. When I debugged the script, I found that the yahoo data fails to retrieve saying service un

  • Jasmine gives Cannot read property 'getXHR' of null for Angular 2 unit testJanuary 25

    I have found many examples online of unit testing Angular 2 with a http call. However when I make my own test and run it Jasmine it gives me an error: http Http .request() should accept a fully-qualified request as its only parameter Failed: Cannot r

  • Cannot set property 'innerHTML' of null January 25

    This question already has an answer here: Why does jQuery or a DOM method such as getElementById not find the element? 6 answers I am using ajax to filter a profession in a professional listing. But it asks me this error: Can not set property 'innerH

  • Google Cloud Pub/Sub Node.js Sample: TypeError: Cannot read property 'on' of nullJanuary 27

    I'm using GCP and I want to use Cloud Pub/Sub. I got this error below when I tried Node.js sample. Does anyone knows how to fix it? /private/tmp/pubsub/pubsubsample.js:26 subscription.on('error', onError); ^ TypeError: Cannot read property 'on' of nu

  • Ajax Uncaught TypeError: Cannot read property 'click' of nullJanuary 30

    I am not able to figure out the cause of the error. I keep getting Uncaught TypeError: Cannot read property 'click' of null error. I do have .product-btn class defined in the button. Here is the Complete Code: <script type="text/javascript"&g

  • Uncaught TypeError: Cannot read property '__e3_' of nullJanuary 31

    I'm getting the error Uncaught TypeError: Cannot read property '__e3_' of null randomly when dragging a polygon inside a google map. I mean, most of the times when I drag the polygon works as expected, but rarely a few times fails. In the Google Chro

  • NodeJS db-migrate TypeError: Cannot read property '1' of nullFebruary 2

    I've just installed the nodejs package db-migrate into an existing nodejs project. Everything seems to be configured correctly in regards to the connection to the DB. Database.json: { "development": "postgres://blabla", "productio

  • GXT 2.3.1 Cannot read property 'style' of null on google chrome version 48February 7

    SEVERE: LogConfiguration: (TypeError): Cannot read property 'style' of null I keep getting this kind of error on the chrome build 48. It can't be produced on Firefox. I am using GXT 2.3.1 for my application. It happens when there is a grid which has

  • twilio video beta 'cannot read property stack of null' errorFebruary 8

    Basically, the issue is this: I include the twilio common and twilio conversation scripts in the index.html head as described in docs. I fetch a token from our server which has been generated using our twilio auth token and user ID and good things li

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.246 s.