Merge pull request #89 from useplunk/dev-driaug-revert

Catch up canary to main
This commit is contained in:
Dries Augustyns
2024-09-13 21:23:32 +02:00
committed by GitHub
5 changed files with 61 additions and 44 deletions
+3 -1
View File
@@ -8,8 +8,10 @@
<p align="center"> <p align="center">
<img src="https://img.shields.io/github/contributors/useplunk/plunk"/> <img src="https://img.shields.io/github/contributors/useplunk/plunk"/>
<img src="https://img.shields.io/github/actions/workflow/status/driaug/plunk-whitelabel/docker-build.yml"/> <img src="https://img.shields.io/github/actions/workflow/status/driaug/plunk-whitelabel/docker-build-prod.yml"/>
<img src="https://img.shields.io/docker/pulls/driaug/plunk"/> <img src="https://img.shields.io/docker/pulls/driaug/plunk"/>
<img src="https://img.shields.io/github/license/useplunk/plunk"/>
<img src="https://img.shields.io/github/stars/useplunk/plunk"/>
</p> </p>
## Introduction ## Introduction
+2 -4
View File
@@ -1,12 +1,10 @@
{ {
"name": "plunk", "name": "plunk",
"version": "1.0.3", "version": "1.0.5",
"private": true, "private": true,
"license": "agpl-3.0", "license": "agpl-3.0",
"workspaces": { "workspaces": {
"packages": [ "packages": ["packages/*"]
"packages/*"
]
}, },
"engines": { "engines": {
"npm": ">=6.14.x", "npm": ">=6.14.x",
+4 -4
View File
@@ -103,13 +103,13 @@ export class Contacts {
const { id, email } = ContactSchemas.manage.parse(req.body); const { id, email } = ContactSchemas.manage.parse(req.body);
const contact = id ? await ContactService.id(id) : await ContactService.email(project.id, email as string); let contact = id ? await ContactService.id(id) : await ContactService.email(project.id, email as string);
if (!contact || contact.projectId !== project.id) { if (!contact || contact.projectId !== project.id) {
throw new NotFound("contact"); throw new NotFound("contact");
} }
await prisma.contact.update({ contact = await prisma.contact.update({
where: { id: contact.id }, where: { id: contact.id },
data: { subscribed: false }, data: { subscribed: false },
}); });
@@ -154,13 +154,13 @@ export class Contacts {
const { id, email } = ContactSchemas.manage.parse(req.body); const { id, email } = ContactSchemas.manage.parse(req.body);
const contact = id ? await ContactService.id(id) : await ContactService.email(project.id, email as string); let contact = id ? await ContactService.id(id) : await ContactService.email(project.id, email as string);
if (!contact || contact.projectId !== project.id) { if (!contact || contact.projectId !== project.id) {
throw new NotFound("contact"); throw new NotFound("contact");
} }
await prisma.contact.update({ contact = await prisma.contact.update({
where: { id: contact.id }, where: { id: contact.id },
data: { subscribed: true }, data: { subscribed: true },
}); });
@@ -33,6 +33,7 @@ export class Events {
await prisma.event.delete({ where: { id } }); await prisma.event.delete({ where: { id } });
await redis.del(Keys.Event.id(id)); await redis.del(Keys.Event.id(id));
await redis.del(Keys.Event.event(project.id, event.name));
return res.status(200).json(event); return res.status(200).json(event);
} }
@@ -108,6 +108,22 @@ export default function Editor({ value, onChange, mode, modeSwitcher }: Markdown
keydown: (_view, event) => { keydown: (_view, event) => {
return event.key === "Enter" && !event.shiftKey; return event.key === "Enter" && !event.shiftKey;
}, },
paste: (view, event) => {
const text = event.clipboardData?.getData("text");
const urlPattern = /^(https?:\/\/)?([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*({{[\w-]+}})?)*$/;
if (editor && text && urlPattern.test(text)) {
event.preventDefault();
editor
.chain()
.focus()
.extendMarkRange("link")
.setLink({ href: text.startsWith("http") ? text : `https://${text}`, target: "_blank" })
.run();
editor.commands.insertContent(text);
}
return true;
},
}, },
}, },
onUpdate: ({ editor }) => { onUpdate: ({ editor }) => {