howdy!

i'd like to use IMCE to insert an image into the header field of a view

i don't want to use a wysiwyg editor

i've enabled IMCE, and added the textarea id (edit-header) to the list in IMCE common settings.

however, i don't have an insert image link when i try to edit the header.

am i doing something wrong? is this impossible or is IMCE incompatible with view's very ajaxy edit form?

thanks!

CommentFileSizeAuthor
#4 imce.inline.behavior.patch821 bytesufku

Comments

ufku’s picture

When the textarea is loaded via AJAX, the required js file "imce/js/imce_set_inline.js" will not be present in the page and you won't be able to see the IMCE link.

A workaround is to include imce_set_inline.js in your theme (in every page or conditionally in views pages.). If you already have a script.js file in your theme, you can add the contents of imce_set_inline.js to it. It will load in every page.

firebus’s picture

thanks so much for your response!

i copied imce_set_inline.js to my theme directory and added it to scripts[] in my theme.info file

i confirm that imce_set_inline.js is being included in the page, and i've reconfirmed that
- the id of the textarea in question is edit-header
- edit-header is in the list of textarea ids in imce common settings
- imce is working on other pages (edit-body on the node edit form, for example)

but i'm still not seeing an edit link here. am i missing something? (i can work around it if imce won't work with the views edit form, but it would be nice!)

firebus’s picture

also confirmed that imce is working with the edit-header textarea if i disable javascript in views_ui.

ufku’s picture

StatusFileSize
new821 bytes

In order to process a textarea loaded by ajax, we need to define a Drupal behavior.

Here is a patch that replaces the jquery-initiation-on-load with a Drupal behavior, which will also process textareas loaded by ajax.

firebus’s picture

Title: using IMCE with no wysiwg editor and views edit form text area? » provide image upload links without wysiwg integration on form components loaded by ajax (e.g. views edit form)
Version: 6.x-2.1 » 6.x-2.x-dev
Category: support » feature
Status: Active » Needs review

wow! thanks for the patch, i will test it against 6.x-2.x-dev and report back

firebus’s picture

Status: Needs review » Reviewed & tested by the community

this patch works as advertised.

first, i added imce_set_inline.js to every page in my theme in
_preprocess_page()

  drupal_add_js('sites/all/modules/imce/js/imce_set_inline.js');
  $vars['scripts'] = drupal_get_js();

as ufku suggested above, you could add an if statement to only add js to the views edit page or wherever if you wanted ot.

then i applied the patch, and was able to see/use the imce add image link in the edit-header form on the views edit page.

ufku’s picture

Status: Reviewed & tested by the community » Fixed

committed. thanks

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.