mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-19 10:26:17 +00:00
fix: wiki cn input
This commit is contained in:
@@ -53,14 +53,15 @@ class MainPanel extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleRenameDocument = (e) => {
|
handleRenameDocument = (e) => {
|
||||||
|
const { nativeEvent: { isComposing } } = e;
|
||||||
|
if (isComposing) return;
|
||||||
|
|
||||||
const newName = e.target.value.trim();
|
const newName = e.target.value.trim();
|
||||||
const { currentPageConfig } = this.state;
|
const { currentPageConfig } = this.state;
|
||||||
const { id, name, icon } = currentPageConfig;
|
const { id, name, icon } = currentPageConfig;
|
||||||
if (newName === name) return;
|
if (newName === name) return;
|
||||||
const pageConfig = { name: newName, icon };
|
const pageConfig = { name: newName, icon };
|
||||||
this.props.onUpdatePage(id, pageConfig);
|
this.props.onUpdatePage(id, pageConfig);
|
||||||
// Reset title if name is empty
|
|
||||||
if (!newName) e.target.value = name;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@@ -92,7 +93,7 @@ class MainPanel extends Component {
|
|||||||
document={this.props.editorContent}
|
document={this.props.editorContent}
|
||||||
docUuid={this.state.docUuid}
|
docUuid={this.state.docUuid}
|
||||||
isWikiReadOnly={isReadOnly}
|
isWikiReadOnly={isReadOnly}
|
||||||
topSlot={<Input className='sf-wiki-title' bsSize="lg" onChange={this.handleRenameDocument} defaultValue={currentPageConfig.name} />}
|
topSlot={<Input className='sf-wiki-title' onCompositionEnd={this.handleRenameDocument} bsSize="lg" onChange={this.handleRenameDocument} defaultValue={currentPageConfig.name} />}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
Reference in New Issue
Block a user