-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Introduce paste from libre office plugin #3624
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ( styles.color === '#000080' ) { | ||
delete styles.color; | ||
} | ||
|
||
if ( styles[ 'text-decoration' ] === 'underline' ) { | ||
delete styles[ 'text-decoration' ]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe extract it to separate function, e.g. removeDefaultLinkStyling
? At the moment it looks like some magic styles being removed.
plugins/pastetools/filter/common.js
Outdated
if ( /%$/.test( value ) ) { | ||
Style.setStyle( element, 'width', value ); | ||
} else { | ||
Style.setStyle( element, 'width', value + 'px' ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it's used in two places, it can be extracted to separate function.
Additionally IMO regexps should be extracted to variables with descriptive names (eg. endsWithPercentRegex
).
plugins/pastetools/filter/common.js
Outdated
'background:transparent', | ||
'background-color:none', | ||
'background:none', | ||
'text-align:start', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this style removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably some remaining leftover from the early stage of development.
); | ||
}, | ||
|
||
'test common filter should remove superflous styles': function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'test common filter should remove superflous styles': function() { | |
'test common filter should remove superfluous styles': function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed that during batch commit :( So I add it separately to not spend too much time on git history fixing.
It seems to pass on my env. Please check if those still fails after rebase to current major and if so, then provide more details on what browser and which version you are using. |
@jacekbogdanski this PR is not related to #2800. |
I've rebased the pr to current |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall it works really well, good job 👍.
I'm missing mainly… support for Page Break. We have it in PfW, so it would be nice to introduce it also for PfLO. It does not seem difficult, LO adds page-break-before: always
style to appropriate element.
There is also an issue with aligning images.
On Safari image is not inserted at all. On IE8 and 11 image is inserted, but it's broken:
<img style="width: 117px; height: 117px;" src="file:///C:/Users/dev/AppData/Local/Temp/lu7500w8bapy.tmp/lu7500w8baq5_tmp_da3e8e737c4f214e.png" data-cke-saved-src="file:///C:/Users/dev/AppData/Local/Temp/lu7500w8bapy.tmp/lu7500w8baq5_tmp_da3e8e737c4f214e.png">
Most other pain points are already extracted as separate issues and my quick manual tests showed that pasting works well. So I can't even complain much 😞
} | ||
|
||
function getListEvaluator() { | ||
var guard = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe isInBlock
? Current name is not much informative.
Issue related to |
The case related to missing images on IE11 is extracted to #3781. The image cannot be embedded in content as there is no available data which allows on that. This is why most suitable fix for this case is removing such elements, however, this change will affect the PFW behaviour. |
About IE8 I remain it as it is. PFLO is a new feature and those has limited compatibility with obsolete browsers. It doesn't look that breaks something on this browser. |
…lows to avoid checking wordRegexp what reduces false positive results. Change data input to base on full text/html datatransfer which contains meta tags.
I've reported it: https://bugs.webkit.org/show_bug.cgi?id=206348 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering how much work it would involve to introduce support for SVG graphics (e.g. document-with-image.odt.zip; unfortunately GH does not support ODT documents). I stumbled upon this use case today. It seems that SVG file is inside RTF as pict
element. Maybe we would be able to add the support easily 🤔
There are also some small things to add:
- new plugin should be added to the build config in
dev/builder
; - there should be also info about supported environments inside the plugin.
Everything else seems to be working well 👍
Unfortunately, the format of this is image is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
Does this need a new toolbar button or is it added into other paste features? |
@LiamDawe - it's added by default in Standard and Full presets and doesn't use additional paste button. So all content pasted from Libre Office with |
What is the purpose of this pull request?
New feature
Does your PR contain necessary tests?
All patches which change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.
This PR contains
What is the proposed changelog entry for this pull request?
What changes did you make?
Requires: #3593
Implement part of the content fixing mechanism inside the common filter. Thi result with fixing some of the wrong expected output for IE11 & Safari on PFW.
The plugin doesn't change pftools mechanism, however, it bypasses it in some places.