Skip to content
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

Framework: Set/Get default block slug #1156

Merged
merged 1 commit into from
Jun 15, 2017
Merged

Conversation

youknowriad
Copy link
Contributor

closes #798

In this PR, I'm adding two functions setDefaultBlockSlug and getDefaultBlockSlug in the same way we have setUnknownTypeHandler.

I'm hoping to use this default block as an automatic block appended to newly created blocks. #1082

@youknowriad youknowriad added the Framework Issues related to broader framework topics, especially as it relates to javascript label Jun 13, 2017
@youknowriad youknowriad self-assigned this Jun 13, 2017
@youknowriad youknowriad requested review from mtias and aduth June 13, 2017 10:16
@@ -13,6 +13,8 @@ export {
unregisterBlockType,
setUnknownTypeHandler,
getUnknownTypeHandler,
setDefaultBlockSlug,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defaultBlockName? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got confused, because we were using slug in the same file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated but I'm still confused when to use slug and when to use name

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related: #974

I think the intent is to replace slug with name.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we still have a few to clean up, but going with name across the board.

*
* @param {string} slug Block slug
*/
export function setDefaultBlockName( slug ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per prior note, we should probably change this from slug to name in anticipation of #974.

@youknowriad
Copy link
Contributor Author

I'm going to merge this soon, to move forward with #1082

*
* @param {string} name Block name
*/
export function setDefaultBlockName( name ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe setDefaultBlock( name ) ? Could be confused as "change the name of the block which is the default", not "set the block to be used as the default".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, also redundant because you are passing the name.

Copy link
Member

@aduth aduth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm continuing to flip-flop on the naming, since we'd distinguished blocks more as instances and block type as the prototype, setDefaultBlock may not be most accurate.

Anyways, I don't want to hold this up, and we can revisit, notably in pushing along #974.

@youknowriad youknowriad merged commit c80a365 into master Jun 15, 2017
@youknowriad youknowriad deleted the try/default-block-config branch June 15, 2017 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Framework Issues related to broader framework topics, especially as it relates to javascript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to set a "default block"
3 participants