refactor(editor): Convert Sticky component to Options API (no-changelog) (#10975)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-09-26 14:15:11 +02:00
committed by GitHub
parent 06d749ffa7
commit b7951a071c
4 changed files with 280 additions and 315 deletions

View File

@@ -136,7 +136,7 @@ const htmlContent = computed(() => {
});
const emit = defineEmits<{
'markdown-click': [link: string, e: MouseEvent];
'markdown-click': [link: HTMLAnchorElement, e: MouseEvent];
'update-content': [content: string];
}>();
@@ -154,7 +154,7 @@ const onClick = (event: MouseEvent) => {
}
}
if (clickedLink) {
emit('markdown-click', clickedLink?.href, event);
emit('markdown-click', clickedLink, event);
}
};

View File

@@ -21,6 +21,7 @@ const emit = defineEmits<{
resize: [values: ResizeData];
resizestart: [];
resizeend: [];
'markdown-click': [link: HTMLAnchorElement, e: MouseEvent];
}>();
const attrs = useAttrs();
@@ -42,6 +43,10 @@ const onResizeEnd = () => {
isResizing.value = false;
emit('resizeend');
};
const onMarkdownClick = (link: HTMLAnchorElement, event: MouseEvent) => {
emit('markdown-click', link, event);
};
</script>
<template>
@@ -57,6 +62,6 @@ const onResizeEnd = () => {
@resize="onResize"
@resizestart="onResizeStart"
>
<N8nSticky v-bind="stickyBindings" />
<N8nSticky v-bind="stickyBindings" @markdown-click="onMarkdownClick" />
</N8nResizeWrapper>
</template>

View File

@@ -13,7 +13,7 @@ const props = withDefaults(defineProps<StickyProps>(), defaultStickyProps);
const emit = defineEmits<{
edit: [editing: boolean];
'update:modelValue': [value: string];
'markdown-click': [link: string, e: Event];
'markdown-click': [link: HTMLAnchorElement, e: MouseEvent];
}>();
const { t } = useI18n();
@@ -63,7 +63,7 @@ const onUpdateModelValue = (value: string) => {
emit('update:modelValue', value);
};
const onMarkdownClick = (link: string, event: Event) => {
const onMarkdownClick = (link: HTMLAnchorElement, event: MouseEvent) => {
emit('markdown-click', link, event);
};