Skip to content

Commit 17c54a6

Browse files
authored
Merge pull request #123 from ragestudio/dev
1.37.0
2 parents ec8d0a0 + b900864 commit 17c54a6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+630
-6263
lines changed

comty.js

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
1-
export default {
2-
"default-context": (items) => {
3-
const text = window.getSelection().toString()
1+
import copyToClipboard from "@utils/copyToClipboard"
2+
import pasteFromClipboard from "@utils/pasteFromClipboard"
43

5-
if (text) {
6-
items.push({
7-
label: "Copy",
8-
icon: "FiCopy",
9-
action: (clickedItem, ctx) => {
10-
copyToClipboard(text)
4+
export default {
5+
"default-context": (items) => {
6+
const text = window.getSelection().toString()
117

12-
ctx.close()
13-
}
14-
})
15-
}
8+
if (text) {
9+
items.push({
10+
label: "Copy",
11+
icon: "FiCopy",
12+
action: (clickedItem, ctx) => {
13+
copyToClipboard(text)
1614

17-
items.push({
18-
label: "Paste",
19-
icon: "FiClipboard",
20-
action: (clickedItem, ctx) => {
21-
app.message.error("This action is not supported by your browser")
15+
ctx.close()
16+
},
17+
})
18+
}
2219

23-
ctx.close()
24-
}
25-
})
20+
items.push({
21+
label: "Paste",
22+
icon: "FiClipboard",
23+
action: (clickedItem, ctx) => {
24+
pasteFromClipboard(clickedItem)
25+
ctx.close()
26+
},
27+
})
2628

27-
items.push({
28-
label: "Report a bug",
29-
icon: "FiAlertTriangle",
30-
action: (clickedItem, ctx) => {
31-
app.eventBus.emit("app.reportBug", {
32-
clickedItem,
33-
})
29+
items.push({
30+
label: "Report a bug",
31+
icon: "FiAlertTriangle",
32+
action: (clickedItem, ctx) => {
33+
app.eventBus.emit("app.reportBug", {
34+
clickedItem,
35+
})
3436

35-
ctx.close()
36-
}
37-
})
37+
ctx.close()
38+
},
39+
})
3840

39-
return items
40-
}
41-
}
41+
return items
42+
},
43+
}

packages/app/config/context-menu/post/index.js

Lines changed: 61 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2,69 +2,73 @@ import copyToClipboard from "@utils/copyToClipboard"
22
import download from "@utils/download"
33

44
export default {
5-
"post-card": (items, parent, element, control) => {
6-
items.push({
7-
label: "Copy ID",
8-
icon: "FiCopy",
9-
action: () => {
10-
copyToClipboard(parent.id)
11-
control.close()
12-
}
13-
})
5+
"post-card": (items, parent, element, control) => {
6+
if (!parent.id) {
7+
parent = parent.parentNode
8+
}
149

15-
items.push({
16-
label: "Copy Link",
17-
icon: "FiLink",
18-
action: () => {
19-
copyToClipboard(`${window.location.origin}/post/${parent.id}`)
20-
control.close()
21-
}
22-
})
10+
items.push({
11+
label: "Copy ID",
12+
icon: "FiCopy",
13+
action: () => {
14+
copyToClipboard(parent.id)
15+
control.close()
16+
},
17+
})
2318

24-
let media = null
19+
items.push({
20+
label: "Copy Link",
21+
icon: "FiLink",
22+
action: () => {
23+
copyToClipboard(`${window.location.origin}/post/${parent.id}`)
24+
control.close()
25+
},
26+
})
2527

26-
if (parent.querySelector(".attachment")) {
27-
media = parent.querySelector(".attachment")
28-
media = media.querySelector("video, img")
28+
let media = null
2929

30-
if (media.querySelector("source")) {
31-
media = media.querySelector("source")
32-
}
33-
}
30+
if (parent.querySelector(".attachment")) {
31+
media = parent.querySelector(".attachment")
32+
media = media.querySelector("video, img")
3433

35-
if (media) {
36-
items.push({
37-
type: "separator",
38-
})
34+
if (media.querySelector("source")) {
35+
media = media.querySelector("source")
36+
}
37+
}
3938

40-
items.push({
41-
label: "Copy media URL",
42-
icon: "FiCopy",
43-
action: () => {
44-
copyToClipboard(media.src)
45-
control.close()
46-
}
47-
})
39+
if (media) {
40+
items.push({
41+
type: "separator",
42+
})
4843

49-
items.push({
50-
label: "Open media in new tab",
51-
icon: "FiExternalLink",
52-
action: () => {
53-
window.open(media.src, "_blank")
54-
control.close()
55-
}
56-
})
44+
items.push({
45+
label: "Copy media URL",
46+
icon: "FiCopy",
47+
action: () => {
48+
copyToClipboard(media.src)
49+
control.close()
50+
},
51+
})
5752

58-
items.push({
59-
label: "Download media",
60-
icon: "FiDownload",
61-
action: () => {
62-
download(media.src)
63-
control.close()
64-
}
65-
})
66-
}
53+
items.push({
54+
label: "Open media in new tab",
55+
icon: "FiExternalLink",
56+
action: () => {
57+
window.open(media.src, "_blank")
58+
control.close()
59+
},
60+
})
6761

68-
return items
69-
}
70-
}
62+
items.push({
63+
label: "Download media",
64+
icon: "FiDownload",
65+
action: () => {
66+
download(media.src)
67+
control.close()
68+
},
69+
})
70+
}
71+
72+
return items
73+
},
74+
}

packages/app/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
{
22
"name": "@comty/app",
3-
"version": "1.36.0@alpha",
3+
"version": "1.37.0@alpha",
44
"license": "ComtyLicense",
55
"main": "electron/main",
66
"type": "module",
77
"author": "RageStudio",
88
"description": "A prototype of a social network.",
99
"scripts": {
10-
"build": "vite build",
1110
"dev": "vite",
12-
"docker-compose:update_run": "docker-compose down && git pull && yarn build && docker-compose up -d --build",
11+
"build": "vite build",
1312
"preview": "vite preview",
1413
"release": "node ./scripts/release.js"
1514
},
@@ -33,7 +32,7 @@
3332
"axios": "^1.7.7",
3433
"bear-react-carousel": "^4.0.10-alpha.0",
3534
"classnames": "2.3.1",
36-
"comty.js": "^0.61.0",
35+
"comty.js": "^0.63.0",
3736
"dashjs": "^4.7.4",
3837
"dompurify": "^3.0.0",
3938
"fast-average-color": "^9.2.0",

packages/app/src-tauri/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)