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

Pasting: Convert unknown shortcodes to Shortcode block #3610

Merged
merged 1 commit into from Nov 28, 2017

Conversation

Projects
None yet
3 participants
@mcsf
Contributor

mcsf commented Nov 22, 2017

Fixes #3062. Builds on top of #3609 (fix/shortcode-pasting-plain-text).

Description

Blocks can specify shortcodes from which blocks should be automatically created when pasting. For any other shortcode, the core Shortcode block will now act as a fallback.

The main benefit of this is that, within the Shortcode block, the code will be properly handled and never mishandled. Notably, this fixes the case where a shortcode sitting in a Paragraph block will be picked up with its double quotes rendered as ", thus breaking parsing of a shortcode's attributes.

How Has This Been Tested?

Screenshots (jpeg or gifs if applicable):

gutenberg-shortcode-paste-fallback

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows has proper inline documentation.
@ephox-mogran

This comment has been minimized.

Show comment
Hide comment
@ephox-mogran

ephox-mogran Nov 23, 2017

Contributor

Works well 👍

Contributor

ephox-mogran commented Nov 23, 2017

Works well 👍

Show outdated Hide outdated blocks/library/shortcode/index.js Outdated
@@ -1,3 +1,4 @@
import './shortcode';

This comment has been minimized.

@aduth

aduth Nov 27, 2017

Member

Can you explain this change? It makes me nervous that we depend on load order of blocks.

@aduth

aduth Nov 27, 2017

Member

Can you explain this change? It makes me nervous that we depend on load order of blocks.

This comment has been minimized.

@mcsf

mcsf Nov 28, 2017

Contributor

Yes, I agree. See #3326 (comment). My thinking is that we can get away with it for now in library, and we could soon start to think of a mechanism based on explicit priority.

@mcsf

mcsf Nov 28, 2017

Contributor

Yes, I agree. See #3326 (comment). My thinking is that we can get away with it for now in library, and we could soon start to think of a mechanism based on explicit priority.

@mcsf mcsf referenced this pull request Nov 28, 2017

Merged

Pasting: Respect plain-text pastes #3609

0 of 3 tasks complete

@mcsf mcsf changed the base branch from fix/shortcode-pasting-plain-text to master Nov 28, 2017

Pasting: Convert unknown shortcodes to Shortcode block
Blocks can specify shortcodes from which blocks should be automatically
created. For any other shortcode, the core Shortcode block will now act
as a fallback.

The main benefit of this is that, within the Shortcode block, the code
will be properly handled and never mishandled. Notably, this fixes the
case where a shortcode sitting in a Paragraph block will be picked up
with its double quotes rendered as `&doubl;`, thus breaking parsing of a
shortcode's attributes.
@codecov

This comment has been minimized.

Show comment
Hide comment
@codecov

codecov bot Nov 28, 2017

Codecov Report

Merging #3610 into master will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3610      +/-   ##
==========================================
- Coverage   37.45%   37.45%   -0.01%     
==========================================
  Files         277      277              
  Lines        6706     6707       +1     
  Branches     1222     1222              
==========================================
  Hits         2512     2512              
- Misses       3535     3536       +1     
  Partials      659      659
Impacted Files Coverage Δ
blocks/api/raw-handling/shortcode-converter.js 52.38% <0%> (ø) ⬆️
blocks/library/shortcode/index.js 33.33% <0%> (-6.67%) ⬇️

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 d5d7064...73ca3fa. Read the comment docs.

codecov bot commented Nov 28, 2017

Codecov Report

Merging #3610 into master will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3610      +/-   ##
==========================================
- Coverage   37.45%   37.45%   -0.01%     
==========================================
  Files         277      277              
  Lines        6706     6707       +1     
  Branches     1222     1222              
==========================================
  Hits         2512     2512              
- Misses       3535     3536       +1     
  Partials      659      659
Impacted Files Coverage Δ
blocks/api/raw-handling/shortcode-converter.js 52.38% <0%> (ø) ⬆️
blocks/library/shortcode/index.js 33.33% <0%> (-6.67%) ⬇️

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 d5d7064...73ca3fa. Read the comment docs.

@mcsf mcsf merged commit 7bad210 into master Nov 28, 2017

3 checks passed

codecov/project 37.45% (-0.01%) compared to d5d7064
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@mcsf mcsf deleted the fix/shortcode-catchall-transform branch Nov 28, 2017

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