Class: CKEditor5::Rails::Plugins::SpecialCharactersBootstrap
- Inherits:
-
Editor::PropsInlinePlugin
- Object
- Editor::PropsBasePlugin
- Editor::PropsInlinePlugin
- CKEditor5::Rails::Plugins::SpecialCharactersBootstrap
- Defined in:
- lib/ckeditor5/rails/plugins/special_characters_bootstrap.rb
Constant Summary collapse
- PLUGIN_CODE =
<<~JS const { Plugin } = await import( 'ckeditor5' ); return class SpecialCharactersBootstrap extends Plugin { static get pluginName() { return 'SpecialCharactersBootstrap'; } get bootstrapConfig() { return this.editor.config.get('specialCharactersBootstrap'); } async init() { const { editor, bootstrapConfig } = this; const currentConfig = editor.config.get('specialCharacters'); if (!bootstrapConfig) { return; } editor.config.define('specialCharacters', { ...currentConfig, order: bootstrapConfig.order || currentConfig.order, } ); } async afterInit() { const { editor, bootstrapConfig } = this; const specialCharacters = editor.plugins.get('SpecialCharacters'); if (!specialCharacters || !bootstrapConfig) { return; } const groups = bootstrapConfig.groups || []; for (const { name, items, options } of groups) { specialCharacters.addItems(name, items, { label: name, ...options }); } } } JS
Instance Attribute Summary
Attributes inherited from Editor::PropsInlinePlugin
Attributes inherited from Editor::PropsBasePlugin
Instance Method Summary collapse
-
#initialize ⇒ SpecialCharactersBootstrap
constructor
A new instance of SpecialCharactersBootstrap.
Methods inherited from Editor::PropsInlinePlugin
Methods inherited from Editor::PropsBasePlugin
normalize, #preload_assets_bundle, #to_h
Constructor Details
#initialize ⇒ SpecialCharactersBootstrap
Returns a new instance of SpecialCharactersBootstrap.
53 54 55 56 |
# File 'lib/ckeditor5/rails/plugins/special_characters_bootstrap.rb', line 53 def initialize super(:SpecialCharactersBootstrap, PLUGIN_CODE) compress! end |