# j-ContentEditable

> j-ContentEditable : utilisation facile ; prend en charge d'excellentes fonctionnalités

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: fr
Content-SHA256: 8a4fc6c25bbab7ed6baf26ce7def37306853d523a59dddee228e8e527e70af7f
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

- prend en charge d'excellentes fonctionnalités
- fonctionne avec le système Bootstrap Grid
- facile à personnaliser
- prend en charge les raccourcis de base `CMD+B` __bold__, `CMD+U` __underline__, `CMD+I` __italic__ et `CMD+L` __crée un lien__

__Attributs__ :
- `data-required="true"` en option, `false` par défaut
- `data-clipboard="text/plain"` en option, `text/plain` par défaut (pour la prise en charge de `html`, utilisez `text/html`)

__Méthodes__ :
- `component.getNode()` renvoie une sélection `node` dans le texte `{Object}`
- `component.getSelection()` renvoie une sélection actuelle `{String}`
- `component.insert(value, [encode])` insère un texte HTML ou PLAIN personnalisé à la position actuelle du curseur, `encode` (facultatif) est par défaut `false`
- `component.exec('Bold', false, null)` a les mêmes fonctionnalités que `document.execCommand()`

__Gestionnaires__ :
`component.event(type, value)` gère tous les événements de l'éditeur.

```html
type = bold          - when a text is bolded (value is boolean)
type = italic        - when a text is italic (value is boolean)
type = underline     - when a text is underlined (value is boolean)
type = link          - when a link is created (value is a temporary URL)
type = current       - when a current element is changed in the text (value is NODE)
type = paste         - when the clipboard is used (value is a clipboard value)
type = select        - when a text is selected (value is selected text)
type = focus         - editor is focused (value is undefined)
type = blur          - editor is not focused (value is undefined)
type = click         - click on the specific element in the text (value is NODE)
```

__Déclaration par défaut__ :

```javascript
self.event = function(type, value) {
    if (type === 'paste')
        self.insert(value, true);
};
```

Utilisez-le avec `<ui-component name="contenteditable">`. Lorsque le composant n'est pas encore chargé, jComponent le télécharge lors de la première utilisation depuis l'adresse dans `DEF.fallback` (le CDN Componentator par défaut). Auteur : Peter Širka. Source : le référentiel de composants Componentator, licence MIT.

```html example.html
<div class="container">
	<div class="row">
		<div class="col-md-6">
			<ui-component name="contenteditable" path="myhtml"></ui-component>
		</div>
	</div>
</div>
```
