Skip to content

Commit

Permalink
import/export
Browse files Browse the repository at this point in the history
  • Loading branch information
edde746 committed Aug 18, 2023
1 parent 97a82b4 commit 1796d49
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

- name: Copy additional files
run: |
cp -r previews/* dist || true
cp -r previews/* dist/previews/ || true
cp README.md dist/README.md
printf -- "---\npermalink: /404.html\n---\n" > dist/404.md
printf -- "> **Note:** You accessed a link that returned a 404, probably by clicking one of the plugin links. You're supposed to copy the link address and add it into shelter.\n\n" >> dist/404.md
Expand Down
34 changes: 34 additions & 0 deletions plugins/canned-responses/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const {
TextArea,
TextBox,
niceScrollbarsClass,
showToast,
},
plugin: { store },
util: { getFiber },
Expand Down Expand Up @@ -89,6 +90,34 @@ const managementModal = () => (
))}
</div>
</ModalBody>
<ModalFooter>
<div className="buttons-container">
<Button
onClick={() => {
// copy store.responses to clipboard
navigator.clipboard.writeText(JSON.stringify(store.responses));
showToast({
title: "Exported",
content: "Canned responses copied to clipboard",
duration: 3000,
});
}}
grow={true}
>
Export
</Button>
<Button
onClick={async () => {
// import store.responses from clipboard
const text = await navigator.clipboard.readText();
store.responses = JSON.parse(text);
}}
grow={true}
>
Import
</Button>
</div>
</ModalFooter>
</ModalRoot>
);

Expand Down Expand Up @@ -185,6 +214,11 @@ const toggleSendingPopup = () => {
let unobserve = null;
export function onLoad() {
injectCss(`
.buttons-container {
display: flex;
gap: .5rem;
}
.send-responses {
max-height: 200px;
overflow-y: auto;
Expand Down

0 comments on commit 1796d49

Please sign in to comment.