prose_mirror_ruby 0.1.1 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78bc17787531ffe01a656e70876935071859afc98eaf814799c165680f9c689a
4
- data.tar.gz: 4d43f410e59748ef8e64335baaa8f328622c17057f7bb03ed41d8806bbe0e23e
3
+ metadata.gz: 997123de42d6971c9247120b96c785e771688b0e6d0555d0ba0f6f0a2810b45e
4
+ data.tar.gz: e03ebfd450a7265dbeae8f3bc257464116a526a6921f40cd842a857ae9507459
5
5
  SHA512:
6
- metadata.gz: d97653a9274c6e59271ac20b59dfd9cafe89d85fd7d80583c2b492bbcc2127ee0232cffba75e2b624f0066f888d361ab01c4b8460f294bfd3891bda7932495bf
7
- data.tar.gz: ce4af37ef52f6e5a6504dfbd4c6b0a5d780cef3d773cccb8d86ee7aa03d871ae3b6e42894d981b219902c80b4839c08480cb7a7381a34bedc3aedf4d928e5893
6
+ metadata.gz: eefad1d1c11004d5d7b1ae3586185b52b589d9a84d3c8c8d7368e48587035dc6dc981687edca8fa96e27beab326d0f5fb86ff9b3ae6c1295f38bd55a2cd45308
7
+ data.tar.gz: 160e9d5b278280935b2b5550ff8062df6c4241a6d549a13d6c4ce17b4871ccb40f1455a43cd4980db9e92fe594203ae54d2a58ae7f2cf803c14081a2d9e714db
@@ -146,6 +146,62 @@ module ProseMirror
146
146
 
147
147
  text: ->(state, node, parent = nil, index = nil) {
148
148
  state.text(node.text, !state.in_autolink)
149
+ },
150
+
151
+ # Table serialization support
152
+ table: ->(state, node, parent = nil, index = nil) {
153
+ # Track that we're in a table
154
+ old_in_table = state.instance_variable_get(:@in_table) || false
155
+ state.instance_variable_set(:@in_table, true)
156
+
157
+ # Render table content
158
+ state.render_content(node)
159
+
160
+ # Restore table state
161
+ state.instance_variable_set(:@in_table, old_in_table)
162
+
163
+ # Only add newline if not at the end of the document
164
+ if parent && index < parent.child_count - 1
165
+ state.close_block(node)
166
+ end
167
+ },
168
+
169
+ table_row: ->(state, node, parent = nil, index = nil) {
170
+ # Write row separator after headers
171
+ if index == 1 && parent && parent.child(0).content.any? { |cell| cell.type.name == "table_header" }
172
+ state.write("|")
173
+ node.content.each do |_|
174
+ state.write(" --- |")
175
+ end
176
+ state.write("\n")
177
+ end
178
+
179
+ # Write row content
180
+ state.write("|")
181
+ state.render_content(node)
182
+
183
+ # Add newline unless this is the last row
184
+ if parent && index < parent.child_count - 1
185
+ state.write("\n")
186
+ end
187
+ },
188
+
189
+ table_header: ->(state, node, parent = nil, index = nil) {
190
+ state.write(" ")
191
+ # Render content with marks
192
+ node.content.each do |cell_content|
193
+ state.render_inline(cell_content)
194
+ end
195
+ state.write(" |")
196
+ },
197
+
198
+ table_cell: ->(state, node, parent = nil, index = nil) {
199
+ state.write(" ")
200
+ # Render content with marks
201
+ node.content.each do |cell_content|
202
+ state.render_inline(cell_content)
203
+ end
204
+ state.write(" |")
149
205
  }
150
206
  }
151
207
 
@@ -1,3 +1,3 @@
1
1
  module ProseMirror
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prose_mirror_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Ross