smoohted out update sync functionality for posts

This commit is contained in:
Ro 2018-11-21 20:08:53 -05:00
parent bc1b4fa3e8
commit b057c50ad4
10 changed files with 29523 additions and 530 deletions

View file

@ -19,11 +19,7 @@ var router = express.Router();
var multer = require('multer'); var multer = require('multer');
var fs = require('fs-extra'); var fs = require('fs-extra');
var Models = require('../../models'); var Models = require('../../models');
var uuidv4 = require('uuid/v4');
var md = require('markdown-it')('commonmark');
var sanitize = require('sanitize-html');
const dateUtils = new DateUtils(); const dateUtils = new DateUtils();
const stringUtils = new StringUtils();
const rightsManager = new RightsManager(); const rightsManager = new RightsManager();
var uploadPath = "./content/blog-images/" + dateUtils.getDate('year', new Date()) + "/" + dateUtils.getDate('month', new Date()); var uploadPath = "./content/blog-images/" + dateUtils.getDate('year', new Date()) + "/" + dateUtils.getDate('month', new Date());
var Sequelize = require('sequelize'); var Sequelize = require('sequelize');
@ -54,6 +50,9 @@ var post_upload = multer(
{ {
storage: storage storage: storage
}).array('post_image'); }).array('post_image');
//** SYNC POSTS */
router.post("/sync", (req, res, next) => router.post("/sync", (req, res, next) =>
{ {
let payload = req.body; let payload = req.body;
@ -68,27 +67,37 @@ router.post("/sync", (req, res, next) =>
{ {
where: where:
{ {
"post": { "post":
[Op.contains]: { {
[Op.contains]:
{
slug: item.post.slug slug: item.post.slug
} }
} }
} }
}).then(found =>{ }).then(found =>
if (!_.isEqual(item.post, found.post) ) found.update(item) {
if (!_.isEqual(item.post, found.post)){
found.update(item).then(updated=>{
console.log("UPDATED", updated);
}).catch(err=>{ }).catch(err=>{
Models.FreshPost.create(item).then(fresh =>{ //console.log("***ERROR***", err);
})
} else{
//chilld
}
}).catch(err =>
{
Models.FreshPost.create(item).then(fresh =>
{
//console.log(fresh) //console.log(fresh)
}) })
}) })
} }
res.json( res.json(
{ {
message: "postsSynced" message: "postsSynced"
}); });
} }
else else
{ {
@ -99,62 +108,6 @@ router.post("/sync", (req, res, next) =>
} }
}); });
}) })
router.post('/jsontest-edit', function(req, res, next)
{
Models.FreshPost.findById(req.body.id).then(fresh =>
{
fresh.update(req.body)
res.json(
{
message: "jsonPostUpdated"
});
}).catch(err =>
{
console.log(err)
})
})
router.get('/', function(req, res, next)
{
Models.Post.findAll(
{
order: [
['id']
]
}).then(function(posts)
{
var count = posts.length;
var list = [];
for (let index = 0; index < count; index++)
{
let item = posts[index];
let post = {
post:
{
uuid: item.uuid,
title: item.title,
slug: item.slug,
tags: item.tags,
feature: item.feature_image,
author: "Are0h",
html: item.html,
plaintext: item.plaintext,
featured: item.featured,
published: item.published,
page: item.page,
created: item.created_at,
updated: item.updated_at,
deleted: false
}
}
list.push(post);
}
res.json(list);
}).catch(function(err)
{
//next(err);
})
})
router.get('/json', function(req, res, next) router.get('/json', function(req, res, next)
{ {
Models.FreshPost.findAll( Models.FreshPost.findAll(
@ -170,213 +123,7 @@ router.get('/json', function(req, res, next)
//next(err); //next(err);
}) })
}) })
/***
ADD POST
*/
router.post('/add', function(req, res, next)
{
if (!req.session.user) return res.json(
{
message: "You need to be logged in, champ."
});
Models.User.findById(req.session.user.id).then((user) =>
{
if (rightsManager.check(user.role, OBJECT_POST, TASK_CREATE))
{
feature_upload(req, res, function(err)
{
if (err)
{
res.json(
{
message: err
});
throw err;
}
else
{
var postImages = [];
if (req.files != "")
{
for (let i = 0; i < req.files.length; i++)
{
postImages.push(req.files[i].path);
}
}
else
{
console.log("NOTHING TO SAVE");
}
Models.Post.sync().then(f =>
{
var html = req.body.post_plaintext;
html = html.replace(/<\/?span[^>]*>/g, ""); //removes highightjs styling
console.log("REGULAR: " + html);
let buffed = sanitize(html,
{
allowedTags: ['del', 'a', 'iframe', 'img'],
allowedAttributes:
{
a: ['href', 'name', 'target'],
img: ['src'],
iframe: ['height', 'width', 'src', 'frameborder', 'allow', 'allowfullscreen']
}
})
buffed = stringUtils.decodeHTML(buffed)
Models.Post.create(
{
uuid: uuidv4(),
title: req.body.title,
slug: req.body.slug,
plaintext: buffed,
tags: req.body.tags,
page: req.body.status_page,
featured: req.body.status_feature,
published: req.body.status_published,
author_id: req.session.user.id,
origin_date: new Date(req.body.origin_date),
html: md.render(buffed,
{
html: true,
xhtmlOut: true,
}),
feature_image: JSON.stringify(postImages)
}).then(saved =>
{
res.json(
{
message: "postAdded",
postID: saved.slug
});
}).catch(err =>
{
console.log(err)
})
})
}
});
}
else
{
res.json(
{
message: "Nah. You can't do that. Talk to the admin, sport."
});
}
});
});
/***
UPDATE POST
*/
router.post('/update/:id', function(req, res, next)
{
//console.log(req.body);
if (!req.session.user) return res.json(
{
message: "You need to be logged in, champ."
});
Models.User.findById(req.session.user.id).then((user) =>
{
if (rightsManager.check(user.role, OBJECT_POST, TASK_UPDATE))
{
feature_upload(req, res, function(err)
{
if (err)
{
res.json(
{
message: err
});
throw err;
}
else
{
var postImages = [];
if (req.files != "")
{
for (let i = 0; i < req.files.length; i++)
{
postImages.push(req.files[i].path);
}
}
else
{
console.log("NOTHING TO SAVE");
}
Models.Post.findOne(
{
where:
{
id: req.params.id
}
}).then(post =>
{
if (postImages.length == 0) postImages = JSON.parse(post.feature_image);
var html = req.body.post_plaintext;
html = html.replace(/<\/?span[^>]*>/g, ""); //removes highightjs styling
let cleaned = sanitize(html,
{
allowedTags: ['del', 'a', 'iframe', 'img'],
allowedAttributes:
{
a: ['href', 'name', 'target'],
img: ['src'],
iframe: ['height', 'width', 'src', 'frameborder', 'allow', 'allowfullscreen']
}
})
cleaned = stringUtils.decodeHTML(cleaned)
post.update(
{
title: req.body.title,
slug: req.body.slug,
plaintext: cleaned,
origin_date: new Date(req.body.origin_date),
tags: req.body.tags,
page: req.body.status_page,
featured: req.body.status_feature,
published: req.body.status_published,
html: md.render(cleaned,
{
html: true,
xhtmlOut: true
}),
feature_image: JSON.stringify(postImages)
}).then(updated =>
{
res.json(
{
message: "postUpdated"
});
}).catch(err =>
{
console.log(err)
res.json(
{
message: "postError",
error: err
});
})
}).catch(err =>
{
//console.log(err)
res.json(
{
message: "postError",
error: err
});
})
}
});
}
else
{
res.json(
{
message: "Nah. You can't do that. Talk to the admin, sport."
});
}
});
});
/*** /***
POST IMAGE POST IMAGE
*/ */
@ -422,43 +169,4 @@ router.post('/add-post-image', function(req, res, next)
} }
}); });
}); });
router.post('/delete/:id', function(req, res, next)
{
if (!req.session.user) return res.json(
{
message: "You need to be logged in, champ."
});
Models.User.findById(req.session.user.id).then((user) =>
{
if (rightsManager.check(user.role, OBJECT_POST, TASK_DELETE))
{
Models.Post.findOne(
{
where:
{
id: req.params.id
}
}).then(post =>
{
post.destroy().then(deleted =>
{
res.json(
{
message: "postDeleted"
});
})
}).catch(err =>
{
console.log(err);
})
}
else
{
res.json(
{
message: "Nah. You can't do that. Talk to the admin, sport."
});
}
});
});
module.exports = router; module.exports = router;

