Class: CKEditor5::Rails::Editor::PropsInlinePlugin
- Inherits:
-
PropsBasePlugin
- Object
- PropsBasePlugin
- CKEditor5::Rails::Editor::PropsInlinePlugin
- Defined in:
- lib/ckeditor5/rails/editor/props_inline_plugin.rb
Direct Known Subclasses
PropsPatchPlugin, Plugins::CustomTranslationsLoader, Plugins::SimpleUploadAdapter, Plugins::SpecialCharactersBootstrap, Plugins::WProofreaderSync
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#compress ⇒ Object
readonly
Returns the value of attribute compress.
Attributes inherited from PropsBasePlugin
Instance Method Summary collapse
-
#initialize(name, code, compress: true) ⇒ PropsInlinePlugin
constructor
A new instance of PropsInlinePlugin.
- #to_h ⇒ Object
- #try_compress! ⇒ Object
Methods inherited from PropsBasePlugin
normalize, #preload_assets_bundle
Constructor Details
#initialize(name, code, compress: true) ⇒ PropsInlinePlugin
Returns a new instance of PropsInlinePlugin.
9 10 11 12 13 14 15 16 |
# File 'lib/ckeditor5/rails/editor/props_inline_plugin.rb', line 9 def initialize(name, code, compress: true) super(name) raise ArgumentError, 'Code must be a String' unless code.is_a?(String) @code = "(async () => { #{code} })()" @compress = compress end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
7 8 9 |
# File 'lib/ckeditor5/rails/editor/props_inline_plugin.rb', line 7 def code @code end |
#compress ⇒ Object (readonly)
Returns the value of attribute compress.
7 8 9 |
# File 'lib/ckeditor5/rails/editor/props_inline_plugin.rb', line 7 def compress @compress end |
Instance Method Details
#to_h ⇒ Object
24 25 26 27 28 |
# File 'lib/ckeditor5/rails/editor/props_inline_plugin.rb', line 24 def to_h { window_name: name } end |
#try_compress! ⇒ Object
18 19 20 21 22 |
# File 'lib/ckeditor5/rails/editor/props_inline_plugin.rb', line 18 def try_compress! return unless @compress @code = Terser.new(compress: false, mangle: true).compile(@code) end |