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

Insert @username for user mention autocomplete #4444

Merged
merged 6 commits into from
Jan 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions blocks/autocompleters/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function blockAutocompleter( { onReplace } ) {
};
}
/**
* Returns a "completer" definition for inserting links to the posts of a user.
* Returns a "completer" definition for inserting a user mention.
* The definition can be understood by the Autocomplete component.
*
* @returns {Completer} Completer object used by the Autocomplete component.
Expand All @@ -118,12 +118,12 @@ export function userAutocompleter() {
} );
};

const allowNode = ( textNode ) => {
return textNode.parentElement.closest( 'a' ) === null;
const allowNode = () => {
return true;
};

const onSelect = ( user ) => {
return <a href={ user.link }>{ '@' + user.name }</a>;
return ( '@' + user.slug );
};

return {
Expand Down