mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Android release v1.0.338
This commit is contained in:
parent
11646d1c21
commit
743c11c279
127
ElectronClient/gui/KeymapConfig/KeymapConfigScreen.js
Normal file
127
ElectronClient/gui/KeymapConfig/KeymapConfigScreen.js
Normal file
File diff suppressed because one or more lines are too long
51
ElectronClient/gui/KeymapConfig/ShortcutRecorder.js
Normal file
51
ElectronClient/gui/KeymapConfig/ShortcutRecorder.js
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
'use strict';
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
const React = require('react');
|
||||||
|
const react_1 = require('react');
|
||||||
|
const KeymapService_1 = require('../../lib/services/KeymapService');
|
||||||
|
const styles_1 = require('./styles');
|
||||||
|
const { _ } = require('lib/locale');
|
||||||
|
const keymapService = KeymapService_1.default.instance();
|
||||||
|
exports.ShortcutRecorder = ({ onSave, onReset, onCancel, onError, initialAccelerator, commandName, themeId }) => {
|
||||||
|
const styles = styles_1.default(themeId);
|
||||||
|
const [accelerator, setAccelerator] = react_1.useState(initialAccelerator);
|
||||||
|
const [saveAllowed, setSaveAllowed] = react_1.useState(true);
|
||||||
|
react_1.useEffect(() => {
|
||||||
|
try {
|
||||||
|
// Only perform validations if there's an accelerator provided
|
||||||
|
// Otherwise performing a save means that it's going to be disabled
|
||||||
|
if (accelerator) {
|
||||||
|
keymapService.validateAccelerator(accelerator);
|
||||||
|
keymapService.validateKeymap({ accelerator, command: commandName });
|
||||||
|
}
|
||||||
|
// Discard previous errors
|
||||||
|
onError({ recorderError: null });
|
||||||
|
setSaveAllowed(true);
|
||||||
|
} catch (recorderError) {
|
||||||
|
onError({ recorderError });
|
||||||
|
setSaveAllowed(false);
|
||||||
|
}
|
||||||
|
}, [accelerator]);
|
||||||
|
const handleKeydown = (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
const newAccelerator = keymapService.domToElectronAccelerator(event);
|
||||||
|
switch (newAccelerator) {
|
||||||
|
case 'Enter':
|
||||||
|
if (saveAllowed) { return onSave({ commandName, accelerator }); }
|
||||||
|
break;
|
||||||
|
case 'Escape':
|
||||||
|
return onCancel({ commandName });
|
||||||
|
case 'Backspace':
|
||||||
|
case 'Delete':
|
||||||
|
return setAccelerator('');
|
||||||
|
default:
|
||||||
|
setAccelerator(newAccelerator);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return (React.createElement('div', { style: styles.recorderContainer },
|
||||||
|
React.createElement('input', { value: accelerator, placeholder: _('Press the shortcut'), onKeyDown: handleKeydown, style: styles.recorderInput, readOnly: true, autoFocus: true }),
|
||||||
|
React.createElement('button', { style: styles.inlineButton, disabled: !saveAllowed, onClick: () => onSave({ commandName, accelerator }) }, _('Save')),
|
||||||
|
React.createElement('button', { style: styles.inlineButton, onClick: () => onReset({ commandName }) }, _('Restore')),
|
||||||
|
React.createElement('button', { style: styles.inlineButton, onClick: () => onCancel({ commandName }) }, _('Cancel'))));
|
||||||
|
};
|
||||||
|
// # sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU2hvcnRjdXRSZWNvcmRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIlNob3J0Y3V0UmVjb3JkZXIudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsK0JBQStCO0FBQy9CLGlDQUEyRDtBQUUzRCxvRUFBNkQ7QUFDN0QscUNBQStCO0FBRS9CLE1BQU0sRUFBRSxDQUFDLEVBQUUsR0FBRyxPQUFPLENBQUMsWUFBWSxDQUFDLENBQUM7QUFDcEMsTUFBTSxhQUFhLEdBQUcsdUJBQWEsQ0FBQyxRQUFRLEVBQUUsQ0FBQztBQVlsQyxRQUFBLGdCQUFnQixHQUFHLENBQUMsRUFBRSxNQUFNLEVBQUUsT0FBTyxFQUFFLFFBQVEsRUFBRSxPQUFPLEVBQUUsa0JBQWtCLEVBQUUsV0FBVyxFQUFFLE9BQU8sR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DQUFDLENBQ0w7UUFDVCxnQ0FBUSxLQUFLLEVBQUUsTUFBTSxDQUFDLFlBQVksRUFBRSxPQUFPLEVBQUUsR0FBRyxFQUFFLENBQUMsUUFBUSxDQUFDLEVBQUUsV0FBVyxFQUFFLENBQUMsSUFDMUUsQ0FBQyxDQUFDLFFBQVEsQ0FBQyxDQUNKLENBQ0osQ0FDTixDQUFDO0FBQ0gsQ0FBQyxDQUFDIn0=
|
53
ElectronClient/gui/KeymapConfig/styles/index.js
Normal file
53
ElectronClient/gui/KeymapConfig/styles/index.js
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
'use strict';
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
const { buildStyle } = require('lib/theme');
|
||||||
|
function styles(themeId) {
|
||||||
|
return buildStyle('KeymapConfigScreen', themeId, (theme) => {
|
||||||
|
return {
|
||||||
|
container: Object.assign(Object.assign({}, theme.containerStyle), { padding: 16 }),
|
||||||
|
actionsContainer: {
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'row',
|
||||||
|
},
|
||||||
|
recorderContainer: {
|
||||||
|
padding: 2,
|
||||||
|
flexGrow: 1,
|
||||||
|
},
|
||||||
|
filterInput: Object.assign(Object.assign({}, theme.inputStyle), { flexGrow: 1, minHeight: 29, alignSelf: 'center' }),
|
||||||
|
recorderInput: Object.assign(Object.assign({}, theme.inputStyle), { minHeight: 29 }),
|
||||||
|
label: Object.assign(Object.assign({}, theme.textStyle), { alignSelf: 'center', marginRight: 10 }),
|
||||||
|
table: Object.assign(Object.assign({}, theme.containerStyle), { marginTop: 16, overflow: 'auto', width: '100%' }),
|
||||||
|
tableShortcutColumn: Object.assign(Object.assign({}, theme.textStyle), { width: '60%' }),
|
||||||
|
tableCommandColumn: Object.assign(Object.assign({}, theme.textStyle), { width: 'auto' }),
|
||||||
|
tableCell: {
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'row',
|
||||||
|
},
|
||||||
|
tableCellContent: {
|
||||||
|
flexGrow: 1,
|
||||||
|
alignSelf: 'center',
|
||||||
|
},
|
||||||
|
tableCellStatus: {
|
||||||
|
height: '100%',
|
||||||
|
alignSelf: 'center',
|
||||||
|
},
|
||||||
|
kbd: {
|
||||||
|
fontFamily: 'sans-serif',
|
||||||
|
border: '1px solid',
|
||||||
|
borderRadius: 4,
|
||||||
|
backgroundColor: theme.raisedBackgroundColor,
|
||||||
|
padding: 2,
|
||||||
|
paddingLeft: 6,
|
||||||
|
paddingRight: 6,
|
||||||
|
},
|
||||||
|
disabled: {
|
||||||
|
color: theme.colorFaded,
|
||||||
|
fontStyle: 'italic',
|
||||||
|
},
|
||||||
|
inlineButton: Object.assign(Object.assign({}, theme.buttonStyle), { marginLeft: 12 }),
|
||||||
|
warning: Object.assign(Object.assign({}, theme.textStyle), { backgroundColor: theme.warningBackgroundColor, paddingLeft: 16, paddingRight: 16, paddingTop: 2, paddingBottom: 2 }),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.default = styles;
|
||||||
|
// # sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLE1BQU0sRUFBRSxVQUFVLEVBQUUsR0FBRyxPQUFPLENBQUMsV0FBVyxDQUFDLENBQUM7QUFFNUMsU0FBd0IsTUFBTSxDQUFDLE9BQWU7SUFDN0MsT0FBTyxVQUFVLENBQUMsb0JBQW9CLEVBQUUsT0FBTyxFQUFFLENBQUMsS0FBVSxFQUFFLEVBQUU7UUFDL0QsT0FBTztZQUNOLFNBQVMsa0NBQ0wsS0FBSyxDQUFDLGNBQWMsS0FDdkIsT0FBTyxFQUFFLEVBQUUsR0FDWDtZQUNELGdCQUFnQixFQUFFO2dCQUNqQixPQUFPLEVBQUUsTUFBTTtnQkFDZixhQUFhLEVBQUUsS0FBS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BQUUsV0FBVztnQkFDbkIsWUFBWSxFQUFFLENBQUM7Z0JBQ2YsZUFBZSxFQUFFLEtBQUssQ0FBQyxxQkFBcUI7Z0JBQzVDLE9BQU8sRUFBRSxDQUFDO2dCQUNWLFdBQVcsRUFBRSxDQUFDO2dCQUNkLFlBQVksRUFBRSxDQUFDO2FBQ2Y7WUFDRCxRQUFRLEVBQUU7Z0JBQ1QsS0FBSyxFQUFFLEtBQUssQ0FBQyxVQUFVO2dCQUN2QixTQUFTLEVBQUUsUUFBUTthQUNuQjtZQUNELFlBQVksa0NBQ1IsS0FBSyxDQUFDLFdBQVcsS0FDcEIsVUFBVSxFQUFFLEVBQUUsR0FDZDtZQUNELE9BQU8sa0NBQ0gsS0FBSyxDQUFDLFNBQVMsS0FDbEIsZUFBZSxFQUFFLEtBQUssQ0FBQyxzQkFBc0IsRUFDN0MsV0FBVyxFQUFFLEVBQUUsRUFDZixZQUFZLEVBQUUsRUFBRSxFQUNoQixVQUFVLEVBQUUsQ0FBQyxFQUNiLGFBQWEsRUFBRSxDQUFDLEdBQ2hCO1NBQ0QsQ0FBQztJQUNILENBQUMsQ0FBQyxDQUFDO0FBQ0osQ0FBQztBQW5GRCx5QkFtRkMifQ==
|
33
ElectronClient/gui/KeymapConfig/utils/getLabel.js
Normal file
33
ElectronClient/gui/KeymapConfig/utils/getLabel.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
'use strict';
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
const CommandService_1 = require('../../../lib/services/CommandService');
|
||||||
|
const { _ } = require('lib/locale');
|
||||||
|
const { shim } = require('lib/shim');
|
||||||
|
const commandService = CommandService_1.default.instance();
|
||||||
|
const getLabel = (commandName) => {
|
||||||
|
if (commandService.exists(commandName)) { return commandService.label(commandName); }
|
||||||
|
// Some commands are not registered in CommandService at the moment
|
||||||
|
// Following hard-coded labels are used as a workaround
|
||||||
|
switch (commandName) {
|
||||||
|
case 'quit':
|
||||||
|
return _('Quit');
|
||||||
|
case 'insertTemplate':
|
||||||
|
return _('Insert template');
|
||||||
|
case 'zoomActualSize':
|
||||||
|
return _('Actual Size');
|
||||||
|
case 'gotoAnything':
|
||||||
|
return _('Goto Anything...');
|
||||||
|
case 'help':
|
||||||
|
return _('Website and documentation');
|
||||||
|
case 'hideApp':
|
||||||
|
return _('Hide Joplin');
|
||||||
|
case 'closeWindow':
|
||||||
|
return _('Close Window');
|
||||||
|
case 'config':
|
||||||
|
return shim.isMac() ? _('Preferences') : _('Options');
|
||||||
|
default:
|
||||||
|
throw new Error(`Command: ${commandName} is unknown`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
exports.default = getLabel;
|
||||||
|
// # sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0TGFiZWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJnZXRMYWJlbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlFQUFrRTtBQUVsRSxNQUFNLEVBQUUsQ0FBQyxFQUFFLEdBQUcsT0FBTyxDQUFDLFlBQVksQ0FBQyxDQUFDO0FBQ3BDLE1BQU0sRUFBRSxJQUFJLEVBQUUsR0FBRyxPQUFPLENBQUMsVUFBVSxDQUFDLENBQUM7QUFFckMsTUFBTSxjQUFjLEdBQUcsd0JBQWMsQ0FBQyxRQUFRLEVBQUUsQ0FBQztBQUVqRCxNQUFNLFFBQVEsR0FBRyxDQUFDLFdBQW1CLEVBQUUsRUFBRTtJQUN4QyxJQUFJLGNBQWMsQ0FBQyxNQUFNLENBQUMsV0FBVyxDQUFDO1FBQUUsT0FBTyxjQUFjLENBQUMsS0FBSyxDQUFDLFdBQVcsQ0FBQyxDQUFDO0lBRWpGLG1FQUFtRTtJQUNuRSx1REFBdUQ7SUFFdkQsUUFBUSxXQUFXLEVBQUU7UUFDckIsS0FBSyxNQUFNO1lBQ1YsT0FBTyxDQUFDLENBQUMsTUFBTSxDQUFDLENBQUM7UUFDbEIsS0FBSyxnQkFBZ0I7WUFDcEIsT0FBTyxDQUFDLENBQUMsaUJBQWlCLENBQUMsQ0FBQztRQUM3QixLQUFLLGdCQUFnQjtZQUNwQixPQUFPLENBQUMsQ0FBQyxhQUFhLENBQUMsQ0FBQztRQUN6QixLQUFLLGNBQWM7WUFDbEIsT0FBTyxDQUFDLENBQUMsa0JBQWtCLENBQUMsQ0FBQztRQUM5QixLQUFLLE1BQU07WUFDVixPQUFPLENBQUMsQ0FBQywyQkFBMkIsQ0FBQyxDQUFDO1FBQ3ZDLEtBQUssU0FBUztZQUNiLE9BQU8sQ0FBQyxDQUFDLGFBQWEsQ0FBQyxDQUFDO1FBQ3pCLEtBQUssYUFBYTtZQUNqQixPQUFPLENBQUMsQ0FBQyxjQUFjLENBQUMsQ0FBQztRQUMxQixLQUFLLFFBQVE7WUFDWixPQUFPLElBQUksQ0FBQyxLQUFLLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLGFBQWEsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsU0FBUyxDQUFDLENBQUM7UUFDdkQ7WUFDQyxNQUFNLElBQUksS0FBSyxDQUFDLFlBQVksV0FBVyxhQUFhLENBQUMsQ0FBQztLQUN0RDtBQUNGLENBQUMsQ0FBQztBQUVGLGtCQUFlLFFBQVEsQ0FBQyJ9
|
25
ElectronClient/gui/KeymapConfig/utils/useCommandStatus.js
Normal file
25
ElectronClient/gui/KeymapConfig/utils/useCommandStatus.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
'use strict';
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
const react_1 = require('react');
|
||||||
|
const KeymapService_1 = require('../../../lib/services/KeymapService');
|
||||||
|
const keymapService = KeymapService_1.default.instance();
|
||||||
|
const useCommandStatus = () => {
|
||||||
|
const [status, setStatus] = react_1.useState(() => keymapService.getCommandNames().reduce((accumulator, command) => {
|
||||||
|
accumulator[command] = false;
|
||||||
|
return accumulator;
|
||||||
|
}, {}));
|
||||||
|
const disableStatus = (commandName) => setStatus(prevStatus => (Object.assign(Object.assign({}, prevStatus), { [commandName]: false })));
|
||||||
|
const enableStatus = (commandName) => setStatus(prevStatus => {
|
||||||
|
// Falsify all the commands; Only one command should be truthy at any given time
|
||||||
|
const newStatus = Object.keys(prevStatus).reduce((accumulator, command) => {
|
||||||
|
accumulator[command] = false;
|
||||||
|
return accumulator;
|
||||||
|
}, {});
|
||||||
|
// Make the appropriate command truthful
|
||||||
|
newStatus[commandName] = true;
|
||||||
|
return newStatus;
|
||||||
|
});
|
||||||
|
return [status, enableStatus, disableStatus];
|
||||||
|
};
|
||||||
|
exports.default = useCommandStatus;
|
||||||
|
// # sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlQ29tbWFuZFN0YXR1cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInVzZUNvbW1hbmRTdGF0dXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpQ0FBaUM7QUFDakMsdUVBQWdFO0FBRWhFLE1BQU0sYUFBYSxHQUFHLHVCQUFhLENBQUMsUUFBUSxFQUFFLENBQUM7QUFNL0MsTUFBTSxnQkFBZ0IsR0FBRyxHQUFrRixFQUFFO0lBQzVHLE1BQU0sQ0FBQyxNQUFNLEVBQUUsU0FBUyxDQUFDLEdBQUcsZ0JBQVEsQ0FBZ0IsR0FBRyxFQUFFLENBQ3hELGFBQWEsQ0FBQyxlQUFlLEVBQUUsQ0FBQyxNQUFNLENBQUMsQ0FBQyxXQUEwQixFQUFFLE9BQWUsRUFBRSxFQUFFO1FBQ3RGLFdBQVcsQ0FBQyxPQUFPLENBQUMsR0FBRyxLQUFLLENBQUM7UUFDN0IsT0FBTyxXQUFXLENBQUM7SUFDcEIsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUNOLENBQUM7SUFFRixNQUFNLGFBQWEsR0FBRyxDQUFDLFdBQW1CLEVBQUUsRUFBRSxDQUFDLFNBQVMsQ0FBQyxVQUFVLENBQUMsRUFBRSxDQUFDLGlDQUFNLFVBQVUsS0FBRSxDQUFDLFdBQVcsQ0FBQyxFQUFFLEtBQUssSUFBRyxDQUFDLENBQUM7SUFDbEgsTUFBTSxZQUFZLEdBQUcsQ0FBQyxXQUFtQixFQUFFLEVBQUUsQ0FBQyxTQUFTLENBQUMsVUFBVSxDQUFDLEVBQUU7UUFDcEUsZ0ZBQWdGO1FBQ2hGLE1BQU0sU0FBUyxHQUFHLE1BQU0sQ0FBQyxJQUFJLENBQUMsVUFBVSxDQUFDLENBQUMsTUFBTSxDQUFDLENBQUMsV0FBMEIsRUFBRSxPQUFlLEVBQUUsRUFBRTtZQUNoRyxXQUFXLENBQUMsT0FBTyxDQUFDLEdBQUcsS0FBSyxDQUFDO1lBQzdCLE9BQU8sV0FBVyxDQUFDO1FBQ3BCLENBQUMsRUFBRSxFQUFFLENBQUMsQ0FBQztRQUVQLHdDQUF3QztRQUN4QyxTQUFTLENBQUMsV0FBVyxDQUFDLEdBQUcsSUFBSSxDQUFDO1FBQzlCLE9BQU8sU0FBUyxDQUFDO0lBQ2xCLENBQUMsQ0FBQyxDQUFDO0lBRUgsT0FBTyxDQUFDLE1BQU0sRUFBRSxZQUFZLEVBQUUsYUFBYSxDQUFDLENBQUM7QUFDOUMsQ0FBQyxDQUFDO0FBRUYsa0JBQWUsZ0JBQWdCLENBQUMifQ==
|
68
ElectronClient/gui/KeymapConfig/utils/useKeymap.js
Normal file
68
ElectronClient/gui/KeymapConfig/utils/useKeymap.js
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
'use strict';
|
||||||
|
const __awaiter = (this && this.__awaiter) || function(thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function(resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function(resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator['throw'](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
const react_1 = require('react');
|
||||||
|
const KeymapService_1 = require('../../../lib/services/KeymapService');
|
||||||
|
const keymapService = KeymapService_1.default.instance();
|
||||||
|
// This custom hook provides a synchronized snapshot of the keymap residing at KeymapService
|
||||||
|
// All the logic regarding altering and interacting with the keymap is isolated from the components
|
||||||
|
const useKeymap = () => {
|
||||||
|
const [keymapItems, setKeymapItems] = react_1.useState(() => keymapService.getKeymapItems());
|
||||||
|
const [keymapError, setKeymapError] = react_1.useState(null);
|
||||||
|
const setAccelerator = (commandName, accelerator) => {
|
||||||
|
setKeymapItems(prevKeymap => {
|
||||||
|
const newKeymap = [...prevKeymap];
|
||||||
|
newKeymap.find(item => item.command === commandName).accelerator = accelerator || null /* Disabled */;
|
||||||
|
return newKeymap;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const resetAccelerator = (commandName) => {
|
||||||
|
const defaultAccelerator = keymapService.getDefaultAccelerator(commandName);
|
||||||
|
setKeymapItems(prevKeymap => {
|
||||||
|
const newKeymap = [...prevKeymap];
|
||||||
|
newKeymap.find(item => item.command === commandName).accelerator = defaultAccelerator;
|
||||||
|
return newKeymap;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const overrideKeymapItems = (customKeymapItems) => {
|
||||||
|
const oldKeymapItems = [...customKeymapItems];
|
||||||
|
keymapService.initialize(); // Start with a fresh keymap
|
||||||
|
try {
|
||||||
|
// First, try to update the in-memory keymap of KeymapService
|
||||||
|
// This function will throw if there are any issues with the new custom keymap
|
||||||
|
keymapService.overrideKeymap(customKeymapItems);
|
||||||
|
// Then, update the state with the data from KeymapService
|
||||||
|
// Side-effect: Changes will also be saved to the disk
|
||||||
|
setKeymapItems(keymapService.getKeymapItems());
|
||||||
|
} catch (err) {
|
||||||
|
// oldKeymapItems includes even the unchanged keymap items
|
||||||
|
// However, it is not an issue because the logic accounts for such scenarios
|
||||||
|
keymapService.overrideKeymap(oldKeymapItems);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const exportCustomKeymap = (customKeymapPath) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
|
// KeymapService is already synchronized automatically with the in-state keymap
|
||||||
|
yield keymapService.saveCustomKeymap(customKeymapPath);
|
||||||
|
});
|
||||||
|
react_1.useEffect(() => {
|
||||||
|
try {
|
||||||
|
keymapService.overrideKeymap(keymapItems);
|
||||||
|
keymapService.saveCustomKeymap();
|
||||||
|
setKeymapError(null);
|
||||||
|
} catch (err) {
|
||||||
|
setKeymapError(err);
|
||||||
|
}
|
||||||
|
}, [keymapItems]);
|
||||||
|
return [keymapItems, keymapError, overrideKeymapItems, exportCustomKeymap, setAccelerator, resetAccelerator];
|
||||||
|
};
|
||||||
|
exports.default = useKeymap;
|
||||||
|
// # sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlS2V5bWFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsidXNlS2V5bWFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7O0FBQUEsaUNBQTRDO0FBQzVDLHVFQUFnRjtBQUVoRixNQUFNLGFBQWEsR0FBRyx1QkFBYSxDQUFDLFFBQVEsRUFBRSxDQUFDO0FBRS9DLDRGQUE0RjtBQUM1RixtR0FBbUc7QUFFbkcsTUFBTSxTQUFTLEdBQUcsR0FPaEIsRUFBRTtJQUNILE1BQU0sQ0FBQyxXQUFXLEVBQUUsY0FBYyxDQUFDLEdBQUcsZ0JBQVEsQ0FBZSxHQUFHLEVBQUUsQ0FBQyxhQUFh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FBRSxXQUFXLEVBQUUsbUJBQW1CLEVBQUUsa0JBQWtCLEVBQUUsY0FBYyxFQUFFLGdCQUFnQixDQUFDLENBQUM7QUFDOUcsQ0FBQyxDQUFDO0FBRUYsa0JBQWUsU0FBUyxDQUFDIn0=
|
@ -28,7 +28,7 @@ Linux | <a href='https://github.com/laurent22/joplin/releases/download/
|
|||||||
|
|
||||||
Operating System | Download | Alt. Download
|
Operating System | Download | Alt. Download
|
||||||
-----------------|----------|----------------
|
-----------------|----------|----------------
|
||||||
Android | <a href='https://play.google.com/store/apps/details?id=net.cozic.joplin&utm_source=GitHub&utm_campaign=README&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'><img alt='Get it on Google Play' height="40px" src='https://joplinapp.org/images/BadgeAndroid.png'/></a> | or download the APK file: [64-bit](https://github.com/laurent22/joplin-android/releases/download/android-v1.0.337/joplin-v1.0.337.apk) [32-bit](https://github.com/laurent22/joplin-android/releases/download/android-v1.0.337/joplin-v1.0.337-32bit.apk)
|
Android | <a href='https://play.google.com/store/apps/details?id=net.cozic.joplin&utm_source=GitHub&utm_campaign=README&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'><img alt='Get it on Google Play' height="40px" src='https://joplinapp.org/images/BadgeAndroid.png'/></a> | or download the APK file: [64-bit](https://github.com/laurent22/joplin-android/releases/download/android-v1.0.338/joplin-v1.0.338.apk) [32-bit](https://github.com/laurent22/joplin-android/releases/download/android-v1.0.338/joplin-v1.0.338-32bit.apk)
|
||||||
iOS | <a href='https://itunes.apple.com/us/app/joplin/id1315599797'><img alt='Get it on the App Store' height="40px" src='https://joplinapp.org/images/BadgeIOS.png'/></a> | -
|
iOS | <a href='https://itunes.apple.com/us/app/joplin/id1315599797'><img alt='Get it on the App Store' height="40px" src='https://joplinapp.org/images/BadgeIOS.png'/></a> | -
|
||||||
|
|
||||||
## Terminal application
|
## Terminal application
|
||||||
|
@ -125,8 +125,8 @@ android {
|
|||||||
applicationId "net.cozic.joplin"
|
applicationId "net.cozic.joplin"
|
||||||
minSdkVersion rootProject.ext.minSdkVersion
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
versionCode 2097573
|
versionCode 2097574
|
||||||
versionName "1.0.337"
|
versionName "1.0.338"
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
|
abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user