mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-19 20:31:46 +02:00
Tools: Implement "prefer-object-spread" eslint rule
This commit is contained in:
parent
804d674d37
commit
c89edd7b22
@ -143,6 +143,7 @@ module.exports = {
|
||||
'spaced-comment': ['error', 'always'],
|
||||
'keyword-spacing': ['error', { 'before': true, 'after': true }],
|
||||
'no-multi-spaces': ['error'],
|
||||
'prefer-object-spread': ['error'],
|
||||
|
||||
// Regarding the keyword blacklist:
|
||||
// - err: We generally avoid using too many abbreviations, so it should
|
||||
|
@ -42,7 +42,7 @@ export function addJoplinChecklistCommands(editor, ToggleList) {
|
||||
});
|
||||
|
||||
editor.addCommand('InsertJoplinChecklist', function (ui, detail) {
|
||||
detail = Object.assign({}, detail, { listType: 'joplinChecklist' });
|
||||
detail = { ...detail, listType: 'joplinChecklist' };
|
||||
ToggleList.toggleList(editor, 'UL', detail);
|
||||
});
|
||||
}
|
@ -302,7 +302,7 @@ class AppGui {
|
||||
const output = [];
|
||||
|
||||
for (let i = 0; i < keymap.length; i++) {
|
||||
const item = Object.assign({}, keymap[i]);
|
||||
const item = { ...keymap[i] };
|
||||
|
||||
if (!item.command) throw new Error(`Missing command for keymap item: ${JSON.stringify(item)}`);
|
||||
|
||||
@ -427,7 +427,7 @@ class AppGui {
|
||||
async handleModelAction(action) {
|
||||
this.logger().info('Action:', action);
|
||||
|
||||
const state = Object.assign({}, defaultState);
|
||||
const state = { ...defaultState };
|
||||
state.notes = this.widget('noteList').items;
|
||||
|
||||
const newState = reducer(state, action);
|
||||
|
@ -192,7 +192,7 @@ class Application extends BaseApplication {
|
||||
let output = await this.cache_.getItem('metadata');
|
||||
if (output) {
|
||||
this.commandMetadata_ = output;
|
||||
return Object.assign({}, this.commandMetadata_);
|
||||
return { ...this.commandMetadata_ };
|
||||
}
|
||||
|
||||
const commands = this.commands();
|
||||
@ -207,7 +207,7 @@ class Application extends BaseApplication {
|
||||
await this.cache_.setItem('metadata', output, 1000 * 60 * 60 * 24);
|
||||
|
||||
this.commandMetadata_ = output;
|
||||
return Object.assign({}, this.commandMetadata_);
|
||||
return { ...this.commandMetadata_ };
|
||||
}
|
||||
|
||||
hasGui() {
|
||||
|
@ -94,12 +94,12 @@ browser_.runtime.onMessage.addListener(async (command) => {
|
||||
const imageSize = await getImageSize(imageDataUrl);
|
||||
const imagePixelRatio = imageSize.width / command.content.windowInnerWidth;
|
||||
|
||||
const content = Object.assign({}, command.content);
|
||||
const content = { ...command.content };
|
||||
content.image_data_url = imageDataUrl;
|
||||
if ('url' in content) content.source_url = content.url;
|
||||
|
||||
const ratio = browserZoom * imagePixelRatio;
|
||||
const newArea = Object.assign({}, command.content.crop_rect);
|
||||
const newArea = { ...command.content.crop_rect };
|
||||
newArea.x *= ratio;
|
||||
newArea.y *= ratio;
|
||||
newArea.width *= ratio;
|
||||
|
@ -378,7 +378,7 @@
|
||||
tags: command.tags || '',
|
||||
image_sizes: imageSizes,
|
||||
anchor_names: anchorNames,
|
||||
source_command: Object.assign({}, command),
|
||||
source_command: { ...command },
|
||||
convert_to: convertToMarkup,
|
||||
stylesheets: stylesheets,
|
||||
};
|
||||
@ -392,7 +392,7 @@
|
||||
} catch (error) {
|
||||
console.warn(error);
|
||||
console.warn('Sending full page HTML instead');
|
||||
const newCommand = Object.assign({}, command, { name: 'completePageHtml' });
|
||||
const newCommand = { ...command, name: 'completePageHtml' };
|
||||
const response = await prepareCommandResponse(newCommand);
|
||||
response.warning = 'Could not retrieve simplified version of page - full page has been saved instead.';
|
||||
return response;
|
||||
|
@ -67,7 +67,7 @@ class AppComponent extends Component {
|
||||
});
|
||||
|
||||
this.confirm_click = async () => {
|
||||
const content = Object.assign({}, this.props.clippedContent);
|
||||
const content = { ...this.props.clippedContent };
|
||||
content.tags = this.state.selectedTags.join(',');
|
||||
content.parent_id = this.props.selectedFolderId;
|
||||
const response = await bridge().sendContentToJoplin(content);
|
||||
|
@ -410,7 +410,7 @@ class Bridge {
|
||||
|
||||
if (body) fetchOptions.body = typeof body === 'string' ? body : JSON.stringify(body);
|
||||
|
||||
query = Object.assign(query || {}, { token: this.token_ });
|
||||
query = { ...query, token: this.token_ };
|
||||
|
||||
let queryString = '';
|
||||
if (query) {
|
||||
|
@ -40,34 +40,34 @@ function reducer(state = defaultState, action) {
|
||||
|
||||
if (action.type === 'WARNING_SET') {
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.warning = action.text;
|
||||
|
||||
} else if (action.type === 'IS_PROBABLY_READERABLE') {
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.isProbablyReaderable = action.value;
|
||||
|
||||
} else if (action.type === 'CLIPPED_CONTENT_SET') {
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.clippedContent = action.content;
|
||||
|
||||
} else if (action.type === 'CLIPPED_CONTENT_TITLE_SET') {
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
const newContent = newState.clippedContent ? Object.assign({}, newState.clippedContent) : {};
|
||||
newState = { ...state };
|
||||
const newContent = newState.clippedContent ? { ...newState.clippedContent } : {};
|
||||
newContent.title = action.text;
|
||||
newState.clippedContent = newContent;
|
||||
|
||||
} else if (action.type === 'CONTENT_UPLOAD') {
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.contentUploadOperation = action.operation;
|
||||
|
||||
} else if (action.type === 'FOLDERS_SET') {
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.folders = action.folders;
|
||||
|
||||
if (!newState.selectedFolderId && action.folders.length) {
|
||||
@ -76,30 +76,30 @@ function reducer(state = defaultState, action) {
|
||||
|
||||
} else if (action.type === 'TAGS_SET') {
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.tags = action.tags;
|
||||
|
||||
} else if (action.type === 'SELECTED_FOLDER_SET') {
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.selectedFolderId = action.id;
|
||||
|
||||
} else if (action.type === 'CLIPPER_SERVER_SET') {
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
const clipperServer = Object.assign({}, newState.clipperServer);
|
||||
newState = { ...state };
|
||||
const clipperServer = { ...newState.clipperServer };
|
||||
if ('foundState' in action) clipperServer.foundState = action.foundState;
|
||||
if ('port' in action) clipperServer.port = action.port;
|
||||
newState.clipperServer = clipperServer;
|
||||
|
||||
} else if (action.type === 'ENV_SET') {
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.env = action.env;
|
||||
|
||||
} else if (action.type === 'AUTH_STATE_SET') {
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.authStatus = action.value;
|
||||
|
||||
}
|
||||
|
@ -29,13 +29,11 @@ export default class InteropServiceHelper {
|
||||
private static async exportNoteToHtmlFile(noteId: string, exportOptions: ExportNoteOptions) {
|
||||
const tempFile = `${Setting.value('tempDir')}/${md5(Date.now() + Math.random())}.html`;
|
||||
|
||||
const fullExportOptions: ExportOptions = Object.assign({}, {
|
||||
path: tempFile,
|
||||
const fullExportOptions: ExportOptions = { path: tempFile,
|
||||
format: 'html',
|
||||
target: FileSystemItem.File,
|
||||
sourceNoteIds: [noteId],
|
||||
customCss: '',
|
||||
}, exportOptions);
|
||||
customCss: '', ...exportOptions };
|
||||
|
||||
const service = InteropService.instance();
|
||||
|
||||
|
@ -82,7 +82,7 @@ export default function(state: AppState, action: any) {
|
||||
|
||||
const currentRoute = state.route;
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
const newNavHistory = state.navHistory.slice();
|
||||
|
||||
if (goingBack) {
|
||||
@ -119,7 +119,7 @@ export default function(state: AppState, action: any) {
|
||||
|
||||
case 'WINDOW_CONTENT_SIZE_SET':
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.windowContentSize = action.size;
|
||||
break;
|
||||
|
||||
@ -147,7 +147,7 @@ export default function(state: AppState, action: any) {
|
||||
return nextLayout === 'both' ? ['editor', 'viewer'] : [nextLayout];
|
||||
};
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
|
||||
const panes = state.noteVisiblePanes.slice();
|
||||
newState.noteVisiblePanes = getNextLayout(panes);
|
||||
@ -156,7 +156,7 @@ export default function(state: AppState, action: any) {
|
||||
|
||||
case 'NOTE_VISIBLE_PANES_SET':
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.noteVisiblePanes = action.panes;
|
||||
break;
|
||||
|
||||
@ -194,7 +194,7 @@ export default function(state: AppState, action: any) {
|
||||
case 'NOTE_FILE_WATCHER_ADD':
|
||||
|
||||
if (newState.watchedNoteFiles.indexOf(action.id) < 0) {
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
const watchedNoteFiles = newState.watchedNoteFiles.slice();
|
||||
watchedNoteFiles.push(action.id);
|
||||
newState.watchedNoteFiles = watchedNoteFiles;
|
||||
@ -204,7 +204,7 @@ export default function(state: AppState, action: any) {
|
||||
case 'NOTE_FILE_WATCHER_REMOVE':
|
||||
|
||||
{
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
const idx = newState.watchedNoteFiles.indexOf(action.id);
|
||||
if (idx >= 0) {
|
||||
const watchedNoteFiles = newState.watchedNoteFiles.slice();
|
||||
@ -217,7 +217,7 @@ export default function(state: AppState, action: any) {
|
||||
case 'NOTE_FILE_WATCHER_CLEAR':
|
||||
|
||||
if (state.watchedNoteFiles.length) {
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.watchedNoteFiles = [];
|
||||
}
|
||||
break;
|
||||
@ -225,38 +225,38 @@ export default function(state: AppState, action: any) {
|
||||
case 'EDITOR_SCROLL_PERCENT_SET':
|
||||
|
||||
{
|
||||
newState = Object.assign({}, state);
|
||||
const newPercents = Object.assign({}, newState.lastEditorScrollPercents);
|
||||
newState = { ...state };
|
||||
const newPercents = { ...newState.lastEditorScrollPercents };
|
||||
newPercents[action.noteId] = action.percent;
|
||||
newState.lastEditorScrollPercents = newPercents;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'NOTE_DEVTOOLS_TOGGLE':
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.devToolsVisible = !newState.devToolsVisible;
|
||||
break;
|
||||
|
||||
case 'NOTE_DEVTOOLS_SET':
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.devToolsVisible = action.value;
|
||||
break;
|
||||
|
||||
case 'VISIBLE_DIALOGS_ADD':
|
||||
newState = Object.assign({}, state);
|
||||
newState.visibleDialogs = Object.assign({}, newState.visibleDialogs);
|
||||
newState = { ...state };
|
||||
newState.visibleDialogs = { ...newState.visibleDialogs };
|
||||
newState.visibleDialogs[action.name] = true;
|
||||
break;
|
||||
|
||||
case 'VISIBLE_DIALOGS_REMOVE':
|
||||
newState = Object.assign({}, state);
|
||||
newState.visibleDialogs = Object.assign({}, newState.visibleDialogs);
|
||||
newState = { ...state };
|
||||
newState.visibleDialogs = { ...newState.visibleDialogs };
|
||||
delete newState.visibleDialogs[action.name];
|
||||
break;
|
||||
|
||||
case 'FOCUS_SET':
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.focusedField = action.field;
|
||||
break;
|
||||
|
||||
@ -264,7 +264,7 @@ export default function(state: AppState, action: any) {
|
||||
|
||||
// A field can only clear its own state
|
||||
if (action.field === state.focusedField) {
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.focusedField = null;
|
||||
}
|
||||
break;
|
||||
@ -281,7 +281,7 @@ export default function(state: AppState, action: any) {
|
||||
isOpen = action.isOpen !== false;
|
||||
}
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
|
||||
if (isOpen) {
|
||||
const newDialogs = newState.dialogs.slice();
|
||||
|
@ -201,12 +201,10 @@ export class Bridge {
|
||||
...options,
|
||||
};
|
||||
|
||||
const result = this.showMessageBox_(this.window(), Object.assign({}, {
|
||||
type: 'question',
|
||||
const result = this.showMessageBox_(this.window(), { type: 'question',
|
||||
message: message,
|
||||
cancelId: 1,
|
||||
buttons: options.buttons,
|
||||
}, options));
|
||||
buttons: options.buttons, ...options });
|
||||
|
||||
return result === 0;
|
||||
}
|
||||
@ -215,21 +213,17 @@ export class Bridge {
|
||||
public showMessageBox(message: string, options: any = null) {
|
||||
if (options === null) options = {};
|
||||
|
||||
const result = this.showMessageBox_(this.window(), Object.assign({}, {
|
||||
type: 'question',
|
||||
const result = this.showMessageBox_(this.window(), { type: 'question',
|
||||
message: message,
|
||||
buttons: [_('OK'), _('Cancel')],
|
||||
}, options));
|
||||
buttons: [_('OK'), _('Cancel')], ...options });
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public showInfoMessageBox(message: string, options: any = {}) {
|
||||
const result = this.showMessageBox_(this.window(), Object.assign({}, {
|
||||
type: 'info',
|
||||
const result = this.showMessageBox_(this.window(), { type: 'info',
|
||||
message: message,
|
||||
buttons: [_('OK')],
|
||||
}, options));
|
||||
buttons: [_('OK')], ...options });
|
||||
return result === 0;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ function getMajorMinorTagName(tagName: string) {
|
||||
}
|
||||
|
||||
async function fetchLatestRelease(options: CheckForUpdateOptions) {
|
||||
options = Object.assign({}, { includePreReleases: false }, options);
|
||||
options = { includePreReleases: false, ...options };
|
||||
|
||||
const response = await shim.fetch('https://api.github.com/repos/laurent22/joplin/releases');
|
||||
|
||||
|
@ -46,13 +46,11 @@ class ClipperConfigScreenComponent extends React.Component {
|
||||
public render() {
|
||||
const theme = themeStyle(this.props.themeId);
|
||||
|
||||
const containerStyle = Object.assign({}, theme.containerStyle, {
|
||||
overflowY: 'scroll',
|
||||
const containerStyle = { ...theme.containerStyle, overflowY: 'scroll',
|
||||
// padding: theme.configScreenPadding,
|
||||
backgroundColor: theme.backgroundColor3,
|
||||
});
|
||||
backgroundColor: theme.backgroundColor3 };
|
||||
|
||||
const buttonStyle = Object.assign({}, theme.buttonStyle, { marginRight: 10 });
|
||||
const buttonStyle = { ...theme.buttonStyle, marginRight: 10 };
|
||||
|
||||
const stepBoxStyle = {
|
||||
border: '1px solid',
|
||||
@ -106,18 +104,16 @@ class ClipperConfigScreenComponent extends React.Component {
|
||||
);
|
||||
}
|
||||
|
||||
const apiTokenStyle = Object.assign({}, theme.textStyle, {
|
||||
color: theme.colorFaded,
|
||||
const apiTokenStyle = { ...theme.textStyle, color: theme.colorFaded,
|
||||
wordBreak: 'break-all',
|
||||
paddingTop: 10,
|
||||
paddingBottom: 10,
|
||||
});
|
||||
paddingBottom: 10 };
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div style={containerStyle}>
|
||||
<div>
|
||||
<p style={Object.assign({}, theme.textStyle, { marginTop: 0 })}>{_('Joplin Web Clipper allows saving web pages and screenshots from your browser to Joplin.')}</p>
|
||||
<p style={{ ...theme.textStyle, marginTop: 0 }}>{_('Joplin Web Clipper allows saving web pages and screenshots from your browser to Joplin.')}</p>
|
||||
<p style={theme.textStyle}>{_('In order to use the web clipper, you need to do the following:')}</p>
|
||||
|
||||
<div style={stepBoxStyle}>
|
||||
|
@ -135,7 +135,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
|
||||
|
||||
const theme = themeStyle(this.props.themeId);
|
||||
return (
|
||||
<div style={Object.assign({}, theme.textStyle, { marginBottom: 15 })}>
|
||||
<div style={{ ...theme.textStyle, marginBottom: 15 }}>
|
||||
{description}
|
||||
</div>
|
||||
);
|
||||
@ -177,7 +177,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
|
||||
|
||||
if (section.name === 'sync') {
|
||||
const syncTargetMd = SyncTargetRegistry.idToMetadata(settings['sync.target']);
|
||||
const statusStyle = Object.assign({}, theme.textStyle, { marginTop: 10 });
|
||||
const statusStyle = { ...theme.textStyle, marginTop: 10 };
|
||||
|
||||
if (syncTargetMd.supportsConfigCheck) {
|
||||
const messages = shared.checkSyncConfigMessages(this);
|
||||
@ -207,7 +207,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
|
||||
|
||||
if (advancedSettingComps.length) {
|
||||
const iconName = this.state.showAdvancedSettings ? 'fa fa-angle-down' : 'fa fa-angle-right';
|
||||
// const advancedSettingsButtonStyle = Object.assign({}, theme.buttonStyle, { marginBottom: 10 });
|
||||
// const advancedSettingsButtonStyle = { ...theme.buttonStyle, marginBottom: 10 };
|
||||
advancedSettingsButton = (
|
||||
<div style={{ marginBottom: 10 }}>
|
||||
<Button
|
||||
@ -233,23 +233,19 @@ class ConfigScreenComponent extends React.Component<any, any> {
|
||||
|
||||
private labelStyle(themeId: number) {
|
||||
const theme = themeStyle(themeId);
|
||||
return Object.assign({}, theme.textStyle, {
|
||||
display: 'block',
|
||||
return { ...theme.textStyle, display: 'block',
|
||||
color: theme.color,
|
||||
fontSize: theme.fontSize * 1.083333,
|
||||
fontWeight: 500,
|
||||
marginBottom: theme.mainPadding / 2,
|
||||
});
|
||||
marginBottom: theme.mainPadding / 2 };
|
||||
}
|
||||
|
||||
private descriptionStyle(themeId: number) {
|
||||
const theme = themeStyle(themeId);
|
||||
return Object.assign({}, theme.textStyle, {
|
||||
color: theme.colorFaded,
|
||||
return { ...theme.textStyle, color: theme.colorFaded,
|
||||
fontStyle: 'italic',
|
||||
maxWidth: '70em',
|
||||
marginTop: 5,
|
||||
});
|
||||
marginTop: 5 };
|
||||
}
|
||||
|
||||
private renderLabel(themeId: number, label: string) {
|
||||
@ -264,14 +260,12 @@ class ConfigScreenComponent extends React.Component<any, any> {
|
||||
private renderHeader(themeId: number, label: string, style: any = null) {
|
||||
const theme = themeStyle(themeId);
|
||||
|
||||
const labelStyle = Object.assign({}, theme.textStyle, {
|
||||
display: 'block',
|
||||
const labelStyle = { ...theme.textStyle, display: 'block',
|
||||
color: theme.color,
|
||||
fontSize: theme.fontSize * 1.25,
|
||||
fontWeight: 500,
|
||||
marginBottom: theme.mainPadding,
|
||||
...style,
|
||||
});
|
||||
...style };
|
||||
|
||||
return (
|
||||
<div style={labelStyle}>
|
||||
@ -295,17 +289,13 @@ class ConfigScreenComponent extends React.Component<any, any> {
|
||||
|
||||
const labelStyle = this.labelStyle(this.props.themeId);
|
||||
|
||||
const subLabel = Object.assign({}, labelStyle, {
|
||||
display: 'block',
|
||||
const subLabel = { ...labelStyle, display: 'block',
|
||||
opacity: 0.7,
|
||||
marginBottom: labelStyle.marginBottom,
|
||||
});
|
||||
marginBottom: labelStyle.marginBottom };
|
||||
|
||||
const checkboxLabelStyle = Object.assign({}, labelStyle, {
|
||||
marginLeft: 8,
|
||||
const checkboxLabelStyle = { ...labelStyle, marginLeft: 8,
|
||||
display: 'inline',
|
||||
backgroundColor: 'transparent',
|
||||
});
|
||||
backgroundColor: 'transparent' };
|
||||
|
||||
const controlStyle = {
|
||||
display: 'inline-block',
|
||||
@ -314,8 +304,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
|
||||
backgroundColor: theme.backgroundColor,
|
||||
};
|
||||
|
||||
const textInputBaseStyle = Object.assign({}, controlStyle, {
|
||||
fontFamily: theme.fontFamily,
|
||||
const textInputBaseStyle = { ...controlStyle, fontFamily: theme.fontFamily,
|
||||
border: '1px solid',
|
||||
padding: '4px 6px',
|
||||
boxSizing: 'border-box',
|
||||
@ -324,8 +313,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
|
||||
paddingLeft: 6,
|
||||
paddingRight: 6,
|
||||
paddingTop: 4,
|
||||
paddingBottom: 4,
|
||||
});
|
||||
paddingBottom: 4 };
|
||||
|
||||
const updateSettingValue = (key: string, value: any) => {
|
||||
const md = Setting.settingMetadata(key);
|
||||
@ -381,14 +369,12 @@ class ConfigScreenComponent extends React.Component<any, any> {
|
||||
);
|
||||
}
|
||||
|
||||
const selectStyle = Object.assign({}, controlStyle, {
|
||||
paddingLeft: 6,
|
||||
const selectStyle = { ...controlStyle, paddingLeft: 6,
|
||||
paddingRight: 6,
|
||||
paddingTop: 4,
|
||||
paddingBottom: 4,
|
||||
borderColor: theme.borderColor4,
|
||||
borderRadius: 3,
|
||||
});
|
||||
borderRadius: 3 };
|
||||
|
||||
return (
|
||||
<div key={key} style={rowStyle}>
|
||||
@ -443,10 +429,8 @@ class ConfigScreenComponent extends React.Component<any, any> {
|
||||
</div>
|
||||
);
|
||||
} else if (md.type === Setting.TYPE_STRING) {
|
||||
const inputStyle: any = Object.assign({}, textInputBaseStyle, {
|
||||
width: '50%',
|
||||
minWidth: '20em',
|
||||
});
|
||||
const inputStyle: any = { ...textInputBaseStyle, width: '50%',
|
||||
minWidth: '20em' };
|
||||
const inputType = md.secure === true ? 'password' : 'text';
|
||||
|
||||
if (md.subType === 'file_path_and_args' || md.subType === 'file_path' || md.subType === 'directory_path') {
|
||||
@ -542,7 +526,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
|
||||
<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', marginBottom: inputStyle.marginBottom }}>
|
||||
<input
|
||||
type={inputType}
|
||||
style={Object.assign({}, inputStyle, { marginBottom: 0, marginRight: 5 })}
|
||||
style={{ ...inputStyle, marginBottom: 0, marginRight: 5 }}
|
||||
onChange={(event: any) => {
|
||||
onPathChange(event);
|
||||
}}
|
||||
@ -595,7 +579,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
|
||||
const label = [md.label()];
|
||||
if (md.unitLabel) label.push(`(${md.unitLabel()})`);
|
||||
|
||||
const inputStyle: any = Object.assign({}, textInputBaseStyle);
|
||||
const inputStyle: any = { ...textInputBaseStyle };
|
||||
|
||||
return (
|
||||
<div key={key} style={rowStyle}>
|
||||
@ -679,15 +663,13 @@ class ConfigScreenComponent extends React.Component<any, any> {
|
||||
public render() {
|
||||
const theme = themeStyle(this.props.themeId);
|
||||
|
||||
const style = Object.assign({},
|
||||
this.props.style,
|
||||
{
|
||||
overflow: 'hidden',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
backgroundColor: theme.backgroundColor3,
|
||||
}
|
||||
);
|
||||
const style = {
|
||||
...this.props.style,
|
||||
overflow: 'hidden',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
backgroundColor: theme.backgroundColor3,
|
||||
};
|
||||
|
||||
const settings = this.state.settings;
|
||||
|
||||
|
@ -74,7 +74,7 @@ export default function DialogButtonRow(props: Props) {
|
||||
|
||||
if (props.cancelButtonShow !== false) {
|
||||
buttonComps.push(
|
||||
<button disabled={props.cancelButtonDisabled} key="cancel" style={Object.assign({}, buttonStyle)} onClick={onCancelButtonClick}>
|
||||
<button disabled={props.cancelButtonDisabled} key="cancel" style={{ ...buttonStyle }} onClick={onCancelButtonClick}>
|
||||
{props.cancelButtonLabel ? props.cancelButtonLabel : _('Cancel')}
|
||||
</button>
|
||||
);
|
||||
|
@ -29,15 +29,13 @@ class DropboxLoginScreenComponent extends React.Component<any, any> {
|
||||
const style = this.props.style;
|
||||
const theme = themeStyle(this.props.themeId);
|
||||
|
||||
const containerStyle = Object.assign({}, theme.containerStyle, {
|
||||
padding: theme.configScreenPadding,
|
||||
const containerStyle = { ...theme.containerStyle, padding: theme.configScreenPadding,
|
||||
height: style.height - theme.margin * 2,
|
||||
flex: 1,
|
||||
});
|
||||
flex: 1 };
|
||||
|
||||
const inputStyle = Object.assign({}, theme.inputStyle, { width: 500 });
|
||||
const inputStyle = { ...theme.inputStyle, width: 500 };
|
||||
|
||||
const buttonStyle = Object.assign({}, theme.buttonStyle, { marginRight: 10 });
|
||||
const buttonStyle = { ...theme.buttonStyle, marginRight: 10 };
|
||||
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>
|
||||
|
@ -82,7 +82,7 @@ function ExtensionBadge(props: Props) {
|
||||
void bridge().openExternal(props.url);
|
||||
};
|
||||
|
||||
const rootStyle = props.style ? Object.assign({}, style.root, props.style) : style.root;
|
||||
const rootStyle = props.style ? { ...style.root, ...props.style } : style.root;
|
||||
|
||||
return (
|
||||
<a style={rootStyle} onClick={onClick} href="#">
|
||||
|
@ -23,7 +23,7 @@ class HelpButtonComponent extends React.Component<Props> {
|
||||
|
||||
public render() {
|
||||
const theme = themeStyle(this.props.themeId);
|
||||
const style = Object.assign({}, this.props.style, { color: theme.color, textDecoration: 'none' });
|
||||
const style = { ...this.props.style, color: theme.color, textDecoration: 'none' };
|
||||
const helpIconStyle = { flex: 0, width: 16, height: 16, marginLeft: 10 };
|
||||
const extraProps: any = {};
|
||||
if (this.props.tip) extraProps['data-tip'] = this.props.tip;
|
||||
|
@ -18,21 +18,19 @@ class IconButton extends React.Component<Props> {
|
||||
};
|
||||
const icon = <i style={iconStyle} className={`fas ${this.props.iconName}`}></i>;
|
||||
|
||||
const rootStyle = Object.assign(
|
||||
{
|
||||
display: 'flex',
|
||||
textDecoration: 'none',
|
||||
padding: 10,
|
||||
width: theme.buttonMinHeight,
|
||||
height: theme.buttonMinHeight,
|
||||
boxSizing: 'border-box',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
backgroundColor: theme.backgroundColor,
|
||||
cursor: 'default',
|
||||
},
|
||||
style
|
||||
);
|
||||
const rootStyle = {
|
||||
display: 'flex',
|
||||
textDecoration: 'none',
|
||||
padding: 10,
|
||||
width: theme.buttonMinHeight,
|
||||
height: theme.buttonMinHeight,
|
||||
boxSizing: 'border-box',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
backgroundColor: theme.backgroundColor,
|
||||
cursor: 'default',
|
||||
...style,
|
||||
};
|
||||
|
||||
return (
|
||||
<a
|
||||
|
@ -148,10 +148,8 @@ class ItemList extends React.Component<Props, State> {
|
||||
|
||||
public render() {
|
||||
const items = this.props.items;
|
||||
const style = Object.assign({}, this.props.style, {
|
||||
overflowX: 'hidden',
|
||||
overflowY: 'auto',
|
||||
});
|
||||
const style = { ...this.props.style, overflowX: 'hidden',
|
||||
overflowY: 'auto' };
|
||||
|
||||
// if (this.props.disabled) style.opacity = 0.5;
|
||||
|
||||
|
@ -501,16 +501,14 @@ class MainScreenComponent extends React.Component<Props, State> {
|
||||
height: height,
|
||||
};
|
||||
|
||||
this.styles_.modalLayer = Object.assign({}, theme.textStyle, {
|
||||
zIndex: 10000,
|
||||
this.styles_.modalLayer = { ...theme.textStyle, zIndex: 10000,
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
backgroundColor: theme.backgroundColor,
|
||||
width: width - 20,
|
||||
height: height - 20,
|
||||
padding: 10,
|
||||
});
|
||||
padding: 10 };
|
||||
|
||||
return this.styles_;
|
||||
}
|
||||
@ -803,13 +801,11 @@ class MainScreenComponent extends React.Component<Props, State> {
|
||||
|
||||
public render() {
|
||||
const theme = themeStyle(this.props.themeId);
|
||||
const style = Object.assign(
|
||||
{
|
||||
color: theme.color,
|
||||
backgroundColor: theme.backgroundColor,
|
||||
},
|
||||
this.props.style
|
||||
);
|
||||
const style = {
|
||||
color: theme.color,
|
||||
backgroundColor: theme.backgroundColor,
|
||||
...this.props.style,
|
||||
};
|
||||
const promptOptions = this.state.promptOptions;
|
||||
const styles = this.styles(this.props.themeId, style.width, style.height, this.messageBoxVisible());
|
||||
|
||||
@ -824,7 +820,7 @@ class MainScreenComponent extends React.Component<Props, State> {
|
||||
const dialogInfo = PluginManager.instance().pluginDialogToShow(this.props.pluginsLegacy);
|
||||
const pluginDialog = !dialogInfo ? null : <dialogInfo.Dialog {...dialogInfo.props} />;
|
||||
|
||||
const modalLayerStyle = Object.assign({}, styles.modalLayer, { display: this.state.modalLayer.visible ? 'block' : 'none' });
|
||||
const modalLayerStyle = { ...styles.modalLayer, display: this.state.modalLayer.visible ? 'block' : 'none' };
|
||||
|
||||
const notePropertiesDialogOptions = this.state.notePropertiesDialogOptions;
|
||||
const noteContentPropertiesDialogOptions = this.state.noteContentPropertiesDialogOptions;
|
||||
|
@ -17,11 +17,9 @@ export const runtime = (): CommandRuntime => {
|
||||
|
||||
const defaultValues = Note.previewFieldsWithDefaultValues({ includeTimestamps: false });
|
||||
|
||||
let newNote = Object.assign({}, defaultValues, {
|
||||
parent_id: folderId,
|
||||
let newNote = { ...defaultValues, parent_id: folderId,
|
||||
is_todo: isTodo ? 1 : 0,
|
||||
body: body,
|
||||
});
|
||||
body: body };
|
||||
|
||||
newNote = await Note.save(newNote, { provisional: true });
|
||||
|
||||
|
@ -31,7 +31,7 @@ export default function useExternalPlugins(CodeMirror: any, plugins: PluginState
|
||||
}
|
||||
|
||||
if (mod.codeMirrorOptions) {
|
||||
newOptions = Object.assign({}, newOptions, mod.codeMirrorOptions);
|
||||
newOptions = { ...newOptions, ...mod.codeMirrorOptions };
|
||||
}
|
||||
|
||||
if (mod.assets) {
|
||||
|
@ -1544,7 +1544,7 @@
|
||||
}
|
||||
});
|
||||
editor.addCommand('InsertJoplinChecklist', function (ui, detail) {
|
||||
detail = Object.assign({}, detail, { listType: 'joplinChecklist' });
|
||||
detail = { ...detail, listType: 'joplinChecklist' };
|
||||
ToggleList.toggleList(editor, 'UL', detail);
|
||||
});
|
||||
}
|
||||
|
@ -364,13 +364,11 @@ function NoteEditor(props: NoteEditorProps) {
|
||||
}, [props.dispatch, formNote]);
|
||||
|
||||
function renderNoNotes(rootStyle: any) {
|
||||
const emptyDivStyle = Object.assign(
|
||||
{
|
||||
backgroundColor: 'black',
|
||||
opacity: 0.1,
|
||||
},
|
||||
rootStyle
|
||||
);
|
||||
const emptyDivStyle = {
|
||||
backgroundColor: 'black',
|
||||
opacity: 0.1,
|
||||
...rootStyle,
|
||||
};
|
||||
return <div style={emptyDivStyle}></div>;
|
||||
}
|
||||
|
||||
|
@ -59,14 +59,12 @@ export default function useMarkupToHtml(deps: HookDependencies) {
|
||||
|
||||
delete options.replaceResourceInternalToExternalLinks;
|
||||
|
||||
const result = await markupToHtml.render(markupLanguage, md, theme, Object.assign({}, {
|
||||
codeTheme: theme.codeThemeCss,
|
||||
const result = await markupToHtml.render(markupLanguage, md, theme, { codeTheme: theme.codeThemeCss,
|
||||
resources: resources,
|
||||
postMessageSyntax: 'ipcProxySendToHost',
|
||||
splitted: true,
|
||||
externalAssetsOnly: true,
|
||||
codeHighlightCacheKey: 'useMarkupToHtml',
|
||||
}, options));
|
||||
codeHighlightCacheKey: 'useMarkupToHtml', ...options });
|
||||
|
||||
return result;
|
||||
// eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied
|
||||
|
@ -62,7 +62,7 @@ export default function useNoteSearchBar({ noteSearchBarRef }: UseNoteSearchBarP
|
||||
|
||||
const noteSearchBarNextPrevious = useCallback((inc: number) => {
|
||||
setLocalSearch((prev: LocalSearch) => {
|
||||
const ls = Object.assign({}, prev);
|
||||
const ls = { ...prev };
|
||||
ls.selectedIndex += inc;
|
||||
ls.timestamp = Date.now();
|
||||
if (ls.selectedIndex < 0) ls.selectedIndex = ls.resultCount - 1;
|
||||
|
@ -108,10 +108,10 @@ function NoteListItem(props: NoteListItemProps, ref: any) {
|
||||
);
|
||||
}
|
||||
|
||||
let listItemTitleStyle = Object.assign({}, props.style.listItemTitle);
|
||||
let listItemTitleStyle = { ...props.style.listItemTitle };
|
||||
listItemTitleStyle.paddingLeft = !item.is_todo ? hPadding : 4;
|
||||
if (item.is_shared) listItemTitleStyle.color = theme.colorWarn3;
|
||||
if (item.is_todo && !!item.todo_completed) listItemTitleStyle = Object.assign(listItemTitleStyle, props.style.listItemTitleCompleted);
|
||||
if (item.is_todo && !!item.todo_completed) listItemTitleStyle = { ...listItemTitleStyle, ...props.style.listItemTitleCompleted };
|
||||
|
||||
const displayTitle = Note.displayTitle(item);
|
||||
let titleComp = null;
|
||||
|
@ -114,7 +114,7 @@ class NotePropertiesDialog extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
public formNoteToNote(formNote: any) {
|
||||
const note = Object.assign({ id: formNote.id }, this.latLongFromLocation(formNote.location));
|
||||
const note = { id: formNote.id, ...this.latLongFromLocation(formNote.location) };
|
||||
note.user_created_time = time.formatLocalToMs(formNote.user_created_time);
|
||||
note.user_updated_time = time.formatLocalToMs(formNote.user_updated_time);
|
||||
|
||||
@ -211,7 +211,7 @@ class NotePropertiesDialog extends React.Component<Props, State> {
|
||||
if (!this.state.editedKey) return;
|
||||
|
||||
return new Promise((resolve: Function) => {
|
||||
const newFormNote = Object.assign({}, this.state.formNote);
|
||||
const newFormNote = { ...this.state.formNote };
|
||||
|
||||
if (this.state.editedKey.indexOf('_time') >= 0) {
|
||||
const dt = time.anythingToDateTime(this.state.editedValue, new Date());
|
||||
@ -248,7 +248,7 @@ class NotePropertiesDialog extends React.Component<Props, State> {
|
||||
public createNoteField(key: string, value: any) {
|
||||
const styles = this.styles(this.props.themeId);
|
||||
const theme = themeStyle(this.props.themeId);
|
||||
const labelComp = <label style={Object.assign({}, theme.textStyle, theme.controlBoxLabel)}>{this.formatLabel(key)}</label>;
|
||||
const labelComp = <label style={{ ...theme.textStyle, ...theme.controlBoxLabel }}>{this.formatLabel(key)}</label>;
|
||||
let controlComp = null;
|
||||
let editComp = null;
|
||||
let editCompHandler = null;
|
||||
@ -317,7 +317,7 @@ class NotePropertiesDialog extends React.Component<Props, State> {
|
||||
const ll = this.latLongFromLocation(value);
|
||||
url = Note.geoLocationUrlFromLatLong(ll.latitude, ll.longitude);
|
||||
}
|
||||
const urlStyle = Object.assign({}, theme.urlStyle, { maxWidth: '180px', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' });
|
||||
const urlStyle = { ...theme.urlStyle, maxWidth: '180px', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' };
|
||||
controlComp = (
|
||||
<a href="#" onClick={() => bridge().openExternal(url)} style={urlStyle}>
|
||||
{displayedValue}
|
||||
@ -330,7 +330,7 @@ class NotePropertiesDialog extends React.Component<Props, State> {
|
||||
</a>
|
||||
);
|
||||
} else {
|
||||
controlComp = <div style={Object.assign({}, theme.textStyle, theme.controlBoxValue)}>{displayedValue}</div>;
|
||||
controlComp = <div style={{ ...theme.textStyle, ...theme.controlBoxValue }}>{displayedValue}</div>;
|
||||
}
|
||||
|
||||
if (['id', 'revisionsLink', 'markup_language'].indexOf(key) < 0) {
|
||||
|
@ -67,8 +67,8 @@ class NoteRevisionViewerComponent extends React.PureComponent<Props, State> {
|
||||
flex: 1,
|
||||
flexDirection: 'column',
|
||||
},
|
||||
titleInput: Object.assign({}, theme.inputStyle, { flex: 1 }),
|
||||
revisionList: Object.assign({}, theme.dropdownList, { marginLeft: 10, flex: 0.5 }),
|
||||
titleInput: { ...theme.inputStyle, flex: 1 },
|
||||
revisionList: { ...theme.dropdownList, marginLeft: 10, flex: 0.5 },
|
||||
};
|
||||
|
||||
return style;
|
||||
@ -205,14 +205,14 @@ class NoteRevisionViewerComponent extends React.PureComponent<Props, State> {
|
||||
|
||||
const titleInput = (
|
||||
<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', marginBottom: 10, borderWidth: 1, borderBottomStyle: 'solid', borderColor: theme.dividerColor, paddingBottom: 10 }}>
|
||||
<button onClick={this.backButton_click} style={Object.assign({}, theme.buttonStyle, { marginRight: 10, height: theme.inputStyle.height })}>
|
||||
<button onClick={this.backButton_click} style={{ ...theme.buttonStyle, marginRight: 10, height: theme.inputStyle.height }}>
|
||||
<i style={theme.buttonIconStyle} className={'fa fa-chevron-left'}></i>{_('Back')}
|
||||
</button>
|
||||
<input readOnly type="text" style={style.titleInput} value={this.state.note ? this.state.note.title : ''} />
|
||||
<select disabled={!this.state.revisions.length} value={this.state.currentRevId} style={style.revisionList} onChange={this.revisionList_onChange}>
|
||||
{revisionListItems}
|
||||
</select>
|
||||
<button disabled={!this.state.revisions.length || this.state.restoring} onClick={this.importButton_onClick} style={Object.assign({}, theme.buttonStyle, { marginLeft: 10, height: theme.inputStyle.height })}>
|
||||
<button disabled={!this.state.revisions.length || this.state.restoring} onClick={this.importButton_onClick} style={{ ...theme.buttonStyle, marginLeft: 10, height: theme.inputStyle.height }}>
|
||||
{restoreButtonTitle}
|
||||
</button>
|
||||
<HelpButton tip={helpMessage} id="noteRevisionHelpButton" onClick={this.helpButton_onClick} />
|
||||
|
@ -37,10 +37,8 @@ class NoteSearchBar extends React.Component<Props> {
|
||||
const theme = themeStyle(this.props.themeId);
|
||||
|
||||
const style = {
|
||||
root: Object.assign({}, theme.textStyle, {
|
||||
backgroundColor: theme.backgroundColor,
|
||||
color: theme.colorFaded,
|
||||
}),
|
||||
root: { ...theme.textStyle, backgroundColor: theme.backgroundColor,
|
||||
color: theme.colorFaded },
|
||||
};
|
||||
|
||||
return style;
|
||||
@ -150,12 +148,10 @@ class NoteSearchBar extends React.Component<Props> {
|
||||
const previousButton = this.buttonIconComponent('fa-chevron-up', this.previousButton_click, buttonEnabled);
|
||||
const nextButton = this.buttonIconComponent('fa-chevron-down', this.nextButton_click, buttonEnabled);
|
||||
|
||||
const textStyle = Object.assign({
|
||||
fontSize: theme.fontSize,
|
||||
const textStyle = { fontSize: theme.fontSize,
|
||||
fontFamily: theme.fontFamily,
|
||||
color: theme.colorFaded,
|
||||
backgroundColor: theme.backgroundColor,
|
||||
});
|
||||
backgroundColor: theme.backgroundColor };
|
||||
|
||||
const matchesFoundString = (query.length > 0) ? (
|
||||
<div style={textStyle}>
|
||||
|
@ -15,10 +15,8 @@ class NoteStatusBarComponent extends React.Component<Props> {
|
||||
const theme = themeStyle(this.props.themeId);
|
||||
|
||||
const style = {
|
||||
root: Object.assign({}, theme.textStyle, {
|
||||
backgroundColor: theme.backgroundColor,
|
||||
color: theme.colorFaded,
|
||||
}),
|
||||
root: { ...theme.textStyle, backgroundColor: theme.backgroundColor,
|
||||
color: theme.colorFaded },
|
||||
};
|
||||
|
||||
return style;
|
||||
|
@ -173,7 +173,7 @@ export default class NoteTextViewerComponent extends React.Component<Props, any>
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
public render() {
|
||||
const viewerStyle = Object.assign({}, { border: 'none' }, this.props.viewerStyle);
|
||||
const viewerStyle = { border: 'none', ...this.props.viewerStyle };
|
||||
return <iframe className="noteTextViewer" ref={this.webviewRef_} style={viewerStyle} src="gui/note-viewer/index.html"></iframe>;
|
||||
}
|
||||
}
|
||||
|
@ -132,43 +132,49 @@ export default class PromptDialog extends React.Component<Props, any> {
|
||||
};
|
||||
|
||||
this.styles_.select = {
|
||||
control: (provided: any) =>
|
||||
Object.assign(provided, {
|
||||
control: (provided: any) => {
|
||||
return { ...provided,
|
||||
minWidth: width * 0.2,
|
||||
maxWidth: width * 0.5,
|
||||
fontFamily: theme.fontFamily,
|
||||
}),
|
||||
input: (provided: any) =>
|
||||
Object.assign(provided, {
|
||||
};
|
||||
},
|
||||
input: (provided: any) => {
|
||||
return { ...provided,
|
||||
minWidth: '20px',
|
||||
color: theme.color,
|
||||
}),
|
||||
menu: (provided: any) =>
|
||||
Object.assign(provided, {
|
||||
};
|
||||
},
|
||||
menu: (provided: any) => {
|
||||
return { ...provided,
|
||||
color: theme.color,
|
||||
fontFamily: theme.fontFamily,
|
||||
backgroundColor: theme.backgroundColor,
|
||||
}),
|
||||
option: (provided: any, state: any) =>
|
||||
Object.assign(provided, {
|
||||
};
|
||||
},
|
||||
option: (provided: any, state: any) => {
|
||||
return { ...provided,
|
||||
color: theme.color,
|
||||
fontFamily: theme.fontFamily,
|
||||
paddingLeft: `${10 + (state.data.indentDepth || 0) * 20}px`,
|
||||
}),
|
||||
multiValueLabel: (provided: any) =>
|
||||
Object.assign(provided, {
|
||||
};
|
||||
},
|
||||
multiValueLabel: (provided: any) => {
|
||||
return { ...provided,
|
||||
fontFamily: theme.fontFamily,
|
||||
}),
|
||||
multiValueRemove: (provided: any) =>
|
||||
Object.assign(provided, {
|
||||
};
|
||||
},
|
||||
multiValueRemove: (provided: any) => {
|
||||
return { ...provided,
|
||||
color: theme.color,
|
||||
}),
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
this.styles_.selectTheme = (tagTheme: any) =>
|
||||
Object.assign(tagTheme, {
|
||||
this.styles_.selectTheme = (tagTheme: any) => {
|
||||
return { ...tagTheme,
|
||||
borderRadius: 2,
|
||||
colors: Object.assign(tagTheme.colors, {
|
||||
colors: { ...tagTheme.colors,
|
||||
primary: theme.raisedBackgroundColor,
|
||||
primary25: theme.raisedBackgroundColor,
|
||||
neutral0: theme.backgroundColor,
|
||||
@ -184,12 +190,11 @@ export default class PromptDialog extends React.Component<Props, any> {
|
||||
neutral90: theme.color,
|
||||
danger: theme.backgroundColor,
|
||||
dangerLight: theme.colorError2,
|
||||
}),
|
||||
});
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
this.styles_.desc = Object.assign({}, theme.textStyle, {
|
||||
marginTop: 10,
|
||||
});
|
||||
this.styles_.desc = { ...theme.textStyle, marginTop: 10 };
|
||||
|
||||
return this.styles_;
|
||||
}
|
||||
|
@ -56,15 +56,13 @@ function StatusScreen(props: Props) {
|
||||
flexDirection: 'column',
|
||||
};
|
||||
|
||||
const retryStyle = Object.assign({}, theme.urlStyle, { marginLeft: 5 });
|
||||
const retryAllStyle = Object.assign({}, theme.urlStyle, { marginTop: 5, display: 'inline-block' });
|
||||
const retryStyle = { ...theme.urlStyle, marginLeft: 5 };
|
||||
const retryAllStyle = { ...theme.urlStyle, marginTop: 5, display: 'inline-block' };
|
||||
|
||||
const containerPadding = theme.configScreenPadding;
|
||||
|
||||
const containerStyle = Object.assign({}, theme.containerStyle, {
|
||||
padding: containerPadding,
|
||||
flex: 1,
|
||||
});
|
||||
const containerStyle = { ...theme.containerStyle, padding: containerPadding,
|
||||
flex: 1 };
|
||||
|
||||
function renderSectionTitleHtml(key: string, title: string) {
|
||||
return (
|
||||
|
@ -7,7 +7,7 @@ import { AppState } from '../app.reducer';
|
||||
class TagItemComponent extends React.Component {
|
||||
public render() {
|
||||
const theme = themeStyle(this.props.themeId);
|
||||
const style = Object.assign({}, theme.tagStyle);
|
||||
const style = { ...theme.tagStyle };
|
||||
const { title, id } = this.props;
|
||||
|
||||
return <button style={style} onClick={() => CommandService.instance().execute('openTag', id)}>{title}</button>;
|
||||
|
@ -16,14 +16,12 @@ class ToolbarBaseComponent extends React.Component<Props, any> {
|
||||
public render() {
|
||||
const theme = themeStyle(this.props.themeId);
|
||||
|
||||
const style: any = Object.assign({
|
||||
display: 'flex',
|
||||
const style: any = { display: 'flex',
|
||||
flexDirection: 'row',
|
||||
boxSizing: 'border-box',
|
||||
backgroundColor: theme.backgroundColor3,
|
||||
padding: theme.toolbarPadding,
|
||||
paddingRight: theme.mainPadding,
|
||||
}, this.props.style);
|
||||
paddingRight: theme.mainPadding, ...this.props.style };
|
||||
|
||||
const groupStyle: any = {
|
||||
display: 'flex',
|
||||
@ -45,13 +43,11 @@ class ToolbarBaseComponent extends React.Component<Props, any> {
|
||||
|
||||
if (!key) key = `${o.type}_${i}`;
|
||||
|
||||
const props = Object.assign(
|
||||
{
|
||||
key: key,
|
||||
themeId: this.props.themeId,
|
||||
},
|
||||
o
|
||||
);
|
||||
const props = {
|
||||
key: key,
|
||||
themeId: this.props.themeId,
|
||||
...o,
|
||||
};
|
||||
|
||||
if (o.name === 'toggleEditors') {
|
||||
rightItemComps.push(<ToggleEditorsButton
|
||||
@ -77,7 +73,7 @@ class ToolbarBaseComponent extends React.Component<Props, any> {
|
||||
<div style={groupStyle}>
|
||||
{centerItemComps}
|
||||
</div>
|
||||
<div style={Object.assign({}, groupStyle, { flex: 1, justifyContent: 'flex-end' })}>
|
||||
<div style={{ ...groupStyle, flex: 1, justifyContent: 'flex-end' }}>
|
||||
{rightItemComps}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -8,7 +8,7 @@ interface Props {
|
||||
class ToolbarSpace extends React.Component<Props> {
|
||||
public render() {
|
||||
const theme = themeStyle(this.props.themeId);
|
||||
const style = Object.assign({}, theme.toolbarStyle);
|
||||
const style = { ...theme.toolbarStyle };
|
||||
style.minWidth = style.height / 2;
|
||||
|
||||
return <span style={style}></span>;
|
||||
|
@ -96,25 +96,23 @@ markJsUtils.markKeyword = (mark, keyword, stringUtils, extraOptions = null) => {
|
||||
|
||||
mark.mark(
|
||||
[value],
|
||||
Object.assign(
|
||||
{},
|
||||
{
|
||||
accuracy: accuracy,
|
||||
filter: (node, _term, _totalCounter, _counter) => {
|
||||
// We exclude SVG because it creates a "<mark>" tag inside
|
||||
// the document, which is not a valid SVG tag. As a result
|
||||
// the content within that tag disappears.
|
||||
//
|
||||
// mark.js has an "exclude" parameter, but it doesn't work
|
||||
// so we use "filter" instead.
|
||||
//
|
||||
// https://github.com/joplin/plugin-abc-sheet-music
|
||||
if (isInsideContainer(node, 'SVG')) return false;
|
||||
return true;
|
||||
},
|
||||
{
|
||||
|
||||
accuracy: accuracy,
|
||||
filter: (node, _term, _totalCounter, _counter) => {
|
||||
// We exclude SVG because it creates a "<mark>" tag inside
|
||||
// the document, which is not a valid SVG tag. As a result
|
||||
// the content within that tag disappears.
|
||||
//
|
||||
// mark.js has an "exclude" parameter, but it doesn't work
|
||||
// so we use "filter" instead.
|
||||
//
|
||||
// https://github.com/joplin/plugin-abc-sheet-music
|
||||
if (isInsideContainer(node, 'SVG')) return false;
|
||||
return true;
|
||||
},
|
||||
extraOptions
|
||||
)
|
||||
...extraOptions,
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -41,13 +41,9 @@ const style = createSelector(
|
||||
},
|
||||
};
|
||||
|
||||
output.buttonIconSelected = Object.assign({}, output.buttonIcon, {
|
||||
color: theme.highlightedColor,
|
||||
});
|
||||
output.buttonIconSelected = { ...output.buttonIcon, color: theme.highlightedColor };
|
||||
|
||||
output.buttonLabelSelected = Object.assign({}, output.buttonLabel, {
|
||||
color: theme.color,
|
||||
});
|
||||
output.buttonLabelSelected = { ...output.buttonLabel, color: theme.color };
|
||||
|
||||
return output;
|
||||
}
|
||||
|
@ -133,8 +133,8 @@ class Dialog extends React.PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
this.styles_[styleKey] = {
|
||||
dialogBox: Object.assign({}, theme.dialogBox, { minWidth: '50%', maxWidth: '50%' }),
|
||||
input: Object.assign({}, theme.inputStyle, { flex: 1 }),
|
||||
dialogBox: { ...theme.dialogBox, minWidth: '50%', maxWidth: '50%' },
|
||||
input: { ...theme.inputStyle, flex: 1 },
|
||||
row: {
|
||||
overflow: 'hidden',
|
||||
height: itemHeight,
|
||||
@ -148,7 +148,7 @@ class Dialog extends React.PureComponent<Props, State> {
|
||||
borderBottomColor: theme.dividerColor,
|
||||
boxSizing: 'border-box',
|
||||
},
|
||||
help: Object.assign({}, theme.textStyle, { marginBottom: 10 }),
|
||||
help: { ...theme.textStyle, marginBottom: 10 },
|
||||
inputHelpWrapper: { display: 'flex', flexDirection: 'row', alignItems: 'center' },
|
||||
};
|
||||
|
||||
@ -163,19 +163,15 @@ class Dialog extends React.PureComponent<Props, State> {
|
||||
userSelect: 'none',
|
||||
};
|
||||
|
||||
const rowTitleStyle = Object.assign({}, rowTextStyle, {
|
||||
fontSize: rowTextStyle.fontSize * 1.4,
|
||||
const rowTitleStyle = { ...rowTextStyle, fontSize: rowTextStyle.fontSize * 1.4,
|
||||
marginBottom: this.state.resultsInBody ? 6 : 4,
|
||||
color: theme.colorFaded,
|
||||
});
|
||||
color: theme.colorFaded };
|
||||
|
||||
const rowFragmentsStyle = Object.assign({}, rowTextStyle, {
|
||||
fontSize: rowTextStyle.fontSize * 1.2,
|
||||
const rowFragmentsStyle = { ...rowTextStyle, fontSize: rowTextStyle.fontSize * 1.2,
|
||||
marginBottom: this.state.resultsInBody ? 8 : 6,
|
||||
color: theme.colorFaded,
|
||||
});
|
||||
color: theme.colorFaded };
|
||||
|
||||
this.styles_[styleKey].rowSelected = Object.assign({}, this.styles_[styleKey].row, { backgroundColor: theme.selectedColor });
|
||||
this.styles_[styleKey].rowSelected = { ...this.styles_[styleKey].row, backgroundColor: theme.selectedColor };
|
||||
this.styles_[styleKey].rowPath = rowTextStyle;
|
||||
this.styles_[styleKey].rowTitle = rowTitleStyle;
|
||||
this.styles_[styleKey].rowFragments = rowFragmentsStyle;
|
||||
@ -304,7 +300,7 @@ class Dialog extends React.PureComponent<Props, State> {
|
||||
for (let i = 0; i < results.length; i++) {
|
||||
const row = results[i];
|
||||
const path = Folder.folderPathString(this.props.folders, row.parent_id);
|
||||
results[i] = Object.assign({}, row, { path: path ? path : '/' });
|
||||
results[i] = { ...row, path: path ? path : '/' };
|
||||
}
|
||||
} else { // Note TITLE or BODY
|
||||
listType = BaseModel.TYPE_NOTE;
|
||||
@ -317,7 +313,7 @@ class Dialog extends React.PureComponent<Props, State> {
|
||||
for (let i = 0; i < results.length; i++) {
|
||||
const row = results[i];
|
||||
const path = Folder.folderPathString(this.props.folders, row.parent_id);
|
||||
results[i] = Object.assign({}, row, { path: path });
|
||||
results[i] = { ...row, path: path };
|
||||
}
|
||||
} else {
|
||||
const limit = 20;
|
||||
@ -365,9 +361,9 @@ class Dialog extends React.PureComponent<Props, State> {
|
||||
|
||||
}
|
||||
|
||||
results[i] = Object.assign({}, row, { path, fragments });
|
||||
results[i] = { ...row, path, fragments };
|
||||
} else {
|
||||
results[i] = Object.assign({}, row, { path: path, fragments: '' });
|
||||
results[i] = { ...row, path: path, fragments: '' };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ class CameraView extends Component {
|
||||
}
|
||||
|
||||
return (
|
||||
<TouchableOpacity onPress={onPress} style={Object.assign({}, style)}>
|
||||
<TouchableOpacity onPress={onPress} style={{ ...style }}>
|
||||
<View style={{ borderRadius: 32, width: 60, height: 60, borderColor: '#00000040', borderWidth: 1, borderStyle: 'solid', backgroundColor: '#ffffff77', justifyContent: 'center', alignItems: 'center', alignSelf: 'baseline' }}>
|
||||
{ icon }
|
||||
</View>
|
||||
@ -177,10 +177,10 @@ class CameraView extends Component {
|
||||
cameraRect.top = (this.state.screenHeight - cameraRect.height) / 2;
|
||||
|
||||
return (
|
||||
<View style={Object.assign({}, this.props.style, { position: 'relative' })} onLayout={this.onLayout}>
|
||||
<View style={{ ...this.props.style, position: 'relative' }} onLayout={this.onLayout}>
|
||||
<View style={{ position: 'absolute', backgroundColor: '#000000', width: '100%', height: '100%' }}/>
|
||||
<RNCamera
|
||||
style={Object.assign({ position: 'absolute' }, cameraRect)}
|
||||
style={({ position: 'absolute', ...cameraRect })}
|
||||
ref={(ref: any) => {
|
||||
this.camera = ref;
|
||||
}}
|
||||
|
@ -84,36 +84,26 @@ class Dropdown extends Component<DropdownProps, DropdownState> {
|
||||
width: windowWidth,
|
||||
};
|
||||
|
||||
const itemListStyle = Object.assign({}, this.props.itemListStyle ? this.props.itemListStyle : {}, {
|
||||
borderWidth: 1,
|
||||
borderColor: '#ccc',
|
||||
});
|
||||
const itemListStyle = { ...(this.props.itemListStyle ? this.props.itemListStyle : {}), borderWidth: 1,
|
||||
borderColor: '#ccc' };
|
||||
|
||||
const itemWrapperStyle = Object.assign({}, this.props.itemWrapperStyle ? this.props.itemWrapperStyle : {}, {
|
||||
flex: 1,
|
||||
const itemWrapperStyle = { ...(this.props.itemWrapperStyle ? this.props.itemWrapperStyle : {}), flex: 1,
|
||||
justifyContent: 'center',
|
||||
height: itemHeight,
|
||||
paddingLeft: 20,
|
||||
paddingRight: 10,
|
||||
});
|
||||
paddingRight: 10 };
|
||||
|
||||
const headerWrapperStyle = Object.assign({}, this.props.headerWrapperStyle ? this.props.headerWrapperStyle : {}, {
|
||||
height: 35,
|
||||
const headerWrapperStyle = { ...(this.props.headerWrapperStyle ? this.props.headerWrapperStyle : {}), height: 35,
|
||||
flex: 1,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
});
|
||||
alignItems: 'center' };
|
||||
|
||||
const headerStyle = Object.assign({}, this.props.headerStyle ? this.props.headerStyle : {}, {
|
||||
flex: 1,
|
||||
});
|
||||
const headerStyle = { ...(this.props.headerStyle ? this.props.headerStyle : {}), flex: 1 };
|
||||
|
||||
const headerArrowStyle = Object.assign({}, this.props.headerStyle ? this.props.headerStyle : {}, {
|
||||
flex: 0,
|
||||
marginRight: 10,
|
||||
});
|
||||
const headerArrowStyle = { ...(this.props.headerStyle ? this.props.headerStyle : {}), flex: 0,
|
||||
marginRight: 10 };
|
||||
|
||||
const itemStyle = Object.assign({}, this.props.itemStyle ? this.props.itemStyle : {}, {});
|
||||
const itemStyle = { ...(this.props.itemStyle ? this.props.itemStyle : {}) };
|
||||
|
||||
let headerLabel = '...';
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
@ -136,7 +126,7 @@ class Dropdown extends Component<DropdownProps, DropdownState> {
|
||||
const key = item.value ? item.value.toString() : '__null'; // The top item ("Move item to notebook...") has a null value.
|
||||
return (
|
||||
<TouchableOpacity
|
||||
style={itemWrapperStyle}
|
||||
style={itemWrapperStyle as any}
|
||||
accessibilityRole="menuitem"
|
||||
key={key}
|
||||
onPress={() => {
|
||||
@ -170,7 +160,7 @@ class Dropdown extends Component<DropdownProps, DropdownState> {
|
||||
return (
|
||||
<View style={{ flex: 1, flexDirection: 'column' }}>
|
||||
<TouchableOpacity
|
||||
style={headerWrapperStyle}
|
||||
style={headerWrapperStyle as any}
|
||||
ref={ref => (this.headerRef = ref)}
|
||||
disabled={this.props.disabled}
|
||||
onPress={() => {
|
||||
|
@ -34,12 +34,10 @@ class ModalDialog extends React.Component {
|
||||
modalContentWrapper2: {
|
||||
flex: 1,
|
||||
},
|
||||
title: Object.assign({}, theme.normalText, {
|
||||
borderBottomWidth: 1,
|
||||
title: { ...theme.normalText, borderBottomWidth: 1,
|
||||
borderBottomColor: theme.dividerColor,
|
||||
paddingBottom: 10,
|
||||
fontWeight: 'bold',
|
||||
}),
|
||||
fontWeight: 'bold' },
|
||||
buttonRow: {
|
||||
flexDirection: 'row',
|
||||
borderTopWidth: 1,
|
||||
|
@ -148,7 +148,7 @@ export const SearchPanel = (props: SearchPanelProps) => {
|
||||
const control = props.searchControl;
|
||||
|
||||
const updateSearchState = (changedData: any) => {
|
||||
const newState = Object.assign({}, state, changedData);
|
||||
const newState = { ...state, ...changedData };
|
||||
control.setSearchState(newState);
|
||||
};
|
||||
|
||||
|
@ -20,7 +20,7 @@ function JoplinSafeAreaView(props) {
|
||||
if (Platform.OS === 'ios') {
|
||||
return <SafeAreaView {...props}>{props.children}</SafeAreaView>;
|
||||
} else {
|
||||
const viewProps = Object.assign({}, props);
|
||||
const viewProps = { ...props };
|
||||
|
||||
const style = [];
|
||||
|
||||
|
@ -201,17 +201,17 @@ class ScreenHeaderComponent extends PureComponent<ScreenHeaderProps, ScreenHeade
|
||||
},
|
||||
};
|
||||
|
||||
styleObject.topIcon = Object.assign({}, theme.icon);
|
||||
styleObject.topIcon = { ...theme.icon };
|
||||
styleObject.topIcon.flex = 1;
|
||||
styleObject.topIcon.textAlignVertical = 'center';
|
||||
styleObject.topIcon.color = theme.colorBright2;
|
||||
|
||||
styleObject.backButton = Object.assign({}, styleObject.iconButton);
|
||||
styleObject.backButton = { ...styleObject.iconButton };
|
||||
styleObject.backButton.marginRight = 1;
|
||||
|
||||
styleObject.backButtonDisabled = Object.assign({}, styleObject.backButton, { opacity: theme.disabledOpacity });
|
||||
styleObject.saveButtonDisabled = Object.assign({}, styleObject.saveButton, { opacity: theme.disabledOpacity });
|
||||
styleObject.iconButtonDisabled = Object.assign({}, styleObject.iconButton, { opacity: theme.disabledOpacity });
|
||||
styleObject.backButtonDisabled = { ...styleObject.backButton, opacity: theme.disabledOpacity };
|
||||
styleObject.saveButtonDisabled = { ...styleObject.saveButton, opacity: theme.disabledOpacity };
|
||||
styleObject.iconButtonDisabled = { ...styleObject.iconButton, opacity: theme.disabledOpacity };
|
||||
|
||||
this.cachedStyles[themeId] = StyleSheet.create(styleObject);
|
||||
return this.cachedStyles[themeId];
|
||||
|
@ -42,11 +42,11 @@ class Checkbox extends Component {
|
||||
render() {
|
||||
const iconName = this.state.checked ? 'md-checkbox-outline' : 'md-square-outline';
|
||||
|
||||
const style = this.props.style ? Object.assign({}, this.props.style) : {};
|
||||
const style = this.props.style ? { ...this.props.style } : {};
|
||||
style.justifyContent = 'center';
|
||||
style.alignItems = 'center';
|
||||
|
||||
const checkboxIconStyle = Object.assign({}, styles.checkboxIcon);
|
||||
const checkboxIconStyle = { ...styles.checkboxIcon };
|
||||
if (style.color) checkboxIconStyle.color = style.color;
|
||||
|
||||
if (style.paddingTop) checkboxIconStyle.marginTop = style.paddingTop;
|
||||
|
@ -100,7 +100,7 @@ function themeStyle(theme) {
|
||||
const cacheKey = [theme].join('-');
|
||||
if (themeCache_[cacheKey]) return themeCache_[cacheKey];
|
||||
|
||||
const output = Object.assign({}, baseStyle, themeById(theme));
|
||||
const output = { ...baseStyle, ...themeById(theme) };
|
||||
themeCache_[cacheKey] = addExtraStyles(output);
|
||||
return themeCache_[cacheKey];
|
||||
}
|
||||
|
@ -51,16 +51,16 @@ class NoteItemComponent extends Component {
|
||||
},
|
||||
};
|
||||
|
||||
styles.listItemWithCheckbox = Object.assign({}, styles.listItem);
|
||||
styles.listItemWithCheckbox = { ...styles.listItem };
|
||||
delete styles.listItemWithCheckbox.paddingTop;
|
||||
delete styles.listItemWithCheckbox.paddingBottom;
|
||||
delete styles.listItemWithCheckbox.paddingLeft;
|
||||
|
||||
styles.listItemTextWithCheckbox = Object.assign({}, styles.listItemText);
|
||||
styles.listItemTextWithCheckbox = { ...styles.listItemText };
|
||||
styles.listItemTextWithCheckbox.marginTop = styles.listItem.paddingTop - 1;
|
||||
styles.listItemTextWithCheckbox.marginBottom = styles.listItem.paddingBottom;
|
||||
|
||||
styles.selectionWrapperSelected = Object.assign({}, styles.selectionWrapper);
|
||||
styles.selectionWrapperSelected = { ...styles.selectionWrapper };
|
||||
styles.selectionWrapperSelected.backgroundColor = theme.selectedColor;
|
||||
|
||||
this.styles_[this.props.themeId] = StyleSheet.create(styles);
|
||||
|
@ -284,30 +284,28 @@ class ConfigScreenComponent extends BaseScreenComponent {
|
||||
},
|
||||
};
|
||||
|
||||
styles.settingContainerNoBottomBorder = Object.assign({}, styles.settingContainer, {
|
||||
borderBottomWidth: 0,
|
||||
paddingBottom: theme.marginBottom / 2,
|
||||
});
|
||||
styles.settingContainerNoBottomBorder = { ...styles.settingContainer, borderBottomWidth: 0,
|
||||
paddingBottom: theme.marginBottom / 2 };
|
||||
|
||||
styles.settingControl.borderBottomWidth = 1;
|
||||
styles.settingControl.borderBottomColor = theme.dividerColor;
|
||||
|
||||
styles.switchSettingText = Object.assign({}, styles.settingText);
|
||||
styles.switchSettingText = { ...styles.settingText };
|
||||
styles.switchSettingText.width = '80%';
|
||||
|
||||
styles.switchSettingContainer = Object.assign({}, styles.settingContainer);
|
||||
styles.switchSettingContainer = { ...styles.settingContainer };
|
||||
styles.switchSettingContainer.flexDirection = 'row';
|
||||
styles.switchSettingContainer.justifyContent = 'space-between';
|
||||
|
||||
styles.linkText = Object.assign({}, styles.settingText);
|
||||
styles.linkText = { ...styles.settingText };
|
||||
styles.linkText.borderBottomWidth = 1;
|
||||
styles.linkText.borderBottomColor = theme.color;
|
||||
styles.linkText.flex = 0;
|
||||
styles.linkText.fontWeight = 'normal';
|
||||
|
||||
styles.headerWrapperStyle = Object.assign({}, styles.settingContainer, theme.headerWrapperStyle);
|
||||
styles.headerWrapperStyle = { ...styles.settingContainer, ...theme.headerWrapperStyle };
|
||||
|
||||
styles.switchSettingControl = Object.assign({}, styles.settingControl);
|
||||
styles.switchSettingControl = { ...styles.settingControl };
|
||||
delete styles.switchSettingControl.color;
|
||||
// styles.switchSettingControl.width = '20%';
|
||||
styles.switchSettingControl.flex = 0;
|
||||
|
@ -136,7 +136,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
Keyboard.dismiss();
|
||||
|
||||
this.setState({
|
||||
note: Object.assign({}, this.state.lastSavedNote),
|
||||
note: { ...this.state.lastSavedNote },
|
||||
mode: 'view',
|
||||
});
|
||||
|
||||
@ -281,7 +281,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
if (!undoState) return;
|
||||
|
||||
this.setState((state: any) => {
|
||||
const newNote = Object.assign({}, state.note);
|
||||
const newNote = { ...state.note };
|
||||
newNote.body = undoState.body;
|
||||
return {
|
||||
note: newNote,
|
||||
@ -380,7 +380,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
borderBottomWidth: 1,
|
||||
};
|
||||
|
||||
styles.titleContainerTodo = Object.assign({}, styles.titleContainer);
|
||||
styles.titleContainerTodo = { ...styles.titleContainer };
|
||||
styles.titleContainerTodo.paddingLeft = 0;
|
||||
|
||||
styles.titleTextInput = {
|
||||
@ -692,7 +692,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
|
||||
const resourceTag = Resource.markdownTag(resource);
|
||||
|
||||
const newNote = Object.assign({}, this.state.note);
|
||||
const newNote = { ...this.state.note };
|
||||
|
||||
if (this.state.mode === 'edit' && !!this.selection) {
|
||||
const newText = `\n${resourceTag}\n`;
|
||||
@ -787,7 +787,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
}
|
||||
|
||||
public async onAlarmDialogAccept(date: Date) {
|
||||
const newNote = Object.assign({}, this.state.note);
|
||||
const newNote = { ...this.state.note };
|
||||
newNote.todo_due = date ? date.getTime() : 0;
|
||||
|
||||
await this.saveOneProperty('todo_due', date ? date.getTime() : 0);
|
||||
@ -1085,7 +1085,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
const folder = await Folder.load(note.parent_id);
|
||||
|
||||
this.setState({
|
||||
lastSavedNote: Object.assign({}, note),
|
||||
lastSavedNote: { ...note },
|
||||
note: note,
|
||||
folder: folder,
|
||||
});
|
||||
|
@ -46,7 +46,7 @@ class NoteTagsDialogComponent extends React.Component {
|
||||
for (let i = 0; i < newData.length; i++) {
|
||||
const t = newData[i];
|
||||
if (t.id === tagId) {
|
||||
const newTag = Object.assign({}, t);
|
||||
const newTag = { ...t };
|
||||
newTag.selected = !newTag.selected;
|
||||
newData[i] = newTag;
|
||||
break;
|
||||
@ -142,7 +142,7 @@ class NoteTagsDialogComponent extends React.Component {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
},
|
||||
tagText: Object.assign({}, theme.normalText),
|
||||
tagText: { ...theme.normalText },
|
||||
tagCheckbox: {
|
||||
marginRight: 8,
|
||||
fontSize: 20,
|
||||
@ -156,8 +156,8 @@ class NoteTagsDialogComponent extends React.Component {
|
||||
borderBottomWidth: 1,
|
||||
borderBottomColor: theme.dividerColor,
|
||||
},
|
||||
newTagBoxLabel: Object.assign({}, theme.normalText, { marginRight: 8 }),
|
||||
tagBoxInput: Object.assign({}, theme.lineInput, { flex: 1 }),
|
||||
newTagBoxLabel: { ...theme.normalText, marginRight: 8 },
|
||||
tagBoxInput: { ...theme.lineInput, flex: 1 },
|
||||
};
|
||||
|
||||
this.styles_[themeId] = StyleSheet.create(styles);
|
||||
|
@ -26,7 +26,7 @@ class NotesScreenComponent extends BaseScreenComponent<any> {
|
||||
|
||||
this.onAppStateChange_ = async () => {
|
||||
// Force an update to the notes list when app state changes
|
||||
const newProps = Object.assign({}, this.props);
|
||||
const newProps = { ...this.props };
|
||||
newProps.notesSource = '';
|
||||
await this.refreshNotes(newProps);
|
||||
};
|
||||
|
@ -39,8 +39,8 @@ class DropboxLoginScreenComponent extends BaseScreenComponent {
|
||||
padding: theme.margin,
|
||||
backgroundColor: theme.backgroundColor,
|
||||
},
|
||||
stepText: Object.assign({}, theme.normalText, { marginBottom: theme.margin }),
|
||||
urlText: Object.assign({}, theme.urlText, { marginBottom: theme.margin }),
|
||||
stepText: { ...theme.normalText, marginBottom: theme.margin },
|
||||
urlText: { ...theme.urlText, marginBottom: theme.margin },
|
||||
};
|
||||
|
||||
this.styles_[themeId] = StyleSheet.create(styles);
|
||||
|
@ -29,14 +29,14 @@ class FolderScreenComponent extends BaseScreenComponent {
|
||||
const folder = Folder.new();
|
||||
this.setState({
|
||||
folder: folder,
|
||||
lastSavedFolder: Object.assign({}, folder),
|
||||
lastSavedFolder: { ...folder },
|
||||
});
|
||||
} else {
|
||||
// eslint-disable-next-line promise/prefer-await-to-then -- Old code before rule was applied
|
||||
Folder.load(this.props.folderId).then(folder => {
|
||||
this.setState({
|
||||
folder: folder,
|
||||
lastSavedFolder: Object.assign({}, folder),
|
||||
lastSavedFolder: { ...folder },
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -51,7 +51,7 @@ class FolderScreenComponent extends BaseScreenComponent {
|
||||
|
||||
folderComponent_change(propName, propValue) {
|
||||
this.setState((prevState) => {
|
||||
const folder = Object.assign({}, prevState.folder);
|
||||
const folder = { ...prevState.folder };
|
||||
folder[propName] = propValue;
|
||||
return { folder: folder };
|
||||
});
|
||||
@ -67,7 +67,7 @@ class FolderScreenComponent extends BaseScreenComponent {
|
||||
|
||||
|
||||
async saveFolderButton_press() {
|
||||
let folder = Object.assign({}, this.state.folder);
|
||||
let folder = { ...this.state.folder };
|
||||
|
||||
try {
|
||||
if (folder.id && !(await Folder.canNestUnder(folder.id, folder.parent_id))) throw new Error(_('Cannot move notebook to this location'));
|
||||
@ -78,7 +78,7 @@ class FolderScreenComponent extends BaseScreenComponent {
|
||||
}
|
||||
|
||||
this.setState({
|
||||
lastSavedFolder: Object.assign({}, folder),
|
||||
lastSavedFolder: { ...folder },
|
||||
folder: folder,
|
||||
});
|
||||
|
||||
|
@ -50,10 +50,10 @@ class LogScreenComponent extends BaseScreenComponent {
|
||||
styles.rowText.fontFamily = 'monospace';
|
||||
}
|
||||
|
||||
styles.rowTextError = Object.assign({}, styles.rowText);
|
||||
styles.rowTextError = { ...styles.rowText };
|
||||
styles.rowTextError.color = theme.colorError;
|
||||
|
||||
styles.rowTextWarn = Object.assign({}, styles.rowText);
|
||||
styles.rowTextWarn = { ...styles.rowText };
|
||||
styles.rowTextWarn.color = theme.colorWarn;
|
||||
|
||||
this.styles_[this.props.themeId] = StyleSheet.create(styles);
|
||||
|
@ -57,13 +57,13 @@ class SearchScreenComponent extends BaseScreenComponent {
|
||||
},
|
||||
};
|
||||
|
||||
styles.searchTextInput = Object.assign({}, theme.lineInput);
|
||||
styles.searchTextInput = { ...theme.lineInput };
|
||||
styles.searchTextInput.paddingLeft = theme.marginLeft;
|
||||
styles.searchTextInput.flex = 1;
|
||||
styles.searchTextInput.backgroundColor = theme.backgroundColor;
|
||||
styles.searchTextInput.color = theme.color;
|
||||
|
||||
styles.clearIcon = Object.assign({}, theme.icon);
|
||||
styles.clearIcon = { ...theme.icon };
|
||||
styles.clearIcon.color = theme.colorFaded;
|
||||
styles.clearIcon.paddingRight = theme.marginRight;
|
||||
styles.clearIcon.backgroundColor = theme.backgroundColor;
|
||||
|
@ -60,7 +60,7 @@ class StatusScreenComponent extends BaseScreenComponent {
|
||||
for (let i = 0; i < report.length; i++) {
|
||||
const section = report[i];
|
||||
|
||||
let style = Object.assign({}, baseStyle);
|
||||
let style = { ...baseStyle };
|
||||
style.fontWeight = 'bold';
|
||||
if (i > 0) style.paddingTop = 20;
|
||||
lines.push({ key: `section_${i}`, isSection: true, text: section.title });
|
||||
@ -70,7 +70,7 @@ class StatusScreenComponent extends BaseScreenComponent {
|
||||
|
||||
for (const n in section.body) {
|
||||
if (!section.body.hasOwnProperty(n)) continue;
|
||||
style = Object.assign({}, baseStyle);
|
||||
style = { ...baseStyle };
|
||||
const item = section.body[n];
|
||||
|
||||
let text = '';
|
||||
@ -98,7 +98,7 @@ class StatusScreenComponent extends BaseScreenComponent {
|
||||
<FlatList
|
||||
data={lines}
|
||||
renderItem={({ item }) => {
|
||||
const style = Object.assign({}, baseStyle);
|
||||
const style = { ...baseStyle };
|
||||
|
||||
if (item.isSection === true) {
|
||||
style.fontWeight = 'bold';
|
||||
|
@ -45,8 +45,8 @@ class SideMenuContentNoteComponent extends Component {
|
||||
},
|
||||
};
|
||||
|
||||
styles.sideButton = Object.assign({}, styles.button, { flex: 0 });
|
||||
styles.sideButtonDisabled = Object.assign({}, styles.sideButton, { opacity: 0.6 });
|
||||
styles.sideButton = { ...styles.button, flex: 0 };
|
||||
styles.sideButtonDisabled = { ...styles.sideButton, opacity: 0.6 };
|
||||
|
||||
this.styles_[this.props.themeId] = StyleSheet.create(styles);
|
||||
return this.styles_[this.props.themeId];
|
||||
|
@ -85,18 +85,18 @@ const SideMenuContentComponent = (props: Props) => {
|
||||
},
|
||||
};
|
||||
|
||||
styles.folderButton = Object.assign({}, styles.button);
|
||||
styles.folderButton = { ...styles.button };
|
||||
styles.folderButton.paddingLeft = 0;
|
||||
styles.folderButtonText = Object.assign({}, styles.buttonText, { paddingLeft: 0 });
|
||||
styles.folderButtonSelected = Object.assign({}, styles.folderButton);
|
||||
styles.folderButtonText = { ...styles.buttonText, paddingLeft: 0 };
|
||||
styles.folderButtonSelected = { ...styles.folderButton };
|
||||
styles.folderButtonSelected.backgroundColor = theme.selectedColor;
|
||||
styles.folderIcon = Object.assign({}, theme.icon);
|
||||
styles.folderIcon = { ...theme.icon };
|
||||
styles.folderIcon.color = theme.colorFaded; // '#0072d5';
|
||||
styles.folderIcon.paddingTop = 3;
|
||||
|
||||
styles.sideButton = Object.assign({}, styles.button, { flex: 0 });
|
||||
styles.sideButtonSelected = Object.assign({}, styles.sideButton, { backgroundColor: theme.selectedColor });
|
||||
styles.sideButtonText = Object.assign({}, styles.buttonText);
|
||||
styles.sideButton = { ...styles.button, flex: 0 };
|
||||
styles.sideButtonSelected = { ...styles.sideButton, backgroundColor: theme.selectedColor };
|
||||
styles.sideButtonText = { ...styles.buttonText };
|
||||
|
||||
styles.emptyFolderIcon = { ...styles.sidebarIcon, marginRight: folderIconRightMargin, width: 20 };
|
||||
|
||||
|
@ -216,13 +216,11 @@ const DEFAULT_ROUTE = {
|
||||
smartFilterId: 'c3176726992c11e9ac940492261af972',
|
||||
};
|
||||
|
||||
const appDefaultState: AppState = Object.assign({}, defaultState, {
|
||||
sideMenuOpenPercent: 0,
|
||||
const appDefaultState: AppState = { ...defaultState, sideMenuOpenPercent: 0,
|
||||
route: DEFAULT_ROUTE,
|
||||
noteSelectionEnabled: false,
|
||||
noteSideMenuOptions: null,
|
||||
isOnMobileData: false,
|
||||
});
|
||||
isOnMobileData: false };
|
||||
|
||||
const appReducer = (state = appDefaultState, action: any) => {
|
||||
let newState = state;
|
||||
@ -275,11 +273,11 @@ const appReducer = (state = appDefaultState, action: any) => {
|
||||
for (let i = 0; i < navHistory.length; i++) {
|
||||
const n = navHistory[i];
|
||||
if (n.routeName === action.routeName) {
|
||||
navHistory[i] = Object.assign({}, action);
|
||||
navHistory[i] = { ...action };
|
||||
}
|
||||
}
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
|
||||
newState.selectedNoteHash = '';
|
||||
|
||||
@ -323,32 +321,32 @@ const appReducer = (state = appDefaultState, action: any) => {
|
||||
|
||||
case 'SIDE_MENU_TOGGLE':
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.showSideMenu = !newState.showSideMenu;
|
||||
break;
|
||||
|
||||
case 'SIDE_MENU_OPEN':
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.showSideMenu = true;
|
||||
break;
|
||||
|
||||
case 'SIDE_MENU_CLOSE':
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.showSideMenu = false;
|
||||
break;
|
||||
|
||||
case 'SIDE_MENU_OPEN_PERCENT':
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.sideMenuOpenPercent = action.value;
|
||||
break;
|
||||
|
||||
case 'NOTE_SELECTION_TOGGLE':
|
||||
|
||||
{
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
|
||||
const noteId = action.id;
|
||||
const newSelectedNoteIds = state.selectedNoteIds.slice();
|
||||
@ -368,7 +366,7 @@ const appReducer = (state = appDefaultState, action: any) => {
|
||||
case 'NOTE_SELECTION_START':
|
||||
|
||||
if (!state.noteSelectionEnabled) {
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.noteSelectionEnabled = true;
|
||||
newState.selectedNoteIds = [action.id];
|
||||
}
|
||||
@ -376,20 +374,20 @@ const appReducer = (state = appDefaultState, action: any) => {
|
||||
|
||||
case 'NOTE_SELECTION_END':
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.noteSelectionEnabled = false;
|
||||
newState.selectedNoteIds = [];
|
||||
break;
|
||||
|
||||
case 'NOTE_SIDE_MENU_OPTIONS_SET':
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.noteSideMenuOptions = action.options;
|
||||
break;
|
||||
|
||||
case 'MOBILE_DATA_WARNING_UPDATE':
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState = { ...state };
|
||||
newState.isOnMobileData = action.isOnMobileData;
|
||||
break;
|
||||
|
||||
|
@ -251,7 +251,7 @@ function shimInit() {
|
||||
await shim.fsDriver().copy(filePath, targetPath);
|
||||
|
||||
if (defaultProps) {
|
||||
resource = Object.assign({}, resource, defaultProps);
|
||||
resource = { ...resource, ...defaultProps };
|
||||
}
|
||||
|
||||
const itDoes = await shim.fsDriver().waitTillExists(targetPath);
|
||||
|
@ -100,7 +100,7 @@ module.exports = class extends Generator {
|
||||
|
||||
if (!derivedProps.packageName) derivedProps.packageName = defaultPackageName;
|
||||
|
||||
this.props = Object.assign({}, initialProps, derivedProps);
|
||||
this.props = { ...initialProps, ...derivedProps };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,7 @@ const distDir = path.resolve(rootDir, 'dist');
|
||||
const srcDir = path.resolve(rootDir, 'src');
|
||||
const publishDir = path.resolve(rootDir, 'publish');
|
||||
|
||||
const userConfig = Object.assign({}, {
|
||||
extraScripts: [],
|
||||
}, fs.pathExistsSync(userConfigPath) ? require(userConfigFilename) : {});
|
||||
const userConfig = { extraScripts: [], ...(fs.pathExistsSync(userConfigPath) ? require(userConfigFilename) : {}) };
|
||||
|
||||
const manifestPath = `${srcDir}/manifest.json`;
|
||||
const packageJsonPath = `${rootDir}/package.json`;
|
||||
@ -169,8 +167,7 @@ const baseConfig = {
|
||||
},
|
||||
};
|
||||
|
||||
const pluginConfig = Object.assign({}, baseConfig, {
|
||||
entry: './src/index.ts',
|
||||
const pluginConfig = { ...baseConfig, entry: './src/index.ts',
|
||||
resolve: {
|
||||
alias: {
|
||||
api: path.resolve(__dirname, 'api'),
|
||||
@ -202,18 +199,15 @@ const pluginConfig = Object.assign({}, baseConfig, {
|
||||
},
|
||||
],
|
||||
}),
|
||||
],
|
||||
});
|
||||
] };
|
||||
|
||||
const extraScriptConfig = Object.assign({}, baseConfig, {
|
||||
resolve: {
|
||||
alias: {
|
||||
api: path.resolve(__dirname, 'api'),
|
||||
},
|
||||
fallback: moduleFallback,
|
||||
extensions: ['.js', '.tsx', '.ts', '.json'],
|
||||
const extraScriptConfig = { ...baseConfig, resolve: {
|
||||
alias: {
|
||||
api: path.resolve(__dirname, 'api'),
|
||||
},
|
||||
});
|
||||
fallback: moduleFallback,
|
||||
extensions: ['.js', '.tsx', '.ts', '.json'],
|
||||
} };
|
||||
|
||||
const createArchiveConfig = {
|
||||
stats: 'errors-only',
|
||||
@ -261,10 +255,8 @@ function buildExtraScriptConfigs(userConfig) {
|
||||
|
||||
for (const scriptName of userConfig.extraScripts) {
|
||||
const scriptPaths = resolveExtraScriptPath(scriptName);
|
||||
output.push(Object.assign({}, extraScriptConfig, {
|
||||
entry: scriptPaths.entry,
|
||||
output: scriptPaths.output,
|
||||
}));
|
||||
output.push({ ...extraScriptConfig, entry: scriptPaths.entry,
|
||||
output: scriptPaths.output });
|
||||
}
|
||||
|
||||
return output;
|
||||
|
@ -3,7 +3,7 @@ const slugify = require('slugify');
|
||||
// "source" is the framework current version.
|
||||
// "dest" is the user existing version.
|
||||
function mergePackageKey(parentKey, source, dest) {
|
||||
const output = Object.assign({}, dest);
|
||||
const output = { ...dest };
|
||||
|
||||
for (const k in source) {
|
||||
if (k === 'keywords' && !Array.isArray(output[k])) {
|
||||
|
@ -145,7 +145,7 @@ export default class BaseApplication {
|
||||
|
||||
public switchCurrentFolder(folder: any) {
|
||||
if (!this.hasGui()) {
|
||||
this.currentFolder_ = Object.assign({}, folder);
|
||||
this.currentFolder_ = { ...folder };
|
||||
Setting.setValue('activeFolderId', folder ? folder.id : '');
|
||||
} else {
|
||||
this.dispatch({
|
||||
@ -792,7 +792,7 @@ export default class BaseApplication {
|
||||
await shim.fsDriver().removeAllThatStartWith(profileDir, 'edit-');
|
||||
|
||||
const extraFlags = await this.readFlagsFromFile(`${profileDir}/flags.txt`);
|
||||
initArgs = Object.assign(initArgs, extraFlags);
|
||||
initArgs = { ...initArgs, ...extraFlags };
|
||||
|
||||
|
||||
|
||||
|
@ -107,7 +107,7 @@ class BaseModel {
|
||||
}
|
||||
return output;
|
||||
} else {
|
||||
model = Object.assign({}, model);
|
||||
model = { ...model };
|
||||
model.type_ = this.modelType();
|
||||
return model;
|
||||
}
|
||||
@ -234,7 +234,7 @@ class BaseModel {
|
||||
if (!options) {
|
||||
options = {};
|
||||
} else {
|
||||
options = Object.assign({}, options);
|
||||
options = { ...options };
|
||||
}
|
||||
if (!('isNew' in options)) options.isNew = 'auto';
|
||||
if (!('autoTimestamp' in options)) options.autoTimestamp = true;
|
||||
@ -509,7 +509,7 @@ class BaseModel {
|
||||
query = Database.insertQuery(this.tableName(), o);
|
||||
} else {
|
||||
const where = { id: o.id };
|
||||
const temp = Object.assign({}, o);
|
||||
const temp = { ...o };
|
||||
delete temp.id;
|
||||
|
||||
query = Database.updateQuery(this.tableName(), temp, where);
|
||||
@ -578,7 +578,7 @@ class BaseModel {
|
||||
try {
|
||||
await this.db().transactionExecBatch(queries);
|
||||
|
||||
o = Object.assign({}, o);
|
||||
o = { ...o };
|
||||
if (modelId) o.id = modelId;
|
||||
if ('updated_time' in saveQuery.modObject) o.updated_time = saveQuery.modObject.updated_time;
|
||||
if ('created_time' in saveQuery.modObject) o.created_time = saveQuery.modObject.created_time;
|
||||
@ -623,7 +623,7 @@ class BaseModel {
|
||||
public static filter(model: any) {
|
||||
if (!model) return model;
|
||||
|
||||
const output = Object.assign({}, model);
|
||||
const output = { ...model };
|
||||
for (const n in output) {
|
||||
if (!output.hasOwnProperty(n)) continue;
|
||||
|
||||
|
@ -119,16 +119,14 @@ export default class ClipperServer {
|
||||
|
||||
this.server_.on('request', async (request: any, response: any) => {
|
||||
const writeCorsHeaders = (code: any, contentType = 'application/json', additionalHeaders: any = null) => {
|
||||
const headers = Object.assign(
|
||||
{},
|
||||
{
|
||||
'Content-Type': contentType,
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS, PUT, PATCH, DELETE',
|
||||
'Access-Control-Allow-Headers': 'X-Requested-With,content-type',
|
||||
},
|
||||
additionalHeaders ? additionalHeaders : {}
|
||||
);
|
||||
const headers = {
|
||||
|
||||
'Content-Type': contentType,
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS, PUT, PATCH, DELETE',
|
||||
'Access-Control-Allow-Headers': 'X-Requested-With,content-type',
|
||||
...(additionalHeaders ? additionalHeaders : {}),
|
||||
};
|
||||
response.writeHead(code, headers);
|
||||
};
|
||||
|
||||
|
@ -388,7 +388,7 @@ export default class Synchronizer {
|
||||
|
||||
const synchronizationId = time.unixMs().toString();
|
||||
|
||||
const outputContext = Object.assign({}, lastContext);
|
||||
const outputContext = { ...lastContext };
|
||||
|
||||
this.progressReport_.startTime = time.unixMs();
|
||||
|
||||
@ -1036,7 +1036,7 @@ export default class Synchronizer {
|
||||
// the update will simply be skipped.
|
||||
if (!hasCancelled) {
|
||||
if (options.saveContextHandler) {
|
||||
const deltaToSave = Object.assign({}, listResult.context);
|
||||
const deltaToSave = { ...listResult.context };
|
||||
// Remove these two variables because they can be large and can be rebuilt
|
||||
// the next time the sync is started.
|
||||
delete deltaToSave.statsCache;
|
||||
|
@ -24,12 +24,12 @@ class WebDavApi {
|
||||
if (this.lastRequests_.length > 10) this.lastRequests_.splice(0, 1);
|
||||
|
||||
const serializeRequest = (r) => {
|
||||
const options = Object.assign({}, r.options);
|
||||
const options = { ...r.options };
|
||||
if (typeof options.body === 'string') options.body = options.body.substr(0, 4096);
|
||||
const output = [];
|
||||
output.push(options.method ? options.method : 'GET');
|
||||
output.push(r.url);
|
||||
options.headers = Object.assign({}, options.headers);
|
||||
options.headers = { ...options.headers };
|
||||
if (options.headers['Authorization']) options.headers['Authorization'] = '********';
|
||||
delete options.method;
|
||||
delete options.agent;
|
||||
@ -335,8 +335,8 @@ class WebDavApi {
|
||||
// </d:propfind>'
|
||||
|
||||
async exec(method, path = '', body = null, headers = null, options = null) {
|
||||
headers = Object.assign({}, headers);
|
||||
options = Object.assign({}, options);
|
||||
headers = { ...headers };
|
||||
options = { ...options };
|
||||
|
||||
if (!options.responseFormat) options.responseFormat = 'json';
|
||||
if (!options.target) options.target = 'string';
|
||||
|
@ -44,9 +44,9 @@ shared.checkSyncConfig = async function(comp, settings) {
|
||||
const syncTargetId = settings['sync.target'];
|
||||
const SyncTargetClass = SyncTargetRegistry.classById(syncTargetId);
|
||||
|
||||
const options = Object.assign({},
|
||||
Setting.subValues(`sync.${syncTargetId}`, settings),
|
||||
Setting.subValues('net', settings));
|
||||
const options = {
|
||||
...Setting.subValues(`sync.${syncTargetId}`, settings),
|
||||
...Setting.subValues('net', settings) };
|
||||
|
||||
comp.setState({ checkSyncConfigResult: 'checking' });
|
||||
const result = await SyncTargetClass.checkConfig(ObjectUtils.convertValuesToFunctions(options));
|
||||
@ -92,7 +92,7 @@ shared.updateSettingValue = function(comp, key, value, callback = null) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const settings = Object.assign({}, state.settings);
|
||||
const settings = { ...state.settings };
|
||||
const changedSettingKeys = state.changedSettingKeys.slice();
|
||||
settings[key] = Setting.formatValue(key, value);
|
||||
if (changedSettingKeys.indexOf(key) < 0) changedSettingKeys.push(key);
|
||||
|
@ -44,7 +44,7 @@ shared.handleNoteDeletedWhileEditing_ = async (note: NoteEntity) => {
|
||||
|
||||
reg.logger().info('Note has been deleted while it was being edited - recreating it.');
|
||||
|
||||
let newNote = Object.assign({}, note);
|
||||
let newNote = { ...note };
|
||||
delete newNote.id;
|
||||
newNote = await Note.save(newNote);
|
||||
|
||||
@ -52,13 +52,11 @@ shared.handleNoteDeletedWhileEditing_ = async (note: NoteEntity) => {
|
||||
};
|
||||
|
||||
shared.saveNoteButton_press = async function(comp: any, folderId: string = null, options: any = null) {
|
||||
options = Object.assign({}, {
|
||||
autoTitle: true,
|
||||
}, options);
|
||||
options = { autoTitle: true, ...options };
|
||||
|
||||
const releaseMutex = await saveNoteMutex_.acquire();
|
||||
|
||||
let note = Object.assign({}, comp.state.note);
|
||||
let note = { ...comp.state.note };
|
||||
|
||||
const recreatedNote = await shared.handleNoteDeletedWhileEditing_(note);
|
||||
if (recreatedNote) note = recreatedNote;
|
||||
@ -86,7 +84,7 @@ shared.saveNoteButton_press = async function(comp: any, folderId: string = null,
|
||||
if (saveOptions.fields && saveOptions.fields.indexOf('title') < 0) saveOptions.fields.push('title');
|
||||
}
|
||||
|
||||
const savedNote = 'fields' in saveOptions && !saveOptions.fields.length ? Object.assign({}, note) : await Note.save(note, saveOptions);
|
||||
const savedNote = 'fields' in saveOptions && !saveOptions.fields.length ? { ...note } : await Note.save(note, saveOptions);
|
||||
|
||||
const stateNote = comp.state.note;
|
||||
|
||||
@ -94,7 +92,7 @@ shared.saveNoteButton_press = async function(comp: any, folderId: string = null,
|
||||
if (!recreatedNote && (!stateNote || stateNote.id !== savedNote.id)) return releaseMutex();
|
||||
|
||||
// Re-assign any property that might have changed during saving (updated_time, etc.)
|
||||
note = Object.assign(note, savedNote);
|
||||
note = { ...note, ...savedNote };
|
||||
|
||||
if (stateNote.id === note.id) {
|
||||
// But we preserve the current title and body because
|
||||
@ -109,7 +107,7 @@ shared.saveNoteButton_press = async function(comp: any, folderId: string = null,
|
||||
}
|
||||
|
||||
const newState: any = {
|
||||
lastSavedNote: Object.assign({}, note),
|
||||
lastSavedNote: { ...note },
|
||||
note: note,
|
||||
};
|
||||
|
||||
@ -136,8 +134,8 @@ shared.saveNoteButton_press = async function(comp: any, folderId: string = null,
|
||||
altitude: geoNote.altitude,
|
||||
};
|
||||
|
||||
const modNote = Object.assign({}, stateNote, geoInfo);
|
||||
const modLastSavedNote = Object.assign({}, comp.state.lastSavedNote, geoInfo);
|
||||
const modNote = { ...stateNote, ...geoInfo };
|
||||
const modLastSavedNote = { ...comp.state.lastSavedNote, ...geoInfo };
|
||||
|
||||
comp.setState({ note: modNote, lastSavedNote: modLastSavedNote });
|
||||
};
|
||||
@ -150,7 +148,7 @@ shared.saveNoteButton_press = async function(comp: any, folderId: string = null,
|
||||
};
|
||||
|
||||
shared.saveOneProperty = async function(comp: any, name: string, value: any) {
|
||||
let note = Object.assign({}, comp.state.note);
|
||||
let note = { ...comp.state.note };
|
||||
|
||||
const recreatedNote = await shared.handleNoteDeletedWhileEditing_(note);
|
||||
if (recreatedNote) note = recreatedNote;
|
||||
@ -161,7 +159,7 @@ shared.saveOneProperty = async function(comp: any, name: string, value: any) {
|
||||
note[name] = toSave[name];
|
||||
|
||||
comp.setState({
|
||||
lastSavedNote: Object.assign({}, note),
|
||||
lastSavedNote: { ...note },
|
||||
note: note,
|
||||
});
|
||||
};
|
||||
@ -169,7 +167,7 @@ shared.saveOneProperty = async function(comp: any, name: string, value: any) {
|
||||
shared.noteComponent_change = function(comp: any, propName: string, propValue: any) {
|
||||
const newState: any = {};
|
||||
|
||||
const note = Object.assign({}, comp.state.note);
|
||||
const note = { ...comp.state.note };
|
||||
note[propName] = propValue;
|
||||
newState.note = note;
|
||||
|
||||
@ -231,7 +229,7 @@ shared.initState = async function(comp: any) {
|
||||
const folder = Folder.byId(comp.props.folders, note.parent_id);
|
||||
|
||||
comp.setState({
|
||||
lastSavedNote: Object.assign({}, note),
|
||||
lastSavedNote: { ...note },
|
||||
note: note,
|
||||
mode: mode,
|
||||
folder: folder,
|
||||
|
@ -57,7 +57,7 @@ export default class FileApiDriverMemory {
|
||||
|
||||
public stat(path: string) {
|
||||
const item = this.itemByPath(path);
|
||||
return Promise.resolve(item ? Object.assign({}, item) : null);
|
||||
return Promise.resolve(item ? { ...item } : null);
|
||||
}
|
||||
|
||||
public async setTimestamp(path: string, timestampMs: number): Promise<any> {
|
||||
@ -75,7 +75,7 @@ export default class FileApiDriverMemory {
|
||||
if (item.path.indexOf(`${path}/`) === 0) {
|
||||
const s = item.path.substr(path.length + 1);
|
||||
if (s.split('/').length === 1) {
|
||||
const it = Object.assign({}, item);
|
||||
const it = { ...item };
|
||||
it.path = it.path.substr(path.length + 1);
|
||||
output.push(it);
|
||||
}
|
||||
@ -155,7 +155,7 @@ export default class FileApiDriverMemory {
|
||||
public async delete(path: string) {
|
||||
const index = this.itemIndexByPath(path);
|
||||
if (index >= 0) {
|
||||
const item = Object.assign({}, this.items_[index]);
|
||||
const item = { ...this.items_[index] };
|
||||
item.isDeleted = true;
|
||||
item.updated_time = time.unixMs();
|
||||
this.deletedItems_.push(item);
|
||||
@ -178,7 +178,7 @@ export default class FileApiDriverMemory {
|
||||
const getStatFn = async (path: string) => {
|
||||
const output = this.items_.slice();
|
||||
for (let i = 0; i < output.length; i++) {
|
||||
const item = Object.assign({}, output[i]);
|
||||
const item = { ...output[i] };
|
||||
item.path = item.path.substr(path.length + 1);
|
||||
output[i] = item;
|
||||
}
|
||||
|
@ -80,11 +80,9 @@ class FileApiDriverOneDrive {
|
||||
}
|
||||
|
||||
async list(path, options = null) {
|
||||
options = Object.assign({}, {
|
||||
context: null,
|
||||
}, options);
|
||||
options = { context: null, ...options };
|
||||
|
||||
let query = Object.assign({}, this.itemFilter_(), { '$top': 1000 });
|
||||
let query = { ...this.itemFilter_(), '$top': 1000 };
|
||||
let url = `${this.makePath_(path)}:/children`;
|
||||
|
||||
if (options.context) {
|
||||
|
@ -6,19 +6,17 @@ class FoldersScreenUtils {
|
||||
static async allForDisplay(options = {}) {
|
||||
const orderDir = Setting.value('folders.sortOrder.reverse') ? 'DESC' : 'ASC';
|
||||
|
||||
const folderOptions = Object.assign(
|
||||
{},
|
||||
{
|
||||
caseInsensitive: true,
|
||||
order: [
|
||||
{
|
||||
by: 'title',
|
||||
dir: orderDir,
|
||||
},
|
||||
],
|
||||
},
|
||||
options
|
||||
);
|
||||
const folderOptions = {
|
||||
|
||||
caseInsensitive: true,
|
||||
order: [
|
||||
{
|
||||
by: 'title',
|
||||
dir: orderDir,
|
||||
},
|
||||
],
|
||||
...options,
|
||||
};
|
||||
|
||||
let folders = await Folder.all(folderOptions);
|
||||
|
||||
|
@ -103,7 +103,7 @@ function enexXmlToHtml_(stream, resources) {
|
||||
for (let i = 0; i < remainingResources.length; i++) {
|
||||
const r = remainingResources[i];
|
||||
if (!r.id) {
|
||||
resource = Object.assign({}, r);
|
||||
resource = { ...r };
|
||||
resource.id = hash;
|
||||
remainingResources.splice(i, 1);
|
||||
found = true;
|
||||
|
@ -884,7 +884,7 @@ function enexXmlToMdArray(stream: any, resources: ResourceEntity[]): Promise<Ene
|
||||
for (let i = 0; i < remainingResources.length; i++) {
|
||||
const r = remainingResources[i];
|
||||
if (!r.id) {
|
||||
resource = Object.assign({}, r);
|
||||
resource = { ...r };
|
||||
resource.id = hash;
|
||||
remainingResources.splice(i, 1);
|
||||
found = true;
|
||||
|
@ -175,7 +175,7 @@ async function processNoteResource(resource: ExtractedResource) {
|
||||
}
|
||||
|
||||
if (!resource.id || !resource.size) {
|
||||
const debugTemp = Object.assign({}, resource);
|
||||
const debugTemp = { ...resource };
|
||||
debugTemp.data = debugTemp.data ? `${debugTemp.data.substr(0, 32)}...` : debugTemp.data;
|
||||
throw new Error(`This resource was not added because it has no ID or no content: ${JSON.stringify(debugTemp)}`);
|
||||
}
|
||||
@ -189,7 +189,7 @@ async function saveNoteResources(note: ExtractedNote) {
|
||||
for (let i = 0; i < note.resources.length; i++) {
|
||||
const resource = note.resources[i];
|
||||
|
||||
const toSave = Object.assign({}, resource);
|
||||
const toSave = { ...resource };
|
||||
delete toSave.dataFilePath;
|
||||
delete toSave.dataEncoding;
|
||||
delete toSave.hasData;
|
||||
@ -230,9 +230,7 @@ interface ImportOptions {
|
||||
}
|
||||
|
||||
async function saveNoteToStorage(note: ExtractedNote, importOptions: ImportOptions) {
|
||||
importOptions = Object.assign({}, {
|
||||
fuzzyMatching: false,
|
||||
}, importOptions);
|
||||
importOptions = { fuzzyMatching: false, ...importOptions };
|
||||
|
||||
note = Note.filter(note as any);
|
||||
|
||||
|
@ -559,7 +559,7 @@ function localeStrings(canonicalName: string) {
|
||||
|
||||
if (loadedLocales_[locale]) return loadedLocales_[locale];
|
||||
|
||||
loadedLocales_[locale] = Object.assign({}, supportedLocales_[locale]);
|
||||
loadedLocales_[locale] = { ...supportedLocales_[locale] };
|
||||
|
||||
return loadedLocales_[locale];
|
||||
}
|
||||
|
@ -40,25 +40,23 @@ markJsUtils.markKeyword = (mark, keyword, stringUtils, extraOptions = null) => {
|
||||
|
||||
mark.mark(
|
||||
[value],
|
||||
Object.assign(
|
||||
{},
|
||||
{
|
||||
accuracy: accuracy,
|
||||
filter: (node, _term, _totalCounter, _counter) => {
|
||||
// We exclude SVG because it creates a "<mark>" tag inside
|
||||
// the document, which is not a valid SVG tag. As a result
|
||||
// the content within that tag disappears.
|
||||
//
|
||||
// mark.js has an "exclude" parameter, but it doesn't work
|
||||
// so we use "filter" instead.
|
||||
//
|
||||
// https://github.com/joplin/plugin-abc-sheet-music
|
||||
if (isInsideContainer(node, 'SVG')) return false;
|
||||
return true;
|
||||
},
|
||||
{
|
||||
|
||||
accuracy: accuracy,
|
||||
filter: (node, _term, _totalCounter, _counter) => {
|
||||
// We exclude SVG because it creates a "<mark>" tag inside
|
||||
// the document, which is not a valid SVG tag. As a result
|
||||
// the content within that tag disappears.
|
||||
//
|
||||
// mark.js has an "exclude" parameter, but it doesn't work
|
||||
// so we use "filter" instead.
|
||||
//
|
||||
// https://github.com/joplin/plugin-abc-sheet-music
|
||||
if (isInsideContainer(node, 'SVG')) return false;
|
||||
return true;
|
||||
},
|
||||
extraOptions
|
||||
)
|
||||
...extraOptions,
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -48,13 +48,11 @@ export class MarkupLanguageUtils {
|
||||
pluginOptions[n] = { enabled: subValues[n] };
|
||||
}
|
||||
|
||||
options = Object.assign({
|
||||
ResourceModel: Resource,
|
||||
options = { ResourceModel: Resource,
|
||||
pluginOptions: pluginOptions,
|
||||
tempDir: Setting.value('tempDir'),
|
||||
fsDriver: shim.fsDriver(),
|
||||
isSafeMode: Setting.value('isSafeMode'),
|
||||
}, options);
|
||||
isSafeMode: Setting.value('isSafeMode'), ...options };
|
||||
|
||||
return new MarkupToHtml(options);
|
||||
}
|
||||
|
@ -44,9 +44,7 @@ export default class Folder extends BaseItem {
|
||||
}
|
||||
|
||||
public static noteIds(parentId: string, options: any = null) {
|
||||
options = Object.assign({}, {
|
||||
includeConflicts: false,
|
||||
}, options);
|
||||
options = { includeConflicts: false, ...options };
|
||||
|
||||
const where = ['parent_id = ?'];
|
||||
if (!options.includeConflicts) {
|
||||
@ -619,7 +617,7 @@ export default class Folder extends BaseItem {
|
||||
public static buildTree(folders: FolderEntity[]): FolderEntityWithChildren[] {
|
||||
const idToFolders: Record<string, any> = {};
|
||||
for (let i = 0; i < folders.length; i++) {
|
||||
idToFolders[folders[i].id] = Object.assign({}, folders[i]);
|
||||
idToFolders[folders[i].id] = { ...folders[i] };
|
||||
idToFolders[folders[i].id].children = [];
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ export default class Note extends BaseItem {
|
||||
}
|
||||
|
||||
public static minimalSerializeForDisplay(note: NoteEntity) {
|
||||
const n = Object.assign({}, note);
|
||||
const n = { ...note };
|
||||
|
||||
const fieldNames = this.fieldNames();
|
||||
|
||||
@ -146,9 +146,7 @@ export default class Note extends BaseItem {
|
||||
}
|
||||
|
||||
public static async replaceResourceInternalToExternalLinks(body: string, options: any = null) {
|
||||
options = Object.assign({}, {
|
||||
useAbsolutePaths: false,
|
||||
}, options);
|
||||
options = { useAbsolutePaths: false, ...options };
|
||||
|
||||
// this.logger().debug('replaceResourceInternalToExternalLinks', 'options:', options, 'body:', body);
|
||||
|
||||
@ -176,9 +174,7 @@ export default class Note extends BaseItem {
|
||||
}
|
||||
|
||||
public static async replaceResourceExternalToInternalLinks(body: string, options: any = null) {
|
||||
options = Object.assign({}, {
|
||||
useAbsolutePaths: false,
|
||||
}, options);
|
||||
options = { useAbsolutePaths: false, ...options };
|
||||
|
||||
const resourceDir = toForwardSlashes(Setting.value('resourceDir'));
|
||||
|
||||
@ -313,9 +309,7 @@ export default class Note extends BaseItem {
|
||||
}
|
||||
|
||||
public static previewFields(options: any = null) {
|
||||
options = Object.assign({
|
||||
includeTimestamps: true,
|
||||
}, options);
|
||||
options = { includeTimestamps: true, ...options };
|
||||
|
||||
const output = ['id', 'title', 'is_todo', 'todo_completed', 'todo_due', 'parent_id', 'encryption_applied', 'order', 'markup_language', 'is_conflict', 'is_shared'];
|
||||
|
||||
@ -400,7 +394,7 @@ export default class Note extends BaseItem {
|
||||
let cond = options.conditions.slice();
|
||||
cond.push('is_todo = 1');
|
||||
cond.push('(todo_completed <= 0 OR todo_completed IS NULL)');
|
||||
let tempOptions = Object.assign({}, options);
|
||||
let tempOptions = { ...options };
|
||||
tempOptions.conditions = cond;
|
||||
|
||||
const uncompletedTodos = await this.search(tempOptions);
|
||||
@ -413,7 +407,7 @@ export default class Note extends BaseItem {
|
||||
cond.push('(is_todo = 1 AND todo_completed > 0)');
|
||||
}
|
||||
|
||||
tempOptions = Object.assign({}, options);
|
||||
tempOptions = { ...options };
|
||||
tempOptions.conditions = cond;
|
||||
if ('limit' in tempOptions) tempOptions.limit -= uncompletedTodos.length;
|
||||
const theRest = await this.search(tempOptions);
|
||||
@ -485,7 +479,7 @@ export default class Note extends BaseItem {
|
||||
|
||||
let geoData = null;
|
||||
if (this.geolocationCache_ && this.geolocationCache_.timestamp + 1000 * 60 * 10 > time.unixMs()) {
|
||||
geoData = Object.assign({}, this.geolocationCache_);
|
||||
geoData = { ...this.geolocationCache_ };
|
||||
} else {
|
||||
this.geolocationUpdating_ = true;
|
||||
|
||||
@ -564,7 +558,7 @@ export default class Note extends BaseItem {
|
||||
|
||||
if (Number(note.is_todo) === newIsTodo) return note;
|
||||
|
||||
const output = Object.assign({}, note);
|
||||
const output = { ...note };
|
||||
output.is_todo = newIsTodo;
|
||||
output.todo_due = 0;
|
||||
output.todo_completed = 0;
|
||||
@ -579,7 +573,7 @@ export default class Note extends BaseItem {
|
||||
public static toggleTodoCompleted(note: NoteEntity) {
|
||||
if (!('todo_completed' in note)) throw new Error('Missing "todo_completed" property');
|
||||
|
||||
note = Object.assign({}, note);
|
||||
note = { ...note };
|
||||
if (note.todo_completed) {
|
||||
note.todo_completed = 0;
|
||||
} else {
|
||||
@ -627,7 +621,7 @@ export default class Note extends BaseItem {
|
||||
const originalNote: NoteEntity = await Note.load(noteId);
|
||||
if (!originalNote) throw new Error(`Unknown note: ${noteId}`);
|
||||
|
||||
const newNote = Object.assign({}, originalNote);
|
||||
const newNote = { ...originalNote };
|
||||
const fieldsToReset = ['id', 'created_time', 'updated_time', 'user_created_time', 'user_updated_time'];
|
||||
|
||||
for (const field of fieldsToReset) {
|
||||
@ -825,11 +819,9 @@ export default class Note extends BaseItem {
|
||||
// Update the note "order" field without changing the user timestamps,
|
||||
// which is generally what we want.
|
||||
private static async updateNoteOrder_(note: NoteEntity, order: any) {
|
||||
return Note.save(Object.assign({}, note, {
|
||||
order: order,
|
||||
return Note.save({ ...note, order: order,
|
||||
user_updated_time: note.user_updated_time,
|
||||
updated_time: time.unixMs(),
|
||||
}), { autoTimestamp: false, dispatchUpdateAction: false });
|
||||
updated_time: time.unixMs() }, { autoTimestamp: false, dispatchUpdateAction: false });
|
||||
}
|
||||
|
||||
// This method will disable the NOTE_UPDATE_ONE action to prevent a lot
|
||||
@ -957,7 +949,7 @@ export default class Note extends BaseItem {
|
||||
if (n.order <= previousOrder) {
|
||||
const o = previousOrder + defaultIntevalBetweeNotes;
|
||||
const updatedNote = await this.updateNoteOrder_(n, o);
|
||||
notes[i] = Object.assign({}, n, updatedNote);
|
||||
notes[i] = { ...n, ...updatedNote };
|
||||
previousOrder = o;
|
||||
} else {
|
||||
previousOrder = n.order;
|
||||
@ -1003,7 +995,7 @@ export default class Note extends BaseItem {
|
||||
|
||||
|
||||
public static async createConflictNote(sourceNote: NoteEntity, changeSource: number): Promise<NoteEntity> {
|
||||
const conflictNote = Object.assign({}, sourceNote);
|
||||
const conflictNote = { ...sourceNote };
|
||||
delete conflictNote.id;
|
||||
conflictNote.is_conflict = 1;
|
||||
conflictNote.conflict_original_id = sourceNote.id;
|
||||
|
@ -157,7 +157,7 @@ export default class Resource extends BaseItem {
|
||||
public static async decrypt(item: ResourceEntity) {
|
||||
// The item might already be decrypted but not the blob (for instance if it crashes while
|
||||
// decrypting the blob or was otherwise interrupted).
|
||||
const decryptedItem = item.encryption_cipher_text ? await super.decrypt(item) : Object.assign({}, item);
|
||||
const decryptedItem = item.encryption_cipher_text ? await super.decrypt(item) : { ...item };
|
||||
if (!decryptedItem.encryption_blob_encrypted) return decryptedItem;
|
||||
|
||||
const localState = await this.localState(item);
|
||||
@ -225,7 +225,7 @@ export default class Resource extends BaseItem {
|
||||
throw error;
|
||||
}
|
||||
|
||||
const resourceCopy = Object.assign({}, resource);
|
||||
const resourceCopy = { ...resource };
|
||||
resourceCopy.encryption_blob_encrypted = 1;
|
||||
return { path: encryptedPath, resource: resourceCopy };
|
||||
}
|
||||
@ -273,7 +273,7 @@ export default class Resource extends BaseItem {
|
||||
|
||||
public static async setLocalState(resourceOrId: any, state: ResourceLocalStateEntity) {
|
||||
const id = typeof resourceOrId === 'object' ? resourceOrId.id : resourceOrId;
|
||||
await ResourceLocalState.save(Object.assign({}, state, { resource_id: id }));
|
||||
await ResourceLocalState.save({ ...state, resource_id: id });
|
||||
}
|
||||
|
||||
public static async needFileSizeSet() {
|
||||
|
@ -33,7 +33,7 @@ export default class ResourceLocalState extends BaseModel {
|
||||
}
|
||||
|
||||
public static batchDelete(ids: string[], options: any = null) {
|
||||
options = options ? Object.assign({}, options) : {};
|
||||
options = options ? { ...options } : {};
|
||||
options.idFieldName = 'resource_id';
|
||||
return super.batchDelete(ids, options);
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ export default class Revision extends BaseItem {
|
||||
|
||||
public static applyObjectPatch(object: any, patch: string) {
|
||||
const parsedPatch: ObjectPatch = JSON.parse(this.sanitizeObjectPatch(patch));
|
||||
const output = Object.assign({}, object);
|
||||
const output = { ...object };
|
||||
|
||||
for (const k in parsedPatch.new) {
|
||||
output[k] = parsedPatch.new[k];
|
||||
|
@ -1700,7 +1700,7 @@ class Setting extends BaseModel {
|
||||
|
||||
this.metadata_ = { ...this.buildInMetadata_ };
|
||||
|
||||
this.metadata_ = Object.assign(this.metadata_, this.customMetadata_);
|
||||
this.metadata_ = { ...this.metadata_, ...this.customMetadata_ };
|
||||
|
||||
if (this.constants_.env === Env.Dev) this.validateMetadata(this.metadata_);
|
||||
|
||||
@ -1819,7 +1819,7 @@ class Setting extends BaseModel {
|
||||
public static settingMetadata(key: string): SettingItem {
|
||||
const metadata = this.metadata();
|
||||
if (!(key in metadata)) throw new JoplinError(`Unknown key: ${key}`, 'unknown_key');
|
||||
const output = Object.assign({}, metadata[key]);
|
||||
const output = { ...metadata[key] };
|
||||
output.key = key;
|
||||
return output;
|
||||
}
|
||||
@ -1849,9 +1849,7 @@ class Setting extends BaseModel {
|
||||
}
|
||||
|
||||
public static keys(publicOnly: boolean = false, appType: AppType = null, options: KeysOptions = null) {
|
||||
options = Object.assign({}, {
|
||||
secureOnly: false,
|
||||
}, options);
|
||||
options = { secureOnly: false, ...options };
|
||||
|
||||
if (!this.keys_) {
|
||||
const metadata = this.metadata();
|
||||
@ -2209,7 +2207,7 @@ class Setting extends BaseModel {
|
||||
function copyIfNeeded(value: any) {
|
||||
if (value === null || value === undefined) return value;
|
||||
if (Array.isArray(value)) return value.slice();
|
||||
if (typeof value === 'object') return Object.assign({}, value);
|
||||
if (typeof value === 'object') return { ...value };
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -2317,7 +2315,7 @@ class Setting extends BaseModel {
|
||||
queries.push(`DELETE FROM settings WHERE key IN ("${keys.join('","')}")`);
|
||||
|
||||
for (let i = 0; i < this.cache_.length; i++) {
|
||||
const s = Object.assign({}, this.cache_[i]);
|
||||
const s = { ...this.cache_[i] };
|
||||
const valueAsString = this.valueToString(s.key, s.value);
|
||||
|
||||
if (this.isSecureKey(s.key)) {
|
||||
@ -2441,7 +2439,7 @@ class Setting extends BaseModel {
|
||||
const output: any = {};
|
||||
for (const key in metadata) {
|
||||
if (!metadata.hasOwnProperty(key)) continue;
|
||||
const s = Object.assign({}, metadata[key]);
|
||||
const s = { ...metadata[key] };
|
||||
if (!s.public) continue;
|
||||
if (s.appTypes && s.appTypes.indexOf(appType) < 0) continue;
|
||||
s.value = this.value(key);
|
||||
|
@ -32,9 +32,7 @@ export default class Tag extends BaseItem {
|
||||
|
||||
return Note.previews(
|
||||
null,
|
||||
Object.assign({}, options, {
|
||||
conditions: [`id IN ("${noteIds.join('","')}")`],
|
||||
})
|
||||
{ ...options, conditions: [`id IN ("${noteIds.join('","')}")`] }
|
||||
);
|
||||
}
|
||||
|
||||
@ -191,10 +189,8 @@ export default class Tag extends BaseItem {
|
||||
}
|
||||
|
||||
public static async save(o: TagEntity, options: any = null) {
|
||||
options = Object.assign({}, {
|
||||
dispatchUpdateAction: true,
|
||||
userSideValidation: false,
|
||||
}, options);
|
||||
options = { dispatchUpdateAction: true,
|
||||
userSideValidation: false, ...options };
|
||||
|
||||
if (options.userSideValidation) {
|
||||
if ('title' in o) {
|
||||
|
@ -141,7 +141,7 @@ export default class OneDriveApi {
|
||||
}
|
||||
|
||||
public async uploadChunk(url: string, handle: any, buffer: any, options: any) {
|
||||
options = Object.assign({}, options);
|
||||
options = { ...options };
|
||||
if (!options.method) { options.method = 'POST'; }
|
||||
|
||||
if (!options.contentLength) throw new Error('uploadChunk: contentLength is missing');
|
||||
|
@ -421,7 +421,7 @@ function updateOneItem(draft: Draft<State>, action: any, keyName: string = '') {
|
||||
for (let i = 0; i < newItems.length; i++) {
|
||||
const n = newItems[i];
|
||||
if (n.id === item.id) {
|
||||
newItems[i] = Object.assign({}, newItems[i], item);
|
||||
newItems[i] = { ...newItems[i], ...item };
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@ -474,11 +474,11 @@ function changeSelectedFolder(draft: Draft<State>, action: any, options: any = n
|
||||
}
|
||||
|
||||
function recordLastSelectedNoteIds(draft: Draft<State>, noteIds: string[]) {
|
||||
const newOnes: any = Object.assign({}, draft.lastSelectedNotesIds);
|
||||
const newOnes: any = { ...draft.lastSelectedNotesIds };
|
||||
const parent = stateUtils.parentItem(draft);
|
||||
if (!parent) return;
|
||||
|
||||
newOnes[parent.type] = Object.assign({}, newOnes[parent.type]);
|
||||
newOnes[parent.type] = { ...newOnes[parent.type] };
|
||||
newOnes[parent.type][parent.id] = noteIds.slice();
|
||||
|
||||
draft.lastSelectedNotesIds = newOnes;
|
||||
@ -583,8 +583,8 @@ function handleHistory(draft: Draft<State>, action: any) {
|
||||
draft.forwardHistoryNotes = draft.forwardHistoryNotes.concat(currentNote).slice(-MAX_HISTORY);
|
||||
}
|
||||
|
||||
changeSelectedFolder(draft, Object.assign({}, action, { type: 'FOLDER_SELECT', folderId: note.parent_id }));
|
||||
changeSelectedNotes(draft, Object.assign({}, action, { type: 'NOTE_SELECT', noteId: note.id }));
|
||||
changeSelectedFolder(draft, { ...action, type: 'FOLDER_SELECT', folderId: note.parent_id });
|
||||
changeSelectedNotes(draft, { ...action, type: 'NOTE_SELECT', noteId: note.id });
|
||||
|
||||
const ctx = draft.backwardHistoryNotes[draft.backwardHistoryNotes.length - 1];
|
||||
Object.assign(draft, getContextFromHistory(ctx));
|
||||
@ -599,8 +599,8 @@ function handleHistory(draft: Draft<State>, action: any) {
|
||||
draft.backwardHistoryNotes = draft.backwardHistoryNotes.concat(currentNote).slice(-MAX_HISTORY);
|
||||
}
|
||||
|
||||
changeSelectedFolder(draft, Object.assign({}, action, { type: 'FOLDER_SELECT', folderId: note.parent_id }));
|
||||
changeSelectedNotes(draft, Object.assign({}, action, { type: 'NOTE_SELECT', noteId: note.id }));
|
||||
changeSelectedFolder(draft, { ...action, type: 'FOLDER_SELECT', folderId: note.parent_id });
|
||||
changeSelectedNotes(draft, { ...action, type: 'NOTE_SELECT', noteId: note.id });
|
||||
|
||||
const ctx = draft.forwardHistoryNotes[draft.forwardHistoryNotes.length - 1];
|
||||
Object.assign(draft, getContextFromHistory(ctx));
|
||||
@ -633,14 +633,14 @@ function handleHistory(draft: Draft<State>, action: any) {
|
||||
|
||||
draft.backwardHistoryNotes = draft.backwardHistoryNotes.map(note => {
|
||||
if (note.id === modNote.id) {
|
||||
return Object.assign({}, note, { parent_id: modNote.parent_id, selectedFolderId: modNote.parent_id });
|
||||
return { ...note, parent_id: modNote.parent_id, selectedFolderId: modNote.parent_id };
|
||||
}
|
||||
return note;
|
||||
});
|
||||
|
||||
draft.forwardHistoryNotes = draft.forwardHistoryNotes.map(note => {
|
||||
if (note.id === modNote.id) {
|
||||
return Object.assign({}, note, { parent_id: modNote.parent_id, selectedFolderId: modNote.parent_id });
|
||||
return { ...note, parent_id: modNote.parent_id, selectedFolderId: modNote.parent_id };
|
||||
}
|
||||
return note;
|
||||
});
|
||||
@ -763,7 +763,7 @@ const reducer = produce((draft: Draft<State> = defaultState, action: any) => {
|
||||
case 'FOLDER_AND_NOTE_SELECT':
|
||||
{
|
||||
changeSelectedFolder(draft, action);
|
||||
const noteSelectAction = Object.assign({}, action, { type: 'NOTE_SELECT' });
|
||||
const noteSelectAction = { ...action, type: 'NOTE_SELECT' };
|
||||
changeSelectedNotes(draft, noteSelectAction);
|
||||
}
|
||||
break;
|
||||
@ -774,7 +774,7 @@ const reducer = produce((draft: Draft<State> = defaultState, action: any) => {
|
||||
|
||||
case 'SETTING_UPDATE_ONE':
|
||||
{
|
||||
const newSettings = Object.assign({}, draft.settings);
|
||||
const newSettings = { ...draft.settings };
|
||||
newSettings[action.key] = action.value;
|
||||
draft.settings = newSettings;
|
||||
}
|
||||
@ -827,7 +827,7 @@ const reducer = produce((draft: Draft<State> = defaultState, action: any) => {
|
||||
// Note is still in the same folder
|
||||
// Merge the properties that have changed (in modNote) into
|
||||
// the object we already have.
|
||||
newNotes[i] = Object.assign({}, newNotes[i]);
|
||||
newNotes[i] = { ...newNotes[i] };
|
||||
|
||||
for (const n in modNote) {
|
||||
if (!modNote.hasOwnProperty(n)) continue;
|
||||
@ -918,9 +918,9 @@ const reducer = produce((draft: Draft<State> = defaultState, action: any) => {
|
||||
|
||||
case 'FOLDER_TOGGLE':
|
||||
if (draft.collapsedFolderIds.indexOf(action.id) >= 0) {
|
||||
folderSetCollapsed(draft, Object.assign({ collapsed: false }, action));
|
||||
folderSetCollapsed(draft, { collapsed: false, ...action });
|
||||
} else {
|
||||
folderSetCollapsed(draft, Object.assign({ collapsed: true }, action));
|
||||
folderSetCollapsed(draft, { collapsed: true, ...action });
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1054,7 +1054,7 @@ const reducer = produce((draft: Draft<State> = defaultState, action: any) => {
|
||||
let found = false;
|
||||
for (let i = 0; i < searches.length; i++) {
|
||||
if (searches[i].id === action.search.id) {
|
||||
searches[i] = Object.assign({}, action.search);
|
||||
searches[i] = { ...action.search };
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@ -1102,7 +1102,7 @@ const reducer = produce((draft: Draft<State> = defaultState, action: any) => {
|
||||
|
||||
case 'CLIPPER_SERVER_SET':
|
||||
{
|
||||
const clipperServer = Object.assign({}, draft.clipperServer);
|
||||
const clipperServer = { ...draft.clipperServer };
|
||||
if ('startState' in action) clipperServer.startState = action.startState;
|
||||
if ('port' in action) clipperServer.port = action.port;
|
||||
draft.clipperServer = clipperServer;
|
||||
@ -1111,7 +1111,7 @@ const reducer = produce((draft: Draft<State> = defaultState, action: any) => {
|
||||
|
||||
case 'DECRYPTION_WORKER_SET':
|
||||
{
|
||||
const decryptionWorker = Object.assign({}, draft.decryptionWorker);
|
||||
const decryptionWorker = { ...draft.decryptionWorker };
|
||||
for (const n in action) {
|
||||
if (!action.hasOwnProperty(n) || n === 'type') continue;
|
||||
(decryptionWorker as any)[n] = action[n];
|
||||
@ -1122,7 +1122,7 @@ const reducer = produce((draft: Draft<State> = defaultState, action: any) => {
|
||||
|
||||
case 'RESOURCE_FETCHER_SET':
|
||||
{
|
||||
const rf = Object.assign({}, action);
|
||||
const rf = { ...action };
|
||||
delete rf.type;
|
||||
draft.resourceFetcher = rf;
|
||||
}
|
||||
@ -1141,8 +1141,8 @@ const reducer = produce((draft: Draft<State> = defaultState, action: any) => {
|
||||
case 'PLUGINLEGACY_DIALOG_SET':
|
||||
{
|
||||
if (!action.pluginName) throw new Error('action.pluginName not specified');
|
||||
const newPluginsLegacy = Object.assign({}, draft.pluginsLegacy);
|
||||
const newPlugin = draft.pluginsLegacy[action.pluginName] ? Object.assign({}, draft.pluginsLegacy[action.pluginName]) : {};
|
||||
const newPluginsLegacy = { ...draft.pluginsLegacy };
|
||||
const newPlugin = draft.pluginsLegacy[action.pluginName] ? { ...draft.pluginsLegacy[action.pluginName] } : {};
|
||||
if ('open' in action) newPlugin.dialogOpen = action.open;
|
||||
if ('userData' in action) newPlugin.userData = action.userData;
|
||||
newPluginsLegacy[action.pluginName] = newPlugin;
|
||||
|
@ -154,7 +154,7 @@ class Registry {
|
||||
|
||||
try {
|
||||
this.logger().info('Starting scheduled sync');
|
||||
const options = Object.assign({}, syncOptions, { context: context });
|
||||
const options = { ...syncOptions, context: context };
|
||||
if (!options.saveContextHandler) {
|
||||
options.saveContextHandler = (newContext: any) => {
|
||||
Setting.setValue(contextKey, JSON.stringify(newContext));
|
||||
|
@ -177,7 +177,7 @@ export default class AlarmServiceDriverNode {
|
||||
}, interval);
|
||||
}
|
||||
|
||||
this.notifications_[notification.id] = Object.assign({}, notification);
|
||||
this.notifications_[notification.id] = { ...notification };
|
||||
this.notifications_[notification.id].timeoutId = timeoutId;
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ export default class CommandService extends BaseService {
|
||||
|
||||
const command = this.commandByName(commandName);
|
||||
|
||||
runtime = Object.assign({}, runtime);
|
||||
runtime = { ...runtime };
|
||||
if (!runtime.enabledCondition) runtime.enabledCondition = 'true';
|
||||
command.runtime = runtime;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ export default class DecryptionWorker {
|
||||
}
|
||||
|
||||
public dispatchReport(report: any) {
|
||||
const action = Object.assign({}, report);
|
||||
const action = { ...report };
|
||||
action.type = 'DECRYPTION_WORKER_SET';
|
||||
this.dispatch(action);
|
||||
}
|
||||
@ -280,7 +280,7 @@ export default class DecryptionWorker {
|
||||
error: null,
|
||||
};
|
||||
|
||||
this.dispatchReport(Object.assign({}, finalReport, { state: 'idle' }));
|
||||
this.dispatchReport({ ...finalReport, state: 'idle' });
|
||||
|
||||
if (downloadedButEncryptedBlobCount) {
|
||||
this.logger().info(`DecryptionWorker: Some resources have been downloaded but are not decrypted yet. Scheduling another decryption. Resource count: ${downloadedButEncryptedBlobCount}`);
|
||||
|
@ -65,7 +65,7 @@ class PluginManager {
|
||||
|
||||
return {
|
||||
Dialog: Class.Dialog,
|
||||
props: Object.assign({}, this.dialogProps_(name), { userData: p.userData }),
|
||||
props: { ...this.dialogProps_(name), userData: p.userData },
|
||||
};
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ class PluginManager {
|
||||
if (!menuItems) continue;
|
||||
|
||||
for (let i = 0; i < menuItems.length; i++) {
|
||||
const item = Object.assign({}, menuItems[i]);
|
||||
const item = { ...menuItems[i] };
|
||||
|
||||
item.click = () => {
|
||||
this.onPluginMenuItemTrigger_({
|
||||
|
@ -224,13 +224,11 @@ export default class RevisionService extends BaseService {
|
||||
const rev = revisions[index];
|
||||
const merged = await Revision.mergeDiffs(rev, revisions);
|
||||
|
||||
const output: NoteEntity = Object.assign(
|
||||
{
|
||||
title: merged.title,
|
||||
body: merged.body,
|
||||
},
|
||||
merged.metadata
|
||||
);
|
||||
const output: NoteEntity = {
|
||||
title: merged.title,
|
||||
body: merged.body,
|
||||
...merged.metadata,
|
||||
};
|
||||
output.updated_time = output.user_updated_time;
|
||||
output.created_time = output.user_created_time;
|
||||
(output as any).type_ = BaseModel.TYPE_NOTE;
|
||||
@ -268,7 +266,7 @@ export default class RevisionService extends BaseService {
|
||||
}
|
||||
|
||||
public async importRevisionNote(note: NoteEntity): Promise<NoteEntity> {
|
||||
const toImport = Object.assign({}, note);
|
||||
const toImport = { ...note };
|
||||
delete toImport.id;
|
||||
delete toImport.updated_time;
|
||||
delete toImport.created_time;
|
||||
|
@ -237,9 +237,7 @@ export default class EncryptionService {
|
||||
}
|
||||
|
||||
private async generateMasterKeyContent_(password: string, options: EncryptOptions = null) {
|
||||
options = Object.assign({}, {
|
||||
encryptionMethod: this.defaultMasterKeyEncryptionMethod_,
|
||||
}, options);
|
||||
options = { encryptionMethod: this.defaultMasterKeyEncryptionMethod_, ...options };
|
||||
|
||||
const bytes: any[] = await shim.randomBytes(256);
|
||||
const hexaBytes = bytes.map(a => hexPad(a.toString(16), 2)).join('');
|
||||
@ -412,9 +410,7 @@ export default class EncryptionService {
|
||||
}
|
||||
|
||||
private async encryptAbstract_(source: any, destination: any, options: EncryptOptions = null) {
|
||||
options = Object.assign({}, {
|
||||
encryptionMethod: this.defaultEncryptionMethod(),
|
||||
}, options);
|
||||
options = { encryptionMethod: this.defaultEncryptionMethod(), ...options };
|
||||
|
||||
const method = options.encryptionMethod;
|
||||
const masterKeyId = options.masterKeyId ? options.masterKeyId : this.activeMasterKeyId();
|
||||
|
@ -25,7 +25,7 @@ export default class InteropService_Exporter_Base {
|
||||
}
|
||||
|
||||
public updateContext(context: any) {
|
||||
this.context_ = Object.assign({}, this.context_, context);
|
||||
this.context_ = { ...this.context_, ...context };
|
||||
}
|
||||
|
||||
public context() {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user