[closed] Insert/edit link fails in TinyMCE

I’ve been getting reports from content editors for a little while about the insert link button not working in FarCry (7.1.1). One issue is that because I’ve been busy I was ignoring them which now means I’m not sure at what point in time this problem started (e.g. after a project code change or a FarCry upgrade).

When I (finally) had a look yesterday what I found is that when you click the Insert/edit link button in TinyMCE a request is made like this:

https://xxxxxxxx/webtop/facade/ftajax.cfm?ajaxmode=1&formtool=richtext&typename=dmHTML&fieldname=fc28C4AE20247511E58E8B005056A677D9Body&property=Body&objectid=28C4AE20-2475-11E5-8E8B005056A677D9&action=linkoptions&relatedTypename=dmFile,dmNavigation,dmHTML

But this request is then aborted.

There is no error email generated so I had a dig around in the log files and all I could find was this:

“Information”,“ajp-bio-8012-exec-1”,“07/07/15”,“17:45:57”,“DEVELOP_7”,“Unable to locate webskin [edit] for typename [dmHTML]”

My project doesn’t have a dmHTML edit.cfm webskin so this lead me to have a look in the core at \packages\types\dmHTML.cfc and on line 48 is cfproperty for the dmHTML body which contains

ftLinkListFilterTypenames="dmFile,dmNavigation,dmHTML"

As a test I removed the dmHTML from this list, did an update app and tried again. I can see in the ajax request that dmHTML has been removed from the list but it still fails with an abort. I put dmHTML back and removed dmNavigation but still fail, so tried the same again by removing dmFile. Nothing worked. In the end I completely removed the ftLinkListFilterTypenames and it works!! However obviously this is now the default TinyMCE behaviour and can no longer select from the dmFile,dmNavigation or dmHTML lists.

Anyone got any ideas on where to look for an issue? Anyone else seem similar behaviour in their projects recently after an upgrade?

Regards
Mark

The error about being unable to locate the edit webskin for dmHTML is probably unrelated.

I can reproduce the problem locally (did a test on CF9 in fact) and it seems more than a little odd. For me, the first time I click “Insert/edit link” it aborts the request after 2 seconds, but if I click it again straight after the request completes in ~220ms. Clicking cancel in the dialog and then clicking the button again usually also works. But if I leave it for a little while then click the button it will fail again after 2 seconds.

On Railo with the save version of Core, I can’t reproduce the problem at all…

So the requests fail inconsistently and in Adobe CF only?

This is what I was seeing in the network requests in Firebug:

You don’t know how much better that makes me feel knowing you can see the same problem :smile:

I only have ACF so can’t test in Railo/Lucee but for me the errors are consistent, doesn’t matter if I click it again straight away or wait a moment - it always fails

I thought maybe it was some custom edit functions in dmNavigation but I tried removing them and it made no difference.

BTW we are using Adobe CF 10 Standard

As I don’t know when this problem started, I’ve been looking through Git commits for related changes. Any chance this small change could relate to the problem?

https://github.com/farcrycore/core/commit/bc23543e7b801098ec1e716d18335af73345348c

Can you see how long the request takes before it gets aborted? Does yours fail after 2 seconds?

Yep 2 seconds with the very occasional 2.01s which I figure is close enough to 2 seconds :smile:

Are you thinking there might be a 2 second timeout limit? All the other requests (e.g. insert image, FarCry templates etc) all complete in less than 2 seconds.

Just so you know, as a test I removed:

    <cfreturn serializeJSON(
getLinkOptions (
stObject=stObj,stMetadata=arguments.stMetadata,relatedtypename=url.relatedtypename
)) />

from richtext.cfc and replaced with:

<cfset test = '[I pasted the serialized data here]'>
<cfreturn test>

(noting I had text that contained single quotes that I had to remove)

And it worked. Also note data returned in 1.19 seconds.

Hmmm… If yours fails every time… Is it due to some JSON prefix settings in the CF Administrator? That setting may need to be turned off?

Nope, the JSON prefix is already turned off:

Found it!

Well that was a complete waste of a day. I found the issue is a timeout setting in

/webtop/thirdparty/tiny_mce/plugins/link_farcry/plugin.min.js

Line 25 sets a timeout of 2 seconds. Increasing this to 5 seconds fixes my issue (script is taking 3.3 seconds to return).

Considering large sites may take a few seconds to build these results, is it worth increasing this for everyone?

Nice spotting :slight_smile: ACF seems to have highly variable response times compared to Railo for some reason, something to do with the JSON serialisation…

I’ll increase this timeout to 10 seconds just to be safer, for p700 and p710.

I’m also going to take a look into why it takes so longer for the JSON data to be built. On that note I’m not seeing the point of the “Web Page” link it creates as it only lists the page your editing - I originally thought maybe anchors would appear here but they don’t. I’m thinking that this part of the query could probably be dropped.

Hmm, I’m not sure about that “Web Page” item in the “Link list” either…

The timeout is now increased to 10 seconds in both p700 and p710.

https://github.com/farcrycore/core/commit/78c9f80e355d3a87394a9da7bbefe6c471cd9a3e

1 Like

Thanks Justin! Saves me from needing to remake the change on every upgrade :smile: