Giter Club home page Giter Club logo

Comments (7)

techwraith avatar techwraith commented on August 11, 2024

So, this will take a little more work, but my preference would be to have the save method use local storage until the create method or read method is used. Basically, I want to be able to store my drafts in local storage before "publishing" my post.

from epiceditor.

OscarGodson avatar OscarGodson commented on August 11, 2024

@techwraith I'll think about how/if i'd implement that natively. #31 relates to this. I could have it accept a function and in that function you could do something such as .on('create',function(){ localStorage['epiceditor'].clear() }). I'd have to implement a "status" for each file and this is just an editor so nothing is technically a draft, it's just the current state of the file.

Any ideas on how it'd be implemented natively?

If it's not implemented it'd still be easy. You could simply clear the LS in the callback in your form submit.

from epiceditor.

OscarGodson avatar OscarGodson commented on August 11, 2024

Some more thinking... this might be a great use case for a EE plugin. The plugin would enable draft and published and clear the cache once a file was published.

from epiceditor.

techwraith avatar techwraith commented on August 11, 2024

I think the best way to handle this is to have the editor emit events for each action. Each callback would be passed the page data.

ee.on('read', function(page){ // write some logic to send ajax if already published});
ee.on('create', function(page){ // do nothing});
ee.on('remove', function(page){ // write some logic to send ajax if already published});
ee.on('update', function(page){ // write some logic to send ajax if already published});

That way you don't even have to worry about the config options, the user can just worry about that themselves. I think this fits better into your vision for this editor.

from epiceditor.

johnmdonahue avatar johnmdonahue commented on August 11, 2024

Just wanted to throw out a few ideas on the file storage, thinking out loud:

  1. Would it make sense to provide a method to fetch any or all file objects in a given namespace without loading them. A user could throw them into a dropdown for easy jumping between files:
EpicEditor.prototype.files(namespace, file) { // or .listFiles
  return fileInNameSpace || allFilesInNamespace;
}
  1. As mentioned, it would be awesome to build with plugins in mind. Save/sync to Dropbox or GitHub for instance would be incredible.
  2. For extensibility, it might be useful to add file types to names (i.e. example-1.md) and metadata to the file object similar to standard system metadata. for example:
var f = ee.files('epic-editor', 'example-1')
f.status.created // timestamp
f.status.modified // timestamp of last save

This could come in handy in an instance where someone has the file open in 2 tabs simultaneously and the modified stamp could be used to handle conflicts.

Not sure the best way to handle the API for this but I wanted to throw it out there for discussion.

Thanks.

from epiceditor.

OscarGodson avatar OscarGodson commented on August 11, 2024

The finalized API will be what @techwraith suggested. I'm working on it now.

I made a ticket for @johnmdonahue first suggestion (#85) and 2nd awhile ago (#33) and made a ticket for the 3rd as well (#86)

from epiceditor.

OscarGodson avatar OscarGodson commented on August 11, 2024

YAY! in our 0.1.0 branch.

from epiceditor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.