Skip to content

Commit c91f85d

Browse files
authored
Support WordPress/Timber comment content filters (#2129)
1 parent 5f0afee commit c91f85d

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

.changeset/eight-experts-refuse.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@cloudfour/patterns': patch
3+
---
4+
5+
Add support for a `content` property (in addition to `comment_content`) so the comment component will apply content filters in WordPress/Timber projects

src/components/comment/comment.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ test(
2525
author: {
2626
name: 'Test author name',
2727
},
28-
comment_content: 'Test content',
28+
content: 'Test content',
2929
approved: true,
3030
},
3131
allow_replies: true,

src/components/comment/comment.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
message: 'This comment is awaiting moderation.'
4545
} only %}
4646
{% endif %}
47-
{{comment.comment_content|raw}}
47+
{{comment.content|default(comment.comment_content)|raw}}
4848
{% endblock %}
4949
{% endembed %}
5050
<footer class="c-comment__footer">

src/components/comment/demo/data.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export const makeComment = ({
101101
author: {
102102
name: jabber.createFullName().split(' ').slice(1).join(' '),
103103
},
104+
content,
104105
comment_content: content,
105106
is_child: isChild,
106107
children: [] as any,

0 commit comments

Comments
 (0)