Artistmind - Nicedit image bug microsoft edge work arround

Nicedit image bug microsoft edge work arround


Created: 2017-01-18 Last modified: 2017-01-18 Published: 2017-01-18
Omdat ik niet precies weet of ik Brian Kirchoff Nicedit as it is mag redistruberen maar jullie toch niet wil onthouden van de workarround maak ik er een tutorial van.

De bug zit in de browser Microsoft edge. Nicedit gebruikt de javascript functie:
document.execCommand("InsertImage", false, Image);
De Microsoft Edge browser voert het commando "InsertImage" niet uit en andere commando's wel. De workarround die we gaan gebruiken is niet InsertImage gebruiken maar insertHTML omdat deze commando wel werkt. In Nicedit zit execCommand ingebouwd in een functie van Nicedit. Daarom gaan we niet direct de execCommand functie wijzigen maar een andere functie namelijk nicCommand.
this.ne.nicCommand("insertImage",A); 
wordt:
this.ne.nicCommand("insertHTML",'<img align="'+this.inputs.align.value+'" alt="'+this.inputs.alt.value+'" src="'+this.inputs.src.value+'"> ';