Skip to content

Commit 166d8b4

Browse files
chore: updated html attribute validation
1 parent 9965fc7 commit 166d8b4

File tree

1 file changed

+44
-40
lines changed

1 file changed

+44
-40
lines changed

apps/api/plane/utils/content_validator.py

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,9 @@ def validate_binary_data(data):
6767
# Combine custom components and editor-specific nodes into a single set of tags
6868
CUSTOM_TAGS = {
6969
# editor node/tag names
70-
"imageComponent",
71-
"image",
72-
"mention",
73-
"link",
74-
"customColor",
75-
"emoji",
76-
"tableHeader",
77-
"tableCell",
78-
"tableRow",
79-
"codeBlock",
80-
"code",
81-
"horizontalRule",
82-
"calloutComponent",
83-
# component-style tag used by editor embeds
70+
"mention-component",
71+
"label",
72+
"input",
8473
"image-component",
8574
}
8675
ALLOWED_TAGS = nh3.ALLOWED_TAGS | CUSTOM_TAGS
@@ -102,49 +91,64 @@ def validate_binary_data(data):
10291
"data-node-type",
10392
"data-type",
10493
"data-checked",
105-
"data-background",
94+
"data-background-color",
10695
"data-text-color",
96+
"data-name",
97+
# callout attributes
10798
"data-icon-name",
10899
"data-icon-color",
109-
"data-background-color",
100+
"data-background",
110101
"data-emoji-unicode",
111102
"data-emoji-url",
112103
"data-logo-in-use",
113104
"data-block-type",
114-
"data-name",
115-
"data-entity-id",
116-
"data-entity-group-id",
117105
},
118106
"a": {"href", "target"},
119107
# editor node/tag attributes
120-
"imageComponent": {"id", "width", "height", "aspectRatio", "src", "alignment"},
121-
"image": {"width", "height", "aspectRatio", "alignment", "src", "alt", "title"},
122-
"mention": {"id", "entity_identifier", "entity_name"},
123-
"link": {"href", "target"},
124-
"customColor": {"color", "backgroundColor"},
125-
"emoji": {"name"},
126-
"tableHeader": {"colspan", "rowspan", "colwidth", "background", "hideContent"},
127-
"tableCell": {
108+
"image-component": {
109+
"id",
110+
"width",
111+
"height",
112+
"aspectRatio",
113+
"aspectratio",
114+
"src",
115+
"alignment",
116+
},
117+
"img": {
118+
"width",
119+
"height",
120+
"aspectRatio",
121+
"aspectratio",
122+
"alignment",
123+
"src",
124+
"alt",
125+
"title",
126+
},
127+
"mention-component": {"id", "entity_identifier", "entity_name"},
128+
"th": {
128129
"colspan",
129130
"rowspan",
130131
"colwidth",
131132
"background",
132-
"textColor",
133133
"hideContent",
134+
"hidecontent",
135+
"style",
134136
},
135-
"tableRow": {"background", "textColor"},
136-
"codeBlock": {"language"},
137-
"calloutComponent": {
138-
"data-icon-color",
139-
"data-icon-name",
140-
"data-emoji-unicode",
141-
"data-emoji-url",
142-
"data-logo-in-use",
143-
"data-background",
144-
"data-block-type",
137+
"td": {
138+
"colspan",
139+
"rowspan",
140+
"colwidth",
141+
"background",
142+
"textColor",
143+
"textcolor",
144+
"hideContent",
145+
"hidecontent",
146+
"style",
145147
},
146-
# image-component (from editor extension and seeds)
147-
"image-component": {"src", "id", "width", "height", "aspectratio", "alignment"},
148+
"tr": {"background", "textColor", "textcolor", "style"},
149+
"pre": {"language"},
150+
"code": {"language", "spellcheck"},
151+
"input": {"type", "checked"},
148152
}
149153

150154
SAFE_PROTOCOLS = {"http", "https", "mailto", "tel"}

0 commit comments

Comments
 (0)