Override TinyMCE markup when a file is dragged in

Nat
Nat
Vote:
 

I would like to override the markup generated when a file (pdf in this case) is dropped into the TinyMCE editor. as I would like to add some extra properties to the markup which are present on the file itself.

the PdfFile type is a expandsion on the MediaData class, with things like filesize and title.

currently it generates this:

<p><a title="some-pdf.pdf" href="some-pdf.pdf">some pdf</a></p>

I would like something more like:

<p><a title="pdfTitle" href="some-pdf.pdf" data-some-attribute="pdfTitle">some pdf (PdfFileSize)</a></p>

I am unsure as to

  1. how to amend the template which is used by TinyMCE - if that is how it works
  2. how to grab the extra properties in this instance to insert into the template

I know when the file is dropped into the editor, it calls an ajax method, which returns the markup /EPiServer/cms/Stores/contentdata/contentId_workID but that is about it

thanks

#225720
Edited, Jul 24, 2020 10:16
Vote:
 

Hi Nat,

I think you can use Patrick article for a starting point and then do whatever you want

https://www.patrickvankleef.com/2017/02/26/episerver-customize-the-drop-behavior-in-tinymce/

#225721
Jul 24, 2020 10:33
Nat
Vote:
 

thanks Ravindra, I had a go with that, but it doesnt deal with 'templating' the new TinyMCE content, or how to avoid being limited by the 

CreateLink
CreateContentBlock

Which very much limits the markup that can be dumped out, as anything that is returned by the rest store at that point is ignored if it is not url/text (for create link) and similr for createContentBlock. 
I can make a tinyMCE plugin and check for the type of a dropped element, going to the rest store at that point to get the extra properties render as I need. But that avoids pretty much everything in Patricks article, and seems pretty hacky.

maybe I am missing something

#225723
Edited, Jul 28, 2020 12:45
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.