mirror of
https://github.com/wassname/talk.git
synced 2026-07-15 11:26:58 +08:00
Plugins have access to ParentComponent Properties
This commit is contained in:
@@ -160,7 +160,7 @@ class Comment extends React.Component {
|
||||
? <TagLabel><BestIndicator /></TagLabel>
|
||||
: null }
|
||||
<PubDate created_at={comment.created_at} />
|
||||
<Slot fill="Comment.InfoBar" />
|
||||
<Slot fill="Comment.InfoBar" {...this.props}/>
|
||||
</div>
|
||||
|
||||
<Content body={comment.body} />
|
||||
@@ -192,7 +192,7 @@ class Comment extends React.Component {
|
||||
removeBest={removeBestTag} />
|
||||
</IfUserCanModifyBest>
|
||||
</ActionButton>
|
||||
<Slot fill="Comment.Detail" />
|
||||
<Slot fill="Comment.Detail" {...this.props}/>
|
||||
</div>
|
||||
<div className="commentActionsRight comment__action-container">
|
||||
<ActionButton>
|
||||
|
||||
@@ -120,7 +120,7 @@ class Embed extends Component {
|
||||
return (
|
||||
<div style={expandForLogin}>
|
||||
<div className="commentStream">
|
||||
<Slot fill="Stream"/>
|
||||
<Slot fill="Stream" {...this.props} />
|
||||
<TabBar onChange={this.changeTab} activeTab={activeTab}>
|
||||
<Tab><Count count={asset.totalCommentCount}/></Tab>
|
||||
<Tab>{lang.t('MY_COMMENTS')}</Tab>
|
||||
@@ -192,7 +192,9 @@ class Embed extends Component {
|
||||
showSignInDialog={this.props.showSignInDialog}
|
||||
key={highlightedComment.id}
|
||||
reactKey={highlightedComment.id}
|
||||
comment={highlightedComment} />
|
||||
comment={highlightedComment}
|
||||
{...this.props}
|
||||
/>
|
||||
}
|
||||
<NewCount
|
||||
commentCount={asset.commentCount}
|
||||
|
||||
@@ -4,10 +4,10 @@ import actions from 'coral-framework/actions';
|
||||
|
||||
class Slot extends Component {
|
||||
render() {
|
||||
const {fill} = this.props;
|
||||
const slotProps = {...this.props, ...actions};
|
||||
return (
|
||||
<div>
|
||||
{injectPlugins(fill)}
|
||||
{injectPlugins(slotProps)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {client as clientPlugins} from 'pluginsConfig';
|
||||
|
||||
function importer (fill) {
|
||||
function importer ({fill, ...props}) {
|
||||
let context,
|
||||
importedFiles;
|
||||
|
||||
@@ -39,7 +39,8 @@ function importer (fill) {
|
||||
*/
|
||||
plugin.props = {
|
||||
...actionsImporter(),
|
||||
...getConfig(plugin.name)
|
||||
...getConfig(plugin.name),
|
||||
...props
|
||||
};
|
||||
|
||||
return plugin;
|
||||
|
||||
@@ -3,6 +3,7 @@ import styles from './style.css';
|
||||
|
||||
export default (props) => (
|
||||
<div className={styles.Respect} key={props.key}>
|
||||
{console.log(props)}
|
||||
<button>Respect</button>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user