diff --git a/ghost/admin/app/components/modal-post-preview.hbs b/ghost/admin/app/components/modal-post-preview.hbs index b748a25a9e..4115587c64 100644 --- a/ghost/admin/app/components/modal-post-preview.hbs +++ b/ghost/admin/app/components/modal-post-preview.hbs @@ -2,8 +2,10 @@ - {{#if (eq this.tab "desktop")}} - + {{#if (eq this.tab "browser")}} + {{/if}} - {{#if (eq this.tab "email")}} + {{#if (and (eq this.tab "email") this.model.isPost)}} {{/if}} diff --git a/ghost/admin/app/components/modal-post-preview.js b/ghost/admin/app/components/modal-post-preview.js index 854296e41a..7c886d6871 100644 --- a/ghost/admin/app/components/modal-post-preview.js +++ b/ghost/admin/app/components/modal-post-preview.js @@ -6,7 +6,7 @@ import {tracked} from '@glimmer/tracking'; // TODO: update modals to work fully with Glimmer components @classic export default class ModalPostPreviewComponent extends ModalBase { - @tracked tab = 'desktop'; + @tracked tab = 'browser'; @action changeTab(tab) { @@ -17,4 +17,15 @@ export default class ModalPostPreviewComponent extends ModalBase { close() { this.closeModal(); } + + actions = { + confirm() { + // noop - needed to override ModalBase.actions.confirm + }, + + // needed because ModalBase uses .send() for keyboard events + closeModal() { + this.closeModal(); + } + } } diff --git a/ghost/admin/app/components/modal-post-preview/browser.hbs b/ghost/admin/app/components/modal-post-preview/browser.hbs new file mode 100644 index 0000000000..16c95e92dc --- /dev/null +++ b/ghost/admin/app/components/modal-post-preview/browser.hbs @@ -0,0 +1,20 @@ + +
+ Share this preview privately +
+ {{@post.previewUrl}} +
+ +
\ No newline at end of file diff --git a/ghost/admin/app/components/modal-post-preview/browser.js b/ghost/admin/app/components/modal-post-preview/browser.js new file mode 100644 index 0000000000..c19a5f3c52 --- /dev/null +++ b/ghost/admin/app/components/modal-post-preview/browser.js @@ -0,0 +1,12 @@ +import Component from '@glimmer/component'; +import copyTextToClipboard from 'ghost-admin/utils/copy-text-to-clipboard'; +import {task} from 'ember-concurrency-decorators'; +import {timeout} from 'ember-concurrency'; + +export default class ModalPostPreviewBrowserComponent extends Component { + @task + *copyPreviewUrl() { + copyTextToClipboard(this.args.post.previewUrl); + yield timeout(this.isTesting ? 50 : 3000); + } +} diff --git a/ghost/admin/app/components/modal-post-preview/desktop.hbs b/ghost/admin/app/components/modal-post-preview/desktop.hbs deleted file mode 100644 index 9e6e183b0e..0000000000 --- a/ghost/admin/app/components/modal-post-preview/desktop.hbs +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/ghost/admin/app/components/modal-post-preview/email.hbs b/ghost/admin/app/components/modal-post-preview/email.hbs index 363cb50033..124c3a1be1 100644 --- a/ghost/admin/app/components/modal-post-preview/email.hbs +++ b/ghost/admin/app/components/modal-post-preview/email.hbs @@ -1,4 +1,4 @@ -