1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-24 08:12:24 +02:00

Desktop: Resolves #8722: Add option to import HTML and TXT file (#8729)

This commit is contained in:
Hubert 2023-09-11 13:25:12 -03:00 committed by GitHub
parent 217fd20985
commit 5a5a8526c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 22 deletions

View File

@ -403,6 +403,7 @@ function useMenu(props: Props) {
label: module.fullLabel(moduleSource),
click: () => onImportModuleClickRef.current(module, moduleSource),
});
if (module.separatorAfter) importItems.push({ type: 'separator' });
}
}
}

View File

@ -59,6 +59,39 @@ export default class InteropService {
description: _('Joplin Export File'),
}, () => new InteropService_Importer_Jex()),
makeImportModule({
format: 'raw',
sources: [FileSystemItem.Directory],
description: _('Joplin Export Directory'),
separatorAfter: true,
}, () => new InteropService_Importer_Raw()),
makeImportModule({
format: 'enex',
fileExtensions: ['enex'],
sources: [FileSystemItem.File],
description: _('Evernote Export File (as HTML)'),
supportsMobile: false,
outputFormat: ImportModuleOutputFormat.Html,
}, dynamicRequireModuleFactory('./InteropService_Importer_EnexToHtml')),
makeImportModule({
format: 'enex',
fileExtensions: ['enex'],
sources: [FileSystemItem.File],
description: _('Evernote Export File (as Markdown)'),
supportsMobile: false,
isDefault: true,
}, dynamicRequireModuleFactory('./InteropService_Importer_EnexToMd')),
makeImportModule({
format: 'html',
fileExtensions: ['html'],
sources: [FileSystemItem.File, FileSystemItem.Directory],
isNoteArchive: false, // Tells whether the file can contain multiple notes (eg. Enex or Jex format)
description: _('HTML document'),
}, () => new InteropService_Importer_Md()),
makeImportModule({
format: 'md',
fileExtensions: ['md', 'markdown', 'txt', 'html'],
@ -76,28 +109,12 @@ export default class InteropService {
}, () => new InteropService_Importer_Md_frontmatter()),
makeImportModule({
format: 'raw',
sources: [FileSystemItem.Directory],
description: _('Joplin Export Directory'),
}, () => new InteropService_Importer_Raw()),
makeImportModule({
format: 'enex',
fileExtensions: ['enex'],
sources: [FileSystemItem.File],
description: _('Evernote Export File (as Markdown)'),
supportsMobile: false,
isDefault: true,
}, dynamicRequireModuleFactory('./InteropService_Importer_EnexToMd')),
makeImportModule({
format: 'enex',
fileExtensions: ['enex'],
sources: [FileSystemItem.File],
description: _('Evernote Export File (as HTML)'),
supportsMobile: false,
outputFormat: ImportModuleOutputFormat.Html,
}, dynamicRequireModuleFactory('./InteropService_Importer_EnexToHtml')),
format: 'txt',
fileExtensions: ['txt'],
sources: [FileSystemItem.File, FileSystemItem.Directory],
isNoteArchive: false, // Tells whether the file can contain multiple notes (eg. Enex or Jex format)
description: _('Text document'),
}, () => new InteropService_Importer_Md()),
];
const exportModules = [

View File

@ -10,6 +10,7 @@ interface BaseMetadata {
fileExtensions: string[];
description: string;
isDefault: boolean;
separatorAfter: boolean; // this isn't a property of the importer, but of how it should be displayed in the GUI
supportsMobile: boolean;
@ -51,6 +52,7 @@ const defaultBaseMetadata = {
isNoteArchive: true,
supportsMobile: true,
isDefault: false,
separatorAfter: false,
};
const moduleFullLabel = (metadata: ImportMetadata|ExportMetadata, moduleSource: FileSystemItem = null) => {