howto get the new content of edited post?
-
When user edit a post and submit, the new content is rendered correctly in nodebb.
However, my plugin which is listening toaction:posts.edited
, is having the old content (prior the submit) inajaxify.data.posts
.Which hook should i use to get the edited post content?
Thanks in advance!
-
Hi,
Try with this:
-
filter:post.edit
-
action:post.edit
-
action:topic.edit
The second should be enought i think.
-
-
@jarey said in howto get the new content of edited post?:
Hi,
Try with this:
-
filter:post.edit
-
action:post.edit
-
action:topic.edit
The second should be enought i think.
@jarey All 3 hooks that you listed there are server-side hooks, is there any client-side hooks that will return the new content?
-
-
NodeBB/public/src/client/topic/events.js at 0efe315790deed2632e1a27babbac0189cd8a20f · NodeBB/NodeBB
Node.js based forum software built for the modern web - NodeBB/public/src/client/topic/events.js at 0efe315790deed2632e1a27babbac0189cd8a20f · NodeBB/NodeBB
GitHub (github.com)
The hook is passed the new content, you should be using that. IE.
$(window).on('action:posts.edited', function(ev, data) { console.log(data.post.content); });