-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added new option to use Stackable text block as the default tex…
…t block (#3283) * feat: create an editor setting for enabling default block as stackable text * feat: set default block to stackable text when the setting is enabled * fix: create dedicated plugin for setting default block * Updated option description * fix: use raw transform to prevent pasting multiline text of having core/paragraph in between * fix: make sure setting of default block only run once * chore: add comments * fix: load initial enable_text_default_block setting --------- Co-authored-by: Benjamin Intal <[email protected]>
- Loading branch information
Showing
5 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { setDefaultBlockName, getDefaultBlockName } from '@wordpress/blocks' | ||
import { useEffect } from '@wordpress/element' | ||
|
||
export const TextDefaultBlock = () => { | ||
// Set the default block to stackable/text | ||
useEffect( () => { | ||
if ( getDefaultBlockName() === 'stackable/text' ) { | ||
return null | ||
} | ||
setDefaultBlockName( 'stackable/text' ) | ||
}, [] ) | ||
|
||
return null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters