Skip to content

Commit

Permalink
Merge pull request #6196 from haiwen/fix-wiki-editor-cn-input
Browse files Browse the repository at this point in the history
fix: wiki cn input
  • Loading branch information
shuntian authored Jun 17, 2024
2 parents 1d6aa2d + d0e493e commit dbce889
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions frontend/src/pages/wiki2/main-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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>
)}
Expand Down

0 comments on commit dbce889

Please sign in to comment.