ponkotsu-md-editor 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ponkotsu/md/editor/helpers.rb +11 -10
- data/lib/ponkotsu/md/editor/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 19a74db7897bb8d90843b8e9391971f1bc1e5a74825f2215a160147207f8e2b3
|
|
4
|
+
data.tar.gz: a23fbef066d22641f54786263775e8011031ad0f8540a17b74b8acd77b22040b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0e20255ebcda0a88d5498effeb1439619a9341a5b7f9705f53b55f25895ecdafb64d52bdcc5c1d794ff85ffc895231d0cb14ad3457adc9c6069c19345d9d9ef1
|
|
7
|
+
data.tar.gz: 917f27ab90103fe6d7b0f01bdd278a6171c2570f05831b3ccc5e19861b0a3851b136fcc1aacc98a41c15e32bf847c5421fbe7bd3e990bc461d6c5d0f31adbea5
|
|
@@ -8,22 +8,23 @@ module PonkotsuMdEditor
|
|
|
8
8
|
# This module provides view helpers that can be used in ERB templates
|
|
9
9
|
# to integrate the PonkotsuMdEditor functionality
|
|
10
10
|
module Helpers
|
|
11
|
-
# Renders a Markdown editor component
|
|
11
|
+
# Renders a Markdown editor component for the given form and attribute.
|
|
12
12
|
#
|
|
13
|
-
# @param form [ActionView::Helpers::FormBuilder]
|
|
14
|
-
# @param
|
|
15
|
-
# @param options [Hash]
|
|
16
|
-
# @return [String]
|
|
13
|
+
# @param form [ActionView::Helpers::FormBuilder] The form builder object.
|
|
14
|
+
# @param attribute [Symbol, String] The attribute name to bind the editor to (e.g., :content).
|
|
15
|
+
# @param options [Hash] Editor configuration options (e.g., :lang, :preview, :tools, :placeholder).
|
|
16
|
+
# @return [String] The rendered HTML for the Markdown editor.
|
|
17
17
|
#
|
|
18
18
|
# Example usage in a Rails view:
|
|
19
19
|
# <%= markdown_editor(f, :content, {
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
#
|
|
20
|
+
# lang: :en,
|
|
21
|
+
# preview: true,
|
|
22
|
+
# tools: [:bold, :italic, :strikethrough],
|
|
23
|
+
# placeholder: "This is Placeholder."
|
|
24
|
+
# }) %>
|
|
25
25
|
def markdown_editor(form, attribute, options = {})
|
|
26
26
|
form = form[:form] if form.is_a?(Hash)
|
|
27
|
+
attribute = attribute[:attribute] if attribute.is_a?(Hash)
|
|
27
28
|
render "ponkotsu_md_editor/editor", locals: { attribute: attribute, form: form, options: options }
|
|
28
29
|
end
|
|
29
30
|
end
|