documentcloud / wordpress-documentcloud

Embed DocumentCloud documents that won't be eaten by the visual editor

Home Page:https://wordpress.org/plugins/documentcloud/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TinyMCE preview missing for short codes

knowtheory opened this issue · comments

If you paste http://www.documentcloud.org/documents/282753-lefler-thesis.html into the TinyMCE editor and then flip to visual mode, the document will be loaded via oembed.

If you paste in [documentcloud url="http://www.documentcloud.org/documents/282753-lefler-thesis.html" width=100 height=100 sidebar=false] (to shut off the sidebar) and then flip to the visual mode, the shortcode is not converted to an embed in editor.

I know TinyMCE powers the post-editing interface, but as that's an implementation detail, should probably just reference "Text" and "Visual" modes for clarity.

I think this can get lumped into #25, if we use Shortcake. I keep meaning to get to that but keep getting sidetracked by work projects (and the sick).

Is it related? I'm genuinely unsure. What Ted's describing: if you flip to Text mode of a post and paste in a raw DC URL (like https://www.documentcloud.org/documents/282753-lefler-thesis.html) and then flip to Visual mode, the embed gets fetched and inserted into the post body. Which is super cool. But if you flip to Text mode and paste in a shortcode, then flip back to Visual mode, the shortcode is not converted to an embed.

Wait, actually. I think this might be expected behavior. A URL can't be configured, so it makes sense to just convert it straight to an embed even in Visual mode. But a shortcode can be configured, so it would be super annoying for it to convert to an embed in Visual mode.

@knowtheory I think we can wontfix this.

In fact definitely.

wait, wat?

Why is this #wontfix? You should still be able to configure in text mode right? The Q is where the preview happens and whether you can get that in the editor or whether you have to hit the preview button right?

It is super weird to me that the straight URL embeds but not the shortcode, but if that's expected behavior... i guess that's okay?

It's the intersection of a few things that make it reasonable.

Bare resource URLs don't carry any embed configuration options, so it's a straight functionality gain to have them convert to an actual embed in Visual mode. Shortcodes carry configuration options, so having them convert to an embed would means the user would have to flip to Text mode to configure it. Since most users ⬇️ live in Visual mode, WP leaves those alone. If you want to preview shortcodes, you have to use the normal Preview functionality.

➡️ I have no idea if this is true!