NOVALISTIC / keep-comments-open

Overrides "Automatically close comments" for specific posts if it's enabled, thereby keeping comments open on them indefinitely.
0 stars 0 forks source link

Needs porting to Gutenberg #1

Open NOVALISTIC opened 4 years ago

NOVALISTIC commented 4 years ago

After spending an hour whipping up this plugin for blog.NOVALISTIC, where I use the Classic Editor full-time, and another hour reading through the Gutenberg docs, I've realized I have no idea how to port the editor-facing part of my brand new plugin to the JS-based editor.

I could ship the plugin right now and have it require the Classic Editor as a dependency, but before resorting to that I thought I'd try and get some help out here from some more experienced WordPress devs first. Ideally, I'd want the checkbox to appear inside Gutenberg's built-in Discussion panel, like the Discussion meta box in the Classic Editor. Here's a mockup:

"Don't automatically close Comments" checkbox in Gutenberg

I just can't figure out how to modify or hook into Gutenberg's Discussion panel. With the Classic Editor all I had to do was

add_action( 'post_comment_status_meta_box-options', 'nv_kco_classic_meta_box_additions' );

I could do it the ugly way and add an entire legacy meta box to Gutenberg, but I'd really rather not, especially for just one checkbox. Any ideas?

rmleg commented 4 years ago

I've been looking into this a little bit. It looks like the only way to do this right now, at least with what is currently documented, is to add the checkbox to the post's Status & Visibility section of the Document panel. The discussion on this pull request seems to imply they will only add the ability to filter other sections based on whether someone can articulate a viable use case: https://github.com/WordPress/gutenberg/pull/6300. I think this would be a reasonable use case if you were interested in submitting it.

Here is the brief doc on adding the checkbox to the Status & Visibility panel: https://developer.wordpress.org/block-editor/developers/slotfills/plugin-post-status-info/. I think it would be better and make more sense in the UI if you can convince the Gutenberg devs of your use case for editing the Discussion panel, but if you want to add the option to Status & Visibility instead, I can give that a shot.