mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Tools: Linter: Enforce object-curly-spacing - always
This commit is contained in:
parent
49701fbc55
commit
737c3f62db
@ -68,6 +68,7 @@ module.exports = {
|
||||
"linebreak-style": ["error", "unix"],
|
||||
"prefer-template": ["error"],
|
||||
"template-curly-spacing": ["error", "never"],
|
||||
"object-curly-spacing": ["error", "always"],
|
||||
"key-spacing": ["error", {
|
||||
"beforeColon": false,
|
||||
"afterColon": true,
|
||||
|
@ -25,7 +25,7 @@ class Command extends BaseCommand {
|
||||
info: stdoutFn,
|
||||
warn: stdoutFn,
|
||||
error: stdoutFn,
|
||||
}});
|
||||
} });
|
||||
ClipperServer.instance().setDispatch(() => {});
|
||||
ClipperServer.instance().setLogger(clipperLogger);
|
||||
|
||||
|
@ -90,13 +90,13 @@ describe('models_Note', function() {
|
||||
}));
|
||||
|
||||
it('should serialize and unserialize without modifying data', asyncTest(async () => {
|
||||
let folder1 = await Folder.save({ title: 'folder1'});
|
||||
let folder1 = await Folder.save({ title: 'folder1' });
|
||||
const testCases = [
|
||||
[ {title: '', body: 'Body and no title\nSecond line\nThird Line', parent_id: folder1.id},
|
||||
[ { title: '', body: 'Body and no title\nSecond line\nThird Line', parent_id: folder1.id },
|
||||
'', 'Body and no title\nSecond line\nThird Line'],
|
||||
[ {title: 'Note title', body: 'Body and title', parent_id: folder1.id},
|
||||
[ { title: 'Note title', body: 'Body and title', parent_id: folder1.id },
|
||||
'Note title', 'Body and title'],
|
||||
[ {title: 'Title and no body', body: '', parent_id: folder1.id},
|
||||
[ { title: 'Title and no body', body: '', parent_id: folder1.id },
|
||||
'Title and no body', ''],
|
||||
];
|
||||
|
||||
|
@ -86,7 +86,7 @@ describe('models_Tag', function() {
|
||||
let folder1 = await Folder.save({ title: 'folder1' });
|
||||
let note1 = await Note.save({ title: 'ma note', parent_id: folder1.id });
|
||||
let note2 = await Note.save({ title: 'ma 2nd note', parent_id: folder1.id });
|
||||
let tag = await Tag.save({ title: 'mytag'});
|
||||
let tag = await Tag.save({ title: 'mytag' });
|
||||
await Tag.addNote(tag.id, note1.id);
|
||||
|
||||
let tagWithCount = await Tag.loadWithCount(tag.id);
|
||||
|
@ -1,11 +1,11 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
|
||||
require('app-module-path').addPath(__dirname);
|
||||
const {setupDatabaseAndSynchronizer, switchClient, asyncTest } = require('test-utils.js');
|
||||
const { setupDatabaseAndSynchronizer, switchClient, asyncTest } = require('test-utils.js');
|
||||
const Folder = require('lib/models/Folder.js');
|
||||
const Note = require('lib/models/Note.js');
|
||||
const Tag = require('lib/models/Tag.js');
|
||||
const { reducer, defaultState, stateUtils} = require('lib/reducer.js');
|
||||
const { reducer, defaultState, stateUtils } = require('lib/reducer.js');
|
||||
|
||||
async function createNTestFolders(n) {
|
||||
let folders = [];
|
||||
@ -64,7 +64,7 @@ function initTestState(folders, selectedFolderIndex, notes, selectedIndexes, tag
|
||||
}
|
||||
|
||||
function createExpectedState(items, keepIndexes, selectedIndexes) {
|
||||
let expected = { items: [], selectedIds: []};
|
||||
let expected = { items: [], selectedIds: [] };
|
||||
|
||||
for (let i = 0; i < selectedIndexes.length; i++) {
|
||||
expected.selectedIds.push(items[selectedIndexes[i]].id);
|
||||
@ -111,7 +111,7 @@ describe('Reducer', function() {
|
||||
|
||||
// test action
|
||||
// delete the third note
|
||||
state = reducer(state, {type: 'NOTE_DELETE', id: notes[2].id});
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[2].id });
|
||||
|
||||
// expect that the third note is missing, and the 4th note is now selected
|
||||
let expected = createExpectedState(notes, [0,1,3,4], [3]);
|
||||
@ -128,7 +128,7 @@ describe('Reducer', function() {
|
||||
let state = initTestState(folders, 0, notes, [1]);
|
||||
|
||||
// test action
|
||||
state = reducer(state, {type: 'NOTE_DELETE', id: notes[0].id});
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[0].id });
|
||||
|
||||
let expected = createExpectedState(notes, [1,2,3,4], [1]);
|
||||
|
||||
@ -142,7 +142,7 @@ describe('Reducer', function() {
|
||||
let state = initTestState(folders, 0, notes, [0]);
|
||||
|
||||
// test action
|
||||
state = reducer(state, {type: 'NOTE_DELETE', id: notes[0].id});
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[0].id });
|
||||
|
||||
let expected = createExpectedState(notes, [], []);
|
||||
|
||||
@ -156,7 +156,7 @@ describe('Reducer', function() {
|
||||
let state = initTestState(folders, 0, notes, [4]);
|
||||
|
||||
// test action
|
||||
state = reducer(state, {type: 'NOTE_DELETE', id: notes[4].id});
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[4].id });
|
||||
|
||||
let expected = createExpectedState(notes, [0,1,2,3], [3]);
|
||||
|
||||
@ -170,7 +170,7 @@ describe('Reducer', function() {
|
||||
let state = initTestState(folders, 0, notes, [3]);
|
||||
|
||||
// test action
|
||||
state = reducer(state, {type: 'NOTE_DELETE', id: notes[1].id});
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[1].id });
|
||||
|
||||
let expected = createExpectedState(notes, [0,2,3,4], [3]);
|
||||
|
||||
@ -184,7 +184,7 @@ describe('Reducer', function() {
|
||||
let state = initTestState(folders, 0, notes, [1]);
|
||||
|
||||
// test action
|
||||
state = reducer(state, {type: 'NOTE_DELETE', id: notes[3].id});
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[3].id });
|
||||
|
||||
let expected = createExpectedState(notes, [0,1,2,4], [1]);
|
||||
|
||||
@ -198,8 +198,8 @@ describe('Reducer', function() {
|
||||
let state = initTestState(folders, 0, notes, [1,2]);
|
||||
|
||||
// test action
|
||||
state = reducer(state, {type: 'NOTE_DELETE', id: notes[1].id});
|
||||
state = reducer(state, {type: 'NOTE_DELETE', id: notes[2].id});
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[1].id });
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[2].id });
|
||||
|
||||
let expected = createExpectedState(notes, [0,3,4], [3]);
|
||||
|
||||
@ -213,7 +213,7 @@ describe('Reducer', function() {
|
||||
let state = initTestState(folders, 0, notes, [3,4]);
|
||||
|
||||
// test action
|
||||
state = reducer(state, {type: 'NOTE_DELETE', id: notes[1].id});
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[1].id });
|
||||
|
||||
let expected = createExpectedState(notes, [0,2,3,4], [3,4]);
|
||||
|
||||
@ -227,7 +227,7 @@ describe('Reducer', function() {
|
||||
let state = initTestState(folders, 0, notes, [1,2]);
|
||||
|
||||
// test action
|
||||
state = reducer(state, {type: 'NOTE_DELETE', id: notes[3].id});
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[3].id });
|
||||
|
||||
let expected = createExpectedState(notes, [0,1,2,4], [1,2]);
|
||||
|
||||
@ -241,8 +241,8 @@ describe('Reducer', function() {
|
||||
let state = initTestState(folders, 0, notes, [3,4]);
|
||||
|
||||
// test action
|
||||
state = reducer(state, {type: 'NOTE_DELETE', id: notes[3].id});
|
||||
state = reducer(state, {type: 'NOTE_DELETE', id: notes[4].id});
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[3].id });
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[4].id });
|
||||
|
||||
let expected = createExpectedState(notes, [0,1,2], [2]);
|
||||
|
||||
@ -256,9 +256,9 @@ describe('Reducer', function() {
|
||||
let state = initTestState(folders, 0, notes, [0,2,4]);
|
||||
|
||||
// test action
|
||||
state = reducer(state, {type: 'NOTE_DELETE', id: notes[0].id});
|
||||
state = reducer(state, {type: 'NOTE_DELETE', id: notes[2].id});
|
||||
state = reducer(state, {type: 'NOTE_DELETE', id: notes[4].id});
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[0].id });
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[2].id });
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[4].id });
|
||||
|
||||
let expected = createExpectedState(notes, [1,3], [1]);
|
||||
|
||||
@ -273,7 +273,7 @@ describe('Reducer', function() {
|
||||
let state = initTestState(folders, 2, notes, [2]);
|
||||
|
||||
// test action
|
||||
state = reducer(state, {type: 'FOLDER_DELETE', id: folders[2].id});
|
||||
state = reducer(state, { type: 'FOLDER_DELETE', id: folders[2].id });
|
||||
|
||||
let expected = createExpectedState(folders, [0,1,3,4], [3]);
|
||||
|
||||
@ -287,7 +287,7 @@ describe('Reducer', function() {
|
||||
let state = initTestState(folders, 1, notes, [2]);
|
||||
|
||||
// test action
|
||||
state = reducer(state, {type: 'FOLDER_DELETE', id: folders[2].id});
|
||||
state = reducer(state, { type: 'FOLDER_DELETE', id: folders[2].id });
|
||||
|
||||
let expected = createExpectedState(folders, [0,1,3,4], [1]);
|
||||
|
||||
@ -301,7 +301,7 @@ describe('Reducer', function() {
|
||||
let state = initTestState(folders, 4, notes, [2]);
|
||||
|
||||
// test action
|
||||
state = reducer(state, {type: 'FOLDER_DELETE', id: folders[2].id});
|
||||
state = reducer(state, { type: 'FOLDER_DELETE', id: folders[2].id });
|
||||
|
||||
let expected = createExpectedState(folders, [0,1,3,4], [4]);
|
||||
|
||||
@ -315,7 +315,7 @@ describe('Reducer', function() {
|
||||
let state = initTestState(null, null, null, null, tags, [2]);
|
||||
|
||||
// test action
|
||||
state = reducer(state, {type: 'TAG_DELETE', id: tags[2].id});
|
||||
state = reducer(state, { type: 'TAG_DELETE', id: tags[2].id });
|
||||
|
||||
let expected = createExpectedState(tags, [0,1,3,4], [3]);
|
||||
|
||||
@ -328,7 +328,7 @@ describe('Reducer', function() {
|
||||
let state = initTestState(null, null, null, null, tags, [2]);
|
||||
|
||||
// test action
|
||||
state = reducer(state, {type: 'TAG_DELETE', id: tags[4].id});
|
||||
state = reducer(state, { type: 'TAG_DELETE', id: tags[4].id });
|
||||
|
||||
let expected = createExpectedState(tags, [0,1,2,3], [2]);
|
||||
|
||||
@ -341,7 +341,7 @@ describe('Reducer', function() {
|
||||
let state = initTestState(null, null, null, null, tags, [2]);
|
||||
|
||||
// test action
|
||||
state = reducer(state, {type: 'TAG_DELETE', id: tags[0].id});
|
||||
state = reducer(state, { type: 'TAG_DELETE', id: tags[0].id });
|
||||
|
||||
let expected = createExpectedState(tags, [1,2,3,4], [2]);
|
||||
|
||||
@ -365,7 +365,7 @@ describe('Reducer', function() {
|
||||
expect(state.selectedNoteIds).toEqual(expected.selectedIds);
|
||||
|
||||
// test action
|
||||
state = reducer(state, {type: 'NOTE_SELECT_ALL'});
|
||||
state = reducer(state, { type: 'NOTE_SELECT_ALL' });
|
||||
|
||||
expected = createExpectedState(notes.slice(0,3), [0,1,2], [0,1,2]);
|
||||
expect(getIds(state.notes)).toEqual(getIds(expected.items));
|
||||
|
@ -279,7 +279,7 @@ describe('services_rest_Api', function() {
|
||||
const response = await api.route('GET', 'notes', { token: 'mytoken' });
|
||||
expect(response.length).toBe(0);
|
||||
|
||||
hasThrown = await checkThrowAsync(async () => await api.route('POST', 'notes', null, JSON.stringify({title: 'testing'})));
|
||||
hasThrown = await checkThrowAsync(async () => await api.route('POST', 'notes', null, JSON.stringify({ title: 'testing' })));
|
||||
expect(hasThrown).toBe(true);
|
||||
}));
|
||||
|
||||
|
@ -189,10 +189,10 @@ class AppComponent extends Component {
|
||||
}
|
||||
|
||||
async loadContentScripts() {
|
||||
await bridge().tabsExecuteScript({file: '/content_scripts/JSDOMParser.js'});
|
||||
await bridge().tabsExecuteScript({file: '/content_scripts/Readability.js'});
|
||||
await bridge().tabsExecuteScript({file: '/content_scripts/Readability-readerable.js'});
|
||||
await bridge().tabsExecuteScript({file: '/content_scripts/index.js'});
|
||||
await bridge().tabsExecuteScript({ file: '/content_scripts/JSDOMParser.js' });
|
||||
await bridge().tabsExecuteScript({ file: '/content_scripts/Readability.js' });
|
||||
await bridge().tabsExecuteScript({ file: '/content_scripts/Readability-readerable.js' });
|
||||
await bridge().tabsExecuteScript({ file: '/content_scripts/index.js' });
|
||||
}
|
||||
|
||||
async componentDidMount() {
|
||||
@ -248,7 +248,7 @@ class AppComponent extends Component {
|
||||
if (!this.state.contentScriptLoaded) {
|
||||
let msg = 'Loading...';
|
||||
if (this.state.contentScriptError) msg = `The Joplin extension is not available on this tab due to: ${this.state.contentScriptError}`;
|
||||
return <div style={{padding: 10, fontSize: 12, maxWidth: 200}}>{msg}</div>;
|
||||
return <div style={{ padding: 10, fontSize: 12, maxWidth: 200 }}>{msg}</div>;
|
||||
}
|
||||
|
||||
const warningComponent = !this.props.warning ? null : <div className="Warning">{ this.props.warning }</div>;
|
||||
|
@ -99,7 +99,7 @@ class InteropServiceHelper {
|
||||
|
||||
if (module.target === 'file') {
|
||||
path = bridge().showSaveDialog({
|
||||
filters: [{ name: module.description, extensions: module.fileExtensions}],
|
||||
filters: [{ name: module.description, extensions: module.fileExtensions }],
|
||||
});
|
||||
} else {
|
||||
path = bridge().showOpenDialog({
|
||||
|
@ -408,7 +408,7 @@ class Application extends BaseApplication {
|
||||
|
||||
if (moduleSource === 'file') {
|
||||
path = bridge().showOpenDialog({
|
||||
filters: [{ name: module.description, extensions: module.fileExtensions}],
|
||||
filters: [{ name: module.description, extensions: module.fileExtensions }],
|
||||
});
|
||||
} else {
|
||||
path = bridge().showOpenDialog({
|
||||
|
@ -56,7 +56,7 @@ class Bridge {
|
||||
}
|
||||
|
||||
showSaveDialog(options) {
|
||||
const {dialog} = require('electron');
|
||||
const { dialog } = require('electron');
|
||||
if (!options) options = {};
|
||||
if (!('defaultPath' in options) && this.lastSelectedPath_) options.defaultPath = this.lastSelectedPath_;
|
||||
const filePath = dialog.showSaveDialogSync(this.window(), options);
|
||||
@ -67,7 +67,7 @@ class Bridge {
|
||||
}
|
||||
|
||||
showOpenDialog(options) {
|
||||
const {dialog} = require('electron');
|
||||
const { dialog } = require('electron');
|
||||
if (!options) options = {};
|
||||
if (!('defaultPath' in options) && this.lastSelectedPath_) options.defaultPath = this.lastSelectedPath_;
|
||||
if (!('createDirectory' in options)) options.createDirectory = true;
|
||||
@ -80,7 +80,7 @@ class Bridge {
|
||||
|
||||
// Don't use this directly - call one of the showXxxxxxxMessageBox() instead
|
||||
showMessageBox_(window, options) {
|
||||
const {dialog} = require('electron');
|
||||
const { dialog } = require('electron');
|
||||
if (!window) window = this.window();
|
||||
return dialog.showMessageBoxSync(window, options);
|
||||
}
|
||||
|
@ -21,8 +21,8 @@ let branch;
|
||||
let hash;
|
||||
try {
|
||||
// Use stdio: 'pipe' so that execSync doesn't print error directly to stdout
|
||||
branch = execSync('git rev-parse --abbrev-ref HEAD', {stdio: 'pipe' }).toString().trim();
|
||||
hash = execSync('git log --pretty="%h" -1', {stdio: 'pipe' }).toString().trim();
|
||||
branch = execSync('git rev-parse --abbrev-ref HEAD', { stdio: 'pipe' }).toString().trim();
|
||||
hash = execSync('git log --pretty="%h" -1', { stdio: 'pipe' }).toString().trim();
|
||||
} catch (err) {
|
||||
// Don't display error object as it's a "fatal" error, but
|
||||
// not for us, since is it not critical information
|
||||
|
@ -121,9 +121,9 @@ class ClipperConfigScreenComponent extends React.Component {
|
||||
<div style={stepBoxStyle}>
|
||||
<p style={theme.h1Style}>{_('Step 2: Install the extension')}</p>
|
||||
<p style={theme.textStyle}>{_('Download and install the relevant extension for your browser:')}</p>
|
||||
<div style={{display: 'flex', flexDirection: 'row'}}>
|
||||
<div style={{ display: 'flex', flexDirection: 'row' }}>
|
||||
<ExtensionBadge theme={this.props.theme} type="firefox" url="https://addons.mozilla.org/en-US/firefox/addon/joplin-web-clipper/"/>
|
||||
<ExtensionBadge style={{marginLeft: 10}} theme={this.props.theme} type="chrome" url="https://chrome.google.com/webstore/detail/joplin-web-clipper/alofnhikmmkdbbbgpnglcpdollgjjfek"/>
|
||||
<ExtensionBadge style={{ marginLeft: 10 }} theme={this.props.theme} type="chrome" url="https://chrome.google.com/webstore/detail/joplin-web-clipper/alofnhikmmkdbbbgpnglcpdollgjjfek"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -212,7 +212,7 @@ class ConfigScreenComponent extends React.Component {
|
||||
if (advancedSettingComps.length) {
|
||||
const iconName = this.state.showAdvancedSettings ? 'fa fa-toggle-up' : 'fa fa-toggle-down';
|
||||
const advancedSettingsButtonStyle = Object.assign({}, theme.buttonStyle, { marginBottom: 10 });
|
||||
advancedSettingsButton = <button onClick={() => shared.advancedSettingsButton_click(this)} style={advancedSettingsButtonStyle}><i style={{fontSize: 14}} className={iconName}></i> {_('Show Advanced Settings')}</button>;
|
||||
advancedSettingsButton = <button onClick={() => shared.advancedSettingsButton_click(this)} style={advancedSettingsButtonStyle}><i style={{ fontSize: 14 }} className={iconName}></i> {_('Show Advanced Settings')}</button>;
|
||||
advancedSettingsSectionStyle.display = this.state.showAdvancedSettings ? 'block' : 'none';
|
||||
}
|
||||
|
||||
@ -575,7 +575,7 @@ class ConfigScreenComponent extends React.Component {
|
||||
borderTopColor: theme.dividerColor,
|
||||
};
|
||||
|
||||
const screenComp = this.state.screenName ? <div style={{overflow: 'scroll', flex: 1}}>{this.screenFromName(this.state.screenName)}</div> : null;
|
||||
const screenComp = this.state.screenName ? <div style={{ overflow: 'scroll', flex: 1 }}>{this.screenFromName(this.state.screenName)}</div> : null;
|
||||
|
||||
if (screenComp) containerStyle.display = 'none';
|
||||
|
||||
|
@ -152,7 +152,7 @@ class MainScreenComponent extends React.Component {
|
||||
.sort((a, b) => {
|
||||
// sensitivity accent will treat accented characters as differemt
|
||||
// but treats caps as equal
|
||||
return a.label.localeCompare(b.label, undefined, {sensitivity: 'accent'});
|
||||
return a.label.localeCompare(b.label, undefined, { sensitivity: 'accent' });
|
||||
});
|
||||
const allTags = await Tag.allWithNotes();
|
||||
const tagSuggestions = allTags.map(a => {
|
||||
|
@ -1117,7 +1117,7 @@ class NoteTextComponent extends React.Component {
|
||||
|
||||
if (command.name === 'exportPdf') {
|
||||
fn = this.commandSavePdf;
|
||||
args = {noteId: command.noteId};
|
||||
args = { noteId: command.noteId };
|
||||
} else if (command.name === 'print') {
|
||||
fn = this.commandPrint;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ class OneDriveLoginScreenComponent extends React.Component {
|
||||
return (
|
||||
<div>
|
||||
<Header style={headerStyle}/>
|
||||
<div style={{padding: 10}}>
|
||||
<div style={{ padding: 10 }}>
|
||||
{logComps}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -62,9 +62,9 @@ class Dialog extends React.PureComponent {
|
||||
this.styles_[this.props.theme] = {
|
||||
dialogBox: Object.assign({}, theme.dialogBox, { minWidth: '50%', maxWidth: '50%' }),
|
||||
input: Object.assign({}, theme.inputStyle, { flex: 1 }),
|
||||
row: {overflow: 'hidden', height: itemHeight, display: 'flex', justifyContent: 'center', flexDirection: 'column', paddingLeft: 10, paddingRight: 10},
|
||||
row: { overflow: 'hidden', height: itemHeight, display: 'flex', justifyContent: 'center', flexDirection: 'column', paddingLeft: 10, paddingRight: 10 },
|
||||
help: Object.assign({}, theme.textStyle, { marginBottom: 10 }),
|
||||
inputHelpWrapper: {display: 'flex', flexDirection: 'row', alignItems: 'center'},
|
||||
inputHelpWrapper: { display: 'flex', flexDirection: 'row', alignItems: 'center' },
|
||||
};
|
||||
|
||||
const rowTextStyle = {
|
||||
@ -254,7 +254,7 @@ class Dialog extends React.PureComponent {
|
||||
|
||||
return (
|
||||
<div key={item.id} style={rowStyle} onClick={this.listItem_onClick} data-id={item.id} data-parent-id={item.parent_id}>
|
||||
<div style={style.rowTitle} dangerouslySetInnerHTML={{__html: titleHtml}}></div>
|
||||
<div style={style.rowTitle} dangerouslySetInnerHTML={{ __html: titleHtml }}></div>
|
||||
{pathComp}
|
||||
</div>
|
||||
);
|
||||
|
@ -24,4 +24,4 @@ const injectCustomStyles = async cssFilePath => {
|
||||
document.head.appendChild(styleTag);
|
||||
};
|
||||
|
||||
module.exports = {loadCustomCss, injectCustomStyles};
|
||||
module.exports = { loadCustomCss, injectCustomStyles };
|
||||
|
@ -3,7 +3,7 @@ const { shim } = require('lib/shim.js');
|
||||
const JoplinError = require('lib/JoplinError');
|
||||
const { rtrimSlashes } = require('lib/path-utils.js');
|
||||
const base64 = require('base-64');
|
||||
const {_ } = require('lib/locale');
|
||||
const { _ } = require('lib/locale');
|
||||
|
||||
interface JoplinServerApiOptions {
|
||||
username: Function,
|
||||
|
@ -45,7 +45,7 @@ TemplateUtils.loadTemplates = async function(filePath) {
|
||||
|
||||
// Make sure templates are always in the same order
|
||||
// sensitivity ensures that the sort will ignore case
|
||||
files.sort((a, b) => { return a.path.localeCompare(b.path, undefined, {sensitivity: 'accent'}); });
|
||||
files.sort((a, b) => { return a.path.localeCompare(b.path, undefined, { sensitivity: 'accent' }); });
|
||||
|
||||
files.forEach(async file => {
|
||||
if (file.path.endsWith('.md')) {
|
||||
|
@ -99,7 +99,7 @@ class CameraView extends Component {
|
||||
|
||||
return (
|
||||
<TouchableOpacity onPress={onPress} style={Object.assign({}, style)}>
|
||||
<View style={{borderRadius: 32, width: 60, height: 60, borderColor: '#00000040', borderWidth: 1, borderStyle: 'solid', backgroundColor: '#ffffff77', justifyContent: 'center', alignItems: 'center', alignSelf: 'baseline' }}>
|
||||
<View style={{ borderRadius: 32, width: 60, height: 60, borderColor: '#00000040', borderWidth: 1, borderStyle: 'solid', backgroundColor: '#ffffff77', justifyContent: 'center', alignItems: 'center', alignSelf: 'baseline' }}>
|
||||
{ icon }
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
@ -152,7 +152,7 @@ class CameraView extends Component {
|
||||
const displayRatios = shim.mobilePlatform() === 'android' && this.state.ratios.length > 1;
|
||||
|
||||
const reverseCameraButton = this.renderButton(this.reverse_onPress, 'md-reverse-camera', { flex: 1, flexDirection: 'row', justifyContent: 'flex-start', marginLeft: 20 });
|
||||
const ratioButton = !displayRatios ? <View style={{ flex: 1 }}/> : this.renderButton(this.ratio_onPress, <Text style={{fontWeight: 'bold', fontSize: 20}}>{Setting.value('camera.ratio')}</Text>, { flex: 1, flexDirection: 'row', justifyContent: 'flex-end', marginRight: 20 });
|
||||
const ratioButton = !displayRatios ? <View style={{ flex: 1 }}/> : this.renderButton(this.ratio_onPress, <Text style={{ fontWeight: 'bold', fontSize: 20 }}>{Setting.value('camera.ratio')}</Text>, { flex: 1, flexDirection: 'row', justifyContent: 'flex-end', marginRight: 20 });
|
||||
|
||||
let cameraRatio = '4:3';
|
||||
const cameraProps = {};
|
||||
|
@ -170,7 +170,7 @@ class ScreenHeaderComponent extends React.PureComponent {
|
||||
|
||||
// Duplicate all selected notes. ensureUniqueTitle is set to true to use the
|
||||
// original note's name as a root for the new unique identifier.
|
||||
await Note.duplicateMultipleNotes(noteIds, {ensureUniqueTitle: true});
|
||||
await Note.duplicateMultipleNotes(noteIds, { ensureUniqueTitle: true });
|
||||
|
||||
this.props.dispatch({ type: 'NOTE_SELECTION_END' });
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ class ConfigScreenComponent extends BaseScreenComponent {
|
||||
const profileExportPrompt = (
|
||||
<View style={this.styles().settingContainer}>
|
||||
<Text style={this.styles().settingText}>Path:</Text>
|
||||
<TextInput style={{marginRight: 20}} onChange={(event) => this.setState({profileExportPath: event.nativeEvent.text })} value={this.state.profileExportPath} placeholder="/path/to/sdcard"></TextInput>
|
||||
<TextInput style={{ marginRight: 20 }} onChange={(event) => this.setState({ profileExportPath: event.nativeEvent.text })} value={this.state.profileExportPath} placeholder="/path/to/sdcard"></TextInput>
|
||||
<Button title="OK" onPress={this.exportProfileButtonPress2_}></Button>
|
||||
</View>
|
||||
);
|
||||
|
@ -81,7 +81,7 @@ class SelectDateTimeDialog extends React.PureComponent {
|
||||
width={0.9}
|
||||
height={350}
|
||||
>
|
||||
<View style={{flex: 1, margin: 20, alignItems: 'center'}}>
|
||||
<View style={{ flex: 1, margin: 20, alignItems: 'center' }}>
|
||||
<DatePicker
|
||||
date={this.state.date}
|
||||
mode="datetime"
|
||||
@ -90,7 +90,7 @@ class SelectDateTimeDialog extends React.PureComponent {
|
||||
confirmBtnText={_('Confirm')}
|
||||
cancelBtnText={_('Cancel')}
|
||||
onDateChange={(date) => { this.setState({ date: this.stringToDate(date) }); }}
|
||||
style={{width: 300}}
|
||||
style={{ width: 300 }}
|
||||
customStyles={{
|
||||
btnConfirm: {
|
||||
paddingVertical: 0,
|
||||
|
@ -11,7 +11,7 @@ function addResourceTag(lines, resource, attributes) {
|
||||
const src = `:/${resource.id}`;
|
||||
|
||||
if (resourceUtils.isImageMimeType(resource.mime)) {
|
||||
lines.push(resourceUtils.imgElement({src, attributes}));
|
||||
lines.push(resourceUtils.imgElement({ src, attributes }));
|
||||
} else if (resource.mime === 'audio/x-m4a') {
|
||||
/**
|
||||
* TODO: once https://github.com/laurent22/joplin/issues/1794 is resolved,
|
||||
@ -162,9 +162,9 @@ async function enexXmlToHtml(xmlString, resources, options = {}) {
|
||||
|
||||
const beautifyHtml = (html) => {
|
||||
return new Promise((resolve) => {
|
||||
const options = {wrap: 0};
|
||||
const options = { wrap: 0 };
|
||||
cleanHtml.clean(html, options, (...cleanedHtml) => resolve(cleanedHtml));
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {enexXmlToHtml};
|
||||
module.exports = { enexXmlToHtml };
|
||||
|
@ -1,5 +1,5 @@
|
||||
const fs = require('fs-extra');
|
||||
const {dirname } = require('../pathUtils');
|
||||
const { dirname } = require('../pathUtils');
|
||||
|
||||
const rootDir = dirname(__dirname);
|
||||
const assetsDir = `${rootDir}/assets`;
|
||||
|
@ -345,8 +345,8 @@ class Setting extends BaseModel {
|
||||
},
|
||||
|
||||
// Deprecated - use markdown.plugin.*
|
||||
'markdown.softbreaks': { value: false, type: Setting.TYPE_BOOL, public: false, appTypes: ['mobile', 'desktop']},
|
||||
'markdown.typographer': { value: false, type: Setting.TYPE_BOOL, public: false, appTypes: ['mobile', 'desktop']},
|
||||
'markdown.softbreaks': { value: false, type: Setting.TYPE_BOOL, public: false, appTypes: ['mobile', 'desktop'] },
|
||||
'markdown.typographer': { value: false, type: Setting.TYPE_BOOL, public: false, appTypes: ['mobile', 'desktop'] },
|
||||
// Deprecated
|
||||
|
||||
'markdown.plugin.softbreaks': { value: false, type: Setting.TYPE_BOOL, section: 'plugins', public: true, appTypes: ['mobile', 'desktop'], label: () => _('Enable soft breaks') },
|
||||
@ -502,13 +502,13 @@ class Setting extends BaseModel {
|
||||
'Tabloid': _('Tabloid'),
|
||||
'Legal': _('Legal'),
|
||||
};
|
||||
}},
|
||||
} },
|
||||
'export.pdfPageOrientation': { value: 'portrait', type: Setting.TYPE_STRING, isEnum: true, public: true, appTypes: ['desktop'], label: () => _('Page orientation for PDF export'), options: () => {
|
||||
return {
|
||||
'portrait': _('Portrait'),
|
||||
'landscape': _('Landscape'),
|
||||
};
|
||||
}},
|
||||
} },
|
||||
|
||||
|
||||
'net.customCertificates': {
|
||||
|
@ -45,17 +45,17 @@ const attributesToStr = (attributes) =>
|
||||
.map(([key, value]) => ` ${key}="${escapeQuotes(value)}"`)
|
||||
.join('');
|
||||
|
||||
const attachmentElement = ({src, attributes, id}) =>
|
||||
const attachmentElement = ({ src, attributes, id }) =>
|
||||
[
|
||||
`<a href='joplin://${id}' ${attributesToStr(attributes)}>`,
|
||||
` ${attributes.alt || src}`,
|
||||
'</a>',
|
||||
].join('');
|
||||
|
||||
const imgElement = ({src, attributes}) =>
|
||||
const imgElement = ({ src, attributes }) =>
|
||||
`<img src="${src}" ${attributesToStr(attributes)} />`;
|
||||
|
||||
const audioElement = ({src, alt, id}) =>
|
||||
const audioElement = ({ src, alt, id }) =>
|
||||
[
|
||||
'<audio controls preload="none" style="width:480px;">',
|
||||
` <source src="${src}" type="audio/mp4" />`,
|
||||
|
@ -196,7 +196,7 @@ class InteropService {
|
||||
const ModuleClass = require(modulePath);
|
||||
const output = new ModuleClass();
|
||||
const moduleMetadata = this.findModuleByFormat_(type, options.format, options.target);
|
||||
output.setMetadata({options, ...moduleMetadata}); // TODO: Check that this metadata is equivalent to module above
|
||||
output.setMetadata({ options, ...moduleMetadata }); // TODO: Check that this metadata is equivalent to module above
|
||||
return output;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ class InteropService_Importer_EnexToHtml extends InteropService_Importer_Base {
|
||||
folder = await Folder.save({ title: folderTitle });
|
||||
}
|
||||
|
||||
await importEnex(folder.id, this.sourcePath_, {...this.options_, outputFormat: 'html'});
|
||||
await importEnex(folder.id, this.sourcePath_, { ...this.options_, outputFormat: 'html' });
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ const Note = require('lib/models/Note.js');
|
||||
const { basename, filename, rtrimSlashes, fileExtension, dirname } = require('lib/path-utils.js');
|
||||
const { shim } = require('lib/shim');
|
||||
const { _ } = require('lib/locale');
|
||||
const {extractImageUrls} = require('lib/markdownUtils');
|
||||
const {unique} = require('lib/ArrayUtils');
|
||||
const { extractImageUrls } = require('lib/markdownUtils');
|
||||
const { unique } = require('lib/ArrayUtils');
|
||||
const { pregQuote } = require('lib/string-utils-common');
|
||||
|
||||
class InteropService_Importer_Md extends InteropService_Importer_Base {
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
// console.disableYellowBox = true
|
||||
|
||||
import {YellowBox} from 'react-native';
|
||||
import { YellowBox } from 'react-native';
|
||||
YellowBox.ignoreWarnings([
|
||||
'Require cycle: node_modules/react-native-',
|
||||
'Require cycle: node_modules/rn-fetch-blob',
|
||||
|
@ -717,10 +717,10 @@ class AppComponent extends React.Component {
|
||||
let menuPosition = 'left';
|
||||
|
||||
if (this.props.routeName === 'Note') {
|
||||
sideMenuContent = <SafeAreaView style={{flex: 1, backgroundColor: theme.backgroundColor}}><SideMenuContentNote options={this.props.noteSideMenuOptions}/></SafeAreaView>;
|
||||
sideMenuContent = <SafeAreaView style={{ flex: 1, backgroundColor: theme.backgroundColor }}><SideMenuContentNote options={this.props.noteSideMenuOptions}/></SafeAreaView>;
|
||||
menuPosition = 'right';
|
||||
} else {
|
||||
sideMenuContent = <SafeAreaView style={{flex: 1, backgroundColor: theme.backgroundColor}}><SideMenuContent/></SafeAreaView>;
|
||||
sideMenuContent = <SafeAreaView style={{ flex: 1, backgroundColor: theme.backgroundColor }}><SideMenuContent/></SafeAreaView>;
|
||||
}
|
||||
|
||||
const appNavInit = {
|
||||
@ -750,12 +750,12 @@ class AppComponent extends React.Component {
|
||||
}}
|
||||
>
|
||||
<MenuContext style={{ flex: 1 }}>
|
||||
<SafeAreaView style={{flex: 0, backgroundColor: theme.raisedBackgroundColor}} />
|
||||
<SafeAreaView style={{flex: 1, backgroundColor: theme.backgroundColor}}>
|
||||
<SafeAreaView style={{ flex: 0, backgroundColor: theme.raisedBackgroundColor }} />
|
||||
<SafeAreaView style={{ flex: 1, backgroundColor: theme.backgroundColor }}>
|
||||
<AppNav screens={appNavInit} />
|
||||
</SafeAreaView>
|
||||
<DropdownAlert ref={ref => this.dropdownAlert_ = ref} tapToCloseEnabled={true} />
|
||||
<Animated.View pointerEvents='none' style={{position: 'absolute', backgroundColor: 'black', opacity: this.state.sideMenuContentOpacity, width: '100%', height: '100%'}}/>
|
||||
<Animated.View pointerEvents='none' style={{ position: 'absolute', backgroundColor: 'black', opacity: this.state.sideMenuContentOpacity, width: '100%', height: '100%' }}/>
|
||||
</MenuContext>
|
||||
</SideMenu>
|
||||
);
|
||||
|
@ -25,7 +25,7 @@ toolUtils.execCommandWithPipes = function(executable, args) {
|
||||
var spawn = require('child_process').spawn;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const child = spawn(executable, args, { stdio: 'inherit'});
|
||||
const child = spawn(executable, args, { stdio: 'inherit' });
|
||||
|
||||
child.on('error', (error) => {
|
||||
reject(error);
|
||||
|
@ -12,7 +12,7 @@ async function gitHubContributors(page) {
|
||||
request.get({
|
||||
url: `https://api.github.com/repos/laurent22/joplin/contributors${page ? `?page=${page}` : ''}`,
|
||||
json: true,
|
||||
headers: {'User-Agent': 'Joplin Readme Updater'},
|
||||
headers: { 'User-Agent': 'Joplin Readme Updater' },
|
||||
}, (error, response, data) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
|
@ -22,7 +22,7 @@ async function gitHubLatestRelease() {
|
||||
request.get({
|
||||
url: url,
|
||||
json: true,
|
||||
headers: {'User-Agent': 'Joplin Readme Updater'},
|
||||
headers: { 'User-Agent': 'Joplin Readme Updater' },
|
||||
}, (error, response, data) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
|
Loading…
Reference in New Issue
Block a user