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

Replace TinyMCE decode entities #10283

Merged
merged 1 commit into from Oct 3, 2018
Merged

Conversation

ellatrix
Copy link
Member

@ellatrix ellatrix commented Oct 1, 2018

Description

Replace TinyMCE function to decode entities with existing Gutenberg package.

How has this been tested?

Copy paste for example http://example.com/path/to/page?name=gutenberg&color=black on top of a selection. A link should be created and the "&" character should be decoded.

I was looking at adding an e2e test but didn't find anything useful right away to do pasting.

Screenshots

Types of changes

Checklist:

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

@ellatrix ellatrix requested a review from a team October 2, 2018 00:10
Copy link
Member

@tofumatt tofumatt left a comment

Choose a reason for hiding this comment

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

Makes sense to me! I think I can add a test for copy/pasting if there's no huge rush on merging this (like an hour or so!)

@ellatrix
Copy link
Member Author

ellatrix commented Oct 2, 2018 via email

@tofumatt
Copy link
Member

tofumatt commented Oct 2, 2018

Clipboard tests in Puppeteer are super weird and not straightforward.

I tried:

it( 'should create a link from a pasted URL ', async () => {
		const url = 'http://example.com/path/to/page?name=gutenberg&color=black';
		// Create some text, including the URL we want to copy/paste.
		await clickBlockAppender();
		await page.keyboard.type( `First paragraph ${ url }` );

		// Select the URL in this paragraph.
		for ( let i = 0; i < url.length; i++ ) {
			await pressWithModifier( 'Shift', 'ArrowLeft' );
		}

		// Copy the URL.
		await pressWithModifier( META_KEY, 'C' );

		// Move the cursor back to the end and create a new paragraph.
		for ( let i = 0; i < url.length; i++ ) {
			await pressWithModifier( 'Shift', 'ArrowRight' );
		}
		await page.keyboard.press( 'Enter' );
		await page.keyboard.type( 'Second paragraph where we can replace the last word.' );

		// Select the last word and paste the URL.
		await page.keyboard.press( 'ArrowLeft' );
		for ( let i = 1; i <= 4; i++ ) {
			await pressWithModifier( 'Shift', 'ArrowLeft' );
		}
		await pressWithModifier( META_KEY, 'P' );

		expect( await getEditedPostContent() ).toMatchSnapshot();
	} );

but it never copy/pasted. I say just merge this and I will work on the tests for a later PR.

@ellatrix ellatrix merged commit 2cd853f into master Oct 3, 2018
@ellatrix ellatrix deleted the try/replace-mce-decode-entities branch October 3, 2018 02:57
@mtias mtias added this to the 4.0 milestone Oct 9, 2018
@mtias mtias added the [Type] Code Quality Issues or PRs that relate to code quality label Oct 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants