Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra <p> tags generated #1

Open
freddahlberg opened this issue Feb 28, 2014 · 11 comments
Open

Extra <p> tags generated #1

freddahlberg opened this issue Feb 28, 2014 · 11 comments

Comments

@freddahlberg
Copy link

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

@IGx89
Copy link
Owner

IGx89 commented Feb 28, 2014

Sorry to hear that! Does the demo work for you: http://igx89.github.io/CKEditor-ShowProtected-Plugin/ ?

@freddahlberg
Copy link
Author

Hi,

I'm not sure what regex you've put in the demo as protectedsource but this
didn't work:

<#test whatever>

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 [email protected] 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//issues/1#issuecomment-36359611
.

@IGx89
Copy link
Owner

IGx89 commented Mar 1, 2014

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.

@hwmaier
Copy link

hwmaier commented Dec 20, 2014

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.

@IGx89
Copy link
Owner

IGx89 commented Jan 3, 2015

@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!

@hwmaier
Copy link

hwmaier commented Jan 5, 2015

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:

  • List

which once the ShowProtected plugin is enabled and you switch from
Source to HTML and back to Source becomes:

  • List

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
#1 (comment).

@IGx89
Copy link
Owner

IGx89 commented Jan 6, 2015

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?

@hwmaier
Copy link

hwmaier commented Jan 6, 2015

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.

@IGx89
Copy link
Owner

IGx89 commented Jan 10, 2015

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?

@hwmaier
Copy link

hwmaier commented Jan 14, 2015

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.

@hwmaier
Copy link

hwmaier commented Jan 29, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants