You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-12-08 23:07:32 +02:00
Compare commits
9 Commits
cli-v3.5.1
...
release-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
884b86f1f9 | ||
|
|
2d7acf1290 | ||
|
|
3555447aaa | ||
|
|
e2bf878953 | ||
|
|
0b50e77ea3 | ||
|
|
a5a7bae6c4 | ||
|
|
36d120ac00 | ||
|
|
d9bd929e03 | ||
|
|
e8d1ac4111 |
@@ -1314,6 +1314,9 @@ packages/lib/services/interop/InteropService_Exporter_Jex.js.map
|
|||||||
packages/lib/services/interop/InteropService_Exporter_Md.d.ts
|
packages/lib/services/interop/InteropService_Exporter_Md.d.ts
|
||||||
packages/lib/services/interop/InteropService_Exporter_Md.js
|
packages/lib/services/interop/InteropService_Exporter_Md.js
|
||||||
packages/lib/services/interop/InteropService_Exporter_Md.js.map
|
packages/lib/services/interop/InteropService_Exporter_Md.js.map
|
||||||
|
packages/lib/services/interop/InteropService_Exporter_Md.test.d.ts
|
||||||
|
packages/lib/services/interop/InteropService_Exporter_Md.test.js
|
||||||
|
packages/lib/services/interop/InteropService_Exporter_Md.test.js.map
|
||||||
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.d.ts
|
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.d.ts
|
||||||
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.js
|
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.js
|
||||||
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.js.map
|
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.js.map
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1297,6 +1297,9 @@ packages/lib/services/interop/InteropService_Exporter_Jex.js.map
|
|||||||
packages/lib/services/interop/InteropService_Exporter_Md.d.ts
|
packages/lib/services/interop/InteropService_Exporter_Md.d.ts
|
||||||
packages/lib/services/interop/InteropService_Exporter_Md.js
|
packages/lib/services/interop/InteropService_Exporter_Md.js
|
||||||
packages/lib/services/interop/InteropService_Exporter_Md.js.map
|
packages/lib/services/interop/InteropService_Exporter_Md.js.map
|
||||||
|
packages/lib/services/interop/InteropService_Exporter_Md.test.d.ts
|
||||||
|
packages/lib/services/interop/InteropService_Exporter_Md.test.js
|
||||||
|
packages/lib/services/interop/InteropService_Exporter_Md.test.js.map
|
||||||
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.d.ts
|
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.d.ts
|
||||||
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.js
|
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.js
|
||||||
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.js.map
|
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.js.map
|
||||||
|
|||||||
4
packages/app-desktop/package-lock.json
generated
4
packages/app-desktop/package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@joplin/app-desktop",
|
"name": "@joplin/app-desktop",
|
||||||
"version": "2.5.10",
|
"version": "2.5.12",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@joplin/app-desktop",
|
"name": "@joplin/app-desktop",
|
||||||
"version": "2.5.10",
|
"version": "2.5.12",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@electron/remote": "^2.0.1",
|
"@electron/remote": "^2.0.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@joplin/app-desktop",
|
"name": "@joplin/app-desktop",
|
||||||
"version": "2.5.10",
|
"version": "2.5.12",
|
||||||
"description": "Joplin for Desktop",
|
"description": "Joplin for Desktop",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|||||||
@@ -492,13 +492,13 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Joplin/Joplin.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Joplin/Joplin.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 74;
|
CURRENT_PROJECT_VERSION = 77;
|
||||||
DEVELOPMENT_TEAM = A9BXAFS6CT;
|
DEVELOPMENT_TEAM = A9BXAFS6CT;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Joplin/Info.plist;
|
INFOPLIST_FILE = Joplin/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
MARKETING_VERSION = 12.5.0;
|
MARKETING_VERSION = 12.5.3;
|
||||||
OTHER_LDFLAGS = (
|
OTHER_LDFLAGS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"-ObjC",
|
"-ObjC",
|
||||||
@@ -521,12 +521,12 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Joplin/Joplin.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Joplin/Joplin.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 74;
|
CURRENT_PROJECT_VERSION = 77;
|
||||||
DEVELOPMENT_TEAM = A9BXAFS6CT;
|
DEVELOPMENT_TEAM = A9BXAFS6CT;
|
||||||
INFOPLIST_FILE = Joplin/Info.plist;
|
INFOPLIST_FILE = Joplin/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
MARKETING_VERSION = 12.5.0;
|
MARKETING_VERSION = 12.5.3;
|
||||||
OTHER_LDFLAGS = (
|
OTHER_LDFLAGS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"-ObjC",
|
"-ObjC",
|
||||||
@@ -667,14 +667,14 @@
|
|||||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
CODE_SIGN_ENTITLEMENTS = ShareExtension/ShareExtension.entitlements;
|
CODE_SIGN_ENTITLEMENTS = ShareExtension/ShareExtension.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 74;
|
CURRENT_PROJECT_VERSION = 77;
|
||||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
DEVELOPMENT_TEAM = A9BXAFS6CT;
|
DEVELOPMENT_TEAM = A9BXAFS6CT;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
INFOPLIST_FILE = ShareExtension/Info.plist;
|
INFOPLIST_FILE = ShareExtension/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
||||||
MARKETING_VERSION = 12.5.0;
|
MARKETING_VERSION = 12.5.3;
|
||||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = net.cozic.joplin.ShareExtension;
|
PRODUCT_BUNDLE_IDENTIFIER = net.cozic.joplin.ShareExtension;
|
||||||
@@ -698,14 +698,14 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = ShareExtension/ShareExtension.entitlements;
|
CODE_SIGN_ENTITLEMENTS = ShareExtension/ShareExtension.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
CURRENT_PROJECT_VERSION = 74;
|
CURRENT_PROJECT_VERSION = 77;
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
DEVELOPMENT_TEAM = A9BXAFS6CT;
|
DEVELOPMENT_TEAM = A9BXAFS6CT;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
INFOPLIST_FILE = ShareExtension/Info.plist;
|
INFOPLIST_FILE = ShareExtension/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
||||||
MARKETING_VERSION = 12.5.0;
|
MARKETING_VERSION = 12.5.3;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = net.cozic.joplin.ShareExtension;
|
PRODUCT_BUNDLE_IDENTIFIER = net.cozic.joplin.ShareExtension;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ PODS:
|
|||||||
- React
|
- React
|
||||||
- RNSecureRandom (1.0.0-rc.0):
|
- RNSecureRandom (1.0.0-rc.0):
|
||||||
- React
|
- React
|
||||||
- RNShare (5.1.5):
|
- RNShare (7.2.1):
|
||||||
- React-Core
|
- React-Core
|
||||||
- RNVectorIcons (7.1.0):
|
- RNVectorIcons (7.1.0):
|
||||||
- React
|
- React
|
||||||
@@ -540,7 +540,7 @@ SPEC CHECKSUMS:
|
|||||||
RNFS: 2bd9eb49dc82fa9676382f0585b992c424cd59df
|
RNFS: 2bd9eb49dc82fa9676382f0585b992c424cd59df
|
||||||
RNQuickAction: 6d404a869dc872cde841ad3147416a670d13fa93
|
RNQuickAction: 6d404a869dc872cde841ad3147416a670d13fa93
|
||||||
RNSecureRandom: 1f19ad1492f7ed416b8fc79e92216a1f73f13a4c
|
RNSecureRandom: 1f19ad1492f7ed416b8fc79e92216a1f73f13a4c
|
||||||
RNShare: 9cdd23357981cf4dee275eb79239e860dccc0faf
|
RNShare: edd621a71124961e29a7ba43a84bd1c6f9980d88
|
||||||
RNVectorIcons: bc69e6a278b14842063605de32bec61f0b251a59
|
RNVectorIcons: bc69e6a278b14842063605de32bec61f0b251a59
|
||||||
Yoga: 575c581c63e0d35c9a83f4b46d01d63abc1100ac
|
Yoga: 575c581c63e0d35c9a83f4b46d01d63abc1100ac
|
||||||
|
|
||||||
|
|||||||
7450
packages/app-mobile/package-lock.json
generated
7450
packages/app-mobile/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -50,7 +50,7 @@
|
|||||||
"react-native-quick-actions": "^0.3.13",
|
"react-native-quick-actions": "^0.3.13",
|
||||||
"react-native-rsa-native": "^2.0.4",
|
"react-native-rsa-native": "^2.0.4",
|
||||||
"react-native-securerandom": "^1.0.0-rc.0",
|
"react-native-securerandom": "^1.0.0-rc.0",
|
||||||
"react-native-share": "^5.1.5",
|
"react-native-share": "^7.2.1",
|
||||||
"react-native-side-menu": "^1.1.3",
|
"react-native-side-menu": "^1.1.3",
|
||||||
"react-native-sqlite-storage": "^5.0.0",
|
"react-native-sqlite-storage": "^5.0.0",
|
||||||
"react-native-vector-icons": "^7.1.0",
|
"react-native-vector-icons": "^7.1.0",
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
import * as fs from 'fs-extra';
|
||||||
|
import { setupDatabaseAndSynchronizer, switchClient, exportDir, supportDir } from '../../testing/test-utils.js';
|
||||||
|
import InteropService_Exporter_Md from '../../services/interop/InteropService_Exporter_Md';
|
||||||
const fs = require('fs-extra');
|
import BaseModel from '../../BaseModel';
|
||||||
const { setupDatabaseAndSynchronizer, switchClient, exportDir, supportDir } = require('../../testing/test-utils.js');
|
import Folder from '../../models/Folder';
|
||||||
const InteropService_Exporter_Md = require('../../services/interop/InteropService_Exporter_Md').default;
|
import Resource from '../../models/Resource';
|
||||||
const BaseModel = require('../../BaseModel').default;
|
import Note from '../../models/Note';
|
||||||
const Folder = require('../../models/Folder').default;
|
import shim from '../../shim';
|
||||||
const Resource = require('../../models/Resource').default;
|
import { MarkupToHtml } from '@joplin/renderer';
|
||||||
const Note = require('../../models/Note').default;
|
import { NoteEntity, ResourceEntity } from '../database/types.js';
|
||||||
const shim = require('../../shim').default;
|
import InteropService from './InteropService.js';
|
||||||
const { MarkupToHtml } = require('@joplin/renderer');
|
import { fileExtension } from '../../path-utils.js';
|
||||||
|
|
||||||
describe('interop/InteropService_Exporter_Md', function() {
|
describe('interop/InteropService_Exporter_Md', function() {
|
||||||
|
|
||||||
@@ -33,8 +33,8 @@ describe('interop/InteropService_Exporter_Md', function() {
|
|||||||
const exporter = new InteropService_Exporter_Md();
|
const exporter = new InteropService_Exporter_Md();
|
||||||
await exporter.init(exportDir());
|
await exporter.init(exportDir());
|
||||||
|
|
||||||
const itemsToExport = [];
|
const itemsToExport: any[] = [];
|
||||||
const queueExportItem = (itemType, itemOrId) => {
|
const queueExportItem = (itemType: number, itemOrId: any) => {
|
||||||
itemsToExport.push({
|
itemsToExport.push({
|
||||||
type: itemType,
|
type: itemType,
|
||||||
itemOrId: itemOrId,
|
itemOrId: itemOrId,
|
||||||
@@ -59,13 +59,13 @@ describe('interop/InteropService_Exporter_Md', function() {
|
|||||||
queueExportItem(BaseModel.TYPE_NOTE, note3);
|
queueExportItem(BaseModel.TYPE_NOTE, note3);
|
||||||
queueExportItem(BaseModel.TYPE_RESOURCE, (await Note.linkedResourceIds(note3.body))[0]);
|
queueExportItem(BaseModel.TYPE_RESOURCE, (await Note.linkedResourceIds(note3.body))[0]);
|
||||||
|
|
||||||
expect(!exporter.context() && !(exporter.context().notePaths || Object.keys(exporter.context().notePaths).length)).toBe(false, 'Context should be empty before processing.');
|
expect(!exporter.context() && !(exporter.context().notePaths || Object.keys(exporter.context().notePaths).length)).toBe(false);
|
||||||
|
|
||||||
await exporter.processItem(Folder.modelType(), folder1);
|
await exporter.processItem(Folder.modelType(), folder1);
|
||||||
await exporter.processItem(Folder.modelType(), folder2);
|
await exporter.processItem(Folder.modelType(), folder2);
|
||||||
await exporter.prepareForProcessingItemType(BaseModel.TYPE_NOTE, itemsToExport);
|
await exporter.prepareForProcessingItemType(BaseModel.TYPE_NOTE, itemsToExport);
|
||||||
|
|
||||||
expect(Object.keys(exporter.context().notePaths).length).toBe(3, 'There should be 3 note paths in the context.');
|
expect(Object.keys(exporter.context().notePaths).length).toBe(3);
|
||||||
expect(exporter.context().notePaths[note1.id]).toBe('folder1/note1.md');
|
expect(exporter.context().notePaths[note1.id]).toBe('folder1/note1.md');
|
||||||
expect(exporter.context().notePaths[note2.id]).toBe('folder1/note2.md');
|
expect(exporter.context().notePaths[note2.id]).toBe('folder1/note2.md');
|
||||||
expect(exporter.context().notePaths[note3.id]).toBe('folder2/note3.html');
|
expect(exporter.context().notePaths[note3.id]).toBe('folder2/note3.html');
|
||||||
@@ -75,8 +75,8 @@ describe('interop/InteropService_Exporter_Md', function() {
|
|||||||
const exporter = new InteropService_Exporter_Md();
|
const exporter = new InteropService_Exporter_Md();
|
||||||
await exporter.init(exportDir());
|
await exporter.init(exportDir());
|
||||||
|
|
||||||
const itemsToExport = [];
|
const itemsToExport: any[] = [];
|
||||||
const queueExportItem = (itemType, itemOrId) => {
|
const queueExportItem = (itemType: number, itemOrId: any) => {
|
||||||
itemsToExport.push({
|
itemsToExport.push({
|
||||||
type: itemType,
|
type: itemType,
|
||||||
itemOrId: itemOrId,
|
itemOrId: itemOrId,
|
||||||
@@ -110,9 +110,9 @@ describe('interop/InteropService_Exporter_Md', function() {
|
|||||||
await exporter.processResource(resource1, Resource.fullPath(resource1));
|
await exporter.processResource(resource1, Resource.fullPath(resource1));
|
||||||
await exporter.processResource(resource2, Resource.fullPath(resource2));
|
await exporter.processResource(resource2, Resource.fullPath(resource2));
|
||||||
|
|
||||||
expect(!exporter.context() && !(exporter.context().destResourcePaths || Object.keys(exporter.context().destResourcePaths).length)).toBe(false, 'Context should be empty before processing.');
|
expect(!exporter.context() && !(exporter.context().destResourcePaths || Object.keys(exporter.context().destResourcePaths).length)).toBe(false);
|
||||||
|
|
||||||
expect(Object.keys(exporter.context().destResourcePaths).length).toBe(2, 'There should be 2 resource paths in the context.');
|
expect(Object.keys(exporter.context().destResourcePaths).length).toBe(2);
|
||||||
expect(exporter.context().destResourcePaths[resource1.id]).toBe(`${exportDir()}/_resources/photo.jpg`);
|
expect(exporter.context().destResourcePaths[resource1.id]).toBe(`${exportDir()}/_resources/photo.jpg`);
|
||||||
expect(exporter.context().destResourcePaths[resource2.id]).toBe(`${exportDir()}/_resources/photo-1.jpg`);
|
expect(exporter.context().destResourcePaths[resource2.id]).toBe(`${exportDir()}/_resources/photo-1.jpg`);
|
||||||
}));
|
}));
|
||||||
@@ -121,8 +121,8 @@ describe('interop/InteropService_Exporter_Md', function() {
|
|||||||
const exporter = new InteropService_Exporter_Md();
|
const exporter = new InteropService_Exporter_Md();
|
||||||
await exporter.init(exportDir());
|
await exporter.init(exportDir());
|
||||||
|
|
||||||
const itemsToExport = [];
|
const itemsToExport: any[] = [];
|
||||||
const queueExportItem = (itemType, itemOrId) => {
|
const queueExportItem = (itemType: number, itemOrId: any) => {
|
||||||
itemsToExport.push({
|
itemsToExport.push({
|
||||||
type: itemType,
|
type: itemType,
|
||||||
itemOrId: itemOrId,
|
itemOrId: itemOrId,
|
||||||
@@ -139,7 +139,7 @@ describe('interop/InteropService_Exporter_Md', function() {
|
|||||||
await exporter.processItem(Folder.modelType(), folder1);
|
await exporter.processItem(Folder.modelType(), folder1);
|
||||||
await exporter.prepareForProcessingItemType(BaseModel.TYPE_NOTE, itemsToExport);
|
await exporter.prepareForProcessingItemType(BaseModel.TYPE_NOTE, itemsToExport);
|
||||||
|
|
||||||
expect(Object.keys(exporter.context().notePaths).length).toBe(2, 'There should be 2 note paths in the context.');
|
expect(Object.keys(exporter.context().notePaths).length).toBe(2);
|
||||||
expect(exporter.context().notePaths[note1.id]).toBe('folder1/note1.md');
|
expect(exporter.context().notePaths[note1.id]).toBe('folder1/note1.md');
|
||||||
expect(exporter.context().notePaths[note1_2.id]).toBe('folder1/note1-1.md');
|
expect(exporter.context().notePaths[note1_2.id]).toBe('folder1/note1-1.md');
|
||||||
}));
|
}));
|
||||||
@@ -148,8 +148,8 @@ describe('interop/InteropService_Exporter_Md', function() {
|
|||||||
const exporter = new InteropService_Exporter_Md();
|
const exporter = new InteropService_Exporter_Md();
|
||||||
await exporter.init(exportDir());
|
await exporter.init(exportDir());
|
||||||
|
|
||||||
const itemsToExport = [];
|
const itemsToExport: any[] = [];
|
||||||
const queueExportItem = (itemType, itemOrId) => {
|
const queueExportItem = (itemType: number, itemOrId: any) => {
|
||||||
itemsToExport.push({
|
itemsToExport.push({
|
||||||
type: itemType,
|
type: itemType,
|
||||||
itemOrId: itemOrId,
|
itemOrId: itemOrId,
|
||||||
@@ -167,7 +167,7 @@ describe('interop/InteropService_Exporter_Md', function() {
|
|||||||
|
|
||||||
await exporter.prepareForProcessingItemType(BaseModel.TYPE_NOTE, itemsToExport);
|
await exporter.prepareForProcessingItemType(BaseModel.TYPE_NOTE, itemsToExport);
|
||||||
|
|
||||||
expect(Object.keys(exporter.context().notePaths).length).toBe(1, 'There should be 1 note paths in the context.');
|
expect(Object.keys(exporter.context().notePaths).length).toBe(1);
|
||||||
expect(exporter.context().notePaths[note1.id]).toBe('folder1/note1-1.md');
|
expect(exporter.context().notePaths[note1.id]).toBe('folder1/note1-1.md');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -175,8 +175,8 @@ describe('interop/InteropService_Exporter_Md', function() {
|
|||||||
const exporter = new InteropService_Exporter_Md();
|
const exporter = new InteropService_Exporter_Md();
|
||||||
await exporter.init(exportDir());
|
await exporter.init(exportDir());
|
||||||
|
|
||||||
const itemsToExport = [];
|
const itemsToExport: any[] = [];
|
||||||
const queueExportItem = (itemType, itemOrId) => {
|
const queueExportItem = (itemType: number, itemOrId: any) => {
|
||||||
itemsToExport.push({
|
itemsToExport.push({
|
||||||
type: itemType,
|
type: itemType,
|
||||||
itemOrId: itemOrId,
|
itemOrId: itemOrId,
|
||||||
@@ -204,16 +204,16 @@ describe('interop/InteropService_Exporter_Md', function() {
|
|||||||
await exporter.processResource(resource1, Resource.fullPath(resource1));
|
await exporter.processResource(resource1, Resource.fullPath(resource1));
|
||||||
await exporter.processResource(resource2, Resource.fullPath(resource2));
|
await exporter.processResource(resource2, Resource.fullPath(resource2));
|
||||||
|
|
||||||
expect(await shim.fsDriver().exists(`${exportDir()}/_resources/photo.jpg`)).toBe(true, 'Resource file should be copied to _resources directory.');
|
expect(await shim.fsDriver().exists(`${exportDir()}/_resources/photo.jpg`)).toBe(true);
|
||||||
expect(await shim.fsDriver().exists(`${exportDir()}/_resources/photo-1.jpg`)).toBe(true, 'Resource file should be copied to _resources directory.');
|
expect(await shim.fsDriver().exists(`${exportDir()}/_resources/photo-1.jpg`)).toBe(true);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should create folders in fs', (async () => {
|
it('should create folders in fs', (async () => {
|
||||||
const exporter = new InteropService_Exporter_Md();
|
const exporter = new InteropService_Exporter_Md();
|
||||||
await exporter.init(exportDir());
|
await exporter.init(exportDir());
|
||||||
|
|
||||||
const itemsToExport = [];
|
const itemsToExport: any[] = [];
|
||||||
const queueExportItem = (itemType, itemOrId) => {
|
const queueExportItem = (itemType: number, itemOrId: any) => {
|
||||||
itemsToExport.push({
|
itemsToExport.push({
|
||||||
type: itemType,
|
type: itemType,
|
||||||
itemOrId: itemOrId,
|
itemOrId: itemOrId,
|
||||||
@@ -234,17 +234,17 @@ describe('interop/InteropService_Exporter_Md', function() {
|
|||||||
await exporter.prepareForProcessingItemType(BaseModel.TYPE_NOTE, itemsToExport);
|
await exporter.prepareForProcessingItemType(BaseModel.TYPE_NOTE, itemsToExport);
|
||||||
await exporter.processItem(Note.modelType(), note2);
|
await exporter.processItem(Note.modelType(), note2);
|
||||||
|
|
||||||
expect(await shim.fsDriver().exists(`${exportDir()}/folder1`)).toBe(true, 'Folder should be created in filesystem.');
|
expect(await shim.fsDriver().exists(`${exportDir()}/folder1`)).toBe(true);
|
||||||
expect(await shim.fsDriver().exists(`${exportDir()}/folder1/folder2`)).toBe(true, 'Folder should be created in filesystem.');
|
expect(await shim.fsDriver().exists(`${exportDir()}/folder1/folder2`)).toBe(true);
|
||||||
expect(await shim.fsDriver().exists(`${exportDir()}/folder1/folder3`)).toBe(true, 'Folder should be created in filesystem.');
|
expect(await shim.fsDriver().exists(`${exportDir()}/folder1/folder3`)).toBe(true);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should save notes in fs', (async () => {
|
it('should save notes in fs', (async () => {
|
||||||
const exporter = new InteropService_Exporter_Md();
|
const exporter = new InteropService_Exporter_Md();
|
||||||
await exporter.init(exportDir());
|
await exporter.init(exportDir());
|
||||||
|
|
||||||
const itemsToExport = [];
|
const itemsToExport: any[] = [];
|
||||||
const queueExportItem = (itemType, itemOrId) => {
|
const queueExportItem = (itemType: number, itemOrId: any) => {
|
||||||
itemsToExport.push({
|
itemsToExport.push({
|
||||||
type: itemType,
|
type: itemType,
|
||||||
itemOrId: itemOrId,
|
itemOrId: itemOrId,
|
||||||
@@ -271,17 +271,17 @@ describe('interop/InteropService_Exporter_Md', function() {
|
|||||||
await exporter.processItem(Note.modelType(), note2);
|
await exporter.processItem(Note.modelType(), note2);
|
||||||
await exporter.processItem(Note.modelType(), note3);
|
await exporter.processItem(Note.modelType(), note3);
|
||||||
|
|
||||||
expect(await shim.fsDriver().exists(`${exportDir()}/${exporter.context().notePaths[note1.id]}`)).toBe(true, 'File should be saved in filesystem.');
|
expect(await shim.fsDriver().exists(`${exportDir()}/${exporter.context().notePaths[note1.id]}`)).toBe(true);
|
||||||
expect(await shim.fsDriver().exists(`${exportDir()}/${exporter.context().notePaths[note2.id]}`)).toBe(true, 'File should be saved in filesystem.');
|
expect(await shim.fsDriver().exists(`${exportDir()}/${exporter.context().notePaths[note2.id]}`)).toBe(true);
|
||||||
expect(await shim.fsDriver().exists(`${exportDir()}/${exporter.context().notePaths[note3.id]}`)).toBe(true, 'File should be saved in filesystem.');
|
expect(await shim.fsDriver().exists(`${exportDir()}/${exporter.context().notePaths[note3.id]}`)).toBe(true);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should replace resource ids with relative paths', (async () => {
|
it('should replace resource ids with relative paths', (async () => {
|
||||||
const exporter = new InteropService_Exporter_Md();
|
const exporter = new InteropService_Exporter_Md();
|
||||||
await exporter.init(exportDir());
|
await exporter.init(exportDir());
|
||||||
|
|
||||||
const itemsToExport = [];
|
const itemsToExport: any[] = [];
|
||||||
const queueExportItem = (itemType, itemOrId) => {
|
const queueExportItem = (itemType: number, itemOrId: any) => {
|
||||||
itemsToExport.push({
|
itemsToExport.push({
|
||||||
type: itemType,
|
type: itemType,
|
||||||
itemOrId: itemOrId,
|
itemOrId: itemOrId,
|
||||||
@@ -325,7 +325,7 @@ describe('interop/InteropService_Exporter_Md', function() {
|
|||||||
await exporter.processResource(resource2, Resource.fullPath(resource2));
|
await exporter.processResource(resource2, Resource.fullPath(resource2));
|
||||||
await exporter.processResource(resource3, Resource.fullPath(resource3));
|
await exporter.processResource(resource3, Resource.fullPath(resource3));
|
||||||
await exporter.processResource(resource4, Resource.fullPath(resource3));
|
await exporter.processResource(resource4, Resource.fullPath(resource3));
|
||||||
const context = {
|
const context: any = {
|
||||||
resourcePaths: {},
|
resourcePaths: {},
|
||||||
};
|
};
|
||||||
context.resourcePaths[resource1.id] = 'resource1.jpg';
|
context.resourcePaths[resource1.id] = 'resource1.jpg';
|
||||||
@@ -343,25 +343,25 @@ describe('interop/InteropService_Exporter_Md', function() {
|
|||||||
const note3_body = await shim.fsDriver().readFile(`${exportDir()}/${exporter.context().notePaths[note3.id]}`);
|
const note3_body = await shim.fsDriver().readFile(`${exportDir()}/${exporter.context().notePaths[note3.id]}`);
|
||||||
const note4_body = await shim.fsDriver().readFile(`${exportDir()}/${exporter.context().notePaths[note4.id]}`);
|
const note4_body = await shim.fsDriver().readFile(`${exportDir()}/${exporter.context().notePaths[note4.id]}`);
|
||||||
|
|
||||||
expect(note1_body).toContain('](../_resources/photo.jpg)', 'Resource id should be replaced with a relative path.');
|
expect(note1_body).toContain('](../_resources/photo.jpg)');
|
||||||
expect(note2_body).toContain('](../../_resources/photo-1.jpg)', 'Resource id should be replaced with a relative path.');
|
expect(note2_body).toContain('](../../_resources/photo-1.jpg)');
|
||||||
expect(note3_body).toContain('<img src="../../_resources/photo-2.jpg" alt="alt">', 'Resource id should be replaced with a relative path.');
|
expect(note3_body).toContain('<img src="../../_resources/photo-2.jpg" alt="alt">');
|
||||||
expect(note4_body).toContain('](../../_resources/photo-3.jpg "title")', 'Resource id should be replaced with a relative path.');
|
expect(note4_body).toContain('](../../_resources/photo-3.jpg "title")');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should replace note ids with relative paths', (async () => {
|
it('should replace note ids with relative paths', (async () => {
|
||||||
const exporter = new InteropService_Exporter_Md();
|
const exporter = new InteropService_Exporter_Md();
|
||||||
await exporter.init(exportDir());
|
await exporter.init(exportDir());
|
||||||
|
|
||||||
const itemsToExport = [];
|
const itemsToExport: any[] = [];
|
||||||
const queueExportItem = (itemType, itemOrId) => {
|
const queueExportItem = (itemType: number, itemOrId: any) => {
|
||||||
itemsToExport.push({
|
itemsToExport.push({
|
||||||
type: itemType,
|
type: itemType,
|
||||||
itemOrId: itemOrId,
|
itemOrId: itemOrId,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeNoteBodyAndReload = async (note, newBody) => {
|
const changeNoteBodyAndReload = async (note: NoteEntity, newBody: string) => {
|
||||||
note.body = newBody;
|
note.body = newBody;
|
||||||
await Note.save(note);
|
await Note.save(note);
|
||||||
return await Note.load(note.id);
|
return await Note.load(note.id);
|
||||||
@@ -395,18 +395,18 @@ describe('interop/InteropService_Exporter_Md', function() {
|
|||||||
const note2_body = await shim.fsDriver().readFile(`${exportDir()}/${exporter.context().notePaths[note2.id]}`);
|
const note2_body = await shim.fsDriver().readFile(`${exportDir()}/${exporter.context().notePaths[note2.id]}`);
|
||||||
const note3_body = await shim.fsDriver().readFile(`${exportDir()}/${exporter.context().notePaths[note3.id]}`);
|
const note3_body = await shim.fsDriver().readFile(`${exportDir()}/${exporter.context().notePaths[note3.id]}`);
|
||||||
|
|
||||||
expect(note1_body).toContain('](../folder3/note3.md)', 'Note id should be replaced with a relative path.');
|
expect(note1_body).toContain('](../folder3/note3.md)');
|
||||||
expect(note2_body).toContain('](../../folder3/note3.md)', 'Resource id should be replaced with a relative path.');
|
expect(note2_body).toContain('](../../folder3/note3.md)');
|
||||||
expect(note2_body).toContain('](../../folder1/note1.md)', 'Resource id should be replaced with a relative path.');
|
expect(note2_body).toContain('](../../folder1/note1.md)');
|
||||||
expect(note3_body).toContain('](../folder1/folder2/note2.md)', 'Resource id should be replaced with a relative path.');
|
expect(note3_body).toContain('](../folder1/folder2/note2.md)');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should url encode relative note links', (async () => {
|
it('should url encode relative note links', (async () => {
|
||||||
const exporter = new InteropService_Exporter_Md();
|
const exporter = new InteropService_Exporter_Md();
|
||||||
await exporter.init(exportDir());
|
await exporter.init(exportDir());
|
||||||
|
|
||||||
const itemsToExport = [];
|
const itemsToExport: any[] = [];
|
||||||
const queueExportItem = (itemType, itemOrId) => {
|
const queueExportItem = (itemType: number, itemOrId: any) => {
|
||||||
itemsToExport.push({
|
itemsToExport.push({
|
||||||
type: itemType,
|
type: itemType,
|
||||||
itemOrId: itemOrId,
|
itemOrId: itemOrId,
|
||||||
@@ -425,6 +425,26 @@ describe('interop/InteropService_Exporter_Md', function() {
|
|||||||
await exporter.processItem(Note.modelType(), note2);
|
await exporter.processItem(Note.modelType(), note2);
|
||||||
|
|
||||||
const note2_body = await shim.fsDriver().readFile(`${exportDir()}/${exporter.context().notePaths[note2.id]}`);
|
const note2_body = await shim.fsDriver().readFile(`${exportDir()}/${exporter.context().notePaths[note2.id]}`);
|
||||||
expect(note2_body).toContain('[link](../folder%20with%20space1/note1%20name%20with%20space.md)', 'Whitespace in URL should be encoded');
|
expect(note2_body).toContain('[link](../folder%20with%20space1/note1%20name%20with%20space.md)');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should preserve resource file extension', (async () => {
|
||||||
|
const folder = await Folder.save({ title: 'testing' });
|
||||||
|
const note = await Note.save({ title: 'mynote', parent_id: folder.id });
|
||||||
|
await shim.attachFileToNote(note, `${supportDir}/photo.jpg`);
|
||||||
|
|
||||||
|
const resource: ResourceEntity = (await Resource.all())[0];
|
||||||
|
await Resource.save({ id: resource.id, title: 'veryverylongtitleveryverylongtitleveryverylongtitleveryverylongtitleveryverylongtitleveryverylongtitleveryverylongtitleveryverylongtitleveryverylongtitleveryverylongtitleveryverylongtitleveryverylongtitleveryverylongtitleveryverylongtitleveryverylongtitleveryverylongtitleveryverylongtitleveryverylongtitle.jpg' });
|
||||||
|
|
||||||
|
const service = InteropService.instance();
|
||||||
|
|
||||||
|
await service.export({
|
||||||
|
path: exportDir(),
|
||||||
|
format: 'md',
|
||||||
|
});
|
||||||
|
|
||||||
|
const resourceFilename = (await fs.readdir(`${exportDir()}/_resources`))[0];
|
||||||
|
expect(fileExtension(resourceFilename)).toBe('jpg');
|
||||||
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -143,7 +143,7 @@ export default class InteropService_Exporter_Md extends InteropService_Exporter_
|
|||||||
if (resource.filename) {
|
if (resource.filename) {
|
||||||
fileName = resource.filename;
|
fileName = resource.filename;
|
||||||
} else if (resource.title) {
|
} else if (resource.title) {
|
||||||
fileName = friendlySafeFilename(resource.title);
|
fileName = friendlySafeFilename(resource.title, null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fall back on the resource filename saved in the users resource folder
|
// Fall back on the resource filename saved in the users resource folder
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ describe('interop/InteropService_Exporter_Md_frontmatter', function() {
|
|||||||
const content = await exportAndLoad(`${exportDir()}/folder1/Source_title.md`);
|
const content = await exportAndLoad(`${exportDir()}/folder1/Source_title.md`);
|
||||||
expect(content).toContain('title: |-\n Source\n title');
|
expect(content).toContain('title: |-\n Source\n title');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test('should not export coordinates if they\'re not available', (async () => {
|
test('should not export coordinates if they\'re not available', (async () => {
|
||||||
const folder1 = await Folder.save({ title: 'folder1' });
|
const folder1 = await Folder.save({ title: 'folder1' });
|
||||||
await Note.save({ title: 'Coordinates', body: '**ma note**', parent_id: folder1.id });
|
await Note.save({ title: 'Coordinates', body: '**ma note**', parent_id: folder1.id });
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ async function renderItem(context: AppContext, item: Item, share: Share): Promis
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createContentDispositionHeader(filename: string) {
|
function createContentDispositionHeader(filename: string) {
|
||||||
const encoded = encodeURIComponent(friendlySafeFilename(filename));
|
const encoded = encodeURIComponent(friendlySafeFilename(filename, null, true));
|
||||||
return `attachment; filename*=UTF-8''${encoded}; filename="${encoded}"`;
|
return `attachment; filename*=UTF-8''${encoded}; filename="${encoded}"`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user