Comments (7)
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.
@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.
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.
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.
Just wanted to throw out a few ideas on the file storage, thinking out loud:
- 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;
}
- As mentioned, it would be awesome to build with plugins in mind. Save/sync to Dropbox or GitHub for instance would be incredible.
- 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.
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.
YAY! in our 0.1.0 branch.
from epiceditor.
Related Issues (20)
- Strange indentation on each new line when load text from database
- Broken Avatars - Footer HOT 1
- Feature request: also support Asciidoc HOT 6
- Stateful Sizing HOT 1
- Unable to use with Webpack import/require calls.
- How to get EpicEditor to work? HOT 9
- Suggestion: Option to display the line number in the edition component
- Suggestion: Option to live preview without fullscreen mode HOT 6
- Question: highlight in the EDITOR (not in the preview)
- Suggestion: Drag and Drop Image upload
- Typography Buttons toolbar like the one available in Github's Issue's comment box. HOT 1
- ECCN required for Epic Editor HOT 1
- .load() triggers a document.write function on an iframe.
- Make CSS csslint compliant HOT 3
- If HTML direction is rtl, so should the Epic Editor
- EpicEditor.prototype.unload fails in an iframe
- Adding placeholder text to the editor? HOT 4
- Update website (itself, readme, or repo description) HOT 2
- Inline Attachments HOT 1
- Regular Expression DoS vulnerability HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from epiceditor.