1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-23 23:33:01 +02:00

Compare commits

..

5 Commits

Author SHA1 Message Date
Laurent Cozic
1e9ac4b49c init 2022-04-12 14:21:23 +01:00
Laurent Cozic
0374505212 Chore: Fixed CI tests 2022-04-12 12:42:21 +01:00
Laurent Cozic
21706fa00a Desktop: Fixed color of published note on Light theme 2022-04-11 17:46:33 +01:00
Laurent Cozic
74273cd570 Plugins: Allow updating a resource via the data API 2022-04-11 17:01:01 +01:00
Laurent
6458ad0540 Desktop: Resolves #591: Add support for multiple profiles (#6385) 2022-04-11 16:49:32 +01:00
10 changed files with 41 additions and 10 deletions

View File

@@ -6,7 +6,7 @@ jobs:
strategy:
matrix:
# Removed windows-2016 for now - discontinued by GitHub
os: [macos-latest, ubuntu-latest]
os: [macos-latest, ubuntu-latest, windows-2019]
steps:
# Silence apt-get update errors (for example when a module doesn't

View File

@@ -110,7 +110,7 @@ function NoteListItem(props: NoteListItemProps, ref: any) {
let listItemTitleStyle = Object.assign({}, props.style.listItemTitle);
listItemTitleStyle.paddingLeft = !item.is_todo ? hPadding : 4;
if (item.is_shared) listItemTitleStyle.color = theme.colorWarn2;
if (item.is_shared) listItemTitleStyle.color = theme.colorWarn3;
if (item.is_todo && !!item.todo_completed) listItemTitleStyle = Object.assign(listItemTitleStyle, props.style.listItemTitleCompleted);
const displayTitle = Note.displayTitle(item);

View File

@@ -1516,7 +1516,7 @@ class Setting extends BaseModel {
this.metadata_ = Object.assign(this.metadata_, this.customMetadata_);
if (this.value('env') === Env.Dev) this.validateMetadata(this.metadata_);
if (this.constants_.env === Env.Dev) this.validateMetadata(this.metadata_);
return this.metadata_;
}

View File

@@ -46,7 +46,6 @@ export default class InteropService_Importer_Md extends InteropService_Importer_
}
async importDirectory(dirPath: string, parentFolderId: string) {
console.info(`Import: ${dirPath}`);
const supportedFileExtension = this.metadata().fileExtensions;
const stats = await shim.fsDriver().readDirStats(dirPath);
for (let i = 0; i < stats.length; i++) {
@@ -54,7 +53,6 @@ export default class InteropService_Importer_Md extends InteropService_Importer_
if (stat.isDirectory()) {
if (await this.isDirectoryEmpty(`${dirPath}/${stat.path}`)) {
console.info(`Ignoring empty directory: ${stat.path}`);
continue;
}
const folderTitle = await Folder.findUniqueItemTitle(basename(stat.path));

View File

@@ -379,6 +379,28 @@ describe('services_rest_Api', function() {
expect(resourceV2.size).toBe((await shim.fsDriver().stat(Resource.fullPath(resourceV2))).size);
}));
it('should allow updating a resource file only', (async () => {
await api.route(RequestMethod.POST, 'resources', null, JSON.stringify({
title: 'resource',
}), [{ path: `${supportDir}/photo.jpg` }]);
const resourceV1: ResourceEntity = (await Resource.all())[0];
await msleep(1);
await api.route(RequestMethod.PUT, `resources/${resourceV1.id}`, null, null, [
{
path: `${supportDir}/photo-large.png`,
},
]);
const resourceV2: ResourceEntity = (await Resource.all())[0];
// It should have updated the file content, but not the metadata
expect(resourceV2.title).toBe(resourceV1.title);
expect(resourceV2.size).toBeGreaterThan(resourceV1.size);
}));
it('should update resource properties', (async () => {
await api.route(RequestMethod.POST, 'resources', null, JSON.stringify({
title: 'resource',

View File

@@ -26,6 +26,7 @@ const input: Theme = {
selectedColor2: '#131313',
colorError2: '#ff6c6c',
colorWarn2: '#ffcb81',
colorWarn3: '#ff7626',
// Color scheme "3" is used for the config screens for example/
// It's dark text over gray background.
@@ -76,6 +77,7 @@ const expected = `
--joplin-selected-color2: #131313;
--joplin-color-error2: #ff6c6c;
--joplin-color-warn2: #ffcb81;
--joplin-color-warn3: #ff7626;
--joplin-background-color3: #F4F5F6;
--joplin-background-color-hover3: #CBDAF1;
--joplin-color3: #738598;

View File

@@ -235,6 +235,8 @@ function shimInit(options = null) {
const readChunk = require('read-chunk');
const imageType = require('image-type');
const isUpdate = !!options.destinationResourceId;
const uuid = require('./uuid').default;
if (!(await fs.pathExists(filePath))) throw new Error(_('Cannot access %s', filePath));
@@ -242,12 +244,16 @@ function shimInit(options = null) {
defaultProps = defaultProps ? defaultProps : {};
let resourceId = defaultProps.id ? defaultProps.id : uuid.create();
if (options.destinationResourceId) resourceId = options.destinationResourceId;
if (isUpdate) resourceId = options.destinationResourceId;
let resource = options.destinationResourceId ? {} : Resource.new();
let resource = isUpdate ? {} : Resource.new();
resource.id = resourceId;
// When this is an update we auto-update the mime type, in case the
// content type has changed, but we keep the title. It is still possible
// to modify the title on update using defaultProps.
resource.mime = mimeUtils.fromFilename(filePath);
resource.title = basename(filePath);
if (!isUpdate) resource.title = basename(filePath);
let fileExt = safeFileExtension(fileExtension(filePath));
@@ -288,7 +294,7 @@ function shimInit(options = null) {
const saveOptions = { isNew: true };
if (options.userSideValidation) saveOptions.userSideValidation = true;
if (options.destinationResourceId) {
if (isUpdate) {
saveOptions.isNew = false;
const tempPath = `${targetPath}.tmp`;
await shim.fsDriver().move(targetPath, tempPath);

View File

@@ -29,6 +29,7 @@ const theme: Theme = {
selectedColor2: '#013F74',
colorError2: '#ff6c6c',
colorWarn2: '#ffcb81',
colorWarn3: '#ffcb81',
// Color scheme "3" is used for the config screens for example/
// It's dark text over gray background.

View File

@@ -26,6 +26,7 @@ const theme: Theme = {
selectedColor2: '#131313',
colorError2: '#ff6c6c',
colorWarn2: '#ffcb81',
colorWarn3: '#ff7626',
// Color scheme "3" is used for the config screens for example/
// It's dark text over gray background.

View File

@@ -27,7 +27,8 @@ export interface Theme {
color2: string;
selectedColor2: string;
colorError2: string;
colorWarn2: string;
colorWarn2: string; // On a darker background (eg. sidebar)
colorWarn3: string; // On a lighter background (eg. note list)
// Color scheme "3" is used for the config screens for example/
// It's dark text over gray background.