-
Notifications
You must be signed in to change notification settings - Fork 571
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
Feature: Import from Google Keep #2015
base: trunk
Are you sure you want to change the base?
Conversation
@mgunyho this looks great and it's so cool that you added it. we're a bit busy preparing the 1.16 release but I'd love to prioritize your PR. Please ping us again here if we haven't done more review by Monday. |
Hi, any update on this? |
Very nice @mgunyho you held me accountable 😄 Sadly no, we got a bit more distracted by some issues we uncovered while testing the 1.16 release. Those are mostly done. I will make sure to get you some review by the end of this weekend - setting an alert on my calendar to remind me. Thanks for your patience! We appreciate your contribution so much and are excited to move it forward! |
lib/utils/import/googlekeep/index.ts
Outdated
|
||
const title = importedNote.title; | ||
let textContent = title ? title + '\n\n' : ''; | ||
textContent += get(importedNote, 'textContent', ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a minor style issue, but we don't need to mutate this variable when we can instead set it in one go
const title = importedNote.title;
const importedContent = importedNote.textContent ?? '';
const textContent = title ? `${ title }\n\n${ importedContent }` : importedContent;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the mutable variable in bd9425b, do you think the code is readable?
Side note: is the ??
operator widely enough supported? With a quick glance, I couldn't find it used elsewhere in this repo.
pinned: importedNote.isPinned, | ||
tags: get(importedNote, 'labels', []).map(item => item.name), | ||
}, | ||
{ ...this.options, isTrashed: importedNote.isTrashed } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it were me I might suggest sending archived notes to the trash or add a tag to them - archived
and leave them in the inbox.
trash is generally safe but someone could accidentally "empty the trash" and wipe out their archive
if, on the other hand, they import their archive into the "All Notes" section then they might get more notes in the list than they expect.
maybe we just need a setting…
Archived Notes: [ ] Import into trash [ ] Import with tag _________
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is how I would do it as well. I don't know how to add a (importer-specific) setting to the dialog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try to play around with it this week and see if it wouldn't be too hard. if not, maybe adding archive
to the tags could be a good interim solution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great. I left some feedback on things that might be good to update. I'm sure our existing importers aren't the best examples of this, but it looks like we pass over a number of different errors/exceptions/failures in this PR and it would be nice to either handle those explicitly or add a comment in the code explaining why we're not and what we expect to happen - skip note vs. emit an error etc…
Thanks for your patience with this and thanks so much for your efforts! ❤️
? importedNote.listContent // Note has checkboxes, no text content | ||
.map(item => `- [${item.isChecked ? 'x' : ' '}] ${item.text}`) | ||
.join('\n') | ||
: importedNote.textContent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting. a note can only either be a list or some text?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, in Keep, you can "show checkboxes", which turns the whole note into a checklist, and as far as I can tell there's no way to have regular text then.
Any updates? |
@KnifeFed if there were updates you'd see them here, so no, unfortunately there are none. |
Fix
This PR adds the option to import notes from Google Keep. Notes can be either imported from a zip file exported from Google Takeout, or as individual JSON files. Attached is a small test file that contains notes with various features (check boxes, tags, etc.).
A couple of things to note:
annotations
attribute that could be used for this.I'm fairly new to typescript, so let me know if something looks wrong in the code!
Test
Release
RELEASE-NOTES.txt
was updated with: