Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions resources/js/components/fieldtypes/LinkFieldtype.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
<script>
import Fieldtype from './Fieldtype.vue';
import { Input, Select } from '@/components/ui';
import debounce from '@/util/debounce.js';
import { markRaw } from 'vue';

export default {
components: { Input, Text, Select },
Expand All @@ -60,6 +62,13 @@ export default {
};
},

created() {
this.syncUrlDebounced = markRaw(debounce((url) => {
this.update(url);
this.updateMeta({ ...this.meta, initialUrl: url });
}, 150));
},

computed: {
entryValue() {
return this.selectedEntries.length ? `entry::${this.selectedEntries[0]}` : null;
Expand Down Expand Up @@ -116,12 +125,11 @@ export default {

urlValue(url) {
if (this.metaChanging) return;

this.update(url);
this.updateMeta({ ...this.meta, initialUrl: url });
this.syncUrlDebounced(url);
},

meta(meta, oldMeta) {
if (meta === oldMeta) return;
if (JSON.stringify(meta) === JSON.stringify(oldMeta)) return;

this.metaChanging = true;
Expand Down
Loading