1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Merge branch 'master' into search_engine_fts_fix

This commit is contained in:
Laurent Cozic 2019-01-19 18:08:45 +00:00
commit a8a7b7c07b
3 changed files with 33 additions and 1 deletions

View File

@ -16,6 +16,8 @@ class NotePropertiesDialog extends React.Component {
this.okButton_click = this.okButton_click.bind(this);
this.cancelButton_click = this.cancelButton_click.bind(this);
this.onKeyDown = this.onKeyDown.bind(this);
this.okButton = React.createRef();
this.state = {
formNote: null,
@ -43,6 +45,12 @@ class NotePropertiesDialog extends React.Component {
}
}
componentDidUpdate() {
if (this.state.editedKey == null) {
this.okButton.current.focus();
}
}
async loadNote(noteId) {
if (!noteId) {
this.setState({ formNote: null });
@ -184,6 +192,14 @@ class NotePropertiesDialog extends React.Component {
this.closeDialog(false);
}
onKeyDown(event) {
if (event.keyCode === 13) {
this.closeDialog(true);
} else if (event.keyCode === 27) {
this.closeDialog(false);
}
}
editPropertyButtonClick(key, initialValue) {
this.setState({
editedKey: key,
@ -222,6 +238,7 @@ class NotePropertiesDialog extends React.Component {
async cancelProperty() {
return new Promise((resolve, reject) => {
this.okButton.current.focus();
this.setState({
editedKey: null,
editedValue: null
@ -347,7 +364,17 @@ class NotePropertiesDialog extends React.Component {
const formNote = this.state.formNote;
const buttonComps = [];
buttonComps.push(<button key="ok" style={styles.button} onClick={this.okButton_click}>{_('Apply')}</button>);
buttonComps.push(
<button
key="ok"
style={styles.button}
onClick={this.okButton_click}
ref={this.okButton}
onKeyDown={this.onKeyDown}
>
{_('Apply')}
</button>
);
buttonComps.push(<button key="cancel" style={styles.button} onClick={this.cancelButton_click}>{_('Cancel')}</button>);
const noteComps = [];

View File

@ -26,6 +26,8 @@
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>

View File

@ -512,6 +512,9 @@ class MdToHtml {
return this.renderImageHtml_(before, src, after, options);
});
// To disable meta tags that would refresh the page - eg "<meta http-equiv="refresh" content="5; url=/">"
// https://github.com/laurent22/joplin/issues/769
renderedBody = renderedBody.replace(/<meta\s/, '&lt;meta ');
// https://necolas.github.io/normalize.css/
const normalizeCss = `