Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Text File Importer #952

Merged
merged 32 commits into from
Nov 1, 2018
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b398d59
Adding core importer.
roundhill Oct 16, 2018
238ddd2
Adding trashedNotes import.
roundhill Oct 16, 2018
be383d1
Pull in the systemTags if they're available (for markdown)
roundhill Oct 18, 2018
266ebf3
Also import the tags to the tag bucket, if there's any present.
roundhill Oct 18, 2018
80fc441
Added a boolean argument to determine whether an imported note should…
roundhill Oct 18, 2018
96bed8a
README cleanup!
roundhill Oct 18, 2018
21d8a7e
Use fat arrow instead of `bind` in tests.
roundhill Oct 18, 2018
632ec9f
Adding an optional argument to `importNotes` to signify which importe…
roundhill Oct 18, 2018
12fa3aa
Removing importedFrom property because the note schema doesn't allow …
roundhill Oct 19, 2018
d9ef006
Adding `pinned` and `markdown` props to the systemTags if present.
roundhill Oct 22, 2018
c0bc066
Initial commit of text parser.
roundhill Oct 24, 2018
7d1370a
Wrapping the core importer in a class, which also now emits errors in…
roundhill Oct 24, 2018
0723583
Merge branch 'feature/import-parser' into feature/text-file-parser
roundhill Oct 24, 2018
24bc146
Using updated CoreImporter class.
roundhill Oct 24, 2018
ec9aebb
Add a default empty tags array if none was present in the imported note.
roundhill Oct 24, 2018
091e7f6
Merge branch 'feature/import-parser' into feature/text-file-parser
roundhill Oct 24, 2018
28c9379
Removing a log line.
roundhill Oct 24, 2018
5ca23ce
Adding a few more error emits.
roundhill Oct 24, 2018
1f013c5
Updated to use `File` and `FileReader` API so we can use this in the …
roundhill Oct 25, 2018
5921940
Constructor now takes an object so we don't muck up the bucket assign…
roundhill Oct 26, 2018
4124fc8
Merge branch 'feature/import-parser' into feature/text-file-parser
roundhill Oct 26, 2018
b736c50
* Renamed `importTextFiles` to `importNotes`.
roundhill Oct 26, 2018
fd4776d
Update lib/utils/import/text-files/index.js
mirka Oct 26, 2018
2bdc4bf
Adding way to report 'complete' status by tracking the last file name.
roundhill Oct 26, 2018
39bfd97
Merge branch 'feature/text-file-parser' of github.com:Automattic/simp…
roundhill Oct 26, 2018
9ae9dbf
Add a markdown override option to the core importer.
roundhill Oct 26, 2018
d31ecbe
Add fallback object to fix exception if no options are passed.
roundhill Oct 26, 2018
1f09364
Merge branch 'feature/import-parser' into feature/text-file-parser
roundhill Oct 26, 2018
b51baa9
Add support for using new options object (currently can use isMarkdow…
roundhill Oct 26, 2018
876c7be
Add the file title to the note content, if it doesn't already exists …
roundhill Oct 29, 2018
be81282
Remove the check for no content until after we process the file name.
roundhill Oct 29, 2018
beb35f3
Merge branch 'master' into feature/text-file-parser
roundhill Nov 1, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a markdown override option to the core importer.
  • Loading branch information
roundhill committed Oct 26, 2018
commit 9ae9dbff6e0bde49812204fda0e23836c7a1e77e
10 changes: 6 additions & 4 deletions lib/utils/import/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ class CoreImporter extends EventEmitter {
this.tagBucket = tagBucket;
}

importNote = (note, isTrashedNotes = false) => {
importNote = (note, { isTrashed = false, isMarkdown = false }) => {
const importedNote = pick(note, propertyWhitelist);
// We don't want to allow these properties to be imported, but they need to be set
importedNote.publishURL = '';
importedNote.shareURL = '';

importedNote.deleted = isTrashedNotes;
importedNote.deleted = isTrashed;

importedNote.tags = get(importedNote, 'tags', []);
importedNote.systemTags = get(importedNote, 'systemTags', []);
Expand All @@ -34,7 +34,7 @@ class CoreImporter extends EventEmitter {
delete importedNote.pinned;
}

if (importedNote.markdown) {
if (importedNote.markdown || isMarkdown) {
importedNote.systemTags.push('markdown');
delete importedNote.markdown;
}
Expand Down Expand Up @@ -81,7 +81,9 @@ class CoreImporter extends EventEmitter {
}

get(notes, 'activeNotes', []).map(note => this.importNote(note));
get(notes, 'trashedNotes', []).map(note => this.importNote(note, true));
get(notes, 'trashedNotes', []).map(note =>
this.importNote(note, { isTrashed: true })
);
};
}

Expand Down