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 ede0cf7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 25 deletions.
37 changes: 13 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,12 @@ 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);
} 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 ede0cf7

Please sign in to comment.