I don't know if this is a excerpt issue or a wysiwyg issue, so I figured I'd start here.

I have the wysiwyg module installed with fskeditor. The full story comes up with the fskeditor just fine, but the excerpt area does not. Is there anyway to enable this?

Comments

mike15’s picture

I'm in the same boat. subscribing...

sylvaingirard’s picture

Assigned: Unassigned » sylvaingirard

It's not linked to a specific editor. I'll try to take a look at it.

hydrogen3’s picture

also subscribing

mr.andrey’s picture

subscribing...

tommytob’s picture

same issue for tinymce

smithn.nc’s picture

Subscribe.

hayesr’s picture

This sounds like a problem with wysiwyg module to me. (I say that because Excerpt does relatively little in the way of Drupal API calls, but if Excerpt's the culprit I'm happy to fix it) Is there someone who can confirm the source of the problem?

rondev’s picture

For people looking for a Wysiwyg solution, The one I found working together for my needs is:
Excerpt 6.x-1.x-dev (2009-mai-23)
FCKeditor - WYSIWYG HTML editor 6.x-2.0-beta1

More over for images:
Image Assist 6.x-2.0-alpha3 (later releases not tested)

adamo’s picture

In order for the Wysiwyg API module to work for the teaser field, you need to add support for input formats to the Teaser field. You would just do the same thing that was done with the Body field. Markup really shouldn't be allowed in the field unless there is an input format specified. Could be a security issue.

hayesr’s picture

@adamo Can you provide a patch? If not I'll look at it as soon as I can, but can't this week.

Jaza’s picture

Component: User interface » Code
Assigned: sylvaingirard » Jaza
Category: feature » bug
Status: Active » Needs review
StatusFileSize
new1.34 KB

Pretty simple fix. Just as the 'body' element is defined as follows in node.module:

$form['body_field']['body'] = array(
  /* ... */
);
$form['body_field']['format'] = filter_form($node->format);

The same needs to be done for the 'teaser' element by excerpt.module (i.e. it need to be wrapped in a parent element, and it needs a sibling 'format' element, in order for Wysiwyg to treat it as an input format-enabled textarea):

$form['teaser_field']['teaser'] = array(
  /* ... */
);
$form['teaser_field']['format'] = filter_form($form['#node']->format);

Patch attached. Tested with TinyMCE enabled in latest stable Wysiwyg module for Drupal 6.

keesje’s picture

Hi, thanks for sharing.

Tested your patch, in my case it enables wysiwyg for excerpt field, but removes it form body field. Hmm.
Investigating this.

keesje’s picture

If i mimic excerpts behaviour by adding a textarea by CCK, multiple wysiwygs are loaded without probs.
I think excerpt needs to change something in the form field declaration to enable filter formats at API level? Don't have time right now to dig into this.

adamo’s picture

In order to have multiple text areas with different filter formats on the same form you need to use the $parents parameter of filter_form(). I don't have time to devote to doing a proper patch right now but I'm going to paste a quick and dirty example of what I had to do to to get this to work in another project. Hope it helps.

