block editor - How can I check if a post is dirty using javascript on the edit post screen?

I'm trying to block a custom javascript function from running (with an appropriate error, of course) if the current

I'm trying to block a custom javascript function from running (with an appropriate error, of course) if the current post is dirty (ie, something has changed either in the editor or a custom field). I can't seem to find the variable or function that the editor page uses to determine this.

Edit for further information: I've added an ACF block in the sidebar, on the Edit page of a custom post type, that has several buttons that have onclick events to run a JS function. That much is working properly as it is.

The CPT has a bunch of ACF select and text fields, as well as a WYSIWYG editor (the old-style TinyMCE editor).

At the beginning of this function, I want it to check to see if the post is dirty - content added or edited in the TinyMCE editor, any of the select or text fields updated - so that I can throw a warning to the user that the post must be published or updated before clicking the button to run my function.

There isn't any code snippits that I can provide in this instance... because I don't know what I'm looking for to see if the post is dirty.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744342166a4569465.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信