forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Inline comment experimental flag
- Loading branch information
1 parent
5d73162
commit 200bd36
Showing
6 changed files
with
65 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
44 changes: 44 additions & 0 deletions
44
packages/block-editor/src/components/inline-comment/comment.js
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,44 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { Component } from '@wordpress/element'; | ||
import { comment } from '@wordpress/icons'; | ||
import { ToolbarGroup, ToolbarButton } from '@wordpress/components'; | ||
import { displayShortcut } from '@wordpress/keycodes'; | ||
import { __ } from '@wordpress/i18n'; | ||
const isInlineCommentExperimentEnabled = | ||
window?.__experimentalEnableInlineComment; | ||
|
||
class InlineCommentToolbar extends Component { | ||
constructor( props ) { | ||
super( props ); | ||
this.onToggle = this.onToggle.bind( this ); | ||
} | ||
onToggle() { | ||
// eslint-disable-next-line no-console | ||
console.log( 'comment toggled' ); | ||
} | ||
|
||
render() { | ||
return ( | ||
<> | ||
{ isInlineCommentExperimentEnabled && ( | ||
<> | ||
<ToolbarGroup className="comment-group"> | ||
<ToolbarButton | ||
icon={ comment } | ||
label={ __( 'Comment' ) } | ||
onClick={ this.onToggle } | ||
shortcut={ displayShortcut.primaryAlt( 'm' ) } | ||
className={ | ||
'comment-group-button toolbar-button-with-text' | ||
} | ||
/> | ||
</ToolbarGroup> | ||
</> | ||
) } | ||
</> | ||
); | ||
} | ||
} | ||
export default InlineCommentToolbar; |
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 @@ | ||
export { default as InlineCommentToolbar } from './comment'; |