function lntw_catreq_admin_settings_form(&$form_state) {
  $form = array();

  // Load data from DB
  $data = db_fetch_array(db_query("SELECT * FROM {lntw_catreq_markup}"));

  $form['formheader'] = array(
    '#type' => 'fieldset',
    '#title' => t('Catalog Request Form Header'),
    '#description' => t('This will be displayed above the catalog request form on the Request Catalog page.'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#tree' => TRUE,
  );
  $form['formheader']['markup'] = array(
    '#type' => 'textarea',
    '#title' => t(''),
    '#rows' => 10,
    '#default_value' => $data['formheader_markup'],
  );
  $form['formheader']['format'] =
    filter_form(!empty($data['formheader_format']) ? $data['formheader_format'] : FILTER_FORMAT_DEFAULT, NULL, array('formheader_format'));

  $form['thankyou'] = array(
    '#type' => 'fieldset',
    '#title' => t('Catalog Request Thank You'),
    '#description' => t('This will be displayed on the "thank you" page when someone submits a catalog request.'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#tree' => TRUE,
  );
  $form['thankyou']['markup'] = array(
    '#type' => 'textarea',
    '#title' => t(''),
    '#rows' => 10,
    '#default_value' => !empty($data['thankyou_markup']) ? $data['thankyou_markup'] : LNTW_CATREQ_THANKYOU_DEFAULT,
  );
  $form['thankyou']['format'] =
    filter_form(!empty($data['thankyou_format']) ? $data['thankyou_format'] : FILTER_FORMAT_DEFAULT, NULL, array('thankyou_format'));

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );

  return $form;
}
ryan.nauman’s picture

subscribing

jaxpax’s picture

subscribing

W.M.’s picture

subscribing

droopy’s picture

subscribing

W.M.’s picture

I have solved the problem by using CCK to create an extra textarea field (and excluding it from front page and node content page). It still appears in editing page. So I write the customized teaser inside it (it supports TinyMCE and other editors) and copy and paste the finished HTML code inside the teaser box of Excerpt (make sure that TinyMCE is configured to show the HTML code button inside editor so you will be able to see the full code and copy & paste it).

Not perfect solution but works perfectly!

Boarder’s picture

Jaza's patch almost solved it for me. But as kees@qrios pointed out the Body textarea doesn't get tinymce anymore. The fix is to change
$form['teaser_field']['format'] = filter_form($form['#node']->format);
with something like
$form['teaser_field']['format'] = filter_form($form['#node']->format, null, array('teaser-format'));

The reason for that is that the Format radiobuttons of both the body textarea and the Excerpt textarea are going to have the default name "format". As such, only one of the 4 radiobuttons can be selected (even among both Format radiobuttons). Consequently, in the wysiwyg javascript where the editors are inserted, no selected radiobutton is found in the Body Format options and thus no TinyMCE is added.

The above fix gives a new name to the radiobutton group of the excerpt and thus we finally end up with two Format setting groups. Now I have TinyMCE working with the excerpt module.

keesje’s picture

StatusFileSize
new1.37 KB

Please test altered patch, changed as outlined in #20

W.M.’s picture

Any success using this patch?!

jakob_dunning’s picture

Version: 6.x-1.x-dev » 6.x-1.0
Status: Needs review » Fixed

I used the patch and it worked just fine.
Thanks a lot. Before, excerpt never created node teasers automatically until i went to the 'edit' pane and saved the node without changing.
Using Drupal 6.x-1.2, ercerpt module 6.x-1.0, wysiwyg 6.x-2.0.

W.M.’s picture

The patch worked perfectly. Thanks.

jakob_dunning’s picture

The patch worked fine. Then I installed the FCKEditor standalone module, image_reference and imagebrowser and now it doesn't anymore. I deinstalled everything again but still no luck.
I found out, that the teaser is auto-generated when i click on "disable rich-text" and delete the line "<p>&nbsp;</p>", which is automatically inserted by FCKEditor (Wysiwyg plugin) and then save the node.
Any suggestions anyone?

Thanks, Jakob

hanoii’s picture

Status: Fixed » Needs review

Is the patch working or not?

@jakob_dunning: Please, do not set issues as fixed. That status is reserved to the module maintainer when they actually commit the code to the CVS and the patch becomes part of the code, otherwise, this is still an active issue. In any case, if a few report the patch as working, you have the 'reviewed & tested by the community' status which let the maintainer know that the patch has been reviewed.

hanoii’s picture

Assigned: Jaza » Unassigned
hanoii’s picture

Version: 6.x-1.x-dev » 6.x-1.0
StatusFileSize
new5.17 KB

I had to go over this issue as I needed to have this module fixed. Unfortunately, although the last patch (#21) works, it still needs work.

If we are going to give the option to select a different format for the teaser (which is great, not only because of the out of the box wysiwyg support), that has to be stored somewhere and processed appropriately. The patch on #21 was using $form['#node']->format to feed the format for the teaser, so even if I want a different format for the teaser, I won't be able to set it because it won't be saved. And, IMO, if the format radios are going to be there, they have to serve some other purpose that just a workaround the wysiwyg issue.

Attached is a patch that solves this by doing more things. It was not my goal to make a simple module difficult, but I saw no other option. In any way, it doesn't really change the user interface, just a bit more logic is needed in the code. The patch covers the following:

remember to run update.php after applying this patch

- Definition of a new schema table in excerpt.install to store teaser format (serves as an entry point for more extra info if ever needed).
- Definition of an update function to create the schema in case you currently have the module installed (run update.php to do this!).
- Logic in hook_nodeapi() to insert/update/delete the teaser format data in the new schema (revisions properly supported).
- Fixed the '#weight' of the teaser which now has to be moved to the parent array (teaser_field) rather than the actual 'teaser' textarea).
- Proper use of the parent argument for the filter_form() function
- The teaser is now 'created' by this module rather than relying on the node_prepare() function, and so, we want that to be set first of all, so we don't mess with other module's teaser modifications (such as cck). For that I set the weight of this module to -10 on the .install file. The teaser format is used for creating the teaser, so you can have a different format.

Tests and feedback for this patch are very much appreciated.

hanoii’s picture

Version: 6.x-1.0 » 6.x-1.x-dev
hanoii’s picture

StatusFileSize
new5.22 KB

Attached is a new patch with one addition:

- Use the same amount of rows as the body field

W.M.’s picture

Would you please release a new and updated version of this great small module. I am not sure how to make all these changes after I have applied the previous working patch (posted on September 7, 2009 - 08:07). Any help will be appreciated. Can you post the updated excerpt.module & excerpt.install files ?!

W.M.’s picture

I have now made all changes as outlined in the recent patches. Everything works fine but for already created nodes the excerpt field always loads in filtered-html even if that is changed to full-html and node is saved. Newly created nodes don't show this problem.

hanoii’s picture

Status: Needs work » Needs review
StatusFileSize
new5.5 KB

Right. I have checked this and you are right, attached is a patch with that fixed. Not information should be stored properly for existing nodes.

When it comes to applying the patches on this issue, I suggest you to start with a fresh excerpt-6.x-1.x-dev and apply my latest patch. That should include all the fixes discussed in the previous patches.

W.M.’s picture

Working fine !

hanoii’s picture

Version: 6.x-1.0 » 6.x-1.x-dev

I just got CVS access so I might soon commit this and release a new version, any other tester out there?

rondev’s picture

Not for me :-(

I go back to previous patch released on #21.

hanoii’s picture

@rondev: What happened? What went wrong?

rondev’s picture

I would like to be more descriptive but there is not much to say.
The teaser area is normal, just without tinymce in my case.
I don't know how to investigate more.

hanoii’s picture

Have you had properly configured wysiwyg profiles and you made sure that the actual input format selected for the teaser was the one that has your tinymce configured for? Are you using wysiwyg module right? what versions?

I am almost positive this improvement has to work, but just wondering why it hasn't for you.

Thanks,
a.=

rondev’s picture

Have you had properly configured wysiwyg profiles and you made sure that the actual input format selected for the teaser was the one that has your tinymce configured for?

Not sure 100%.
Works OK with #21. copy files of dev 2009-Oct-09 then doesn't work. copy files of #21, works again.
No input format asked for the teaser.

Are you using wysiwyg module right? what versions?

Wysiwyg 6.x-2.x-dev (2009-sept.-18)
TinyMCE TinyMCE 3.2.7

hanoii’s picture

Oh, OK. This patch hasn't been committed to CVS yet, I was hoping to get some more feedback before I do it. If you donwload the Oct-9 dev version, you still need to apply the patch on #33 and run update.php to try this out. If you can do so and report back, that'd be great.

rondev’s picture

That was a misunderstood. What was strange is I found the excerpt.install no really different.

The patched one is bigger.

OK. updated test site. TinyMCE works well in teaser area. Thank you.

hanoii’s picture

Status: Needs review » Fixed

Committed, thanks for testing and getting back. Will soon release a new version with this fix.

racakg’s picture

I update Excerpt module to 6.x-1.1 and I notice that Input format under Teaser field doesn't work. Input format under Body field working fine like before. Why Input format under Body field overrides anything I check in Input format under Teaser field? I don't run any wysiwyg. Thanks

hanoii’s picture

@racakg: Have you run update.php in your site? It needs to be run so the new schema gets created.

racakg’s picture

Sure, i run update.php after I update to new modules. I also update Panels and Chaos tool suite in the same time with Excerpt module.

jakob_dunning’s picture

Status: Fixed » Needs work

I am using the patch comitted in #33 against the 6.x-1.x-dev made on Oct. 19th.
Still no luck with autogeneration of teasers.
Before, I could manually delete the code in the fckeditor window after turning off rich-text and then it would autogenerate a teaser. That doesn't work anymore.

Apart from that, there are input format options on both the body and the teaser field, both rich-text-activated.

Does anyone have an idea how to troubleshoot this?

W.M.’s picture

Runs fine here (also the latest stable release). Thanks for this great module! I hope the default html-code feature will be integrated in the future.

racakg’s picture

@hanoii: I double check update lines and system weight = -10 in database and everything was updated ok there. The only solution for me is removing unused line until someone else report the same problem:

$form['teaser_field']['format'] = filter_form($form['#node']->teaser_format, 1, array('teaser_format'));

hanoii’s picture

Status: Needs review » Fixed

@jakob_dunning: the auto-generation of teaser should not be related to this issue, so please leave this one fixed unless you find anything not working in terms of wysiwyg and excerpt, related to this fix. Also, please, if you experience such a problem, can you please open a new issue about this problem and we can follow discussions about that. As a comment, I did try this and the teaser seems to be auto-generated fine on my side

@racakg: I am not sure if I follow your problem then. I am trying it w/o wysiwyg and it seems fine. Basically, you should be able to select input formats for both teaser and body independently, is this not working for you? Can you try this module with a fresh drupal install just to make sure anything else is conflicting, although I don't think there's a conflict. I just did this, and all seems just fine. Can you confirm, when you save a node, that something is written to the excerpt table?

Status: Fixed » Closed (fixed)

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

agileware’s picture

Status: Closed (fixed) » Active
StatusFileSize
new5.32 KB

@hanoii & racakg
I think the problem is because of the code in node_prepare.

Specifically it runs this

$node->teaser = check_markup($node->teaser, $node->format, FALSE);

That code runs before hook_nodeapi is called so by the time we get it it's been done already.
The way I got around this is to relead the teaser from the database in hook_nodeapi.
It is a little bit of a hack but with the negative module weight we are getting in before other modules implementing hook_nodeapi so we shouldn't be overwriting anything.

I have done a D5 version of your patch with my changes to fix this issue included (against the current 5.x-1.x-dev version).
I haven't got time to make a patch to fix the d6 version sorry but you can use the code from this d5 patch.

Also, an option on the node type edit form to set whether or not to use input formats would be good.
You could copy the method used in cck's text sub-module for the radio button options so there is naming consistency.

agileware’s picture

Status: Active » Needs work

The patch in #52 interferes with the corerct functionality of the poll module... and possibly other modules if they insert things into the $node->content.

So it needs some work in regards to that.

nedjo’s picture

Opened #940952: Roll back #429364 suggesting rolling back this patch.

agileware’s picture

There are definitely issues with this approach so I'd be for rolling this back and approaching it differently too.