diff --git a/lib/tip_tap/nodes/text.rb b/lib/tip_tap/nodes/text.rb index e55635b..b184b97 100644 --- a/lib/tip_tap/nodes/text.rb +++ b/lib/tip_tap/nodes/text.rb @@ -37,7 +37,7 @@ def to_html value end - def to_plain_text + def to_plain_text(separator: " ") text end diff --git a/lib/tip_tap/plain_text_renderable.rb b/lib/tip_tap/plain_text_renderable.rb index 08d4359..f7262c7 100644 --- a/lib/tip_tap/plain_text_renderable.rb +++ b/lib/tip_tap/plain_text_renderable.rb @@ -3,8 +3,8 @@ module TipTap module PlainTextRenderable # Useful for searching - def to_plain_text - content.map(&:to_plain_text).join(" ") + def to_plain_text(separator: " ") + content.map { |node| node.to_plain_text(separator: separator) }.join(separator) end end end