-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supporting shortcodes #334
Comments
Great discussion. @azaozz can you add some more context? Thanks. |
Current discussion has led toward discouraging this sort of use of shortcodes in favor of defining block behaviors with a standard HTML output. We should still consider how existing shortcodes built this way would be supported moving forward. The We still lack anything that allows shortcodes (or even plain HTML) to be "upgraded" automatically to new block equivalents. I've roughly considered a block being able to include in its settings a set of matchers to a shortcode or DOM selector: matches: [
{ shortcode: 'faq-builder', attributes( shortcode ) { return /* ... */; } }
] * I'm observing now that this isn't documented at all. I'll see to including this. Here's the current code implementation. |
@grahamarmfield Is that the actual syntax you use or did you put parentheses for ease of typing in this environment? |
@joyously I did use that syntax for ease of typing in this environment. It meant to imply that I would have a series of headings - each one followed by one/some paragraphs of content (including images). All the shortcode does really is place all the content into a (div) with a specific class - that is then turned into an accordion setup with jquery. @aduth The shortcodes I've built do indeed pull in the enclosed content and have various attributes. I know that ideally I would want to put a containing (div) directly into the page, but I'm building these constructs for site owners and admins that have no HTML knowledge. For these people the shortcode context is attractive and easier to understand. I guess my concern with the new editor and enclosing shortcodes is twofold:
I also have some concerns around accessibility, but this thread is not the right place for those. |
Regarding the support for shortcodes in the future, Andrew can provide a better answer than I can. But the problem you're trying to solve with shortcodes — making it easy to create advanced layouts for casual users who don't know HTML — is in fact at the very heart of what we're doing with the editor blocks. The goal for the blocks would be that instead of writing a shortcode to make this simple (where you'd still have to know shortcode syntax), you'd write a custom block to do the same. Instead of having to write shortcodes, your site owners would insert an Accordion block and fill out the fields. You can see some early mockups in #283.
Feel free to add to the discussion on #297! |
To future compatibility, without adding explicit block support, I expect existing shortcodes will adopt behaviors of the text or generic blocks, so interacting should behave similar to as it does today. The remarks in my previous comment were aimed at plugin authors who had taken this approach in the past and would like to provide backwards compatibility for those shortcodes while still taking advantage of newly implemented block best practices. Another group of plugin authors may also have implemented their own behaviors with shortcodes using the existing |
Closing as answered by Andrew here: #334 (comment) |
Having used shortcodes extensively over the years when building sites for clients who have no markup knowledge, I have some concerns about how the editor will cope with shortcodes - especially 'enclosing shortcodes' which may contain multiple paragraphs, headers or other block level elements.
An example:
[faq-builder]
(h2)Question 1(/h2)
(p)Answer to question 1(/p)
(h2)Question 2(/h2)
(p)Answer to question 2(/p)
[/faq-builder]
As far as I can tell from codex this is a valid use of shortcodes. Will the editor treat the opening and closing shortcode as separate elements, and do you foresee any potential issues here?
The text was updated successfully, but these errors were encountered: