Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

editor: disable `suspiciousAttributes` check in prosemirror

Abdullah Atta882305422798
diff --git a/packages/editor/patches/prosemirror-model+1.22.3.patch b/packages/editor/patches/prosemirror-model+1.22.3.patch
index ab5b45c10..37444376f 100644
--- a/packages/editor/patches/prosemirror-model+1.22.3.patch
+++ b/packages/editor/patches/prosemirror-model+1.22.3.patch
@@ -1,5 +1,5 @@
diff --git a/node_modules/prosemirror-model/dist/index.cjs b/node_modules/prosemirror-model/dist/index.cjs
-index aa31355..dcb4a75 100644
+index aa31355..1409b46 100644
--- a/node_modules/prosemirror-model/dist/index.cjs
+++ b/node_modules/prosemirror-model/dist/index.cjs
@@ -95,6 +95,7 @@ var Fragment = function () {
@@ -10,8 +10,17 @@ index aa31355..dcb4a75 100644
var child = this.content[i],
end = pos + child.nodeSize;
if (end > from && f(child, nodeStart + pos, parent || null, i) !== false && child.content.size) {
+@@ -2817,7 +2818,7 @@ function _renderSpec(doc, structure, xmlNS, blockArraysIn) {
+ var tagName = structure[0],
+ suspicious;
+ if (typeof tagName != "string") throw new RangeError("Invalid array passed to renderSpec");
+- if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) && suspicious.indexOf(structure) > -1) throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
++ // if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) && suspicious.indexOf(structure) > -1) throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
+ var space = tagName.indexOf(" ");
+ if (space > 0) {
+ xmlNS = tagName.slice(0, space);
diff --git a/node_modules/prosemirror-model/dist/index.js b/node_modules/prosemirror-model/dist/index.js
-index 0097d9f..44f7d4a 100644
+index 0097d9f..19d7031 100644
--- a/node_modules/prosemirror-model/dist/index.js
+++ b/node_modules/prosemirror-model/dist/index.js
@@ -84,6 +84,7 @@ class Fragment {
@@ -22,3 +31,16 @@ index 0097d9f..44f7d4a 100644
let child = this.content[i], end = pos + child.nodeSize;
if (end > from && f(child, nodeStart + pos, parent || null, i) !== false && child.content.size) {
let start = pos + 1;
+@@ -3397,9 +3398,9 @@ function renderSpec(doc, structure, xmlNS, blockArraysIn) {
+ let tagName = structure[0], suspicious;
+ if (typeof tagName != "string")
+ throw new RangeError("Invalid array passed to renderSpec");
+- if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) &&
+- suspicious.indexOf(structure) > -1)
+- throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
++ // if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) &&
++ // suspicious.indexOf(structure) > -1)
++ // throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
+ let space = tagName.indexOf(" ");
+ if (space > 0) {
+ xmlNS = tagName.slice(0, space);