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

Copy Paste Handler Issue #12780

Closed
elliotcondon opened this issue Dec 11, 2018 · 1 comment · Fixed by #21162
Closed

Copy Paste Handler Issue #12780

elliotcondon opened this issue Dec 11, 2018 · 1 comment · Fixed by #21162
Labels
[Feature] Block API API that allows to express the block paradigm. [Feature] Paste [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Type] Bug An existing feature does not function as intended

Comments

@elliotcondon
Copy link

Describe the bug
Copying & pasting from a <input type="text" /> element produces different results to a <input type="email" /> element.

The value copied from an email input (and also a number input) contains the full block HTML, not the input's value. Issue is demonstrated in the following screen recording.

wbjglpucyf

To Reproduce
Steps to reproduce the behavior:

  1. Add the following JS to register the block
  2. Enter values into both the text and email inputs
  3. Copy and paste the values into the provided textarea
  4. See error
	var el = wp.element.createElement,
    	registerBlockType = wp.blocks.registerBlockType;
	
	registerBlockType( 'test/test-copy-paste', {
	    title: 'Test Copy & Paste',
	    icon: 'universal-access-alt',
	    category: 'layout',
	    edit: function( props ) {
	        return el(
	            'div',
	            {
	                className: 'test',
	            },
	            el(
		            'input',
		            {
		               	type: 'text',
		                placeholder: 'text',
		                style: { width: '45%' }
		            }
		        ),
	            el(
		            'input',
		            {
		                type: 'email',
		                placeholder: 'email',
		                style: { width: '45%' }
		            }
		        ),
		        el(
		            'textarea',
		            {
		                placeholder: 'textarea',
		                style: { width: '100%' }
		            }
		        ),
	        );
	    },
	    save: function( props ) {
	        return el(
	            'p',
	            {},
	            'This is a test.'
	        );
	    }
	});

Expected behavior
The value copied from any input/textarea should match the behavior of the "text" input.

Additional context

  • WordPress 5.0
@swissspidy swissspidy added [Feature] Block API API that allows to express the block paradigm. [Feature] Paste Needs Technical Feedback Needs testing from a developer perspective. labels Dec 11, 2018
@youknowriad youknowriad added [Type] Bug An existing feature does not function as intended [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... and removed Needs Technical Feedback Needs testing from a developer perspective. labels Apr 22, 2019
@grappler
Copy link
Member

This is still an issue with WP 5.4. This #21162 should fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block API API that allows to express the block paradigm. [Feature] Paste [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants