Open freddahlberg opened 10 years ago
Sorry to hear that! Does the demo work for you: http://igx89.github.io/CKEditor-ShowProtected-Plugin/ ?
Hi,
I'm not sure what regex you've put in the demo as protectedsource but this didn't work:
However I didn't see the effect I saw on my local test, where there were loads of extra
created.
Is the demo made with version 3 or 4 of Ckeditor?
Cheers Fredrik Dahlberg
On 28 February 2014 16:16, Matthew Lieder notifications@github.com wrote:
Sorry to hear that! Does the demo work for you: http://igx89.github.io/CKEditor-ShowProtected-Plugin/ ?
Reply to this email directly or view it on GitHubhttps://github.com/IGx89/CKEditor-ShowProtected-Plugin/issues/1#issuecomment-36359611 .
Here's the regex it's using: http://igx89.github.io/CKEditor-ShowProtected-Plugin/config.js. I added support for angled bracket Freemarker directives (previously only square bracket was supported), but CKEditor seems to be escaping the angled brackets for some reason. Don't have time to look into why, though it doesn't seem to be related to my plugin.
It's version 4.3.1 that the demo is on. If you try it with 4.3.1 and it still doesn't work right for you, then it sounds like it might be something with your setup.
Would be a nice plugin but its interaction with CKEdit does not seem robust. For example this PHP template gets also messed up (even in your demo) once the plugin is installed:
<table>
<tbody>
<tr>
<?foreach ($distributors as $distributor):?>
<td><?=$distributor->details?></td>
<?endforeach?>
</tr>
</tbody>
</table>
and becomes
<?foreach ($distributors as $distributor):?><?endforeach?>
<table>
<tbody>
<tr>
<td><?=$distributor->details?></td>
</tr>
</tbody>
</table>
The repositioning of the PHP tags does not happen if the plugin is not installed.
@hwmaier, could you try the latest version at http://igx89.github.io/CKEditor-ShowProtected-Plugin/ and let me know if it handles your needs better? I've refactored it to hopefully handle edge cases like yours (code in areas where img tags aren't allowed) a lot better now. LMK!
Hi Mathew,
Firstly thank you for looking into this. I tried to solve this myself, but the inner workings are too complicated. The plugin still messes up the inserted code by removing or repositioning protected tags. The repositioning does not happen once the Show-Protected plugin is disabled. The repositioning can been seen as soon one switches from Source mode to HTML mode and back.
Using CKEditor 4.4.3 and this setting:
config.protectedSource.push( /<\?[\s\S]*?\?>/g );
For example take this PHP snippet to create a list:
which once the ShowProtected plugin is enabled and you switch from Source to HTML and back to Source becomes:
<?php foreach ($list as $var): ?><?php endforeach ?>
Cheers,
Henrik
On 4/01/2015 6:09 AM, Matthew Lieder wrote:
@hwmaier https://github.com/hwmaier, could you try the latest version at http://igx89.github.io/CKEditor-ShowProtected-Plugin/ and let me know if it handles your needs better? I've refactored it to hopefully handle edge cases like yours (code in areas where tages aren't allowed) a lot better now. LMK!
— Reply to this email directly or view it on GitHub https://github.com/IGx89/CKEditor-ShowProtected-Plugin/issues/1#issuecomment-68607744.
Thanks for the example, @hwmaier! I believe I've now figured out exactly what was causing the tags to be moving around, and have put in a fix to prevent that. Could you check the demo again and see if it's much better now?
Great, we are making progress! The new implementation seems to work now, however I had to downgrade to version 4.3.5 of CKEditor to make it work. The repositioning issue still exists once the current 4.4.x version of CKEditor is used.
I think it would be great if your plugin also could be used with the current 4.4 branches of CKEditor.
Hmmm. I've switched locally to using 4.4.6 from the ckeditor-dev repo and both your examples above still work well with it. Could you give me a bit more details on how to reproduce your issue?
Sorry my fault. I tested only against CKEditor 4.4.3 which is not working but you are right your latest version does work with the latest CKEditor release 4.4.6 and it keeps the placement of tags intact. This means once my CMS upgrades the CKEditor component to 4.4.6 I can start using your very useful plugin. Thanks again for making it available to the community and it is very useful for people using Smarty or Twig template languages.
Matthew, I changed the CSS for showprotected-img.cke_protected in your latest revision from 'display:block;' to 'display:inline-block;' and wonder if that make sense for the broader audience as well. I feel the inline rendering of the <> image looks more fluid compared to the block rendering. In particular if you have a lot of protected inline code. Just a thought, and btw your latest version works quite well. I use it for PHP and also Smarty tags.
Hi,
Very good idea this plugin, but unfortunately I couldn't get it to work.
I tried using your it in ckeditor 4.3.3 and it messed up the code quite significantly. The protected tags (freemarker) were moved and a lot of extra
tags were created.
Fredrik