mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Electron: update note in view when sync update note
This commit is contained in:
parent
26d1c0d79d
commit
f8bcb56964
@ -105,11 +105,10 @@ class NoteTextComponent extends React.Component {
|
||||
}, 500);
|
||||
}
|
||||
|
||||
async componentWillReceiveProps(nextProps) {
|
||||
if ('noteId' in nextProps && nextProps.noteId !== this.props.noteId) {
|
||||
async reloadNote(props) {
|
||||
this.mdToHtml_ = null;
|
||||
|
||||
const noteId = nextProps.noteId;
|
||||
const noteId = props.noteId;
|
||||
this.lastLoadedNoteId_ = noteId;
|
||||
const note = noteId ? await Note.load(noteId) : null;
|
||||
if (noteId !== this.lastLoadedNoteId_) return; // Race condition - current note was changed while this one was loading
|
||||
@ -129,6 +128,15 @@ class NoteTextComponent extends React.Component {
|
||||
webviewReady: webviewReady,
|
||||
});
|
||||
}
|
||||
|
||||
async componentWillReceiveProps(nextProps) {
|
||||
if ('noteId' in nextProps && nextProps.noteId !== this.props.noteId) {
|
||||
await this.reloadNote(nextProps);
|
||||
}
|
||||
|
||||
if ('syncStarted' in nextProps && !nextProps.syncStarted && !this.isModified()) {
|
||||
await this.reloadNote(nextProps);
|
||||
}
|
||||
}
|
||||
|
||||
isModified() {
|
||||
@ -487,6 +495,7 @@ const mapStateToProps = (state) => {
|
||||
folders: state.folders,
|
||||
theme: state.settings.theme,
|
||||
showAdvancedOptions: state.settings.showAdvancedOptions,
|
||||
syncStarted: state.syncStarted,
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -183,7 +183,6 @@ class SideBarComponent extends React.Component {
|
||||
}
|
||||
|
||||
let lines = Synchronizer.reportToLines(this.props.syncReport);
|
||||
console.info(lines);
|
||||
const syncReportText = [];
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
syncReportText.push(<div key={i}>{lines[i]}</div>);
|
||||
|
@ -33,7 +33,7 @@ const globalStyle = {
|
||||
};
|
||||
|
||||
// For WebView - must correspond to the properties above
|
||||
globalStyle.htmlFontSize =globalStyle.fontSize + 'px';
|
||||
globalStyle.htmlFontSize = globalStyle.fontSize + 'px';
|
||||
globalStyle.htmlColor ='black'; // Note: CSS in WebView component only supports named colors or rgb() notation
|
||||
globalStyle.htmlBackgroundColor ='white';
|
||||
globalStyle.htmlDividerColor ='Gainsboro';
|
||||
|
Loading…
Reference in New Issue
Block a user