diff --git a/model/config/ktlint/baseline.xml b/model/config/ktlint/baseline.xml
index 21a9070..8c6fa02 100644
--- a/model/config/ktlint/baseline.xml
+++ b/model/config/ktlint/baseline.xml
@@ -104,7 +104,8 @@
-
+
+
@@ -227,12 +228,13 @@
-
+
+
-
-
-
+
+
+
@@ -302,19 +304,20 @@
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -528,10 +531,12 @@
-
+
+
-
+
+
diff --git a/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Fragment.kt b/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Fragment.kt
index e2d03d8..a9e93ae 100644
--- a/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Fragment.kt
+++ b/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Fragment.kt
@@ -305,10 +305,10 @@ class Fragment {
companion object {
// Deserialize a fragment from its JSON representation.
- fun fromJSON(schema: Schema, value: JsonArray?, withId: Boolean = false): Fragment {
+ fun fromJSON(schema: Schema, value: JsonArray?, withId: Boolean = false, check: Boolean = false): Fragment {
if (value == null) return empty
// if (!Array.isArray(value)) throw RangeError("Invalid input for Fragment.fromJSON")
- return Fragment(value.map { el -> schema.nodeFromJSON(el.jsonObject, withId) })
+ return Fragment(value.map { el -> schema.nodeFromJSON(el.jsonObject, withId, check) })
}
// Build a fragment from an array of nodes. Ensures that adjacent text nodes with the same
diff --git a/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Mark.kt b/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Mark.kt
index 39be245..6761aac 100644
--- a/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Mark.kt
+++ b/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Mark.kt
@@ -101,7 +101,7 @@ open class Mark constructor(
val none = emptyList()
// Deserialize a mark from JSON.
- fun fromJSON(schema: Schema, json: JsonObject?, withId: Boolean = false): Mark {
+ fun fromJSON(schema: Schema, json: JsonObject?, withId: Boolean = false, check: Boolean = false): Mark {
if (json == null) throw RangeError("Invalid input for Mark.fromJSON")
val jsonType = json["type"]?.jsonPrimitive?.contentOrNull
val type = schema.marks[jsonType]
@@ -120,7 +120,9 @@ open class Mark constructor(
} else {
type.create(attrs).also { (it as? UnsupportedMark)?.originalMarkName = jsonType }
}
- type.checkAttrs(mark.attrs)
+ if (check) {
+ type.checkAttrs(mark.attrs)
+ }
return mark
}
diff --git a/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Node.kt b/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Node.kt
index c9e0e81..6020594 100644
--- a/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Node.kt
+++ b/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Node.kt
@@ -632,12 +632,12 @@ open class Node constructor(
// Deserialize a node from its JSON representation.
@Suppress("ThrowsCount", "SwallowedException", "ComplexMethod")
- fun fromJSON(schema: Schema, json: JsonObject?, withId: Boolean = false): Node {
+ fun fromJSON(schema: Schema, json: JsonObject?, withId: Boolean = false, check: Boolean = false): Node {
if (json == null) throw RangeError("Invalid input for Node.fromJSON")
var marks: List? = null
if (json.containsKey("marks")) {
val marksArray = json["marks"]!!.jsonArray
- marks = marksArray.map { schema.markFromJSON(it.jsonObject, withId) }
+ marks = marksArray.map { schema.markFromJSON(it.jsonObject, withId, check) }
}
val type = json["type"]?.jsonPrimitive?.contentOrNull
if (type == "text") {
@@ -645,7 +645,7 @@ open class Node constructor(
if (text?.isString != true) throw RangeError("Invalid text node in JSON")
return schema.text(text.content, marks)
}
- val content = Fragment.fromJSON(schema, json["content"]?.jsonArray, withId)
+ val content = Fragment.fromJSON(schema, json["content"]?.jsonArray, withId, check)
val attrs = json["attrs"]?.jsonObject?.mapValues {
if (it.value is JsonNull) null else JSON.decodeFromJsonElement(it.value)
}
@@ -674,7 +674,9 @@ open class Node constructor(
// for round tripping
node.unknownFields = json.fieldsExcept("marks", "type", "content", "attrs")
}
- node.type.checkAttrs(node.attrs)
+ if (check) {
+ node.type.checkAttrs(node.attrs)
+ }
return node
}
}
diff --git a/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Schema.kt b/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Schema.kt
index 190d825..7f4c19c 100644
--- a/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Schema.kt
+++ b/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Schema.kt
@@ -794,13 +794,13 @@ class Schema {
}
// Deserialize a node from its JSON representation. This method is bound.
- fun nodeFromJSON(json: JsonObject?, withId: Boolean = false): Node {
- return Node.fromJSON(this, json, withId)
+ fun nodeFromJSON(json: JsonObject?, withId: Boolean = false, check: Boolean = false): Node {
+ return Node.fromJSON(this, json, withId, check)
}
// Deserialize a mark from its JSON representation. This method is bound.
- fun markFromJSON(json: JsonObject?, withId: Boolean = false): Mark {
- return Mark.fromJSON(this, json, withId)
+ fun markFromJSON(json: JsonObject?, withId: Boolean = false, check: Boolean = false): Mark {
+ return Mark.fromJSON(this, json, withId, check)
}
fun nodeType(name: String): NodeType {
diff --git a/version.properties b/version.properties
index 90c1ae3..48b2ae6 100644
--- a/version.properties
+++ b/version.properties
@@ -1 +1 @@
-projectVersion=1.1.3
+projectVersion=1.1.4