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
Paste From Word (PFW) filter removes margin-top, margin-bottom #2935
Comments
The case here is that PFW filter removes any margin which value equals 0. In some cases they might be not removed by ACF, e.g. with Reasonable workaround for this is to add config option to not remove margins that equals 0. Additionally I'm changing issue type to feature. |
@f1ames and @engineering-this I’m against the configuration setting because we already have tools to remove unwanted margins and other things when pasting From MS Word - In my opinion PFW should leave all available margins by default because this is what Word passes and what browser sees. If we start getting any feedback that lines are no longer big, we can easily explain to users there is an API which allows removing these margins if they want. We can even provide code snippets for ACF configuration and Configuration setting is also bad because it only concerns 2 styles. With that approach you are taking part of the control from PFW and give it to core for very specific use case. This in my opinion also looks bad because now you have two separate entry points for filtering same content and that should not take place. To summarize - please don't create another setting if we already have tools that do that. Instead, let’s teach our users how to use them. |
I see this bug like cutting hair - you can cut it but you can't glue it back. Currently we cut out too much and can't glue it back. If we let PFW leave as much as possible and get any complaint about it (so far everyone complained about lines being too big) we can happily tell our users we have tools to cut it out even further. |
@engineering-this Is the
The reason we decide to make it a config option is that we would like to keep backwards compatibility of pasted content. Without it, after updating to new CKEditor version pasting content will start behave differently (keeping zero margins) - so if We may change PFW to retain |
@f1ames looks quite common to me. Many tests fail when we allow
Is there an easy way to do so? I don't see an option to add filter rule via |
Guys please remember that you also have The handling was bad in previous versions. Let's just fix it and if anyone doesn't like it, he will have the ability to change the result on his own because we have the tools for it already. |
I agree that PFW can leave those margins untouched so they can be processed for any mechanisms later in the pipeline.
The issue here is that Word adds <p class=MsoNormal>FooBar<o:p></o:p></p> p.MsoNormal, li.MsoNormal, div.MsoNormal {
mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:DengXian;
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
} so making
As I agree that changing this behaviour should be as easy as possible (and may be outside of the PFW plugin itself), making it default behaviour is no go at the moment as it will change the way how content is displayed by default in almost all paste scenarios. So we will have to explain all users how to "revert" this breaking change instead of explaining only a few how to enable zero margins. |
We have agreed with @jswiderski that So there are few options here:
|
I'd go with either first option or with the opposite: config option force removal of |
I'm not sure if
It looks for me like the best approach, although such ACF should be plugin wise (again, |
AFAIR there was some unofficial rule that "PFW changes only things that are changeable by other means (plugins)". Probably in long term we should enhance the currently selected solution with introducing some kind of plugin to control the margins. In case of ad-hoc solution I'm for config option. |
Makes sense because manipulating attributes/styling which cannot be adjusted in any way leaves users in a quite uncomfortable situation. Still, here the user is not able to add removed margin (and will not be able to remove it if it is preserved - unless in
Yes, I think we could proceed with config as proposed in initial PR and then improve this solution if necessary.
It's about |
Type of report
Feature request
Provide detailed reproduction steps (if any)
Margin Top.zip
Expected result
Spacing between lines are small just like in MS Word
Actual result
Spacing between lines are huge.
Other details
HTML seen by browser (FF in that case) contains
margin-top
,margin-bottom
. Unfortunately the PFW removes these styles and there is no way to prevent that. This is a huge problem since there is no way to prevent that.Editor should work in a way that non-configurable PFW allows a lot and configurable ACF can later be used to remove it. PFW should not remove styles which have significant impact on formatting.
HTML seen by browser:
HTML seen by the editor (Notice that margin-top and margin-bottom are removed from paragraph and list):
The text was updated successfully, but these errors were encountered: