admin管理员组

文章数量:1402847

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.

本文标签: block editorHow can I check if a post is dirty using javascript on the edit post screen