tiptap-ruby 0.10.0 → 0.10.1
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/CHANGELOG.md +4 -0
- data/lib/tip_tap/nodes/heading.rb +18 -0
- data/lib/tip_tap/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: 5ef1443001eb5a9a0c3a88c549d355e82f61a81f89075d89f052e39de936e5a1
|
|
4
|
+
data.tar.gz: 6a7101599069141993b13e01ea4a78dbf8451ceb320e486c3c42cbe5e619a942
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 281a4981fca816966bb01712b0420b4b87405a4be6f96af5aad0e4f35ad26ab27d17462fc8551630cd1f778c63d4984473a9cad0ecd9f0a8c93a8bf6ef0776d4
|
|
7
|
+
data.tar.gz: b84ed761263f9ee9d23e63403b92c806d8d50e7965ef26f35e8ca77e9f4144ee5205bca0aab24bde80294466511f27c5f85b1d23dbf855286ece0dc53f3e63dc
|
data/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,13 @@ module TipTap
|
|
|
8
8
|
self.type_name = "heading"
|
|
9
9
|
self.html_tag = proc { "h#{level}" }
|
|
10
10
|
|
|
11
|
+
def initialize(content = [], **attributes)
|
|
12
|
+
super(content, **attributes)
|
|
13
|
+
uuid = SecureRandom.uuid
|
|
14
|
+
@attrs["id"] = uuid
|
|
15
|
+
@attrs["data-toc-id"] = uuid
|
|
16
|
+
end
|
|
17
|
+
|
|
11
18
|
def text(text, marks: [])
|
|
12
19
|
add_content(Text.new(text, marks: marks))
|
|
13
20
|
end
|
|
@@ -16,6 +23,17 @@ module TipTap
|
|
|
16
23
|
attrs["level"]
|
|
17
24
|
end
|
|
18
25
|
|
|
26
|
+
def html_attributes
|
|
27
|
+
# doc-toc-id comes from TipTap and Ruby symbols do not support -
|
|
28
|
+
# so we use string keys here instead.
|
|
29
|
+
{
|
|
30
|
+
"style" => inline_styles,
|
|
31
|
+
"class" => html_class_name,
|
|
32
|
+
"id" => attrs["id"],
|
|
33
|
+
"data-toc-id" => attrs["data-toc-id"]
|
|
34
|
+
}.reject { |key, value| value.blank? }
|
|
35
|
+
end
|
|
36
|
+
|
|
19
37
|
def to_markdown(context = Markdown::Context.root)
|
|
20
38
|
heading_level = [level.to_i, 1].max
|
|
21
39
|
prefix = "#" * heading_level
|
data/lib/tip_tap/version.rb
CHANGED