1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-18 08:16:07 +00:00

fix: wiki cn input

This commit is contained in:
liuhongbo
2024-06-13 11:15:37 +08:00
parent 1d6aa2dc64
commit d0e493e8b2

View File

@@ -53,14 +53,15 @@ class MainPanel extends Component {
}
handleRenameDocument = (e) => {
const { nativeEvent: { isComposing } } = e;
if (isComposing) return;
const newName = e.target.value.trim();
const { currentPageConfig } = this.state;
const { id, name, icon } = currentPageConfig;
if (newName === name) return;
const pageConfig = { name: newName, icon };
this.props.onUpdatePage(id, pageConfig);
// Reset title if name is empty
if (!newName) e.target.value = name;
};
render() {
@@ -92,7 +93,7 @@ class MainPanel extends Component {
document={this.props.editorContent}
docUuid={this.state.docUuid}
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>
)}