Forum

Thread tagged as: Problem, Addons, CKEditor

ckeditor - setting styles not working; editor adds extra apostrophes

So, it seems like the editor adds additional quotes to the class="" definition, when you define styles.

quotes in markup

This is how my config.js:

/**
 * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/license
 */

 // additional styles
CKEDITOR.stylesSet.add( 'sla_styles', [
    // Block-level styles.

    // Inline Styles
    { name: 'weißer Text', element: 'span', styles: { 'color': '#ffffff' } }
]);

CKEDITOR.editorConfig = function( config ) {
    // Define changes to default configuration here.
    // For the complete reference:
    // https://docs.ckeditor.com/#!/api/CKEDITOR.config

    // The toolbar groups arrangement, optimized for two toolbar rows.
    config.toolbarGroups = [
        { name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },
        { name: 'editing',     groups: [ 'find', 'selection', 'spellchecker' ] },
        { name: 'links' },
        { name: 'insert' },
        { name: 'forms' },
        { name: 'tools' },
        { name: 'document',    groups: [ 'mode', 'document', 'doctools' ] },
        { name: 'others' },
        '/',
        { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
        { name: 'paragraph',   groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
        { name: 'styles' },
        { name: 'colors' },
        { name: 'about' }
    ];

    // Remove some buttons, provided by the standard plugins, which we don't
    // need to have in the Standard(s) toolbar.
    config.removeButtons = 'Underline,Subscript,Superscript';

    // Se the most common block elements.
    config.format_tags = 'p;h1;h2;h3;h4;h5;h6';

    // Make dialogs simpler.
    config.removeDialogTabs = 'image:advanced;link:advanced';

    // eigene Styles
    config.stylesSet = 'sla_styles';
};

I dont know if it is a bug, but maybe someone can suggest a workaround for this or tell me what I am doing wrong here?

Thanks in advance!

Thomas Semmler

Thomas Semmler 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What do you get when you view the HTML source?

This is whats in the sourcecode:

<span style=”color:#80bc9f”>

Which would be &ldquo's.

€1: I'd like to add, that adding html="true" to the text_block.html removed this issue, now it works correctly. I still think that this is a little weird, but maybe its wrong from me to expect that.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

If you are using ckeditor it inserts HTML. So you need to add html="true" as explained in the documentation.

https://docs.grabaperch.com/docs/templates/attributes/type/textarea/