Insertion d'images inopérante
Bonjour,
Lorsque je clique sur le bouton image, l'image n'est pas insérée.
- J'ai lu le message de la console:
- A partir du lien indiqué, j'ai configuré CKEditor (voir code ci-dessous) pour le plugin choisi (simpleUpload)
- Par contre, je ne trouve pas comment charger et installer ce plugin à partir de la page d'installation. Je bloque sur
Citation:
First, install the @ckeditor/ckeditor5-upload package:
npm install --save @ckeditor/ckeditor5-upload
Peut-on simplifier ce code?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| const config = {
extraPlugins: [ 'SimpleUploadAdapter', 'image' ]
};
DecoupledEditor
.create( document.querySelector( '#editor' ), {
language: 'fr',
placeholder: "Entrez votre texte ici.",
toolbar: {
removeItems: ['insertTable', 'mediaEmbed']
},
simpleUpload: {
// The URL that the images are uploaded to.
uploadUrl: 'http:sirep.proginet.local/customers', // path where the image will be uploaded // to be updated
// Enable the XMLHttpRequest.withCredentials property.
withCredentials: true,
},
// Headers sent along with the XMLHttpRequest to the upload server.
headers: {
'X-CSRF-TOKEN': 'CSRF-Token',
Authorization: 'Bearer <JSON Web Token>'
}
} )
.then( editor => {
const toolbarContainer = document.querySelector( '#toolbar-container' );
ckEditor = editor;
toolbarContainer.appendChild( editor.ui.view.toolbar.element );
} )
.catch( error => {
console.error( error );
} );
let a= DecoupledEditor.builtinPlugins.map( plugin => plugin.pluginName );
console.table(a); |