@thecodeblogs/blog 0.20.4 → 0.20.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1419,10 +1419,19 @@ class EntryWysiwygComponent {
|
|
|
1419
1419
|
const savedEntry = localStorage.getItem(EntryCreatorComponent.CURRENT_ENTRY_KEY);
|
|
1420
1420
|
if (savedEntry) {
|
|
1421
1421
|
this.entry = new Entry(JSON.parse(savedEntry));
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1422
|
+
// Check if entry is already published, if it is, we'll remove it:
|
|
1423
|
+
this.entryService.getUnpublishedById(this.entry.id).subscribe(result => {
|
|
1424
|
+
const newValue = {
|
|
1425
|
+
'html': this.entryService.convertBlogToHtmlFormat(this.entry)
|
|
1426
|
+
};
|
|
1427
|
+
this.entry.slug = this.entryService.slugify(this.entry.title).toLowerCase();
|
|
1428
|
+
this.form.patchValue(newValue);
|
|
1429
|
+
}, error => {
|
|
1430
|
+
this.entry = null;
|
|
1431
|
+
localStorage.removeItem(EntryCreatorComponent.CURRENT_ENTRY_KEY);
|
|
1432
|
+
alert('The previously created post has been published and is no longer available.');
|
|
1433
|
+
this.seeEntries();
|
|
1434
|
+
});
|
|
1426
1435
|
}
|
|
1427
1436
|
else {
|
|
1428
1437
|
this.seeEntries();
|
|
@@ -1432,8 +1441,10 @@ class EntryWysiwygComponent {
|
|
|
1432
1441
|
.subscribe(value => {
|
|
1433
1442
|
var blogPost = value;
|
|
1434
1443
|
this.entry = this.entryService.convertHtmlToBlogFormat(this.entry, blogPost);
|
|
1435
|
-
this.entryService.
|
|
1444
|
+
this.entry.slug = this.entryService.slugify(this.entry.title).toLowerCase();
|
|
1445
|
+
this.entry.sort();
|
|
1436
1446
|
localStorage.setItem(EntryCreatorComponent.CURRENT_ENTRY_KEY, JSON.stringify(this.entry));
|
|
1447
|
+
this.entryService.currentlyEditedEntry.next(this.entry);
|
|
1437
1448
|
});
|
|
1438
1449
|
}
|
|
1439
1450
|
seeEntries() {
|