Ionaru/easy-markdown-editor

Allow .iix file type for images if .iix is in the imageAccept property

robhumphries5 opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
I am using EasyMDE with ServiceNow and images are stored at paths ending with .iix.
EasyMDE is interpreting these as links.
I understand .iix is not necessarily an image, but in this case I am also explicitly using the "Import an Image" action and I have added image/iix to the imageAccept property of the editor.

Describe the solution you'd like
EasyMDE to process .iix link paths as images if .iix is in the imageAccept property

Describe alternatives you've considered
There are alternatives in ServiceNow like creating an endpoint that converts requests for /abc.png to /abc.iix and return the result.

Additional context
N/A

I have added a workaround like this but it would be nice if iix was supported

editor.codemirror.on("changes",function(event){
	var value = event.getTextArea().value;
	var regex = /[^!]\[[a-z0-9]{32}\.iix/gm;
	var linksThatShouldBeImages = value.match(regex);
	if(!linksThatShouldBeImages){
		return;
	}
	linksThatShouldBeImages.forEach(function(link){
		var firstChar = link.substring(0,1);
		var rest = link.substring(1,link.length);
		value = value.replace(link,firstChar+"!"+rest);
	});
	editor.value(value);
	
});