When opening the Customizer from the admin, the initial page in the preview is the homepage. This often won't have any Code blocks on it, leaving our controls in the Colors section very unhelpful. We need to:
- Add detection for whether the currently-previewed URL has any Code blocks on it.
- If there are no Code blocks previewed, add a control before the Syntax Highlighting Theme control that displays a notice to say that there is no Code blocks in the preview and provide a link to navigate to the most recently-published post that contains a Code block.
- Also, immediately upon changing one of our settings (or rather clicking on a control), the first Code block in the preview should be scrolled into view so that the changes can be previewed.
- Each instance of the Code block should have an edit shortcut.
- Lastly, instead of causing a full page refresh when a setting is changed, we should rather implement a
postMessage preview update, perhaps utilizing selective refresh if needed.
- There should be a shortcut link in the Code block settings panel when editing a post to open that post (even draft) in the Customizer preview with the Colors section auto-expanded so the user can easily change the colors. If the post is not saved, this would need to initiate an autosave.
- Once these changes are done, the readme needs to be updated to better highlight the Customizer integration, as requested in a plugin review:
I just stumbled upon the ability to change the color scheme in the Customizer. This is an awesome feature, but not one that is highlighted in the description of the plugin or in the screenshots. Of course it is mentioned in the Advanced Usage wiki, but I have been using the plugin for months and definitely overlooked that 😉. A brief mention in the main description and a screenshot of the different theme options would definitely help unobservant users like myself.
When opening the Customizer from the admin, the initial page in the preview is the homepage. This often won't have any Code blocks on it, leaving our controls in the Colors section very unhelpful. We need to:
postMessagepreview update, perhaps utilizing selective refresh if needed.