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: remove non inline elements from inline pasted content #2855

Merged
merged 1 commit into from Oct 3, 2017

Conversation

Projects
None yet
2 participants
@iseulde
Member

iseulde commented Oct 2, 2017

Description

This PR ensures that non inline elements are removed if the content is forced as inline (inline Editable). At the moment, these elements are left. E.g. paste some blocks in a caption.

How Has This Been Tested?

  1. Copy some blocks or any HTML with block-level HTML.
  2. Paste it in a caption or similar.
  3. Content should be free of block-level HTML, but formatting should be kept.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows has proper inline documentation.

@iseulde iseulde added the [Type] Bug label Oct 2, 2017

@iseulde iseulde added this to the Beta 1.3 milestone Oct 2, 2017

@codecov

This comment has been minimized.

Show comment
Hide comment
@codecov

codecov bot Oct 2, 2017

Codecov Report

Merging #2855 into master will decrease coverage by 0.26%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2855      +/-   ##
==========================================
- Coverage   33.78%   33.51%   -0.27%     
==========================================
  Files         191      191              
  Lines        5692     5788      +96     
  Branches      997     1020      +23     
==========================================
+ Hits         1923     1940      +17     
- Misses       3189     3249      +60     
- Partials      580      599      +19
Impacted Files Coverage Δ
blocks/api/paste/index.js 86.66% <100%> (+7.35%) ⬆️
editor/modes/visual-editor/block-list.js 0% <0%> (ø) ⬆️
blocks/library/paragraph/index.js 34.78% <0%> (+1.44%) ⬆️
blocks/library/cover-image/index.js 35.89% <0%> (+2.56%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d420547...e5b8f46. Read the comment docs.

codecov bot commented Oct 2, 2017

Codecov Report

Merging #2855 into master will decrease coverage by 0.26%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2855      +/-   ##
==========================================
- Coverage   33.78%   33.51%   -0.27%     
==========================================
  Files         191      191              
  Lines        5692     5788      +96     
  Branches      997     1020      +23     
==========================================
+ Hits         1923     1940      +17     
- Misses       3189     3249      +60     
- Partials      580      599      +19
Impacted Files Coverage Δ
blocks/api/paste/index.js 86.66% <100%> (+7.35%) ⬆️
editor/modes/visual-editor/block-list.js 0% <0%> (ø) ⬆️
blocks/library/paragraph/index.js 34.78% <0%> (+1.44%) ⬆️
blocks/library/cover-image/index.js 35.89% <0%> (+2.56%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d420547...e5b8f46. Read the comment docs.

@@ -19,7 +19,7 @@ import msListConverter from './ms-list-converter';
import listMerger from './list-merger';
import imageCorrector from './image-corrector';
import blockquoteNormaliser from './blockquote-normaliser';
import { deepFilter, isInvalidInline, isNotWhitelisted, isPlain } from './utils';
import { deepFilter, isInvalidInline, isNotWhitelisted, isPlain, isInline } from './utils';

This comment has been minimized.

@gziolo

gziolo Oct 3, 2017

Member

It looks like we don't care about the order of import statements. In Calypso they introduced codemod which sorts everything for you. Just saying, no action necessary here :)

@gziolo

gziolo Oct 3, 2017

Member

It looks like we don't care about the order of import statements. In Calypso they introduced codemod which sorts everything for you. Just saying, no action necessary here :)

This comment has been minimized.

@iseulde

iseulde Oct 3, 2017

Member

Yeah, I saw your ticket #2819. :)

@iseulde

iseulde Oct 3, 2017

Member

Yeah, I saw your ticket #2819. :)

@gziolo

gziolo approved these changes Oct 3, 2017

Code LGTM 👍
I tested with a heading containing italics and bold. I can confirm it pastes as expected.

@iseulde iseulde merged commit 0cc8444 into master Oct 3, 2017

3 checks passed

codecov/project Absolute coverage decreased by -0.26% but relative coverage increased by +66.21% compared to d420547
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@iseulde iseulde deleted the fix/inline-paste-filter branch Oct 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment