mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-18 02:21:47 -05:00
Made a couple of actions work
This commit is contained in:
parent
3d49e01e6a
commit
c542947fa3
2 changed files with 27 additions and 12 deletions
|
@ -106,7 +106,7 @@
|
|||
</button>
|
||||
<GhTaskButton
|
||||
@buttonText="Copy link"
|
||||
@task={{this.handleCopyClick}}
|
||||
@task={{this.handleCopyLink}}
|
||||
@successText="Link copied"
|
||||
@class="gh-btn gh-btn-primary gh-btn-icon" />
|
||||
{{else}}
|
||||
|
@ -124,26 +124,23 @@
|
|||
<button
|
||||
class="gh-btn"
|
||||
type="button"
|
||||
{{!-- {{on "click" this.close}} --}}
|
||||
{{on "click" this.viewInBrowser}}
|
||||
{{on "mousedown" (optional this.noop)}}
|
||||
>
|
||||
<span>View in browser</span>
|
||||
</button>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<button
|
||||
class="gh-btn"
|
||||
type="button"
|
||||
{{!-- {{on "click" this.close}} --}}
|
||||
{{on "mousedown" (optional this.noop)}}
|
||||
>
|
||||
<span>Copy preview link</span>
|
||||
</button>
|
||||
<GhTaskButton
|
||||
@buttonText="Copy preview link"
|
||||
@task={{this.handleCopyPreviewLink}}
|
||||
@successText="Link copied"
|
||||
@class="gh-btn gh-btn-icon" />
|
||||
{{/if}}
|
||||
<button
|
||||
class="gh-btn gh-btn-primary"
|
||||
type="button"
|
||||
{{!-- {{on "click" this.close}} --}}
|
||||
{{on "click" this.close}}
|
||||
{{on "mousedown" (optional this.noop)}}
|
||||
>
|
||||
<span>OK</span>
|
||||
|
|
|
@ -37,10 +37,28 @@ export default class ModalPublishFlow extends ModalComponent {
|
|||
window.open(`http://www.linkedin.com/shareArticle?mini=true&url=${encodeURI(this.post.url)}`, '_blank');
|
||||
}
|
||||
|
||||
@action
|
||||
viewInBrowser() {
|
||||
window.open(this.post.url, '_blank');
|
||||
}
|
||||
|
||||
@action
|
||||
close(event) {
|
||||
event?.preventDefault?.();
|
||||
this.closeModal();
|
||||
}
|
||||
|
||||
@task
|
||||
*handleCopyClick() {
|
||||
*handleCopyLink() {
|
||||
copyTextToClipboard(this.post.url);
|
||||
yield timeout(1000);
|
||||
return true;
|
||||
}
|
||||
|
||||
@task
|
||||
*handleCopyPreviewLink() {
|
||||
copyTextToClipboard(this.post.previewUrl);
|
||||
yield timeout(1000);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue