Skip to content

Commit

Permalink
Use addQueryArgs() for adding the preview argument.
Browse files Browse the repository at this point in the history
  • Loading branch information
pento committed Dec 22, 2017
1 parent 23c42ca commit 0d9179c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions editor/components/post-permalink/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { connect } from 'react-redux';
import { Component } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { Dashicon, ClipboardButton, Button } from '@wordpress/components';
import { addQueryArgs } from '@wordpress/url';

/**
* Internal Dependencies
Expand All @@ -25,7 +26,6 @@ class PostPermalink extends Component {
};
this.onCopy = this.onCopy.bind( this );
this.onEditPermalink = this.onEditPermalink.bind( this );
this.onCancelEditPermalink = this.onCancelEditPermalink.bind( this );
this.onSavePermalink = this.onSavePermalink.bind( this );
}

Expand Down Expand Up @@ -65,7 +65,7 @@ class PostPermalink extends Component {
viewLink = link;
if ( samplePermalink ) {
permalink = samplePermalink[ 0 ].replace( '%postname%', samplePermalink[ 1 ] );
viewLink += '&preview=true';
viewLink = addQueryArgs( viewLink, { preview: true } );
}

const prefix = permalink.replace( /[^/]+\/?$/, '' ),
Expand Down

0 comments on commit 0d9179c

Please sign in to comment.