WYSIWYG 'Add Image' feature breaks when you use the asset selector helper

Permalink
Has anyone run into this?

If you're building a custom form, and you put an asset selector on the page, and the page also has a field that has WYSIWYG capabilities, the WYSIWYG 'Add Image' button actually adds the image to the asset selector field, instead of to the WYSIWYG field.

I was hoping there might be a fix for this out there...

blakeage
 
blakeage replied on at Permalink Reply
blakeage
Actually, I should check the bug list before posting. This bug describes my issue:

http://www.concrete5.org/developers/bugs/5-4-1-1/block-with-tinymce...

I'm going to try the upgrade to 5.4.2 to see if it fixes it.
blakeage replied on at Permalink Reply
blakeage
I didn't see a listed fix in the 5.4.2 Bug Fixes, so I put in my own hack. What I do is target the Add Image button and when it's clicked on, reset its value to the TinyMCE editor function it was before.

In our own javascript (outside the Concrete source code), I put the following:

$("div.ccm-editor-controls-right-cap ul li:first a").click(function(){
  ccm_chooseAsset = function(obj) {
  var mceEd = tinyMCE.activeEditor;
  mceEd.selection.moveToBookmark(bm); // reset selection to the bookmark (ie looses it)
  switch(ccm_editorCurrentAuxTool) {
    case "image":
      var args = {};
      tinymce.extend(args, {
        src : obj.filePathInline,
        alt : obj.title,
        width : obj.width,
        height : obj.height
      });
      mceEd.execCommand('mceInsertContent', false, '<img id="__mce_tmp" src="javascript:;" />', {skip_undo : 1});
      mceEd.dom.setAttribs('__mce_tmp', args);
jordanlev replied on at Permalink Reply
jordanlev
Yeah, I've run into this before. I made a workaround for it and implemented that as part of the Designer Content addon (http://www.concrete5.org/marketplace/addons/designer-content... ) so those blocks work. I hope to one day get around to contributing those fixes into the core system (no idea if/when that will be though).

Note that it does the same thing for the sitemap selector as well.