From 1407c8fdef01ecd0ffb8a8bd46e7113f119b9fde Mon Sep 17 00:00:00 2001 From: julieng Date: Sat, 2 Oct 2021 17:20:24 +0200 Subject: convert content to md --- files/fr/web/api/element/copy_event/index.md | 127 +++++++++------------------ 1 file changed, 43 insertions(+), 84 deletions(-) (limited to 'files/fr/web/api/element/copy_event') diff --git a/files/fr/web/api/element/copy_event/index.md b/files/fr/web/api/element/copy_event/index.md index d4b370823a..042a046235 100644 --- a/files/fr/web/api/element/copy_event/index.md +++ b/files/fr/web/api/element/copy_event/index.md @@ -4,104 +4,63 @@ slug: Web/API/Element/copy_event translation_of: Web/API/Element/copy_event original_slug: Web/Events/copy --- -

L'événement copy est déclenché lorsque l'utilisateur initie une copie par le biais de l'interface du navigateur (par exemple, Ctrl/Cmd+C ou "copier" du menu contextuel) et en réponse d'un appel de {{domxref("Document.execCommand", "document.execCommand('copy')")}} autorisé.

+L'événement **copy** est déclenché lorsque l'utilisateur initie une copie par le biais de l'interface du navigateur (par exemple, Ctrl/Cmd+C ou "copier" du menu contextuel) et en réponse d'un appel de {{domxref("Document.execCommand", "document.execCommand('copy')")}} autorisé. -

Informations générales

+## Informations générales -
-
Spécification
-
Clipboard
-
Interface
-
{{domxref("ClipboardEvent")}}
-
Propagation
-
Oui
-
Annulable
-
Oui
-
Cible
-
{{domxref("Element")}}: L'élément ayant le focus (pour les éléments {{domxref("HTMLElement.contentEditable", "contentEditable")}} - l'élément contenant le début de la sélection), ou l'élément {{HTMLElement("body")}}
-
Action par défaut
-
Voir ce-dessous
-
+- Spécification + - : [Clipboard](https://www.w3.org/TR/clipboard-apis/#the-copy-action) +- Interface + - : {{domxref("ClipboardEvent")}} +- Propagation + - : Oui +- Annulable + - : Oui +- Cible + - : {{domxref("Element")}}: L'élément ayant le focus (pour les éléments {{domxref("HTMLElement.contentEditable", "contentEditable")}} - l'élément contenant le début de la sélection), ou l'élément {{HTMLElement("body")}} +- Action par défaut + - : Voir ce-dessous -

Un gestionnaire de cet événement peut modifier l'objet {{domxref("ClipboardEvent.clipboardData")}} en appellant {{domxref("DataTransfer.setData", "setData(format, data)")}}:

+Un gestionnaire de cet événement peut modifier l'objet {{domxref("ClipboardEvent.clipboardData")}} en appellant {{domxref("DataTransfer.setData", "setData(format, data)")}}: -
document.addEventListener('copy', function(e){
+```js
+document.addEventListener('copy', function(e){
     e.clipboardData.setData('text/plain', 'Hello, world!');
-    e.clipboardData.setData('text/html', '<b>Hello, world!</b>');
+    e.clipboardData.setData('text/html', 'Hello, world!');
     e.preventDefault(); // We want our data, not data from any selection, to be written to the clipboard
-});
+}); +``` -

Un gestionnaire de cet événement ne peut pas lire les données du presse-papiers en utilisant {{domxref("DataTransfer.getData", "clipboardData.getData()")}}.

+Un gestionnaire de cet événement ne peut pas lire les données du presse-papiers en utilisant {{domxref("DataTransfer.getData", "clipboardData.getData()")}}. -

L'action par défaut de l'événement dépend de la source de celui-ci et du comportement du gestionnaire:

+L'action par défaut de l'événement dépend de la source de celui-ci et du comportement du gestionnaire: - +- Un événement de copie [synthétique](/fr/docs/Web/Guide/Events/Creating_and_triggering_events) n'a pas d'action par défaut; +- Si l'événement n'a pas été annulé: Copie de la sélection (s'il y a) dans le presse-papiers; +- Si le gestionnaire a annulé l'événement et appelé setData(): Copie le contenu de _clipboardData_ de {{domxref("ClipboardEvent")}}; +- Si le gestionnaire a annulé l'événement sans appelé setData(): Aucune action. -

Propriétés

+## Propriétés - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyTypeDescription
target {{readonlyInline}}{{domxref("EventTarget")}}The event target (the topmost target in the DOM tree).
type {{readonlyInline}}{{domxref("DOMString")}}The type of event.
bubbles {{readonlyInline}}{{jsxref("Boolean")}}Whether the event normally bubbles or not.
cancelable {{readonlyInline}}{{jsxref("Boolean")}}Whether the event is cancellable or not.
+| Property | Type | Description | +| ------------------------------------- | ------------------------------------ | ------------------------------------------------------ | +| `target` {{readonlyInline}} | {{domxref("EventTarget")}} | The event target (the topmost target in the DOM tree). | +| `type` {{readonlyInline}} | {{domxref("DOMString")}} | The type of event. | +| `bubbles` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event normally bubbles or not. | +| `cancelable` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event is cancellable or not. | -

Spécifications

+## Spécifications - - - - - - - - - - - - - -
SpécificationStatut
{{SpecName('Clipboard API', '#clipboard-event-copy')}}{{Spec2('Clipboard API')}}
+| Spécification | Statut | +| ------------------------------------------------------------------------ | ------------------------------------ | +| {{SpecName('Clipboard API', '#clipboard-event-copy')}} | {{Spec2('Clipboard API')}} | -

Compatibilités navigateur

+## Compatibilités navigateur -

{{Compat("api.Element.copy_event")}}

+{{Compat("api.Element.copy_event")}} -

Voir aussi

+## Voir aussi - - \ No newline at end of file +- Événements relatifs : {{domxref("Element/cut_event", "cut")}}, {{domxref("Element/paste_event", "paste")}} +- Cet événement sur {{domxref("Document")}} cible : {{domxref("Document/copy_event", "copy")}} +- Cet événement sur {{domxref("Window")}} cible : {{domxref("Window/copy_event", "copy")}} -- cgit v1.2.3-54-g00ecf