View file

@ -1,4 +1,3 @@
import DateUtils from '../../tools/utilities/DateUtils'; import DateUtils from '../../tools/utilities/DateUtils';
var express = require('express'); var express = require('express');
var router = express.Router(); var router = express.Router();
@ -6,110 +5,137 @@ var Models = require('../../models');
var hljs = require('highlight.js/lib/highlight'); var hljs = require('highlight.js/lib/highlight');
var hljs_md = require('highlight.js/lib/languages/markdown'); var hljs_md = require('highlight.js/lib/languages/markdown');
hljs.registerLanguage('markdown', hljs_md); hljs.registerLanguage('markdown', hljs_md);
var Sequelize = require('sequelize');
const Op = Sequelize.Op;
const dateUtils = new DateUtils(); const dateUtils = new DateUtils();
//-------------------------- //--------------------------
// POSTS // POSTS
//-------------------------- //--------------------------
router.get('/:page?', function (req, res) { router.get('/:page?', function(req, res)
{
var pageNum = req.params.page; var pageNum = req.params.page;
if (pageNum == "" || pageNum == null) pageNum = 1; if (pageNum == "" || pageNum == null) pageNum = 1;
console.log(pageNum);
var offset = ((pageNum * 5) - 5); var offset = ((pageNum * 5) - 5);
if (req.session.user) { if (req.session.user)
Models.Post.findAll({ {
Models.FreshPost.findAll(
{
order: [ order: [
['id', 'DESC'] ['id', 'DESC']
] ]
}).then(function (posts) { }).then(function(posts)
{
var count = Math.round(posts.length / 6); var count = Math.round(posts.length / 6);
//console.log("COUNT: "+count); //console.log("COUNT: "+count);
var pageItems = []; var pageItems = [];
var itemLimit = 6; var itemLimit = 6;
var rangeStart = (pageNum * itemLimit) - itemLimit; var rangeStart = (pageNum * itemLimit) - itemLimit;
for (var i = 0; i < itemLimit; i++) { for (var i = 0; i < itemLimit; i++)
try { {
if (posts[i + rangeStart].id != null) { try
{
if (posts[i + rangeStart].id != null)
{
pageItems.push(posts[i + rangeStart]); pageItems.push(posts[i + rangeStart]);
} }
} catch (e) { }
catch (e)
{
//console.log(e) //console.log(e)
} }
} }
res.render('dash/posts-index', { res.render('dash/posts-index',
{
title: 'Dashbord | Posts', title: 'Dashbord | Posts',
mode: 'admin', mode: 'admin',
items: pageItems, items: pageItems,
page_index: pageNum, page_index: pageNum,
page_count: count page_count: count
}); });
}).then(function (value) { }).then(function(value)
{
//console.log(value); //console.log(value);
}).catch(function (err) { }).catch(function(err)
{
//next(err); //next(err);
}) })
} else { }
else
{
console.log("REDIRECT") console.log("REDIRECT")
res.redirect('/@/dashboard'); res.redirect('/@/dashboard');
} }
}); });
//-------------------------- //--------------------------
// BLOG POST ADD DISPLAY // BLOG POST ADD DISPLAY
//-------------------------- //--------------------------
router.get('/add/new', function (req, res) { router.get('/add/new', function(req, res)
if (req.session.user) { {
res.render('dash/post-edit', { if (req.session.user)
{
res.render('dash/post-edit',
{
title: 'Make New Post', title: 'Make New Post',
mode: 'admin', mode: 'admin',
date: dateUtils.getDate('year', new Date()) + "-" + dateUtils.getDate('month', new Date()) + "-" + dateUtils.getDate('day', new Date()), date: dateUtils.getDate('year', new Date()) + "-" + dateUtils.getDate('month', new Date()) + "-" + dateUtils.getDate('day', new Date()),
status: ['false', 'false', 'false'], status: ['false', 'false', 'false'],
edit: false edit: false
}); });
} else { }
else
{
res.redirect('/@/dashboard'); res.redirect('/@/dashboard');
} }
}); });
//-------------------------- //--------------------------
// BLOG POST EDIT DISPLAY // BLOG POST EDIT DISPLAY
//-------------------------- //--------------------------
router.get('/edit/:id', function (req, res) { router.get('/edit/:id', function(req, res)
if (req.session.user) { {
Models.Post.findOne({ if (req.session.user)
where: { {
Models.FreshPost.findOne(
{
where:
{
"post":
{
[Op.contains]:
{
slug: req.params.id slug: req.params.id
} }
}).then(post => { }
let featured_img = JSON.parse(post.feature_image); }
}).then(item =>
{
let featured_img = JSON.parse(item.post.feature);
let featured = 'null'; let featured = 'null';
if (featured_img.length != 0) if (featured_img.length != 0) featured = featured_img[0].substr(7, featured_img[0].length);
featured = featured_img[0].substr(7, featured_img[0].length); let pretty = hljs.highlight('markdown', item.post.plaintext).value;
let pretty = hljs.highlight('markdown', post.plaintext).value; let sexydate = dateUtils.getDate('year', item.post.created) + "-" + dateUtils.getDate('month', item.post.created) + "-" + dateUtils.getDate('day', item.post.created)
res.render('dash/post-edit',
let sexydate {
if (post.origin_date == "" || post.origin_date == null) id: item.id,
sexydate = dateUtils.getDate('year', post.created_at) + "-" + dateUtils.getDate('month', post.created_at) + "-" + dateUtils.getDate('day', post.created_at)
else
sexydate = post.origin_date
res.render('dash/post-edit', {
title: 'Edit Post', title: 'Edit Post',
mode: 'admin', mode: 'admin',
post: post, post: item.post,
date: sexydate, date: sexydate,
colored: pretty, colored: pretty,
html: post.plaintext, html: item.post.plaintext,
feature: featured, feature: featured,
status:[String(post.page), String(post.featured), String(post.published)], status: [String(item.post.page), String(item.post.featured), String(item.post.published)],
edit: true edit: true
}); });
}).then(function (value) { }).then(function(value)
{
console.log("VALUE: " + value); console.log("VALUE: " + value);
}).catch(function (err) { }).catch(function(err)
{
console.log(err); console.log(err);
}) })
} else { }
else
{
res.redirect('/@/dashboard'); res.redirect('/@/dashboard');
} }
}); });

