-
Notifications
You must be signed in to change notification settings - Fork 6
Conversation
|
||
const editorDirty = useRef( false ); | ||
const [ siteEditorDirty, setSiteEditorDirty ] = useState( false ); | ||
const [ requestPatternRefresh, setRequestPatternRefresh ] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also removed some dead code here relating to the site editor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
useEffect( () => { | ||
const saveButtons = document.getElementsByClassName( | ||
'editor-post-publish-panel__toggle' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class could change, but it's better than importing the whole testing-library to search for the button text.
} | ||
|
||
// While the above event listeners handle interrupting save button clicks, this also handles keyboard shortcut saves (like cmd+s). | ||
subscribe( () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nice if Gutenberg and React had a better event hook system, but this is what we have.
@@ -30,21 +30,8 @@ export default function usePatterns( initialPatterns: Patterns ) { | |||
window.addEventListener( | |||
'message', | |||
( event ) => { | |||
if ( event.data === 'patternmanager_site_editor_dirty' ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for removing the FSES-specific code.
This PR un-hides the "Save" button in the pattern editor, and makes it work.
What this PR does not do: