|
@ -11,6 +11,7 @@ patch(ChatGPTDialog.prototype, { |
|
|
setup() { |
|
|
setup() { |
|
|
super.setup(...arguments); |
|
|
super.setup(...arguments); |
|
|
this.action = useService('action'); |
|
|
this.action = useService('action'); |
|
|
|
|
|
this.notification = useService("notification"); |
|
|
}, |
|
|
}, |
|
|
// Copy the generated AI text into clipboard when hitting the Copy button
|
|
|
// Copy the generated AI text into clipboard when hitting the Copy button
|
|
|
copyMessage(ev) { |
|
|
copyMessage(ev) { |
|
@ -22,16 +23,16 @@ patch(ChatGPTDialog.prototype, { |
|
|
textArea.select(); |
|
|
textArea.select(); |
|
|
var successful = document.execCommand('copy'); |
|
|
var successful = document.execCommand('copy'); |
|
|
document.body.removeChild(textArea) |
|
|
document.body.removeChild(textArea) |
|
|
// Display notification after copying the text
|
|
|
this.displayNotification( |
|
|
this.action.doAction({ |
|
|
("Text copied to Clipboard") |
|
|
type: "ir.actions.client", |
|
|
); |
|
|
tag: "display_notification", |
|
|
return successful; |
|
|
params: { |
|
|
|
|
|
title: "Text copied", |
|
|
|
|
|
message: "Text copied to Clipboard!", |
|
|
|
|
|
sticky: false, |
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
displayNotification(text) { |
|
|
|
|
|
this.notification.add(text, { |
|
|
|
|
|
type: 'success', |
|
|
|
|
|
title: 'Text copied', |
|
|
|
|
|
sticky: false, |
|
|
}); |
|
|
}); |
|
|
return successful; |
|
|
|
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|