fix: note embedding in Pages editor (#9604)

This commit is contained in:
futchitwo 2023-01-15 23:47:04 +09:00 committed by GitHub
parent a9acd72eb7
commit 7795ff0c95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -37,20 +37,16 @@ const emit = defineEmits<{
let id: any = $ref(props.modelValue.note); let id: any = $ref(props.modelValue.note);
let note: any = $ref(null); let note: any = $ref(null);
watch(id, async () => { watch($$(id), async () => {
if (id && (id.startsWith('http://') || id.startsWith('https://'))) { if (id && (id.startsWith('http://') || id.startsWith('https://'))) {
emit('update:modelValue', { id = (id.endsWith('/') ? id.slice(0, -1) : id).split('/').pop();
...props.modelValue, }
note: (id.endsWith('/') ? id.slice(0, -1) : id).split('/').pop(),
});
} else {
emit('update:modelValue', { emit('update:modelValue', {
...props.modelValue, ...props.modelValue,
note: id, note: id,
}); });
} note = await os.api('notes/show', { noteId: id });
note = await os.api('notes/show', { noteId: props.modelValue.note });
}, { }, {
immediate: true, immediate: true,
}); });