Commit 6a247d84 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch '229588-pasting-an-image-into-a-comment-also-uploads-design' into 'master'

Resolve "Pasting an image into a comment also uploads design"

See merge request gitlab-org/gitlab!37171
parents e58a2eea 4f798c21
...@@ -246,28 +246,28 @@ export default { ...@@ -246,28 +246,28 @@ export default {
this.onUploadDesign([newFile]); this.onUploadDesign([newFile]);
} }
}, },
toggleOnPasteListener(route) { toggleOnPasteListener() {
if (route === DESIGNS_ROUTE_NAME) { document.addEventListener('paste', this.onDesignPaste);
document.addEventListener('paste', this.onDesignPaste); },
} else { toggleOffPasteListener() {
document.removeEventListener('paste', this.onDesignPaste); document.removeEventListener('paste', this.onDesignPaste);
}
}, },
}, },
beforeRouteUpdate(to, from, next) { beforeRouteUpdate(to, from, next) {
this.toggleOnPasteListener(to.name);
this.selectedDesigns = []; this.selectedDesigns = [];
next(); next();
}, },
beforeRouteLeave(to, from, next) {
this.toggleOnPasteListener(to.name);
next();
},
}; };
</script> </script>
<template> <template>
<div data-testid="designs-root" class="gl-mt-5"> <div
data-testid="designs-root"
class="gl-mt-5"
:class="{ 'designs-root': !isDesignListEmpty }"
@mouseenter="toggleOnPasteListener"
@mouseleave="toggleOffPasteListener"
>
<header v-if="showToolbar" class="row-content-block border-top-0 p-2 d-flex"> <header v-if="showToolbar" class="row-content-block border-top-0 p-2 d-flex">
<div class="gl-display-flex gl-justify-content-space-between gl-align-items-center gl-w-full"> <div class="gl-display-flex gl-justify-content-space-between gl-align-items-center gl-w-full">
<div> <div>
......
.designs-root {
border: 2px dashed transparent;
transition: border $gl-transition-duration-medium $general-hover-transition-curve;
&:hover {
border-color: $gray-100;
}
}
.design-list-item { .design-list-item {
height: 280px; height: 280px;
text-decoration: none; text-decoration: none;
......
---
title: Resolve Pasting an image into a comment also uploads design
merge_request: 37171
author:
type: fixed
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
exports[`Design management index page designs does not render toolbar when there is no permission 1`] = ` exports[`Design management index page designs does not render toolbar when there is no permission 1`] = `
<div <div
class="gl-mt-5" class="gl-mt-5 designs-root"
data-testid="designs-root" data-testid="designs-root"
> >
<!----> <!---->
...@@ -87,7 +87,7 @@ exports[`Design management index page designs does not render toolbar when there ...@@ -87,7 +87,7 @@ exports[`Design management index page designs does not render toolbar when there
exports[`Design management index page designs renders designs list and header with upload button 1`] = ` exports[`Design management index page designs renders designs list and header with upload button 1`] = `
<div <div
class="gl-mt-5" class="gl-mt-5 designs-root"
data-testid="designs-root" data-testid="designs-root"
> >
<header <header
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment