I cannot figure out how to get TinyMCE to leave my swf tools tags alone. I have no input filters on except for swftools. As soon as I edit an existing node, the tags get stripped as the editor opens. I can turn of TinyMCE, add the text, and save it - but as soon as I edit again, the tags get removed.

Is there a setting somewhere I can use to fix this?

I have installed the following...
Drupal 6.8
WYSIWYG API 6.x-1.x-dev (2008-Dec-26)
TinyMCE Version 3.2.1.1 (2008-11-27)

All input filters are off except for swftools (and the tags clearly get stripped by Tiny_MCE at edit time)

Thanks
Alan

CommentFileSizeAuthor
#13 swftools.module.patch1.24 KBglorinand

Comments

amccann’s picture

I forgot to mention these settings
settings/wysiwyg/profile/edit/2

Verify HTML - off

Preformatted - off

Convert tags to styles - on

Remove linebreaks - off

Apply source formatting - off

Force cleanup on standard paste - off

sun’s picture

Status: Active » Postponed (maintainer needs more info)

What is a "swftools tag"? HTML markup or some kind of a inline macro (placeholder)?

amccann’s picture

Sorry - I should have clarified.

It is an input filter code made available by
http://drupal.org/project/swftools

the form of the code is to make it easy to embed a flash swf or video.

However, the filter never gets a chance to be used if tinymce/wysiwyg is turned on.

Alan

sun’s picture

Project: Wysiwyg » SWF Tools
Version: 6.x-1.x-dev » 6.x-1.3
Component: Editor - TinyMCE » Code
Category: support » bug
Priority: Normal » Critical
Status: Postponed (maintainer needs more info) » Active

Well, SWFTools should really be using [swf] style macros then, as <swf> a) needs to be not filtered out by HTML filter and b) will be rendered either invisible or stripped out by any client-side editor.
In TinyMCE's case, the editor could be configured to not strip out this HTML tag, but that would not help much, since this is an unknown HTML tag, so your browser does not know how to render it.

Hence, this is a critical design flaw in SWFTools.
Moving to proper project.

amccann’s picture

Thanks for your attention to this!

Alan

vm’s picture

I don't believe is necessary. At the very least it isn't mentioned anywhere in any documentation.

amccann’s picture

Status: Active » Closed (fixed)

YUI editor seems to work fine. I am closing this... it must be a TinyMCE issue.

sun’s picture

Status: Closed (fixed) » Active

Not so fast - how does YUI render this tag? Can you attach a screenshot?

rockitdev’s picture

this isn't a bug with SWF Tools, it's a bug within TinyMCE and how it renders HTML. I'm dealing with the same issue, so the question is, how can you allow custom tags within TinyMCE. If you disable the TinyMCE Rich Text Editor, and use an input format that is swf tools enabled, it works properly.

I have not used YUI myself, but if you think about it, you'll see that the editor ALLOWS the tag to be used.

sun’s picture

Well, I thought this was self-explanatory, but it seems not: Every client-side editor (a.k.a. WYSIWYG editor, i.e. TinyMCE, YUI, etc.) does nothing else than putting the contents of a textarea into an IFRAME (window), which is enabled for "live editing" afterwards (all browsers support this in one way or the other). The browser just renders all the contained markup, just as it would if it was not editable. Since <yui> is not defined in any DTD, most browsers will not render it, so the user will not see those tags - which brings me back to my design point.

rockitdev’s picture

I found a quick solution, it is not mature but it works :).

Open sites\all\modules\tinymce\tinymce\jscripts\tiny_mce\tiny_mce.js.

Locate in the file this._def("valid_elements",. Add after ins[title|id|class|style|dir|lang|datetime|cite] ,+swf[file].

Now, in the editor, you have to open up the Edit HTML interface to allow it to work. What will happen if you simply try to add a <swf> in the WYSIWYG, it will convert your < > tags to < and > respectively.

If i can find some time this week, i'll look at converting this into a button to be added to the toolbar. I'm sure it's probably not that hard.

glorinand’s picture

Status: Active » Needs review
StatusFileSize
new1.24 KB

Hi there. Just about every wysiwyg editor will replace your <> by < and >. As sun commented above, filters should use [] instead of <> to avoid this. But actually I've read somewhere in the documentation or possibly in code comments that you already can use [swf ] instead of . As you may have noticed it doesn't really work.

I have attached a patch of 6.x-1.3 which should make swftools handle [swf ] syntax correctly. However, if you use [], some editors (e.g. FCKEditor) will replace your " by " so I have also modified the regular expression to look for " or " It works well for me, hope it will help you as well... :-) Anyway it's a cleaner solution than messing with editor settings in that it should work for most if not all editors (though I have only tested TinyMCE and FCKEditor).

G Gavitt’s picture

Thanks a lot for that patch glorinad. I patched my 5.x-2.2 version of this module and haven't had any problems so far using it with TinyMce. I even noted the change in the filter tips section as well...( swftools.module line 1023) I have also tested the TinyMCE media module along side this module and both seem to working together just fine.

mrfelton’s picture

Did anyone submit this patch to the swftools people? I have the same problem, but with FCKEditor and this patch seems to do the trick.

Edit: ah, didn't realise this issue had been moved to the swftools queue already!

Stuart Greenfield’s picture

Sorry about the delay on this - this thread fell off my radar. However, I have done some trials tonight and think this explains the issues reported in #401140: Media path being set to sites/default/files/sites/default/files. I have committed the patch from glorinand as I'm fairly sure it is the right fix. There was also an underlying bug in the filter that prevented the [swf] syntax from working.

The patch is available on branches DRUPAL-5 and DRUPAL-6--2. I'd like some user feedback before making these official releases, although the code is testing ok locally, so if you do try the new code out please could you post your experience.

Thanks.

sun’s picture

For reference:
- http://cvs.drupal.org/viewcvs/drupal/contributions/modules/swftools/swft...
- http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/swftools/sw...

If you want to make that syntax future-proof (and thus, compatible to Inline API), you should consider to use the following syntax:

[swf|file=filename.swf]

Inline API also supports a multi-value syntax for parameters (slightly borrowed from gmap), which I can't precisely recall right now, because we're still working on other architectural stuff, but that should also allow your flashvars parameter.

Stuart Greenfield’s picture

Thanks for the pointer!

At the moment the syntax is adapting from how SWF Tools was originally written, but I'll look at introducing support for the preferred syntax so that people can move to that. At least with the latest fixes it might actually properly in the current form which is a big step in the right direction :-)

Stuart Greenfield’s picture

Status: Needs review » Fixed

Released in SWF Tools 6.x-2.5.

Status: Fixed » Closed (fixed)

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