protected function add_js_plugin(&$params, $pluginname='', $jsfile='editor_plugin.js') {
        global $CFG;

        // Set default plugin name.
        if ($pluginname === '') {
            $pluginname = $this->plugin;
        }

        // Add plugin to list in params, so it doesn't try to load it again.
        $params['plugins'] .= ',-' . $pluginname;

        // Add special param that causes Moodle TinyMCE init to load the plugin.
        if (!isset($params['moodle_init_plugins'])) {
            $params['moodle_init_plugins'] = '';
        } else {
            $params['moodle_init_plugins'] .= ',';
        }

        // Get URL of main JS file and store in params.
        $jsurl = $this->get_tinymce_file_url($jsfile, false);
        $params['moodle_init_plugins'] .= $pluginname . ':' . $jsurl;
    }