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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2745d7dc0e8cc41e8be3aca7a626fe0c20205ab6331768efe30d43a7dba967cd
4
- data.tar.gz: cd62d869e49297848d9c27a647edc9992b78d55b3941ce04b73a930dbeb3fbc5
3
+ metadata.gz: 5ef1443001eb5a9a0c3a88c549d355e82f61a81f89075d89f052e39de936e5a1
4
+ data.tar.gz: 6a7101599069141993b13e01ea4a78dbf8451ceb320e486c3c42cbe5e619a942
5
5
  SHA512:
6
- metadata.gz: c49c2d3449cac786dcc90531dcfb25c010af8918302db6b6733fdcca8cc5ad52b0fd462684032405172647a9168e787ade66716074f7f74afeac74e249cc4ae2
7
- data.tar.gz: 959a97bfe7556e49a36acf26a8a09a60338fc41d57bd1ead6d7111144d19735908e8f1af851709f383371ebf2cab6a1fcd8428954188044a3efbe60294723135
6
+ metadata.gz: 281a4981fca816966bb01712b0420b4b87405a4be6f96af5aad0e4f35ad26ab27d17462fc8551630cd1f778c63d4984473a9cad0ecd9f0a8c93a8bf6ef0776d4
7
+ data.tar.gz: b84ed761263f9ee9d23e63403b92c806d8d50e7965ef26f35e8ca77e9f4144ee5205bca0aab24bde80294466511f27c5f85b1d23dbf855286ece0dc53f3e63dc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.10.1] - 2025-11-21
4
+
5
+ - Add support for Table of Contents
6
+
3
7
  ## [0.10.0] - 2025-09-19
4
8
 
5
9
  - Add support for rendering documents to markdown
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TipTap
4
- VERSION = "0.10.0"
4
+ VERSION = "0.10.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiptap-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Wilken