How to use the @ckeditor/ckeditor5-basic-styles/src/attributecommand function in @ckeditor/ckeditor5-basic-styles

To help you get started, we’ve selected a few @ckeditor/ckeditor5-basic-styles examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github neos / neos-ui-extensibility-examples / Resources / Private / CustomStylingForCkEditor / src / examplePlugin.js View on Github external
// here, we additionally set a CSS style property inline. In the real world, you probably would
                // not do this, but instead style the class using your CSS.
                //
                // NOTE: when removing the style definition here, the style tags are automatically removed when a
                //       <span style="..." class="example-class"></span> is encountered.
                styles: {
                    'background-color': 'green',
                }
            }
        };
        this.editor.conversion.attributeToElement(config);

        // Finally, we need to add a new command to apply this attribute.
        // "highlightCommand" is the identifier of the command now
        this.editor.commands.add('highlightCommand', new AttributeCommand(this.editor, 'exampleAttribute'));
    }
}
github breadlesscode / neos-simple-editor-extend / Resources / Private / UiPlugin / src / CkeditorPluginUtils.js View on Github external
init() {
            const config = {
                model: attributeName,
                view: {
                    name: formatting.tag,
                    classes: formatting.classes,
                    styles: formatting.styles
                }
            };

            this.editor.model.schema.extend('$text', {allowAttributes: attributeName});
            this.editor.conversion.attributeToElement(config);
            this.editor.commands.add(commandName, new AttributeCommand(this.editor, attributeName));
        }
    }

@ckeditor/ckeditor5-basic-styles

Basic styles feature for CKEditor 5.

SEE LICENSE IN LICENSE.md
Latest version published 6 days ago

Package Health Score

86 / 100
Full package analysis

Popular @ckeditor/ckeditor5-basic-styles functions