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

View File

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