I realize that development of this module has apparently stopped but I'm posting this here in hopes of someone knowing what the problem is so that they can hopefully steer me in the right direction:

Whenever I create a new node and use Code Snippets to post some code, I experience a situation where the snippet of code will not display until 1 of 2 conditions are met:
1.) The new node's snippet is UPDATED (meaning, the snippet token is selected in the WYSIWYG editor and subsequently updated or edited and reinserted into the content).
2.) New snippets are inserted into pre-existing nodes.

Could someone please explain to me why this is or else just provide some insight into where one might investigate to fix this?

My configuration is as follows:

  1. WYSIWYG - 7.x-2.2
  2. GeSHi Filter - 7.x-1.2 (w/ GeSHi Library 1.0.8.11)
  3. Code Snippets - 7.x-1.x-dev
  4. TinyMCE Library - 3.5.8
  5. The only filter I have enabled for the editor of the Code Snippet-supporting content types is the "Code snippets" filter. The only thing worth mentioning about the WYSIWYG configuration is that nothing is enabled for the cleanup and output.

The use-case I tested with:
1.) Created a new standard page--no additional fields beyond standard title and body.
2.) WYSIWYG editor enabled.
3.) Clicking on the Code Snippets button, I added some basic code (VB code, in this case), gave the snippet a title, indicated that the code was VB, and told it to start numbering at 1.
4.) Clicked on Insert.

The page was saved but nothing was shown. It was essentially a blank / empty page. I then went back to edit this page but made no changes, clicked "Save" to re-publish the node, but again, nothing appeared. However, if I created a new snippet after the snippet that was already there and then clicked to save the page, the NEW snippet displayed perfectly fine. I've also discovered that if you create a new snippet in a pre-existing node / page, it also works.

There appears to be some sort of problem with how these snippets are being saved...?

Any insight / feedback is appreciated.

Comments

ivan zugec’s picture

Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)

Have you tried Code Snippets without WYSIWYG? Setup a fresh Drupal 7 site and test the module and see if you have the same problems.

There could be a possible compatibility issue between WYSIWYG and Code Snippets.

There appears to be some sort of problem with how these snippets are being saved...?

Have you checked the database to see if the snippets are being stored? The snippets are stored as fields.

If you're using the default snippets field then look in the "field_data_snippets_code" table.

wolf_22’s picture

Priority: Normal » Critical
Status: Postponed (maintainer needs more info) » Active

Thanks for the prompt response, Ivan (I know it's something you don't have to do and it's appreciated).

I checked the "code_snippet" table to verify that everything was being saved to the database. It is, so we can mark-off the possibility that anything is being lost at least (btw, I think it's really awesome how you made this module capable of selecting past snippets).

So I created a test input format that uses the code snippet filter itself--and that's all. I left everything else unchecked nor did I add anything else to this format. I made this to test a non-WYSIWYG editor approach. This filter is completely unrestricted as far as I can tell.

I then went to create a snippet test page. I used my "Test" editor but then I realized that I no longer had the code snippet button available to me as the Test editor uses no WYSIWYG... Since I'm not sure what format the module uses to embed snippets into content, I re-enabled WYSIWYG real quick so that I had that snippet button. I then clicked on it, added some generic CSS to test with, and clicked on the "Insert" button.

Seeing the tiny "" icon now in the content, I then re-enabled the "Test" editor (again, this text format has no restrictions and ONLY uses the code snippets filter). The "<code />" icon was then replaced with <code><p>[snippet|type=css|csid=21|tagstyle=block|lineNumbering=|numberStart=1]</p>. I then clicked on "Save" for the page I was creating and unfortunately, nothing appeared when the node was published.

However, if I clicked on "Edit" and then clicked on "Save", the code displayed! Ha. Not sure what's causing this... Very strange.

Any suggestions?

ivan zugec’s picture

Category: bug » support
Priority: Critical » Normal

Quick question, are you trying to configure the "GeSHi code snippets" module?

This module, "Code Snippets" does not have a filter, it stores code snippets in a field.

wolf_22’s picture

Status: Active » Closed (works as designed)

Ivan, I think you're right. I'm so sorry... I feel pretty stupid right now! Ha. But thank you for setting me straight here. :.)

I'll take this battle over there now and close this. Thanks again! :.)