Repository navigation
Conversation
|
@nb could you elaborate on what an "interactive template" is in this context? EDIT thanks for adding the screencast. Very interesting. I hadn't thought of these workflows yet. |
|
@lkraav I added a short screencast to show how it works – see how there is a #-tag automatically derived from the name I am adding. |
|
Very neat. With the combination of placeholder blocks and blocks with "fillable" content, it opens a lot of possibilities for content creation. I agree if we can make this simple—the code is very little, if we don't count transformations ;)—it'd be a great benefit. |
Currently named `transformComponentToText`, open to other names. Also may open the door for other transforms like this.
Its value is always in sync with an attribute.
Make it inline, so that we can safely put in a text block later.
`AttributeInput` and `transformComponentToText`
|
Added few more commits extracting common template functionality:
|
| import { createBlock, switchToBlockType } from '../factory'; | ||
| import { createBlock, switchToBlockType, transformComponentToText } from '../factory'; | ||
| import { getBlockTypes, unregisterBlockType, setUnknownTypeHandler, registerBlockType } from '../registration'; | ||
| import { Component } from 'element' |
There was a problem hiding this comment.
This should be in a separate "WordPress dependencies block":
https://github.com/WordPress/gutenberg/blob/master/docs/coding-guidelines.md#imports
Note with #2172, these need to be updated to prefix the dependencies with @wordpress/. You will need to perform a rebase against the latest version of master and apply your changes:
git fetch origin
git rebase origin/master
|
Not certain about the status of this PR. Also, the intent seems unclear to me. What can we do to unblock this? |
|
The intent was to experiment with building some templates and see what abstractions/tools might be useful to include in Gutenberg to help developers create more templates. In the specific case, I think both |
|
I believe #7352 is related as a since-closed effort to attempt syncing of attributes to input values. It doesn't appear likely that work here will be resumed, so I'm closing the pull request as stale. |
A super common use-case I‘ve found for blocks has been to build interactive templates users can insert into their post.
Few interesting learnings:
tagifyfunction.All in all if we provide some connected inputs and a shortcut to the text transform this could be an incredibly useful way of building a whole class of blocks and maybe a good introduction of both users and developers to Gutenberg.