Skip to content

Commit

Permalink
fix: addressing prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Mozolevsky authored and Dmitry Mozolevsky committed Aug 2, 2024
1 parent 79a4276 commit e406539
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 25 deletions.
38 changes: 14 additions & 24 deletions src/ui/src/core_components/base/BaseControlBar.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
<template>
<div class="BaseControlBar">
<button v-if="props.copyStructuredContent" class="control-button"
@click="copyToClipboard({ text: props.copyStructuredContent })">
<button
v-if="props.copyStructuredContent"
class="control-button"
@click="copyToClipboard({ text: props.copyStructuredContent })"
>
Copy JSON
</button>
<button v-if="props.copyRawContent" class="control-button"
@click="copyToClipboard({ text: props.copyRawContent })">
<button
v-if="props.copyRawContent"
class="control-button"
@click="copyToClipboard({ text: props.copyRawContent })"
>
Copy
</button>
</div>
Expand All @@ -17,29 +23,13 @@ const props = defineProps<{
copyStructuredContent?: string;
}>();
function setClipboardData<T = unknown>(
source: T & { clipboardData: DataTransfer | null | undefined },
{ text, html }: { text?: string; html?: string },
): void {
if (text) {
source.clipboardData?.setData("text/plain", text);
source.clipboardData?.setData("Text", text); // IE mimetype
}
if (html) {
source.clipboardData?.setData("text/html", html);
}
}
function copyToClipboard({
text = "",
}: {
text?: string;
}) {
function copyToClipboard({ text = "" }: { text?: string }) {
try {
navigator.clipboard.writeText(text);
// eslint

Check failure on line 29 in src/ui/src/core_components/base/BaseControlBar.vue

View workflow job for this annotation

GitHub Actions / build (3.12)

Insert `↹`

Check failure on line 29 in src/ui/src/core_components/base/BaseControlBar.vue

View workflow job for this annotation

GitHub Actions / build (3.10)

Insert `↹`

Check failure on line 29 in src/ui/src/core_components/base/BaseControlBar.vue

View workflow job for this annotation

GitHub Actions / build (3.11)

Insert `↹`

Check failure on line 29 in src/ui/src/core_components/base/BaseControlBar.vue

View workflow job for this annotation

GitHub Actions / build (3.9)

Insert `↹`

Check failure on line 29 in src/ui/src/core_components/base/BaseControlBar.vue

View workflow job for this annotation

GitHub Actions / build (3.10)

Insert `↹`

Check failure on line 29 in src/ui/src/core_components/base/BaseControlBar.vue

View workflow job for this annotation

GitHub Actions / build (3.11)

Insert `↹`

Check failure on line 29 in src/ui/src/core_components/base/BaseControlBar.vue

View workflow job for this annotation

GitHub Actions / build (3.10)

Insert `?`
} catch (error) {
console.error(error.message);
// eslint-disable-next-line no-console
console.error(error);
}
}
</script>
Expand Down
5 changes: 4 additions & 1 deletion src/ui/src/core_components/content/CoreAnnotatedText.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<template>
<div class="AnnotatedText">
<span v-for="(content, i) in fields.text.value" :key="String(content) + i">
<span
v-for="(content, i) in fields.text.value"
:key="String(content) + i"
>
<template v-if="typeof content === 'string'">{{
content
}}</template>
Expand Down

0 comments on commit e406539

Please sign in to comment.