Skip to content

Commit 4c5cee9

Browse files
Fixes #17 - Better check for edite mode
1 parent 1d1a3b6 commit 4c5cee9

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

dist/js/field.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/js/components/Slug/FormField.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ export default {
3030
*/
3131
mounted() {
3232
Nova.$on('field-update-' + this.field.attribute, ({value}) => {
33-
if (this.field.disableAutoUpdateWhenUpdating === false) {
34-
this.value = slugify(value, this.field.slugifyOptions || {});
33+
if (this.field.disableAutoUpdateWhenUpdating === true && this.$router.currentRoute.name !== 'create') {
34+
return;
3535
}
36+
this.value = slugify(value, this.field.slugifyOptions || {});
3637
})
3738
},
3839

src/Slug.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ public function slugifyOptions(array $options): Element
5757
*/
5858
public function disableAutoUpdateWhenUpdating(): Element
5959
{
60-
if (request()->get('editMode') !== 'create') {
61-
$this->disableAutoUpdateWhenUpdating = true;
62-
}
60+
$this->disableAutoUpdateWhenUpdating = true;
6361
return $this;
6462
}
6563

0 commit comments

Comments
 (0)