Skip to content

Commit a298112

Browse files
committed
fixes to the auto saving
1 parent b063505 commit a298112

File tree

8 files changed

+23
-16
lines changed

8 files changed

+23
-16
lines changed

public/app.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/dark.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/light.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/mix-manifest.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"/app.js": "/app.js?id=3261b2da6aeec1f70422",
3-
"/light.css": "/light.css?id=30c0155cfd6fa7204a30",
4-
"/dark.css": "/dark.css?id=d4a7c714f436c5fcccd6",
2+
"/app.js": "/app.js?id=a1763873e1bd0b22663f",
3+
"/light.css": "/light.css?id=00726a847dc6b2cb132a",
4+
"/dark.css": "/dark.css?id=aa5f40a240d2b1df06e2",
55
"/favicon.png": "/favicon.png?id=b0b34b4095fcdbb8942d"
66
}

resources/js/components/Editor.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
},
6969
theme: 'bubble',
7070
scrollingContainer: 'html, body',
71-
placeholder: "Write to the world..."
71+
placeholder: "Starting writing now..."
7272
});
7373
},
7474

resources/js/screens/posts/edit.vue

+14-8
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
2929
errors: [],
3030
31-
formWatcher: null,
31+
postBodyWatcher: null,
3232
3333
form: {
3434
id: '',
@@ -66,12 +66,12 @@
6666
},
6767
6868
'form.published'(val) {
69-
if (this.formWatcher) {
70-
this.formWatcher();
69+
if (this.postBodyWatcher) {
70+
this.postBodyWatcher();
7171
}
7272
7373
if (!val) {
74-
this.watchChangesAndSave();
74+
this.watchBodyChangesAndSave();
7575
}
7676
},
7777
@@ -156,17 +156,17 @@
156156
}
157157
158158
if (!this.form.published) {
159-
this.watchChangesAndSave();
159+
this.watchBodyChangesAndSave();
160160
}
161161
},
162162
163163
164164
/**
165165
* Watch changes and save the post.
166166
*/
167-
watchChangesAndSave() {
167+
watchBodyChangesAndSave() {
168168
setTimeout(() => {
169-
this.formWatcher = this.$watch('form', _.debounce(() => this.save(), 1000), {deep: true});
169+
this.postBodyWatcher = this.$watch('form.body', _.debounce(() => this.save(), 1000), {deep: true});
170170
}, 1000);
171171
},
172172
@@ -183,7 +183,7 @@
183183
this.authors = response.data.data;
184184
185185
if (!this.form.author_id && this.authors) {
186-
this.form.author_id = _.first(this.authors).id;
186+
this.form.author_id = this.Wink.author.id;
187187
}
188188
});
189189
},
@@ -306,13 +306,19 @@
306306
this.errors = [];
307307
this.status = 'Saving...';
308308
309+
if (this.form.title != 'Draft' && (!this.form.slug || this.form.slug.startsWith('draft-'))) {
310+
this.form.slug = this.slugify(this.form.title);
311+
}
312+
309313
this.http().post('/api/posts/' + this.id, this.form).then(response => {
310314
this.status = '';
311315
312316
if (this.id == 'new') {
313317
this.$router.push({name: 'post-edit', params: {id: this.form.id}})
314318
}
315319
}).catch(error => {
320+
this.status = '';
321+
316322
this.errors = error.response.data.errors;
317323
318324
this.settingsModalShown = true;

resources/sass/editor.scss

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
}
140140

141141
.ql-editor.ql-blank::before {
142+
color: config('colors.light');
142143
left: 0;
143144
font-style: normal;
144145
}

src/Http/Controllers/PostsController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function show($id = null)
4545
{
4646
if ($id === 'new') {
4747
return response()->json([
48-
'entry' => WinkPost::make(['id' => Str::uuid(), 'publish_date' => now()->toDateTimeString()]),
48+
'entry' => WinkPost::make(['id' => Str::uuid(), 'publish_date' => now()->format('Y-m-d H:i:00')]),
4949
]);
5050
}
5151

0 commit comments

Comments
 (0)