mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Create 2 new dialog controllers
Image import is now triggering a popup after selecting the file. Same for local saves. Drag and drop of .piskel files opens the piskel immediately ! Remains to do : - redesign the dialog for import image and browse local - create dialog for recover session - improve recover session to handle more than the last session
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
ns.DateUtils = {
|
||||
format : function (date, format) {
|
||||
date = new Date(date);
|
||||
return pskl.utils.Template.replace(format, {
|
||||
Y : date.getFullYear(),
|
||||
M : pad(date.getMonth() + 1),
|
||||
|
||||
17
src/js/utils/PiskelFileUtils.js
Normal file
17
src/js/utils/PiskelFileUtils.js
Normal file
@@ -0,0 +1,17 @@
|
||||
(function () {
|
||||
var ns = $.namespace('pskl.utils');
|
||||
|
||||
ns.PiskelFileUtils = {
|
||||
loadFromFile : function (file, onSuccess, onError) {
|
||||
pskl.utils.FileUtils.readFile(file, function (content) {
|
||||
var rawPiskel = window.atob(content.replace('data:;base64,',''));
|
||||
var serializedPiskel = JSON.parse(rawPiskel);
|
||||
var fps = serializedPiskel.piskel.fps;
|
||||
var descriptor = new pskl.model.piskel.Descriptor(serializedPiskel.piskel.name, serializedPiskel.piskel.description, true);
|
||||
pskl.utils.serialization.Deserializer.deserialize(serializedPiskel, function (piskel) {
|
||||
onSuccess(piskel, descriptor, fps);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
})();
|
||||
Reference in New Issue
Block a user