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

Paste: remove non inline elements from inline pasted content #2855

Merged
merged 1 commit into from
Oct 3, 2017

Conversation

ellatrix
Copy link
Member

@ellatrix ellatrix 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.

@ellatrix ellatrix added the [Type] Bug An existing feature does not function as intended label Oct 2, 2017
@ellatrix ellatrix added this to the Beta 1.3 milestone Oct 2, 2017
@codecov
Copy link

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';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I saw your ticket #2819. :)

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@ellatrix ellatrix merged commit 0cc8444 into master Oct 3, 2017
@ellatrix ellatrix deleted the fix/inline-paste-filter branch October 3, 2017 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants