KTML messes up embedded code pasted into code view

spike21
Posts: 10
Joined: 2010-05-19 05:11

KTML messes up embedded code pasted into code view

Post by spike21 » 2010-05-19 05:15

Hi all, I must say, it's good to see people still using KTML and trying to support it. I agree, it's still the best out there. It's a shame they shut it down.

Anyway, I've come across a problem where KTML breaks embedded code that is pasted into code view. The examples I have is this (the original):

Code: Select all

<div style="width:600px; text-align: center;"><embed type="application/x-shockwave-flash" wmode="transparent" src="http://w864.photobucket.com/pbwidget.swf?pbwurl=http%3A%2F%2Fw864.photobucket.com%2Falbums%2Fab206%2Fowenmcc1956%2FWelcome+to+Otahuhu+Intermediate+School%2F02386cf2.pbw" height="180" width="600"><a href="http://photobucket.com/slideshows" target="_blank"><img src="http://pic.photobucket.com/slideshows/btn.gif" style="float:left;border-width: 0;" ></a><a href="http://s864.photobucket.com/albums/ab206/owenmcc1956/Welcome%20to%20Otahuhu%20Intermediate%20School/?action=view&current=02386cf2.pbw" target="_blank"><img src="http://pic.photobucket.com/slideshows/btn_viewallimages.gif" style="float:left;border-width: 0;" ></a></div>
turns into this upon save:

Code: Select all

<div style="width: 600px; text-align: center;"><embed type="application/x-shockwave-flash" wmode="transparent" src="http://w864.photobucket.com/pbwidget.swf?pbwurl=http%253A%252F%252Fw864.photobucket.com%252Falbums%252Fab206%252Fowenmcc1956%252FWelcome+to+Otahuhu+Intermediate+School%252F02386cf2.pbw" height="180" width="600"><a href="http://photobucket.com/slideshows" target="_blank"><img src="http://pic.photobucket.com/slideshows/btn.gif" style="float: left; border-width: 0pt;"></a><a href="http://s864.photobucket.com/albums/ab206/owenmcc1956/Welcome%20to%20Otahuhu%20Intermediate%20School/?action=view&current=02386cf2.pbw" target="_blank"><img src="http://pic.photobucket.com/slideshows/btn_viewallimages.gif" style="float: left; border-width: 0pt;"></a></div>
I'm hoping someone has come across this before. I can't see any configuration options that could stop this from happening. It seems to be re-escaping the escaped url's.

Cheers,

Brendon

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: KTML messes up embedded code pasted into code view

Post by Fred » 2010-05-19 09:08

Have you tried ticking or un-ticking the save text as XML box?

spike21
Posts: 10
Joined: 2010-05-19 05:11

Re: KTML messes up embedded code pasted into code view

Post by spike21 » 2010-05-24 05:22

Hi Fred, thanks for the reply :)

I've abstracted the KTML code out into a Rails app, so I only have the code now (not the dreamweaver extension that generates the code). I was trying to find that property and can only see this vague reference:

Code: Select all

		$ktml_{$_GET['inputid']}->setModuleProperty("xhtml", "AllowedModule", "true", false);
		$ktml_{$_GET['inputid']}->setModuleProperty("xhtml", "xhtml_view_source", "false", true);
		$ktml_{$_GET['inputid']}->setModuleProperty("xhtml", "xhtml_save", "false", true);
ignore the $_GET stuff, that's proprietary to my app. Are any of those options the ones I want to disable?

I couldn't see anything relevant in KT_config.inc.php or ktml4.config.php

Thanks for your help! :)

Brendon

spike21
Posts: 10
Joined: 2010-05-19 05:11

Re: KTML messes up embedded code pasted into code view

Post by spike21 » 2010-05-24 05:34

Just following that up. I tried setting xhtml allowedmodule to false and that disables xhtml save, but it still mangles the code. The code mangling happens when you switch back to code view after pasting your code and leaving code view so I guess it's something deeper :) It appears that KTML is re-escaping the percentage signs. Perhaps this is a safety precaution?

Any ideas would be greatly appreciated :)

Cheers,

Brendon

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: KTML messes up embedded code pasted into code view

Post by Fred » 2010-05-24 09:15

Just tested it on a default KTML installation and it does it as soon as you switch over from the code view to design view so I think you are right in saying it is a security feature.

One of the site members mentioned a while ago he "patched" his ktlm code to allow more tags. Unfortunately I can't remember who it was. Will see if I can find him... or maybe he will see this post and be able to help you out.

spike21
Posts: 10
Joined: 2010-05-19 05:11

Re: KTML messes up embedded code pasted into code view

Post by spike21 » 2010-05-24 11:35

Thanks Fred :) I've used the settings to allow all tags except for IFRAMES so I don't think that's the precise bit of code that's doing it. I think somewhere along the lines it's just escaping the percentage signs of escaped characters it doesn't recognise. I found it unusual that this site would escape the :// in http:// ! However when trying the original code in notepad it still actually works so I'm guessing they do it to help people get around fussy code filters and the like. Too bad KTML is even fussier!

Cheers,

Brendon

spike21
Posts: 10
Joined: 2010-05-19 05:11

Re: KTML messes up embedded code pasted into code view

Post by spike21 » 2010-05-24 11:40

Looks like this guy found the same problem. Not sure if it was ever fixed though:

http://doc.gestalt-inc.com/wiki/index.p ... le_Element

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: KTML messes up embedded code pasted into code view

Post by Fred » 2010-05-24 13:48

Interesting...
Maybe you should contact them and see if they got it fixed or use their workaround for now.

The changes that was made to allow other tags was made in the .js file somewhere.

ianraba
Posts: 34
Joined: 2010-06-24 17:44

Re: KTML messes up embedded code pasted into code view

Post by ianraba » 2011-04-13 16:29

Did anyone resolve this or able to push me in the right direction?

I have a lightbox that needs to be included with parameters within []
like previous comments cut and paste into the wysiwyg causes the [ and ] to be mangled

ANy ideas?

spike21
Posts: 10
Joined: 2010-05-19 05:11

Re: KTML messes up embedded code pasted into code view

Post by spike21 » 2011-04-14 09:05

Sorry bro, was never able to solve it. If you are able to find a way let me know :D I'd say it's burried somewhere deep in their code :)

On a side note, I've got my eyes on the Aloha Editor, I think that's going to be the next big thing and will blow these box based editors out of the water. It's open source too, and the developers are very up to date and savvy :)

Cheers,

Brendon

Post Reply