Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: enable legacy to useClipboard (#10530)

boojackdb36afff8ce0
diff --git a/frontend/src/components/SensitiveData/components/ClassificationExampleModal.vue b/frontend/src/components/SensitiveData/components/ClassificationExampleModal.vue
index 324c49b845..3330df2743 100644
--- a/frontend/src/components/SensitiveData/components/ClassificationExampleModal.vue
+++ b/frontend/src/components/SensitiveData/components/ClassificationExampleModal.vue
@@ -94,10 +94,21 @@ const example = {
],
};
-const { copy: copyTextToClipboard } = useClipboard();
+const { copy: copyTextToClipboard, isSupported } = useClipboard({
+ legacy: true,
+});
const { t } = useI18n();
const handleCopy = () => {
+ if (!isSupported.value) {
+ pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: "Copy to clipboard is not enabled in your browser.",
+ });
+ return;
+ }
+
copyTextToClipboard(JSON.stringify(example, null, 2));
pushNotification({
module: "bytebase",
diff --git a/frontend/src/views/SettingWorkspaceDebugLog.vue b/frontend/src/views/SettingWorkspaceDebugLog.vue
index a6ad193ec0..b767c84574 100644
--- a/frontend/src/views/SettingWorkspaceDebugLog.vue
+++ b/frontend/src/views/SettingWorkspaceDebugLog.vue
@@ -108,8 +108,9 @@ const logString = computed(() => {
});
const { t } = useI18n();
-const { copy } = useClipboard({
+const { copy, isSupported } = useClipboard({
source: logString,
+ legacy: true,
});
const notificationStore = useNotificationStore();
const debugLogList = useDebugLogList();
@@ -149,6 +150,15 @@ const handleExport = () => {
};
const handleCopy = () => {
+ if (!isSupported.value) {
+ notificationStore.pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: "Copy to clipboard is not enabled in your browser.",
+ });
+ return false;
+ }
+
copy();
notificationStore.pushNotification({
module: "bytebase",
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DetailPanel.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/DetailPanel.vue
index 38732a5816..5b322f4fde 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DetailPanel.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DetailPanel.vue
@@ -118,6 +118,7 @@ const { copy, copied } = useClipboard({
source: computed(() => {
return detailValue.value ?? "";
}),
+ legacy: true,
});
const handleCopy = () => {
copy().then(() => {
diff --git a/frontend/src/views/sql-editor/EditorCommon/SharePopover.vue b/frontend/src/views/sql-editor/EditorCommon/SharePopover.vue
index 7d99045608..f1e73b13fc 100644
--- a/frontend/src/views/sql-editor/EditorCommon/SharePopover.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/SharePopover.vue
@@ -170,6 +170,7 @@ const sharedTabLink = computed(() => {
const { copy, copied } = useClipboard({
source: sharedTabLink.value,
+ legacy: true,
});
const handleCopy = async () => {
diff --git a/frontend/src/views/sql-editor/SecondarySidebar/HistoryTabPane/HistoryTabPane.vue b/frontend/src/views/sql-editor/SecondarySidebar/HistoryTabPane/HistoryTabPane.vue
index 12e9ceade2..1949618510 100644
--- a/frontend/src/views/sql-editor/SecondarySidebar/HistoryTabPane/HistoryTabPane.vue
+++ b/frontend/src/views/sql-editor/SecondarySidebar/HistoryTabPane/HistoryTabPane.vue
@@ -90,7 +90,9 @@ const state = reactive<State>({
currentActionHistory: null,
});
-const { copy: copyTextToClipboard } = useClipboard();
+const { copy: copyTextToClipboard, isSupported } = useClipboard({
+ legacy: true,
+});
const isLoading = computed(() => {
return sqlEditorStore.isFetchingQueryHistory;
@@ -140,6 +142,15 @@ const notifyMessage = computed(() => {
});
const handleCopy = (history: QueryHistory) => {
+ if (!isSupported.value) {
+ pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: "Copy to clipboard is not enabled in your browser.",
+ });
+ return;
+ }
+
state.currentActionHistory = history;
copyTextToClipboard(history.statement);
pushNotification({
diff --git a/frontend/src/views/sql-editor/SecondarySidebar/InfoTabPane/SchemaPanel/StringifyMetadataButton.vue b/frontend/src/views/sql-editor/SecondarySidebar/InfoTabPane/SchemaPanel/StringifyMetadataButton.vue
index e764f9b5ea..026e8e9905 100644
--- a/frontend/src/views/sql-editor/SecondarySidebar/InfoTabPane/SchemaPanel/StringifyMetadataButton.vue
+++ b/frontend/src/views/sql-editor/SecondarySidebar/InfoTabPane/SchemaPanel/StringifyMetadataButton.vue
@@ -70,7 +70,9 @@ const props = defineProps<{
const { t } = useI18n();
const dbSchemaStore = useDBSchemaV1Store();
-const { copy: copyTextToClipboard } = useClipboard();
+const { copy: copyTextToClipboard, isSupported } = useClipboard({
+ legacy: true,
+});
const schemaString = ref<string | null>(null);
const isFetching = ref<boolean>(false);
@@ -112,6 +114,15 @@ onMounted(async () => {
});
const handleCopySchemaString = () => {
+ if (!isSupported.value) {
+ pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: "Copy to clipboard is not enabled in your browser.",
+ });
+ return;
+ }
+
copyTextToClipboard(schemaString.value || "");
pushNotification({
module: "bytebase",