View file

@ -62,128 +62,7 @@ router.get('/settings/', function(req, res)
//-------------------------- //--------------------------
// POSTS // POSTS
//-------------------------- //--------------------------
router.get('/posts/:page?', function(req, res)
{
var pageNum = req.params.page;
if (pageNum == "" || pageNum == null) pageNum = 1;
var offset = ((pageNum * 5) - 5);
if (req.session.user)
{
Models.Post.findAll(
{
order: [
['id', 'DESC']
]
}).then(function(posts)
{
var count = Math.round(posts.length / 6);
//console.log("COUNT: "+count);
var pageItems = [];
var itemLimit = 6;
var rangeStart = (pageNum * itemLimit) - itemLimit;
for (var i = 0; i < itemLimit; i++)
{
try
{
if (posts[i + rangeStart].id != null)
{
pageItems.push(posts[i + rangeStart]);
}
}
catch (e)
{
//console.log(e)
}
}
res.render('dash/posts-index',
{
title: 'Dashbord | Posts',
mode: 'admin',
items: pageItems,
page_index: pageNum,
page_count: count
});
}).then(function(value)
{
//console.log(value);
}).catch(function(err)
{
//next(err);
})
}
else
{
res.redirect('/@/dashboard');
}
});
//--------------------------
// BLOG POST ADD DISPLAY
//--------------------------
router.get('/posts/add/new', function(req, res)
{
if (req.session.user)
{
res.render('dash/post-edit',
{
title: 'Make New Post',
mode: 'admin',
date: dateUtils.getDate('year', new Date()) + "-" + dateUtils.getDate('month', new Date()) + "-" + dateUtils.getDate('day', new Date()),
status: ['false', 'false', 'false'],
edit: false
});
}
else
{
res.redirect('/@/dashboard');
}
});
//--------------------------
// BLOG POST EDIT DISPLAY
//--------------------------
router.get('/posts/edit/:id', function(req, res)
{
if (req.session.user)
{
Models.Post.findOne(
{
where:
{
slug: req.params.id
}
}).then(post =>
{
let featured_img = JSON.parse(post.feature_image);
let featured = 'null';
if (featured_img.length != 0) featured = featured_img[0].substr(7, featured_img[0].length);
let pretty = hljs.highlight('markdown', post.plaintext).value;
let sexydate
if (post.origin_date == "" || post.origin_date == null) sexydate = dateUtils.getDate('year', post.created_at) + "-" + dateUtils.getDate('month', post.created_at) + "-" + dateUtils.getDate('day', post.created_at)
else sexydate = post.origin_date
res.render('dash/post-edit',
{
title: 'Edit Post',
mode: 'admin',
post: post,
date: sexydate,
colored: pretty,
html: post.plaintext,
feature: featured,
status: [String(post.page), String(post.featured), String(post.published)],
edit: true
});
}).then(function(value)
{
console.log("VALUE: " + value);
}).catch(function(err)
{
console.log(err);
})
}
else
{
res.redirect('/@/dashboard');
}
});
/** /**
//-------------------------- //--------------------------
// MAIN FIPAMO DISPLAY // MAIN FIPAMO DISPLAY

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -17,7 +17,7 @@ block main-content
-post_date = date -post_date = date
-post_status = status -post_status = status
#post-edit-index #post-edit-index(data-index=id)
#post-edit-index-wrapper #post-edit-index-wrapper
//h2 EDIT //h2 EDIT
=post_title =post_title

View file

@ -10,9 +10,9 @@ block main-content
#posts-list #posts-list
- var index = 0; - var index = 0;
- for ( index; index < items.length; index++) - for ( index; index < items.length; index++)
- var date = new Date(items[index].created_at) - var date = new Date(items[index].post.created)
a.post-list-link(href="/@/dashboard/posts/edit/"+items[index].slug id=items[index].uuid) a.post-list-link(href="/@/dashboard/posts/edit/"+items[index].slug id=items[index].uuid)
= items[index].title = items[index].post.title
br br
span= date.getFullYear()+"-"+date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes() span= date.getFullYear()+"-"+date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()
- var next = parseInt(page_index, 10) + 1 - var next = parseInt(page_index, 10) + 1

View file

@ -56,7 +56,7 @@ export default class Base
self.start(); self.start();
fipamoPosts.postList.toArray(array => fipamoPosts.postList.toArray(array =>
{ {
console.log(array[21].post.title); //console.log(array[21].post.title);
}) })
}).catch(Dexie.BulkError, e => }).catch(Dexie.BulkError, e =>
{ {

View file

@ -11,6 +11,8 @@ from '../../../../../brain//tools/utilities/DataUtils';
import * as DataEvent from '../../../../../brain//tools/events/DataEvent'; import * as DataEvent from '../../../../../brain//tools/events/DataEvent';
import StringUtils from '../../../../../brain//tools/utilities/StringUtils'; import StringUtils from '../../../../../brain//tools/utilities/StringUtils';
import Dexie from 'dexie'; import Dexie from 'dexie';
import sanitize from 'sanitize-html'
var md = require('markdown-it')('commonmark');
class PostActions class PostActions
{ {
//-------------------------- //--------------------------
@ -18,14 +20,74 @@ class PostActions
//-------------------------- //--------------------------
constructor() constructor()
{ {
var folio = [];
this.dataUtils = new DataUtils(); this.dataUtils = new DataUtils();
this.db = new Dexie("fipamo_posts");
this.db.version(1).stores(
{
postList: 'id,post'
});
} }
//-------------------------- //--------------------------
// methods // methods
//-------------------------- //--------------------------
start() update(id, data, files)
{} {
let self = this;
return new Promise((resolve, reject) =>
{
let txt = document.createElement("textarea");
txt.innerHTML = document.getElementById('edit-post-text').innerHTML;
let html = txt.value;
html = html.replace(/<\/?span[^>]*>/g, ""); //removes highightjs styling
let buffed = sanitize(html,
{
allowedTags: ['del', 'a', 'iframe', 'img'],
allowedAttributes:
{
a: ['href', 'name', 'target'],
img: ['src'],
iframe: ['height', 'width', 'src', 'frameborder', 'allow', 'allowfullscreen']
}
})
buffed = new StringUtils().decodeHTML(buffed)
data.title = document.getElementById('post_title').value;
data.slug = new StringUtils().cleanString(document.getElementById('post_title').value)
data.plaintext = buffed;
data.html = md.render(buffed,
{
html: true,
xhtmlOut: true,
})
data.created = document.getElementById('post-date').value;
data.tags = document.getElementById('post_tags').value;
data.page = document.getElementById('option-page').getAttribute('data-active')
data.featured = document.getElementById('option-feature').getAttribute('data-active')
data.published = document.getElementById('option-published').getAttribute('data-active')
this.db.postList.update(Number(id), {post:data}).then(updated =>
{
self.db.postList.toArray(array =>
{
self.dataUtils.request('/api/post/sync', DataEvent.POSTS_SYNCED, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, array).then((response) =>
{
resolve(
{
response
})
}).catch((err) =>
{
reject(
{
err
});
})
})
//(updated) ? resolve("UPDATED") : reject("NOT UPDATED");
});
})
}
sync(files) sync(files)
{ {
let self = this; let self = this;
@ -49,11 +111,8 @@ class PostActions
{ {
postList: 'id,post' postList: 'id,post'
}); });
fipamoPosts.postList.toArray(array => fipamoPosts.postList.toArray(array =>
{ {
console.log(array);
self.dataUtils.request('/api/post/sync', DataEvent.POSTS_SYNCED, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, array).then((response) => self.dataUtils.request('/api/post/sync', DataEvent.POSTS_SYNCED, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, array).then((response) =>
{ {
resolve( resolve(

View file

@ -17,7 +17,7 @@ import TinyDatePicker from 'tiny-date-picker';
import DateUtils from '../../../../../brain/tools/utilities/DateUtils'; import DateUtils from '../../../../../brain/tools/utilities/DateUtils';
import TextEditor from '../../../../../brain/tools/ui/TextEditor'; import TextEditor from '../../../../../brain/tools/ui/TextEditor';
import Dexie from 'dexie'; import Dexie from 'dexie';
class PostEditor export default class PostEditor
{ {
//-------------------------- //--------------------------
// constructor // constructor
@ -32,15 +32,13 @@ class PostEditor
this.dateUtils = new DateUtils(); this.dateUtils = new DateUtils();
this.urlPieces = document.URL.split("/"); this.urlPieces = document.URL.split("/");
this.post = []; this.post = [];
this.postID = document.getElementById('post-edit-index').getAttribute('data-index');
var fipamoPosts = new Dexie("fipamo_posts"); var fipamoPosts = new Dexie("fipamo_posts");
fipamoPosts.version(1).stores( fipamoPosts.version(1).stores(
{ {
postList: 'id, post' postList: 'id, post'
}); });
fipamoPosts.postList.get(Number(this.postID)).then(obj => this.setPost(obj.post));
fipamoPosts.postList.get(1).then(post=>{
});
if (document.getElementById('edit-post-text')) if (document.getElementById('edit-post-text'))
{ {
this.editor = new TextEditor(document.getElementById('edit-post-text'), document.getElementById('header').offsetHeight + document.getElementById('post-header').offsetHeight + document.getElementById('post-feature').offsetHeight); this.editor = new TextEditor(document.getElementById('edit-post-text'), document.getElementById('header').offsetHeight + document.getElementById('post-header').offsetHeight + document.getElementById('post-feature').offsetHeight);
@ -59,11 +57,15 @@ class PostEditor
} }
}); });
} }
this.start();
} }
//-------------------------- //--------------------------
// methods // methods
//-------------------------- //--------------------------
setPost(array)
{
this.post = array;
this.start();
}
start() start()
{ {
let self = this; let self = this;
@ -118,6 +120,14 @@ class PostEditor
case EditorEvent.EDITOR_UPDATE: case EditorEvent.EDITOR_UPDATE:
let edit = false; let edit = false;
//if (e == EditorEvent.EDITOR_UPDATE) edit = true; //if (e == EditorEvent.EDITOR_UPDATE) edit = true;
new PostActions().update(this.postID, this.post, PostEditor.uploadFiles).then(response=>{
this.editor.notify(DataEvent.POST_UPDATED, this.postID);
}).catch(err=>{
console.log("ERROR", err)
})
/**
new PostActions().sync(PostEditor.uploadFiles).then((response) => new PostActions().sync(PostEditor.uploadFiles).then((response) =>
{ {
let note = JSON.parse(response['response']['request'].response); let note = JSON.parse(response['response']['request'].response);
@ -127,7 +137,7 @@ class PostEditor
{ {
console.log(err) console.log(err)
}); });
*/
/* /*
new PostActions().submitPost(edit, PostEditor.uploadFiles).then((response) => new PostActions().submitPost(edit, PostEditor.uploadFiles).then((response) =>
{ {
@ -267,8 +277,3 @@ class PostEditor
} }
} }
PostEditor.uploadFiles = []; PostEditor.uploadFiles = [];
export
{
PostEditor as
default
}