Feature/save load gist #675

Merged
merged 27 commits into from Dec 12, 2016

Projects

None yet

2 participants

@joshuafcole
Contributor
joshuafcole commented Dec 9, 2016 edited

Enables

  • Saving current document as markdown to gist
  • Loading documents from gists in-editor
  • Loading documents from gist-formatted file ids in the editor.

Blocking tasks:

  • Silently remap local anchor tag hrefs to ignore the IDE portion of the document fragment. This isn't any more broken than it used to be, but the problem becomes more prevalent since the documentId is no longer a known static value.
  • Handle saving edits to documents loaded from gists in some reasonable way.

Notes:

  • Code quality is lacking here. Improvements are blocked by some refactoring work that isn't critical. it's still worth discussing any specific issues found, but it's important that we revisit this in the near future for cleanup as part of the broader file store rework.
@joshuafcole joshuafcole requested a review from ibdknox Dec 9, 2016
@ibdknox
Contributor
ibdknox commented Dec 9, 2016

Is this able to load regular github links yet?

@ibdknox
Contributor
ibdknox commented Dec 9, 2016 edited

Seems to work fine for gists :) I think we probably want to make some changes here to make it a little more obvious UX-wise:

  • We should get rid of my on hover for hiding for the nav so that it's always there
  • The load button at least should show up on the directory part of the nav
  • The saved to gist notification should probably be a bit more noticable
  • It'd be nice to have some feedback when you initially press the save button that lets you know it's doing something
  • Collapsing the nav now puts the arrow in a strange place
+ //console.error("Cannot load non-existent document.");
+ //return;
+
+ root = this.nodes[id] = {id, type: "document", name};
@ibdknox
ibdknox Dec 9, 2016 Contributor

Is this always right? What happens if I do try to load something non-existent locally?

src/ide.ts
- {c: `${this.open ? "expand-btn" : "collapse-btn"} ion-ios-arrow-back`, click: this.togglePane},
+
+ this.open && type === "document" ? {c: "ion-ios-cloud-upload-outline btn", title: "Save to Gist", click: () => this.ide.saveToGist()} : undefined,
+ this.open && type === "document" ? {c: "ion-ios-cloud-download-outline btn", title: "Load from Gist", click: this.openLoadDialog} : undefined,
@ibdknox
ibdknox Dec 9, 2016 Contributor

seems like I should be able to load a gist regardless of where I am

@joshuafcole
Contributor

@ibdknox thoughts on making the saved notice more visible without being obnoxious?

@ibdknox
Contributor
ibdknox commented Dec 10, 2016

Nav is empty when:

  1. Load, change, load, change, click overwrite

On change the new file doesn't show up in the directory index without a refresh.

@joshuafcole joshuafcole referenced this pull request Dec 10, 2016
Merged

0.2.3 #682

@joshuafcole
Contributor

This is ready to ship pending final approval.

@ibdknox

👍

@joshuafcole joshuafcole merged commit a29052d into master Dec 12, 2016

1 check passed

ci/circleci Your tests passed on CircleCI!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment