How can I get Zemanta and Redactor to work together?

I am trying to use Zemanta widgets and Redactor HTML together. I can not get Zemanta to find Redactor iframe/content and be able to send updates to it after clicking on one of the widgets.

Redactor creates an iframe , but keeps the real textarea hidden behind the curtains, I assume that you are sending updates between them, but I cannot figure out how to update both at once. If I update textarea using its ID , it works, but I do not see it in Redactor, if I do not click code view . If I use the iframe class, I see it in the editor, but it does not make changes inside textarea , and when I save, I get nothing.

 .redactor_frame (redactor IFRAME) #zemanta_content (textarea) 

How can I update both Zemanta widgets?

  get_editor: function () { var elm = null, win = null, editor = {element: null, property: null, type: null, win: null}; try { elm = $('.redactor_frame').get(0); if (elm && elm.contentWindow) { win = elm.contentWindow; elm = null; } else { elm = $('#zemanta_content').get(0); } editor = win && {element: win.document.body, property: 'innerHTML', type: 'RTE', win: win} || elm && {element: elm, property: 'value', type: elm.tagName.toLowerCase(), win: null} || editor; } catch (er) { $.zemanta.log(er); } return editor; } 
+4
source share
2 answers

Andraz from Zemant is here.

I'm not sure that this will be easy to fix, but we will take care of our developers to take a look at this.

Since the Redactor editor behaves in a slightly non-standard way, it might be best to turn to their support.

+2
source

as Andraz pointed out, overriding / changing only get_editor () in this case will be insufficient. However, I can point to another solution. Other editors seem to update the text box, which they update with iframes quite often, if not constantly, and you see that it is as if they have the same state. Now, if you use only one, you can copy the contents using JavaScript from the current active to the background, associated with some key actions (save, update). This approach will save you a lot of time and is probably very simple to implement.

Did this help you?

+1
source

All Articles