Not sure if there is a way to do this yet, but say I have a CCK textarea field and I want the insert to go to that field instead of the body. Is that possible currently?

Comments

srobert72’s picture

I have 5 textarea in a node and it works.
I've find that you must click in right editor before you click insert button.
Insert works in last clicked editor.

Could you confirm ?

drupalninja99’s picture

ohhh excellent, ok

quicksketch’s picture

Status: Active » Fixed

Insert should work as described by srobert72 in #1 when using the WYSIWYG module. Unfortunately if using the FCKeditor *module*, it does not have an API for knowing the active textarea so it will only work with the body field. FCKeditor (and TinyMCE) work properly when used with WYSIWYG.

srobert72’s picture

That's right, i confirm I have WYSIWYG module installed.

Status: Fixed » Closed (fixed)

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

jhedstrom’s picture

Version: 6.x-1.0-beta2 » 6.x-1.0-beta3
Category: feature » bug
Status: Closed (fixed) » Active

This isn't working for me. I have a content type with no body, and 2 CCK text areas. I get the following js error in FF 3.5, from an imagefield using Insert beta3 when I click the insert button:

content is undefined
insert()insert.js?S (line 47)
anonymous(Object originalEvent=Event click which=1 view=window)jquery.j...val/seq/1 (line 1)
anonymous()jquery.j...val/seq/1 (line 1)
[Break on this error] content = content.replace(/__([a-z0-9_]+)__/g, '');\n

EDIT: I'm using the wysiwyg api in combination with tinymce as well.

geerlingguy’s picture

I'm having an odd problem with this too (using WYSIWYG): I can insert images I attach through an imagefield field, but if I attach a filefield to the same node (with or without any images), the file won't insert when I click the Insert button.

And, to top that off, I have another content type where the same filefield is working perfectly...

Mixologic’s picture

I just ran into this exact issue as stated in #6, and found a solution:

The javascript in insert.js is looking for the data to embed in the textarea in some hidden form inputs

35  var style = $('.insert-style', wrapper).val(); 
//searches the document for an element with class "insert-style", and sets 'style' to the name of the selected style - auto, original, or whatever imagecache preset name you have selected
36  var content = $('input.insert-template[name$="[' + style + ']"]', wrapper).val(); 
// gets a the value attribute of an <input> element from the document with class 'insert-template' and an attribute called 'name' ending in 'style'

in my case there was the following in the source:

<input type="hidden" class="insert-style" value="image">

And also the following:

<input type="hidden" name="field_event_image[0][insert_template][auto]" id="edit-field-event-image-0-insert-template-image" value="&lt;img src=&quot;http://vaprod/sites/default/files/captions-menu_4.jpg&quot; width=&quot;500&quot; height=&quot;327&quot; alt=&quot;__alt__&quot; title=&quot;__title__&quot; class=&quot;event-image&quot; /&gt;" class="insert-template">

So line 35 was looking for "image" when it should have been looking for auto.

I went back into my cck widget settings and sure enough, I had "enabled" only the auto checkbox, but had selected the "original image" to use as the "default". So... maybe the widget shouldn't let you do that? Or maybe the javascript should always look for 'auto' if it cant find anything? Anyhow, google chome's javascript debugger is the bomb.

Clever, embedding html within html.

quicksketch’s picture

So line 35 was looking for "image" when it should have been looking for auto.

"auto" just means it will insert an img tag if it's an image, and will insert a link to the file if it's anything else. Since you uploaded an image, the "auto" value was the "img" tag.

Mixologic’s picture

StatusFileSize
new44.65 KB

When you configure the field if you select "auto", and no other checkboxes in the "enabled insert styles" area, and have "Original Image" selected in the Dropdown (see attached screenshot) you will be able to duplicate this issue. It seems to me that the insert-style hidden field gets its value set by the default_style dropdown, and that the insert_template gets set by the checkboxes.

oh, and I meant line 36 was looking for the word "image"

quicksketch’s picture

Status: Active » Fixed
StatusFileSize
new1.34 KB

Thanks for the description Ryan Aslett. This turns out to be more a documentation/configuration problem than anything else I think. What's happened is that you've selected one style to be enabled, then a separate style to be the default. Since the "default" style isn't actually enabled (but another style is), the default style doesn't work.

This patch makes it so that the default style is ALWAYS enabled. Previously we'd only enable it if no styles were enabled at all. In your situation, this means that after you update to the new version, the Dropdown list of styles will appear with two options: Automatic and Original Image, because you've enabled "Automatic" but set "Original image" to be the default.

In the mean time, I'd suggest you configure your field and disable the option for Automatic, and things should work properly until the next version. I also updated the documentation on what "Automatic" means, which would probably work just as well for you rather than using Original Image.

Status: Fixed » Closed (fixed)

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