add open button

This commit is contained in:
Maxime Cannoodt 2022-07-11 01:13:28 +02:00
parent 1e21a1045c
commit 4781de54ea
2 changed files with 13 additions and 5 deletions

View File

@ -1,6 +1,5 @@
<script lang="ts">
import moment, { type Moment } from "moment";
import { now } from "svelte/internal";
export let url: string;
export let expireTime: Moment;
@ -17,6 +16,10 @@
buttonText = "copy";
}, 1500);
}
function onOpen() {
window.open(url, "_blank");
}
</script>
<div class="share-plugin-modal-container">
@ -27,10 +30,15 @@
<div id="url">
<input disabled id="url-input" type="text" bind:value={url} />
<button
id="url-copy-button"
class="url-button"
aria-label="Copy link to clipboard"
on:click={onCopy}>{buttonText}</button
>
<button
class="url-button"
aria-label="Copy link to clipboard"
on:click={onOpen}>Open</button
>
</div>
<p id="subtext">
🔐 End-to-end encrypted • Expires in {expireTime.diff(
@ -62,9 +70,9 @@
cursor: pointer !important;
}
#url-copy-button {
.url-button {
margin: 0px;
width: 6em;
width: 5em;
}
#subtext {

View File

@ -1,7 +1,7 @@
import type NoteSharingPlugin from "main";
import { Modal } from "obsidian";
import Component from "./SharedNoteSuccessComponent.svelte";
import type { Moment } from "moment";
import Component from "./SharedNoteSuccessComponent.svelte";
export class SharedNoteSuccessModal extends Modal {
private url: string;