Class: ActionText::Editor
Do not use. This class is for internal use only.
| Relationships & Source Files | |
| Namespace Children | |
|
Classes:
| |
| Extension / Inclusion / Inheritance Descendants | |
|
Subclasses:
|
|
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
|
|
| Inherits: | Object |
| Defined in: | actiontext/lib/action_text/editor.rb |
Class Method Summary
- .new(options = {}) ⇒ Editor constructor
::ActiveSupport::Autoload - Extended
Instance Attribute Summary
- #options readonly
Instance Method Summary
-
#as_canonical(editable_fragment)
Convert fragments served by the editor into the canonical form that Action Text stores.
-
#as_editable(canonical_fragment)
Convert fragments from the canonical form that Action Text stores into a format that is supported by the editor.
- #editor_name
- #editor_tag
Constructor Details
.new(options = {}) ⇒ Editor
# File 'actiontext/lib/action_text/editor.rb', line 12
def initialize( = {}) @options = end
Instance Attribute Details
#options (readonly)
[ GitHub ]# File 'actiontext/lib/action_text/editor.rb', line 10
attr_reader :
Instance Method Details
#as_canonical(editable_fragment)
Convert fragments served by the editor into the canonical form that Action Text stores.
def as_canonical(editable_fragment)
editable_fragment.replace "my-editor-attachment" do ||
ActionText::Attachment.from_attributes(
"sgid" => ["sgid"],
"content-type" => ["content-type"]
)
end
end
# File 'actiontext/lib/action_text/editor.rb', line 26
def as_canonical(editable_fragment) editable_fragment end
#as_editable(canonical_fragment)
Convert fragments from the canonical form that Action Text stores into a format that is supported by the editor.
def as_editable(canonical_fragment)
canonical_fragment.replace ActionText::Attachment.tag_name do ||
= {
"sgid" => ["sgid"],
"content-type" => ["content-type"]
}
ActionText::HtmlConversion.create_element("my-editor-attachment", )
end
end
# File 'actiontext/lib/action_text/editor.rb', line 42
def as_editable(canonical_fragment) canonical_fragment end
#editor_name
[ GitHub ]# File 'actiontext/lib/action_text/editor.rb', line 46
def editor_name self.class.name.demodulize.delete_suffix("Editor").underscore end
#editor_tag
[ GitHub ]# File 'actiontext/lib/action_text/editor.rb', line 50
def editor_tag(...) Tag.new(editor_name, ...) end