@uiw/codemirror-extensions-mentions
v4.23.7
Published
Relative line numbers Extensions for CodeMirror6.
Downloads
4,142
Readme
Mentions Extensions
Mentions Extensions for CodeMirror6.
Install
npm install @uiw/codemirror-extensions-mentions --save
Usage
import CodeMirror from '@uiw/react-codemirror';
import { mentions } from '@uiw/codemirror-extensions-mentions';
const users = [
{ label: '@Walter White' },
{ label: '@皮皮鲁' },
{ label: '@鲁西西' },
{ label: '@中本聪' },
{ label: '@サトシ・ナカモト' },
{ label: '@野比のび太' },
{ label: '@성덕선' },
];
function App() {
return <CodeMirror value="" height="200px" extensions={[mentions(users)]} />;
}
export default App;
import { EditorView } from '@codemirror/view';
import { EditorState } from '@codemirror/state';
import { mentions } from '@uiw/codemirror-extensions-mentions';
const users = [
{ label: '@Walter White' },
{ label: '@皮皮鲁' },
{ label: '@鲁西西' },
{ label: '@中本聪' },
{ label: '@サトシ・ナカモト' },
{ label: '@野比のび太' },
{ label: '@성덕선' },
];
const state = EditorState.create({
doc: 'my source code',
extensions: [mentions(users)],
});
const view = new EditorView({
parent: document.querySelector('#editor'),
state,
});
Contributors
As always, thanks to our amazing contributors!
Made with github-action-contributors.
License
Licensed under the MIT License.