Skip to content

Commit

Permalink
refactor: remove clipboardhelper dependency
Browse files Browse the repository at this point in the history
Use Clipboard API to copy the stacktrace to clipboard
  • Loading branch information
flang authored and javier-godoy committed Dec 2, 2022
1 parent 9fac202 commit 2b9ea50
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
7 changes: 1 addition & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,7 @@
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.vaadin.olli</groupId>
<artifactId>clipboardhelper</artifactId>
<version>1.2.0</version>
</dependency>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.Html;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.ButtonVariant;
import com.vaadin.flow.component.dependency.CssImport;
Expand All @@ -39,7 +40,6 @@
import java.util.stream.Stream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.vaadin.olli.ClipboardHelper;

/**
* Component to visualize an error, caused by an exception, as a modal sub-window. <br>
Expand Down Expand Up @@ -177,10 +177,10 @@ private VerticalLayout createMainLayout() {
// copy details to clipboard button
Button clipboarButton = new Button(i18n.getClipboard());
clipboarButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY);
ClipboardHelper clipboardHelper = new ClipboardHelper(getStackTrace(), clipboarButton);
buttonsLayout.add(clipboardHelper);
buttonsLayout.setAlignSelf(Alignment.START, clipboardHelper);
buttonsLayout.setFlexGrow(1.0, clipboardHelper);
clipboarButton.addClickListener(e -> UI.getCurrent().getPage()
.executeJs("navigator.clipboard.writeText($0)", getStackTrace()));
clipboarButton.getStyle().set("margin-right", "auto");
buttonsLayout.add(clipboarButton);

// show details button
Button button = createDetailsButtonLayout();
Expand Down

0 comments on commit 2b9ea50

Please sign in to comment.