lib/draftjs_html/draftjs.rb in draftjs_html-0.31.0 vs lib/draftjs_html/draftjs.rb in draftjs_html-0.32.0
- old
+ new
@@ -1,8 +1,9 @@
# frozen_string_literal: true
require_relative 'draftjs/content'
+require_relative 'draftjs/null_content'
require_relative 'draftjs/character_meta'
require_relative 'draftjs/applicable_range'
require_relative 'draftjs/block'
require_relative 'draftjs/entity_map'
require_relative 'draftjs/entity'
@@ -11,8 +12,14 @@
module DraftjsHtml
module Draftjs
def self.parse(raw)
Content.parse(raw)
+ end
+
+ def self.safe_parse(raw)
+ Content.parse(raw)
+ rescue
+ NullContent.new
end
end
end