forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#### FEATURES * use `ContentState` instead of `EditorState`, selection events won't trigger onChange anymore. * deprecated `Mention.toEditorState`, instead of `Mention.toContentState`, * `Mention.toEditorState` are compatibled, but have a warnning in console. #### ISSUES * `disabled` and `readOnly` props supported. * fixed controlled mode bug. * close ant-design#5788 * close ant-design#5175 * close #react-component/editor-mention#7
- Loading branch information
Showing
10 changed files
with
95 additions
and
27 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
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,53 @@ | ||
--- | ||
order: 7 | ||
title: | ||
zh-CN: 无效或只读 | ||
en-US: disabled or readOnly | ||
--- | ||
|
||
## zh-CN | ||
|
||
通过 `disabled` 属性设置是否生效。通过 `readOnly` 属性设置是否只读。 | ||
|
||
## en-US | ||
|
||
Configurate `disabled` and `readOnly`. | ||
|
||
````jsx | ||
import { Mention } from 'antd'; | ||
const { toString } = Mention; | ||
|
||
function onChange(editorState) { | ||
console.log(toString(editorState)); | ||
} | ||
|
||
const users = ['afc163', 'benjycui', 'yiminghe', 'jljsj33', 'dqaria', 'RaoHai']; | ||
|
||
function App() { | ||
return ( | ||
<div> | ||
<div style={{ marginBottom: 10 }}> | ||
<Mention | ||
style={{ width: '100%' }} | ||
onChange={onChange} | ||
placeholder="this is disabled Mention" | ||
suggestions={users} | ||
disabled | ||
/> | ||
</div> | ||
<Mention | ||
style={{ width: '100%' }} | ||
onChange={onChange} | ||
placeholder="this is readOnly Mention" | ||
suggestions={users} | ||
readOnly | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
|
||
ReactDOM.render( | ||
<App /> | ||
, mountNode); | ||
```` |
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
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