Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a25d108fe | ||
|
|
d98e213b92 | ||
|
|
4d44562ada | ||
|
|
b733b3c59f | ||
|
|
7b54988514 | ||
|
|
ec4da47af6 | ||
|
|
633d59c13b | ||
|
|
c06a92e0ae | ||
|
|
18bd9d62cb | ||
|
|
0bce6c6a46 | ||
|
|
0465442803 | ||
|
|
eb667bc436 | ||
|
|
c81628a66e | ||
|
|
50d3631bc4 | ||
|
|
e971069595 | ||
|
|
ac4c0ec1f6 | ||
|
|
fe3d2e0af4 | ||
|
|
a4b762e1b1 | ||
|
|
daa0015fbd | ||
|
|
804248d6ad | ||
|
|
78c4c67a6c | ||
|
|
c23be53bfd | ||
|
|
d7e3e70430 | ||
|
|
e95a859ee9 | ||
|
|
1a3704e700 | ||
|
|
f49048c6e1 | ||
|
|
59226365c5 | ||
|
|
683ce431db | ||
|
|
8d4e796f42 | ||
|
|
3da1fbf6ca | ||
|
|
419e25df23 | ||
|
|
7fddf80c09 | ||
|
|
fa85e61d6f | ||
|
|
ebac0db0df | ||
|
|
0404f30c87 | ||
|
|
769fd7b524 | ||
|
|
4b5553abef | ||
|
|
e730eb3a32 | ||
|
|
2933b6e732 |
6
.github/PULL_REQUEST_TEMPLATE.md
vendored
6
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,12 +1,12 @@
|
|||||||
<!-- Please read https://github.com/ajbura/cinny/CONTRIBUTING.md before submitting your pull request -->
|
<!-- Please read https://github.com/ajbura/cinny/CONTRIBUTING.md before submitting your pull request -->
|
||||||
|
|
||||||
# Description
|
### Description
|
||||||
|
|
||||||
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
|
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
|
||||||
|
|
||||||
Fixes # (issue)
|
Fixes # (issue)
|
||||||
|
|
||||||
## Type of change
|
#### Type of change
|
||||||
|
|
||||||
Please delete options that are not relevant.
|
Please delete options that are not relevant.
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ Please delete options that are not relevant.
|
|||||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||||
- [ ] This change requires a documentation update
|
- [ ] This change requires a documentation update
|
||||||
|
|
||||||
# Checklist:
|
### Checklist:
|
||||||
|
|
||||||
- [ ] My code follows the style guidelines of this project
|
- [ ] My code follows the style guidelines of this project
|
||||||
- [ ] I have performed a self-review of my own code
|
- [ ] I have performed a self-review of my own code
|
||||||
|
|||||||
709
package-lock.json
generated
709
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cinny",
|
"name": "cinny",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -1596,6 +1596,14 @@
|
|||||||
"integrity": "sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA==",
|
"integrity": "sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@types/debug": {
|
||||||
|
"version": "4.1.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz",
|
||||||
|
"integrity": "sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==",
|
||||||
|
"requires": {
|
||||||
|
"@types/ms": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@types/eslint": {
|
"@types/eslint": {
|
||||||
"version": "7.2.7",
|
"version": "7.2.7",
|
||||||
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.2.7.tgz",
|
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.2.7.tgz",
|
||||||
@@ -1681,6 +1689,11 @@
|
|||||||
"integrity": "sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA==",
|
"integrity": "sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@types/ms": {
|
||||||
|
"version": "0.7.31",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz",
|
||||||
|
"integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA=="
|
||||||
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "14.14.37",
|
"version": "14.14.37",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.37.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.37.tgz",
|
||||||
@@ -2134,12 +2147,6 @@
|
|||||||
"integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=",
|
"integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"array-filter": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/array-filter/-/array-filter-1.0.0.tgz",
|
|
||||||
"integrity": "sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"array-flatten": {
|
"array-flatten": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz",
|
||||||
@@ -2242,6 +2249,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"assert": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/assert/-/assert-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-se5Cd+js9dXJnu6Ag2JFc00t+HmHOen+8Q+L7O9zI0PqQXr20uk2J0XQqMxZEeo5U50o8Nvmmx7dZrl+Ufr35A==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"es6-object-assign": "^1.1.0",
|
||||||
|
"is-nan": "^1.2.1",
|
||||||
|
"object-is": "^1.0.1",
|
||||||
|
"util": "^0.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"assert-plus": {
|
"assert-plus": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
|
||||||
@@ -2309,13 +2328,10 @@
|
|||||||
"integrity": "sha512-jnSyH2d+qdfPGpWlcuhGiHmqBJ6g3X+8T+iRwFrHPLVcdoGJE/x6Qicm6aDHfTsbgZKxyV8UU/YB2p4cjKDRRA=="
|
"integrity": "sha512-jnSyH2d+qdfPGpWlcuhGiHmqBJ6g3X+8T+iRwFrHPLVcdoGJE/x6Qicm6aDHfTsbgZKxyV8UU/YB2p4cjKDRRA=="
|
||||||
},
|
},
|
||||||
"available-typed-arrays": {
|
"available-typed-arrays": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.4.tgz",
|
||||||
"integrity": "sha512-XWX3OX8Onv97LMk/ftVyBibpGwY5a8SmuxZPzeOxqmuEqUCOM9ZE+uIaD1VNJ5QnvU2UQusvmKbuM1FR8QWGfQ==",
|
"integrity": "sha512-SA5mXJWrId1TaQjfxUYghbqQ/hYioKmLJvPJyDuYRtXXenFNMjj4hSSt1Cf1xsuXSXrtxrVC5Ot4eU6cOtBDdA==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"requires": {
|
|
||||||
"array-filter": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"aws-sign2": {
|
"aws-sign2": {
|
||||||
"version": "0.7.0",
|
"version": "0.7.0",
|
||||||
@@ -3359,24 +3375,6 @@
|
|||||||
"integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=",
|
"integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"commonmark": {
|
|
||||||
"version": "0.30.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/commonmark/-/commonmark-0.30.0.tgz",
|
|
||||||
"integrity": "sha512-j1yoUo4gxPND1JWV9xj5ELih0yMv1iCWDG6eEQIPLSWLxzCXiFoyS7kvB+WwU+tZMf4snwJMMtaubV0laFpiBA==",
|
|
||||||
"requires": {
|
|
||||||
"entities": "~2.0",
|
|
||||||
"mdurl": "~1.0.1",
|
|
||||||
"minimist": ">=1.2.2",
|
|
||||||
"string.prototype.repeat": "^0.2.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"entities": {
|
|
||||||
"version": "2.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/entities/-/entities-2.0.3.tgz",
|
|
||||||
"integrity": "sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ=="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"component-emitter": {
|
"component-emitter": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
|
||||||
@@ -4705,6 +4703,12 @@
|
|||||||
"is-symbol": "^1.0.2"
|
"is-symbol": "^1.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"es6-object-assign": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz",
|
||||||
|
"integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"es6-promise": {
|
"es6-promise": {
|
||||||
"version": "3.3.1",
|
"version": "3.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz",
|
||||||
@@ -5972,11 +5976,6 @@
|
|||||||
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
|
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"fuse.js": {
|
|
||||||
"version": "6.4.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-6.4.6.tgz",
|
|
||||||
"integrity": "sha512-/gYxR/0VpXmWSfZOIPS3rWwU8SHgsRTwWuXhyb2O6s7aRuVtHtxCkR33bNYu3wyLyNx/Wpv0vU7FZy8Vj53VNw=="
|
|
||||||
},
|
|
||||||
"fwd-stream": {
|
"fwd-stream": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/fwd-stream/-/fwd-stream-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/fwd-stream/-/fwd-stream-1.0.4.tgz",
|
||||||
@@ -6245,6 +6244,15 @@
|
|||||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz",
|
||||||
"integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw=="
|
"integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw=="
|
||||||
},
|
},
|
||||||
|
"has-tostringtag": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"has-symbols": "^1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"has-unicode": {
|
"has-unicode": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
|
||||||
@@ -7049,10 +7057,13 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"is-generator-function": {
|
"is-generator-function": {
|
||||||
"version": "1.0.8",
|
"version": "1.0.10",
|
||||||
"resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz",
|
||||||
"integrity": "sha512-2Omr/twNtufVZFr1GhxjOMFPAj2sjc/dKaIqBhvo4qciXfJmITGH6ZGd8eZYNHza8t1y0e01AuqRhJwfWp26WQ==",
|
"integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"has-tostringtag": "^1.0.0"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"is-glob": {
|
"is-glob": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
@@ -7068,6 +7079,16 @@
|
|||||||
"resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz",
|
||||||
"integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw=="
|
"integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw=="
|
||||||
},
|
},
|
||||||
|
"is-nan": {
|
||||||
|
"version": "1.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz",
|
||||||
|
"integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"call-bind": "^1.0.0",
|
||||||
|
"define-properties": "^1.1.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
"is-negative-zero": {
|
"is-negative-zero": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz",
|
||||||
@@ -7197,16 +7218,68 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"is-typed-array": {
|
"is-typed-array": {
|
||||||
"version": "1.1.5",
|
"version": "1.1.7",
|
||||||
"resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.7.tgz",
|
||||||
"integrity": "sha512-S+GRDgJlR3PyEbsX/Fobd9cqpZBuvUS+8asRqYDMLCb2qMzt1oz5m5oxQCxOgUDxiWsOVNi4yaF+/uvdlHlYug==",
|
"integrity": "sha512-VxlpTBGknhQ3o7YiVjIhdLU6+oD8dPz/79vvvH4F+S/c8608UCVa9fgDpa1kZgFoUST2DCgacc70UszKgzKuvA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"available-typed-arrays": "^1.0.2",
|
"available-typed-arrays": "^1.0.4",
|
||||||
"call-bind": "^1.0.2",
|
"call-bind": "^1.0.2",
|
||||||
"es-abstract": "^1.18.0-next.2",
|
"es-abstract": "^1.18.5",
|
||||||
"foreach": "^2.0.5",
|
"foreach": "^2.0.5",
|
||||||
"has-symbols": "^1.0.1"
|
"has-tostringtag": "^1.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"es-abstract": {
|
||||||
|
"version": "1.18.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.5.tgz",
|
||||||
|
"integrity": "sha512-DDggyJLoS91CkJjgauM5c0yZMjiD1uK3KcaCeAmffGwZ+ODWzOkPN4QwRbsK5DOFf06fywmyLci3ZD8jLGhVYA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"call-bind": "^1.0.2",
|
||||||
|
"es-to-primitive": "^1.2.1",
|
||||||
|
"function-bind": "^1.1.1",
|
||||||
|
"get-intrinsic": "^1.1.1",
|
||||||
|
"has": "^1.0.3",
|
||||||
|
"has-symbols": "^1.0.2",
|
||||||
|
"internal-slot": "^1.0.3",
|
||||||
|
"is-callable": "^1.2.3",
|
||||||
|
"is-negative-zero": "^2.0.1",
|
||||||
|
"is-regex": "^1.1.3",
|
||||||
|
"is-string": "^1.0.6",
|
||||||
|
"object-inspect": "^1.11.0",
|
||||||
|
"object-keys": "^1.1.1",
|
||||||
|
"object.assign": "^4.1.2",
|
||||||
|
"string.prototype.trimend": "^1.0.4",
|
||||||
|
"string.prototype.trimstart": "^1.0.4",
|
||||||
|
"unbox-primitive": "^1.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"is-regex": {
|
||||||
|
"version": "1.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz",
|
||||||
|
"integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"call-bind": "^1.0.2",
|
||||||
|
"has-tostringtag": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"is-string": {
|
||||||
|
"version": "1.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz",
|
||||||
|
"integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"has-tostringtag": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"object-inspect": {
|
||||||
|
"version": "1.11.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz",
|
||||||
|
"integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"is-typedarray": {
|
"is-typedarray": {
|
||||||
@@ -7956,6 +8029,17 @@
|
|||||||
"micromark": "~2.11.0",
|
"micromark": "~2.11.0",
|
||||||
"parse-entities": "^2.0.0",
|
"parse-entities": "^2.0.0",
|
||||||
"unist-util-stringify-position": "^2.0.0"
|
"unist-util-stringify-position": "^2.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"micromark": {
|
||||||
|
"version": "2.11.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark/-/micromark-2.11.4.tgz",
|
||||||
|
"integrity": "sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==",
|
||||||
|
"requires": {
|
||||||
|
"debug": "^4.0.0",
|
||||||
|
"parse-entities": "^2.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mdast-util-gfm": {
|
"mdast-util-gfm": {
|
||||||
@@ -7978,6 +8062,17 @@
|
|||||||
"ccount": "^1.0.0",
|
"ccount": "^1.0.0",
|
||||||
"mdast-util-find-and-replace": "^1.1.0",
|
"mdast-util-find-and-replace": "^1.1.0",
|
||||||
"micromark": "^2.11.3"
|
"micromark": "^2.11.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"micromark": {
|
||||||
|
"version": "2.11.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark/-/micromark-2.11.4.tgz",
|
||||||
|
"integrity": "sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==",
|
||||||
|
"requires": {
|
||||||
|
"debug": "^4.0.0",
|
||||||
|
"parse-entities": "^2.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mdast-util-gfm-strikethrough": {
|
"mdast-util-gfm-strikethrough": {
|
||||||
@@ -8090,64 +8185,376 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"micromark": {
|
"micromark": {
|
||||||
"version": "2.11.4",
|
"version": "3.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/micromark/-/micromark-2.11.4.tgz",
|
"resolved": "https://registry.npmjs.org/micromark/-/micromark-3.0.3.tgz",
|
||||||
"integrity": "sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==",
|
"integrity": "sha512-fWuHx+JKV4zA8WfCFor2DWP9XmsZkIiyWRGofr7P7IGfpRIlb7/C5wwusGsNyr1D8HI5arghZDG1Ikc0FBwS5Q==",
|
||||||
"requires": {
|
"requires": {
|
||||||
|
"@types/debug": "^4.0.0",
|
||||||
"debug": "^4.0.0",
|
"debug": "^4.0.0",
|
||||||
"parse-entities": "^2.0.0"
|
"micromark-core-commonmark": "^1.0.0",
|
||||||
|
"micromark-factory-space": "^1.0.0",
|
||||||
|
"micromark-util-character": "^1.0.0",
|
||||||
|
"micromark-util-chunked": "^1.0.0",
|
||||||
|
"micromark-util-combine-extensions": "^1.0.0",
|
||||||
|
"micromark-util-decode-numeric-character-reference": "^1.0.0",
|
||||||
|
"micromark-util-encode": "^1.0.0",
|
||||||
|
"micromark-util-normalize-identifier": "^1.0.0",
|
||||||
|
"micromark-util-resolve-all": "^1.0.0",
|
||||||
|
"micromark-util-sanitize-uri": "^1.0.0",
|
||||||
|
"micromark-util-subtokenize": "^1.0.0",
|
||||||
|
"micromark-util-symbol": "^1.0.0",
|
||||||
|
"micromark-util-types": "^1.0.0",
|
||||||
|
"parse-entities": "^3.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"character-entities": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-oHqMj3eAuJ77/P5PaIRcqk+C3hdfNwyCD2DAUcD5gyXkegAuF2USC40CEqPscDk4I8FRGMTojGJQkXDsN5QlJA=="
|
||||||
|
},
|
||||||
|
"character-entities-legacy": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-YwaEtEvWLpFa6Wh3uVLrvirA/ahr9fki/NUd/Bd4OR6EdJ8D22hovYQEOUCBfQfcqnC4IAMGMsHXY1eXgL4ZZA=="
|
||||||
|
},
|
||||||
|
"character-reference-invalid": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-pE3Z15lLRxDzWJy7bBHBopRwfI20sbrMVLQTC7xsPglCHf4Wv1e167OgYAFP78co2XlhojDyAqA+IAJse27//g=="
|
||||||
|
},
|
||||||
|
"is-alphabetical": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-5OV8Toyq3oh4eq6sbWTYzlGdnMT/DPI5I0zxUBxjiigQsZycpkKF3kskkao3JyYGuYDHvhgJF+DrjMQp9SX86w=="
|
||||||
|
},
|
||||||
|
"is-alphanumerical": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-t+2GlJ+hO9yagJ+jU3+HSh80VKvz/3cG2cxbGGm4S0hjKuhWQXgPVUVOZz3tqZzMjhmphZ+1TIJTlRZRoe6GCQ==",
|
||||||
|
"requires": {
|
||||||
|
"is-alphabetical": "^2.0.0",
|
||||||
|
"is-decimal": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"is-decimal": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-QfrfjQV0LjoWQ1K1XSoEZkTAzSa14RKVMa5zg3SdAfzEmQzRM4+tbSFWb78creCeA9rNBzaZal92opi1TwPWZw=="
|
||||||
|
},
|
||||||
|
"is-hexadecimal": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-vGOtYkiaxwIiR0+Ng/zNId+ZZehGfINwTzdrDqc6iubbnQWhnPuYymOzOKUDqa2cSl59yHnEh2h6MvRLQsyNug=="
|
||||||
|
},
|
||||||
|
"parse-entities": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-AJlcIFDNPEP33KyJLguv0xJc83BNvjxwpuUIcetyXUsLpVXAUCePJ5kIoYtEN2R1ac0cYaRu/vk9dVFkewHQhQ==",
|
||||||
|
"requires": {
|
||||||
|
"character-entities": "^2.0.0",
|
||||||
|
"character-entities-legacy": "^2.0.0",
|
||||||
|
"character-reference-invalid": "^2.0.0",
|
||||||
|
"is-alphanumerical": "^2.0.0",
|
||||||
|
"is-decimal": "^2.0.0",
|
||||||
|
"is-hexadecimal": "^2.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-core-commonmark": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-y9g7zymcKRBHM/aNBekstvs/Grpf+y4OEBULUTYvGZcusnp+JeOxmilJY4GMpo2/xY7iHQL9fjz5pD9pSAud9A==",
|
||||||
|
"requires": {
|
||||||
|
"micromark-factory-destination": "^1.0.0",
|
||||||
|
"micromark-factory-label": "^1.0.0",
|
||||||
|
"micromark-factory-space": "^1.0.0",
|
||||||
|
"micromark-factory-title": "^1.0.0",
|
||||||
|
"micromark-factory-whitespace": "^1.0.0",
|
||||||
|
"micromark-util-character": "^1.0.0",
|
||||||
|
"micromark-util-chunked": "^1.0.0",
|
||||||
|
"micromark-util-classify-character": "^1.0.0",
|
||||||
|
"micromark-util-html-tag-name": "^1.0.0",
|
||||||
|
"micromark-util-normalize-identifier": "^1.0.0",
|
||||||
|
"micromark-util-resolve-all": "^1.0.0",
|
||||||
|
"micromark-util-subtokenize": "^1.0.0",
|
||||||
|
"micromark-util-symbol": "^1.0.0",
|
||||||
|
"micromark-util-types": "^1.0.0",
|
||||||
|
"parse-entities": "^3.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"character-entities": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-oHqMj3eAuJ77/P5PaIRcqk+C3hdfNwyCD2DAUcD5gyXkegAuF2USC40CEqPscDk4I8FRGMTojGJQkXDsN5QlJA=="
|
||||||
|
},
|
||||||
|
"character-entities-legacy": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-YwaEtEvWLpFa6Wh3uVLrvirA/ahr9fki/NUd/Bd4OR6EdJ8D22hovYQEOUCBfQfcqnC4IAMGMsHXY1eXgL4ZZA=="
|
||||||
|
},
|
||||||
|
"character-reference-invalid": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-pE3Z15lLRxDzWJy7bBHBopRwfI20sbrMVLQTC7xsPglCHf4Wv1e167OgYAFP78co2XlhojDyAqA+IAJse27//g=="
|
||||||
|
},
|
||||||
|
"is-alphabetical": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-5OV8Toyq3oh4eq6sbWTYzlGdnMT/DPI5I0zxUBxjiigQsZycpkKF3kskkao3JyYGuYDHvhgJF+DrjMQp9SX86w=="
|
||||||
|
},
|
||||||
|
"is-alphanumerical": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-t+2GlJ+hO9yagJ+jU3+HSh80VKvz/3cG2cxbGGm4S0hjKuhWQXgPVUVOZz3tqZzMjhmphZ+1TIJTlRZRoe6GCQ==",
|
||||||
|
"requires": {
|
||||||
|
"is-alphabetical": "^2.0.0",
|
||||||
|
"is-decimal": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"is-decimal": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-QfrfjQV0LjoWQ1K1XSoEZkTAzSa14RKVMa5zg3SdAfzEmQzRM4+tbSFWb78creCeA9rNBzaZal92opi1TwPWZw=="
|
||||||
|
},
|
||||||
|
"is-hexadecimal": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-vGOtYkiaxwIiR0+Ng/zNId+ZZehGfINwTzdrDqc6iubbnQWhnPuYymOzOKUDqa2cSl59yHnEh2h6MvRLQsyNug=="
|
||||||
|
},
|
||||||
|
"parse-entities": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-AJlcIFDNPEP33KyJLguv0xJc83BNvjxwpuUIcetyXUsLpVXAUCePJ5kIoYtEN2R1ac0cYaRu/vk9dVFkewHQhQ==",
|
||||||
|
"requires": {
|
||||||
|
"character-entities": "^2.0.0",
|
||||||
|
"character-entities-legacy": "^2.0.0",
|
||||||
|
"character-reference-invalid": "^2.0.0",
|
||||||
|
"is-alphanumerical": "^2.0.0",
|
||||||
|
"is-decimal": "^2.0.0",
|
||||||
|
"is-hexadecimal": "^2.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"micromark-extension-gfm": {
|
"micromark-extension-gfm": {
|
||||||
"version": "0.3.3",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-0.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-1.0.0.tgz",
|
||||||
"integrity": "sha512-oVN4zv5/tAIA+l3GbMi7lWeYpJ14oQyJ3uEim20ktYFAcfX1x3LNlFGGlmrZHt7u9YlKExmyJdDGaTt6cMSR/A==",
|
"integrity": "sha512-OjqbQPL1Vec/4l5hnC8WnMNmWwgrT9JvzR2udqIGrGKecZsdwY9GAWZ5482CuD12SXuHNj8aS8epni6ip0Pwog==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"micromark": "~2.11.0",
|
"micromark-extension-gfm-autolink-literal": "^1.0.0",
|
||||||
"micromark-extension-gfm-autolink-literal": "~0.5.0",
|
"micromark-extension-gfm-strikethrough": "^1.0.0",
|
||||||
"micromark-extension-gfm-strikethrough": "~0.6.5",
|
"micromark-extension-gfm-table": "^1.0.0",
|
||||||
"micromark-extension-gfm-table": "~0.4.0",
|
"micromark-extension-gfm-tagfilter": "^1.0.0",
|
||||||
"micromark-extension-gfm-tagfilter": "~0.3.0",
|
"micromark-extension-gfm-task-list-item": "^1.0.0",
|
||||||
"micromark-extension-gfm-task-list-item": "~0.3.0"
|
"micromark-util-combine-extensions": "^1.0.0",
|
||||||
|
"micromark-util-types": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"micromark-extension-gfm-autolink-literal": {
|
"micromark-extension-gfm-autolink-literal": {
|
||||||
"version": "0.5.7",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-0.5.7.tgz",
|
"resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-1.0.0.tgz",
|
||||||
"integrity": "sha512-ePiDGH0/lhcngCe8FtH4ARFoxKTUelMp4L7Gg2pujYD5CSMb9PbblnyL+AAMud/SNMyusbS2XDSiPIRcQoNFAw==",
|
"integrity": "sha512-t+K0aPK32mXypVTEKV+WRfoT/Rb7MERDgHZVRr56NXpyQQhgMk72QnK4NljYUlrgbuesH+MxiPQwThzqRDIwvA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"micromark": "~2.11.3"
|
"micromark-util-character": "^1.0.0",
|
||||||
|
"micromark-util-sanitize-uri": "^1.0.0",
|
||||||
|
"micromark-util-symbol": "^1.0.0",
|
||||||
|
"micromark-util-types": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"micromark-extension-gfm-strikethrough": {
|
"micromark-extension-gfm-strikethrough": {
|
||||||
"version": "0.6.5",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-0.6.5.tgz",
|
"resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-1.0.0.tgz",
|
||||||
"integrity": "sha512-PpOKlgokpQRwUesRwWEp+fHjGGkZEejj83k9gU5iXCbDG+XBA92BqnRKYJdfqfkrRcZRgGuPuXb7DaK/DmxOhw==",
|
"integrity": "sha512-5PhVJVK8zRsrc+A715NBPMY5iOQwtkMfL/8XURAPeU5fPC0S5dm4qjpoA6fGy4B9MHm+6WNs3xZDxF1ZGTtGDw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"micromark": "~2.11.0"
|
"micromark-util-chunked": "^1.0.0",
|
||||||
|
"micromark-util-classify-character": "^1.0.0",
|
||||||
|
"micromark-util-resolve-all": "^1.0.0",
|
||||||
|
"micromark-util-symbol": "^1.0.0",
|
||||||
|
"micromark-util-types": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"micromark-extension-gfm-table": {
|
"micromark-extension-gfm-table": {
|
||||||
"version": "0.4.3",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-0.4.3.tgz",
|
"resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-1.0.0.tgz",
|
||||||
"integrity": "sha512-hVGvESPq0fk6ALWtomcwmgLvH8ZSVpcPjzi0AjPclB9FsVRgMtGZkUcpE0zgjOCFAznKepF4z3hX8z6e3HODdA==",
|
"integrity": "sha512-OATRuHDgEAT/aaJJRSdU12V+s01kNSnJ0jumdfLq5mPy0F5DkR3zbTSFLH4tjVYM0/kEG6umxIhHY62mFe4z5Q==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"micromark": "~2.11.0"
|
"micromark-factory-space": "^1.0.0",
|
||||||
|
"micromark-util-character": "^1.0.0",
|
||||||
|
"micromark-util-symbol": "^1.0.0",
|
||||||
|
"micromark-util-types": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"micromark-extension-gfm-tagfilter": {
|
"micromark-extension-gfm-tagfilter": {
|
||||||
"version": "0.3.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-0.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-1.0.0.tgz",
|
||||||
"integrity": "sha512-9GU0xBatryXifL//FJH+tAZ6i240xQuFrSL7mYi8f4oZSbc+NvXjkrHemeYP0+L4ZUT+Ptz3b95zhUZnMtoi/Q=="
|
"integrity": "sha512-GGUZhzQrOdHR8RHU2ru6K+4LMlj+pBdNuXRtw5prOflDOk2hHqDB0xEgej1AHJ2VETeycX7tzQh2EmaTUOmSKg==",
|
||||||
|
"requires": {
|
||||||
|
"micromark-util-types": "^1.0.0"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"micromark-extension-gfm-task-list-item": {
|
"micromark-extension-gfm-task-list-item": {
|
||||||
"version": "0.3.3",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-0.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-1.0.0.tgz",
|
||||||
"integrity": "sha512-0zvM5iSLKrc/NQl84pZSjGo66aTGd57C1idmlWmE87lkMcXrTxg1uXa/nXomxJytoje9trP0NDLvw4bZ/Z/XCQ==",
|
"integrity": "sha512-3tkHCq1NNwijtwpjYba9+rl1yvQ4xYg8iQpUAfTJRyq8MtIEsBUF/vW6B9Gh8Qwy1hE2FmpyHhP4jnFAt61zLg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"micromark": "~2.11.0"
|
"micromark-factory-space": "^1.0.0",
|
||||||
|
"micromark-util-character": "^1.0.0",
|
||||||
|
"micromark-util-symbol": "^1.0.0",
|
||||||
|
"micromark-util-types": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"micromark-factory-destination": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-eUBA7Rs1/xtTVun9TmV3gjfPz2wEwgK5R5xcbIM5ZYAtvGF6JkyaDsj0agx8urXnO31tEO6Ug83iVH3tdedLnw==",
|
||||||
|
"requires": {
|
||||||
|
"micromark-util-character": "^1.0.0",
|
||||||
|
"micromark-util-symbol": "^1.0.0",
|
||||||
|
"micromark-util-types": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-factory-label": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-XWEucVZb+qBCe2jmlOnWr6sWSY6NHx+wtpgYFsm4G+dufOf6tTQRRo0bdO7XSlGPu5fyjpJenth6Ksnc5Mwfww==",
|
||||||
|
"requires": {
|
||||||
|
"micromark-util-character": "^1.0.0",
|
||||||
|
"micromark-util-symbol": "^1.0.0",
|
||||||
|
"micromark-util-types": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-factory-space": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-qUmqs4kj9a5yBnk3JMLyjtWYN6Mzfcx8uJfi5XAveBniDevmZasdGBba5b4QsvRcAkmvGo5ACmSUmyGiKTLZew==",
|
||||||
|
"requires": {
|
||||||
|
"micromark-util-character": "^1.0.0",
|
||||||
|
"micromark-util-types": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-factory-title": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-flvC7Gx0dWVWorXuBl09Cr3wB5FTuYec8pMGVySIp2ZlqTcIjN/lFohZcP0EG//krTptm34kozHk7aK/CleCfA==",
|
||||||
|
"requires": {
|
||||||
|
"micromark-factory-space": "^1.0.0",
|
||||||
|
"micromark-util-character": "^1.0.0",
|
||||||
|
"micromark-util-symbol": "^1.0.0",
|
||||||
|
"micromark-util-types": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-factory-whitespace": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-Qx7uEyahU1lt1RnsECBiuEbfr9INjQTGa6Err+gF3g0Tx4YEviPbqqGKNv/NrBaE7dVHdn1bVZKM/n5I/Bak7A==",
|
||||||
|
"requires": {
|
||||||
|
"micromark-factory-space": "^1.0.0",
|
||||||
|
"micromark-util-character": "^1.0.0",
|
||||||
|
"micromark-util-symbol": "^1.0.0",
|
||||||
|
"micromark-util-types": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-util-character": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-agJ5B3unGNJ9rJvADMJ5ZiYjBRyDpzKAOk01Kpi1TKhlT1APx3XZk6eN7RtSz1erbWHC2L8T3xLZ81wdtGRZzg==",
|
||||||
|
"requires": {
|
||||||
|
"micromark-util-symbol": "^1.0.0",
|
||||||
|
"micromark-util-types": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-util-chunked": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-5e8xTis5tEZKgesfbQMKRCyzvffRRUX+lK/y+DvsMFdabAicPkkZV6gO+FEWi9RfuKKoxxPwNL+dFF0SMImc1g==",
|
||||||
|
"requires": {
|
||||||
|
"micromark-util-symbol": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-util-classify-character": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-F8oW2KKrQRb3vS5ud5HIqBVkCqQi224Nm55o5wYLzY/9PwHGXC01tr3d7+TqHHz6zrKQ72Okwtvm/xQm6OVNZA==",
|
||||||
|
"requires": {
|
||||||
|
"micromark-util-character": "^1.0.0",
|
||||||
|
"micromark-util-symbol": "^1.0.0",
|
||||||
|
"micromark-util-types": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-util-combine-extensions": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-J8H058vFBdo/6+AsjHp2NF7AJ02SZtWaVUjsayNFeAiydTxUwViQPxN0Hf8dp4FmCQi0UUFovFsEyRSUmFH3MA==",
|
||||||
|
"requires": {
|
||||||
|
"micromark-util-chunked": "^1.0.0",
|
||||||
|
"micromark-util-types": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-util-decode-numeric-character-reference": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-OzO9AI5VUtrTD7KSdagf4MWgHMtET17Ua1fIpXTpuhclCqD8egFWo85GxSGvxgkGS74bEahvtM0WP0HjvV0e4w==",
|
||||||
|
"requires": {
|
||||||
|
"micromark-util-symbol": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-util-encode": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-cJpFVM768h6zkd8qJ1LNRrITfY4gwFt+tziPcIf71Ui8yFzY9wG3snZQqiWVq93PG4Sw6YOtcNiKJfVIs9qfGg=="
|
||||||
|
},
|
||||||
|
"micromark-util-html-tag-name": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-NenEKIshW2ZI/ERv9HtFNsrn3llSPZtY337LID/24WeLqMzeZhBEE6BQ0vS2ZBjshm5n40chKtJ3qjAbVV8S0g=="
|
||||||
|
},
|
||||||
|
"micromark-util-normalize-identifier": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-yg+zrL14bBTFrQ7n35CmByWUTFsgst5JhA4gJYoty4Dqzj4Z4Fr/DHekSS5aLfH9bdlfnSvKAWsAgJhIbogyBg==",
|
||||||
|
"requires": {
|
||||||
|
"micromark-util-symbol": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-util-resolve-all": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-CB/AGk98u50k42kvgaMM94wzBqozSzDDaonKU7P7jwQIuH2RU0TeBqGYJz2WY1UdihhjweivStrJ2JdkdEmcfw==",
|
||||||
|
"requires": {
|
||||||
|
"micromark-util-types": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-util-sanitize-uri": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-cCxvBKlmac4rxCGx6ejlIviRaMKZc0fWm5HdCHEeDWRSkn44l6NdYVRyU+0nT1XC72EQJMZV8IPHF+jTr56lAg==",
|
||||||
|
"requires": {
|
||||||
|
"micromark-util-character": "^1.0.0",
|
||||||
|
"micromark-util-encode": "^1.0.0",
|
||||||
|
"micromark-util-symbol": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-util-subtokenize": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-EsnG2qscmcN5XhkqQBZni/4oQbLFjz9yk3ZM/P8a3YUjwV6+6On2wehr1ALx0MxK3+XXXLTzuBKHDFeDFYRdgQ==",
|
||||||
|
"requires": {
|
||||||
|
"micromark-util-chunked": "^1.0.0",
|
||||||
|
"micromark-util-symbol": "^1.0.0",
|
||||||
|
"micromark-util-types": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-util-symbol": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-NZA01jHRNCt4KlOROn8/bGi6vvpEmlXld7EHcRH+aYWUfL3Wc8JLUNNlqUMKa0hhz6GrpUWsHtzPmKof57v0gQ=="
|
||||||
|
},
|
||||||
|
"micromark-util-types": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-psf1WAaP1B77WpW4mBGDkTr+3RsPuDAgsvlP47GJzbH1jmjH8xjOx7Z6kp84L8oqHmy5pYO3Ev46odosZV+3AA=="
|
||||||
|
},
|
||||||
"micromatch": {
|
"micromatch": {
|
||||||
"version": "3.1.10",
|
"version": "3.1.10",
|
||||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
|
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
|
||||||
@@ -8294,7 +8701,8 @@
|
|||||||
"minimist": {
|
"minimist": {
|
||||||
"version": "1.2.5",
|
"version": "1.2.5",
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
|
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"minipass": {
|
"minipass": {
|
||||||
"version": "3.1.3",
|
"version": "3.1.3",
|
||||||
@@ -11129,6 +11537,67 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"mdast-util-gfm": "^0.1.0",
|
"mdast-util-gfm": "^0.1.0",
|
||||||
"micromark-extension-gfm": "^0.3.0"
|
"micromark-extension-gfm": "^0.3.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"micromark": {
|
||||||
|
"version": "2.11.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark/-/micromark-2.11.4.tgz",
|
||||||
|
"integrity": "sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==",
|
||||||
|
"requires": {
|
||||||
|
"debug": "^4.0.0",
|
||||||
|
"parse-entities": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-extension-gfm": {
|
||||||
|
"version": "0.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-0.3.3.tgz",
|
||||||
|
"integrity": "sha512-oVN4zv5/tAIA+l3GbMi7lWeYpJ14oQyJ3uEim20ktYFAcfX1x3LNlFGGlmrZHt7u9YlKExmyJdDGaTt6cMSR/A==",
|
||||||
|
"requires": {
|
||||||
|
"micromark": "~2.11.0",
|
||||||
|
"micromark-extension-gfm-autolink-literal": "~0.5.0",
|
||||||
|
"micromark-extension-gfm-strikethrough": "~0.6.5",
|
||||||
|
"micromark-extension-gfm-table": "~0.4.0",
|
||||||
|
"micromark-extension-gfm-tagfilter": "~0.3.0",
|
||||||
|
"micromark-extension-gfm-task-list-item": "~0.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-extension-gfm-autolink-literal": {
|
||||||
|
"version": "0.5.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-0.5.7.tgz",
|
||||||
|
"integrity": "sha512-ePiDGH0/lhcngCe8FtH4ARFoxKTUelMp4L7Gg2pujYD5CSMb9PbblnyL+AAMud/SNMyusbS2XDSiPIRcQoNFAw==",
|
||||||
|
"requires": {
|
||||||
|
"micromark": "~2.11.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-extension-gfm-strikethrough": {
|
||||||
|
"version": "0.6.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-0.6.5.tgz",
|
||||||
|
"integrity": "sha512-PpOKlgokpQRwUesRwWEp+fHjGGkZEejj83k9gU5iXCbDG+XBA92BqnRKYJdfqfkrRcZRgGuPuXb7DaK/DmxOhw==",
|
||||||
|
"requires": {
|
||||||
|
"micromark": "~2.11.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-extension-gfm-table": {
|
||||||
|
"version": "0.4.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-0.4.3.tgz",
|
||||||
|
"integrity": "sha512-hVGvESPq0fk6ALWtomcwmgLvH8ZSVpcPjzi0AjPclB9FsVRgMtGZkUcpE0zgjOCFAznKepF4z3hX8z6e3HODdA==",
|
||||||
|
"requires": {
|
||||||
|
"micromark": "~2.11.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"micromark-extension-gfm-tagfilter": {
|
||||||
|
"version": "0.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-0.3.0.tgz",
|
||||||
|
"integrity": "sha512-9GU0xBatryXifL//FJH+tAZ6i240xQuFrSL7mYi8f4oZSbc+NvXjkrHemeYP0+L4ZUT+Ptz3b95zhUZnMtoi/Q=="
|
||||||
|
},
|
||||||
|
"micromark-extension-gfm-task-list-item": {
|
||||||
|
"version": "0.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-0.3.3.tgz",
|
||||||
|
"integrity": "sha512-0zvM5iSLKrc/NQl84pZSjGo66aTGd57C1idmlWmE87lkMcXrTxg1uXa/nXomxJytoje9trP0NDLvw4bZ/Z/XCQ==",
|
||||||
|
"requires": {
|
||||||
|
"micromark": "~2.11.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"remark-parse": {
|
"remark-parse": {
|
||||||
@@ -12307,11 +12776,6 @@
|
|||||||
"side-channel": "^1.0.4"
|
"side-channel": "^1.0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"string.prototype.repeat": {
|
|
||||||
"version": "0.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/string.prototype.repeat/-/string.prototype.repeat-0.2.0.tgz",
|
|
||||||
"integrity": "sha1-q6Nt4I3O5qWjN9SbLqHaGyj8Ds8="
|
|
||||||
},
|
|
||||||
"string.prototype.trimend": {
|
"string.prototype.trimend": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz",
|
||||||
@@ -13261,9 +13725,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"util": {
|
"util": {
|
||||||
"version": "0.12.3",
|
"version": "0.12.4",
|
||||||
"resolved": "https://registry.npmjs.org/util/-/util-0.12.3.tgz",
|
"resolved": "https://registry.npmjs.org/util/-/util-0.12.4.tgz",
|
||||||
"integrity": "sha512-I8XkoQwE+fPQEhy9v012V+TSdH2kp9ts29i20TaaDUXsg7x/onePbhFJUExBfv/2ay1ZOp/Vsm3nDlmnFGSAog==",
|
"integrity": "sha512-bxZ9qtSlGUWSOy9Qa9Xgk11kSslpuZwaxCg4sNIDj6FLucDab2JxnHwyNTCpHMtK1MjoQiWQ6DiUMZYbSrO+Sw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"inherits": "^2.0.3",
|
"inherits": "^2.0.3",
|
||||||
@@ -13746,18 +14210,69 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"which-typed-array": {
|
"which-typed-array": {
|
||||||
"version": "1.1.4",
|
"version": "1.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.6.tgz",
|
||||||
"integrity": "sha512-49E0SpUe90cjpoc7BOJwyPHRqSAd12c10Qm2amdEZrJPCY2NDxaW01zHITrem+rnETY3dwrbH3UUrUwagfCYDA==",
|
"integrity": "sha512-DdY984dGD5sQ7Tf+x1CkXzdg85b9uEel6nr4UkFg1LoE9OXv3uRuZhe5CoWdawhGACeFpEZXH8fFLQnDhbpm/Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"available-typed-arrays": "^1.0.2",
|
"available-typed-arrays": "^1.0.4",
|
||||||
"call-bind": "^1.0.0",
|
"call-bind": "^1.0.2",
|
||||||
"es-abstract": "^1.18.0-next.1",
|
"es-abstract": "^1.18.5",
|
||||||
"foreach": "^2.0.5",
|
"foreach": "^2.0.5",
|
||||||
"function-bind": "^1.1.1",
|
"has-tostringtag": "^1.0.0",
|
||||||
"has-symbols": "^1.0.1",
|
"is-typed-array": "^1.1.6"
|
||||||
"is-typed-array": "^1.1.3"
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"es-abstract": {
|
||||||
|
"version": "1.18.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.5.tgz",
|
||||||
|
"integrity": "sha512-DDggyJLoS91CkJjgauM5c0yZMjiD1uK3KcaCeAmffGwZ+ODWzOkPN4QwRbsK5DOFf06fywmyLci3ZD8jLGhVYA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"call-bind": "^1.0.2",
|
||||||
|
"es-to-primitive": "^1.2.1",
|
||||||
|
"function-bind": "^1.1.1",
|
||||||
|
"get-intrinsic": "^1.1.1",
|
||||||
|
"has": "^1.0.3",
|
||||||
|
"has-symbols": "^1.0.2",
|
||||||
|
"internal-slot": "^1.0.3",
|
||||||
|
"is-callable": "^1.2.3",
|
||||||
|
"is-negative-zero": "^2.0.1",
|
||||||
|
"is-regex": "^1.1.3",
|
||||||
|
"is-string": "^1.0.6",
|
||||||
|
"object-inspect": "^1.11.0",
|
||||||
|
"object-keys": "^1.1.1",
|
||||||
|
"object.assign": "^4.1.2",
|
||||||
|
"string.prototype.trimend": "^1.0.4",
|
||||||
|
"string.prototype.trimstart": "^1.0.4",
|
||||||
|
"unbox-primitive": "^1.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"is-regex": {
|
||||||
|
"version": "1.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz",
|
||||||
|
"integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"call-bind": "^1.0.2",
|
||||||
|
"has-tostringtag": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"is-string": {
|
||||||
|
"version": "1.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz",
|
||||||
|
"integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"has-tostringtag": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"object-inspect": {
|
||||||
|
"version": "1.11.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz",
|
||||||
|
"integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"wide-align": {
|
"wide-align": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cinny",
|
"name": "cinny",
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"description": "Yet another matrix client",
|
"description": "Yet another matrix client",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -19,14 +19,14 @@
|
|||||||
"@tippyjs/react": "^4.2.5",
|
"@tippyjs/react": "^4.2.5",
|
||||||
"babel-polyfill": "^6.26.0",
|
"babel-polyfill": "^6.26.0",
|
||||||
"browser-encrypt-attachment": "^0.3.0",
|
"browser-encrypt-attachment": "^0.3.0",
|
||||||
"commonmark": "^0.30.0",
|
|
||||||
"dateformat": "^4.5.1",
|
"dateformat": "^4.5.1",
|
||||||
"emojibase-data": "^6.2.0",
|
"emojibase-data": "^6.2.0",
|
||||||
"flux": "^4.0.1",
|
"flux": "^4.0.1",
|
||||||
"fuse.js": "^6.4.6",
|
|
||||||
"html-react-parser": "^1.2.7",
|
"html-react-parser": "^1.2.7",
|
||||||
"linkifyjs": "^3.0.0-beta.3",
|
"linkifyjs": "^3.0.0-beta.3",
|
||||||
"matrix-js-sdk": "^12.2.0",
|
"matrix-js-sdk": "^12.2.0",
|
||||||
|
"micromark": "^3.0.3",
|
||||||
|
"micromark-extension-gfm": "^1.0.0",
|
||||||
"prop-types": "^15.7.2",
|
"prop-types": "^15.7.2",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-autosize-textarea": "^7.1.0",
|
"react-autosize-textarea": "^7.1.0",
|
||||||
@@ -44,6 +44,7 @@
|
|||||||
"@babel/core": "^7.13.13",
|
"@babel/core": "^7.13.13",
|
||||||
"@babel/preset-env": "^7.13.12",
|
"@babel/preset-env": "^7.13.12",
|
||||||
"@babel/preset-react": "^7.13.13",
|
"@babel/preset-react": "^7.13.13",
|
||||||
|
"assert": "^2.0.0",
|
||||||
"babel-loader": "^8.2.2",
|
"babel-loader": "^8.2.2",
|
||||||
"browserify-fs": "^1.0.0",
|
"browserify-fs": "^1.0.0",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
@@ -69,7 +70,7 @@
|
|||||||
"sass-loader": "^11.0.1",
|
"sass-loader": "^11.0.1",
|
||||||
"stream-browserify": "^3.0.0",
|
"stream-browserify": "^3.0.0",
|
||||||
"style-loader": "^2.0.0",
|
"style-loader": "^2.0.0",
|
||||||
"util": "^0.12.3",
|
"util": "^0.12.4",
|
||||||
"webpack": "^5.28.0",
|
"webpack": "^5.28.0",
|
||||||
"webpack-cli": "^4.5.0",
|
"webpack-cli": "^4.5.0",
|
||||||
"webpack-dev-server": "^3.11.2",
|
"webpack-dev-server": "^3.11.2",
|
||||||
|
|||||||
8
public/res/ic/outlined/pencil.svg
Normal file
8
public/res/ic/outlined/pencil.svg
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
|
||||||
|
<path d="M20.6,5.6l-2.2-2.2C18,3,17.5,2.8,17,2.8S16,3,15.6,3.4L3,16v5h5L20.6,8.4C21.4,7.6,21.4,6.4,20.6,5.6z M7.2,19H5v-2.2
|
||||||
|
l9.2-9.2l2.2,2.2L7.2,19z M15.6,6.2L17,4.8c0,0,0,0,0,0L19.2,7l-1.4,1.4L15.6,6.2z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 652 B |
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import './ContextMenu.scss';
|
import './ContextMenu.scss';
|
||||||
|
|
||||||
@@ -10,12 +10,16 @@ import Button from '../button/Button';
|
|||||||
import ScrollView from '../scroll/ScrollView';
|
import ScrollView from '../scroll/ScrollView';
|
||||||
|
|
||||||
function ContextMenu({
|
function ContextMenu({
|
||||||
content, placement, maxWidth, render,
|
content, placement, maxWidth, render, afterToggle,
|
||||||
}) {
|
}) {
|
||||||
const [isVisible, setVisibility] = useState(false);
|
const [isVisible, setVisibility] = useState(false);
|
||||||
const showMenu = () => setVisibility(true);
|
const showMenu = () => setVisibility(true);
|
||||||
const hideMenu = () => setVisibility(false);
|
const hideMenu = () => setVisibility(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (afterToggle !== null) afterToggle(isVisible);
|
||||||
|
}, [isVisible]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tippy
|
<Tippy
|
||||||
animation="scale-extreme"
|
animation="scale-extreme"
|
||||||
@@ -36,6 +40,7 @@ function ContextMenu({
|
|||||||
ContextMenu.defaultProps = {
|
ContextMenu.defaultProps = {
|
||||||
maxWidth: 'unset',
|
maxWidth: 'unset',
|
||||||
placement: 'right',
|
placement: 'right',
|
||||||
|
afterToggle: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
ContextMenu.propTypes = {
|
ContextMenu.propTypes = {
|
||||||
@@ -49,6 +54,7 @@ ContextMenu.propTypes = {
|
|||||||
PropTypes.number,
|
PropTypes.number,
|
||||||
]),
|
]),
|
||||||
render: PropTypes.func.isRequired,
|
render: PropTypes.func.isRequired,
|
||||||
|
afterToggle: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
function MenuHeader({ children }) {
|
function MenuHeader({ children }) {
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
justify-content: start;
|
justify-content: start;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
.text:first-child {
|
.text:first-child {
|
||||||
margin: {
|
margin: {
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ function linkifyContent(content) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ChannelIntro({
|
function ChannelIntro({
|
||||||
avatarSrc, name, heading, desc, time,
|
roomId, avatarSrc, name, heading, desc, time,
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div className="channel-intro">
|
<div className="channel-intro">
|
||||||
<Avatar imageSrc={avatarSrc} text={name.slice(0, 1)} bgColor={colorMXID(name)} size="large" />
|
<Avatar imageSrc={avatarSrc} text={name.slice(0, 1)} bgColor={colorMXID(roomId)} size="large" />
|
||||||
<div className="channel-intro__content">
|
<div className="channel-intro__content">
|
||||||
<Text className="channel-intro__name" variant="h1">{heading}</Text>
|
<Text className="channel-intro__name" variant="h1">{heading}</Text>
|
||||||
<Text className="channel-intro__desc" variant="b1">{linkifyContent(desc)}</Text>
|
<Text className="channel-intro__desc" variant="b1">{linkifyContent(desc)}</Text>
|
||||||
@@ -33,6 +33,7 @@ ChannelIntro.defaultProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ChannelIntro.propTypes = {
|
ChannelIntro.propTypes = {
|
||||||
|
roomId: PropTypes.string.isRequired,
|
||||||
avatarSrc: PropTypes.oneOfType([
|
avatarSrc: PropTypes.oneOfType([
|
||||||
PropTypes.string,
|
PropTypes.string,
|
||||||
PropTypes.bool,
|
PropTypes.bool,
|
||||||
|
|||||||
57
src/app/molecules/dialog/Dialog.jsx
Normal file
57
src/app/molecules/dialog/Dialog.jsx
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import './Dialog.scss';
|
||||||
|
|
||||||
|
import Text from '../../atoms/text/Text';
|
||||||
|
import Header, { TitleWrapper } from '../../atoms/header/Header';
|
||||||
|
import ScrollView from '../../atoms/scroll/ScrollView';
|
||||||
|
import RawModal from '../../atoms/modal/RawModal';
|
||||||
|
|
||||||
|
function Dialog({
|
||||||
|
className, isOpen, title,
|
||||||
|
contentOptions, onRequestClose, children,
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<RawModal
|
||||||
|
className={`${className === null ? '' : `${className} `}dialog-model`}
|
||||||
|
isOpen={isOpen}
|
||||||
|
onRequestClose={onRequestClose}
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<div className="dialog">
|
||||||
|
<div className="dialog__content">
|
||||||
|
<Header>
|
||||||
|
<TitleWrapper>
|
||||||
|
<Text variant="h2">{title}</Text>
|
||||||
|
</TitleWrapper>
|
||||||
|
{contentOptions}
|
||||||
|
</Header>
|
||||||
|
<div className="dialog__content__wrapper">
|
||||||
|
<ScrollView autoHide>
|
||||||
|
<div className="dialog__content-container">
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
</ScrollView>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</RawModal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Dialog.defaultProps = {
|
||||||
|
className: null,
|
||||||
|
contentOptions: null,
|
||||||
|
onRequestClose: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
Dialog.propTypes = {
|
||||||
|
className: PropTypes.string,
|
||||||
|
isOpen: PropTypes.bool.isRequired,
|
||||||
|
title: PropTypes.string.isRequired,
|
||||||
|
contentOptions: PropTypes.node,
|
||||||
|
onRequestClose: PropTypes.func,
|
||||||
|
children: PropTypes.node.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Dialog;
|
||||||
28
src/app/molecules/dialog/Dialog.scss
Normal file
28
src/app/molecules/dialog/Dialog.scss
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
.dialog-model {
|
||||||
|
--modal-height: 656px;
|
||||||
|
max-height: var(--modal-height) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog {
|
||||||
|
width: 100%;
|
||||||
|
max-height: inherit;
|
||||||
|
background-color: var(--bg-surface);
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
&__content {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.dialog__content-container {
|
||||||
|
padding-top: var(--sp-extra-tight);
|
||||||
|
padding-bottom: var(--sp-extra-loose);
|
||||||
|
}
|
||||||
|
.dialog__content__wrapper {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
@@ -137,11 +137,12 @@ function File({
|
|||||||
}
|
}
|
||||||
File.defaultProps = {
|
File.defaultProps = {
|
||||||
file: null,
|
file: null,
|
||||||
|
type: '',
|
||||||
};
|
};
|
||||||
File.propTypes = {
|
File.propTypes = {
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
link: PropTypes.string.isRequired,
|
link: PropTypes.string.isRequired,
|
||||||
type: PropTypes.string.isRequired,
|
type: PropTypes.string,
|
||||||
file: PropTypes.shape({}),
|
file: PropTypes.shape({}),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -176,6 +177,7 @@ Image.defaultProps = {
|
|||||||
file: null,
|
file: null,
|
||||||
width: null,
|
width: null,
|
||||||
height: null,
|
height: null,
|
||||||
|
type: '',
|
||||||
};
|
};
|
||||||
Image.propTypes = {
|
Image.propTypes = {
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
@@ -183,7 +185,7 @@ Image.propTypes = {
|
|||||||
height: PropTypes.number,
|
height: PropTypes.number,
|
||||||
link: PropTypes.string.isRequired,
|
link: PropTypes.string.isRequired,
|
||||||
file: PropTypes.shape({}),
|
file: PropTypes.shape({}),
|
||||||
type: PropTypes.string.isRequired,
|
type: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
function Audio({
|
function Audio({
|
||||||
@@ -220,11 +222,12 @@ function Audio({
|
|||||||
}
|
}
|
||||||
Audio.defaultProps = {
|
Audio.defaultProps = {
|
||||||
file: null,
|
file: null,
|
||||||
|
type: '',
|
||||||
};
|
};
|
||||||
Audio.propTypes = {
|
Audio.propTypes = {
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
link: PropTypes.string.isRequired,
|
link: PropTypes.string.isRequired,
|
||||||
type: PropTypes.string.isRequired,
|
type: PropTypes.string,
|
||||||
file: PropTypes.shape({}),
|
file: PropTypes.shape({}),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -287,6 +290,7 @@ Video.defaultProps = {
|
|||||||
height: null,
|
height: null,
|
||||||
file: null,
|
file: null,
|
||||||
thumbnail: null,
|
thumbnail: null,
|
||||||
|
type: '',
|
||||||
thumbnailType: null,
|
thumbnailType: null,
|
||||||
thumbnailFile: null,
|
thumbnailFile: null,
|
||||||
};
|
};
|
||||||
@@ -297,7 +301,7 @@ Video.propTypes = {
|
|||||||
width: PropTypes.number,
|
width: PropTypes.number,
|
||||||
height: PropTypes.number,
|
height: PropTypes.number,
|
||||||
file: PropTypes.shape({}),
|
file: PropTypes.shape({}),
|
||||||
type: PropTypes.string.isRequired,
|
type: PropTypes.string,
|
||||||
thumbnailFile: PropTypes.shape({}),
|
thumbnailFile: PropTypes.shape({}),
|
||||||
thumbnailType: PropTypes.string,
|
thumbnailType: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import React, { useRef } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import './Message.scss';
|
import './Message.scss';
|
||||||
|
|
||||||
@@ -13,8 +13,9 @@ import { getUsername } from '../../../util/matrixUtil';
|
|||||||
|
|
||||||
import Text from '../../atoms/text/Text';
|
import Text from '../../atoms/text/Text';
|
||||||
import RawIcon from '../../atoms/system-icons/RawIcon';
|
import RawIcon from '../../atoms/system-icons/RawIcon';
|
||||||
import Avatar from '../../atoms/avatar/Avatar';
|
import Button from '../../atoms/button/Button';
|
||||||
import Tooltip from '../../atoms/tooltip/Tooltip';
|
import Tooltip from '../../atoms/tooltip/Tooltip';
|
||||||
|
import Input from '../../atoms/input/Input';
|
||||||
|
|
||||||
import ReplyArrowIC from '../../../../public/res/ic/outlined/reply-arrow.svg';
|
import ReplyArrowIC from '../../../../public/res/ic/outlined/reply-arrow.svg';
|
||||||
|
|
||||||
@@ -87,9 +88,7 @@ MessageHeader.propTypes = {
|
|||||||
time: PropTypes.string.isRequired,
|
time: PropTypes.string.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
function MessageReply({
|
function MessageReply({ name, color, content }) {
|
||||||
userId, name, color, content,
|
|
||||||
}) {
|
|
||||||
return (
|
return (
|
||||||
<div className="message__reply">
|
<div className="message__reply">
|
||||||
<Text variant="b2">
|
<Text variant="b2">
|
||||||
@@ -102,7 +101,6 @@ function MessageReply({
|
|||||||
}
|
}
|
||||||
|
|
||||||
MessageReply.propTypes = {
|
MessageReply.propTypes = {
|
||||||
userId: PropTypes.string.isRequired,
|
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
color: PropTypes.string.isRequired,
|
color: PropTypes.string.isRequired,
|
||||||
content: PropTypes.string.isRequired,
|
content: PropTypes.string.isRequired,
|
||||||
@@ -128,6 +126,30 @@ MessageContent.propTypes = {
|
|||||||
isEdited: PropTypes.bool,
|
isEdited: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function MessageEdit({ content, onSave, onCancel }) {
|
||||||
|
const editInputRef = useRef(null);
|
||||||
|
return (
|
||||||
|
<form className="message__edit" onSubmit={(e) => { e.preventDefault(); onSave(editInputRef.current.value); }}>
|
||||||
|
<Input
|
||||||
|
forwardRef={editInputRef}
|
||||||
|
value={content}
|
||||||
|
placeholder="Edit message"
|
||||||
|
required
|
||||||
|
resizable
|
||||||
|
/>
|
||||||
|
<div className="message__edit-btns">
|
||||||
|
<Button type="submit" variant="primary">Save</Button>
|
||||||
|
<Button onClick={onCancel}>Cancel</Button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
MessageEdit.propTypes = {
|
||||||
|
content: PropTypes.string.isRequired,
|
||||||
|
onSave: PropTypes.func.isRequired,
|
||||||
|
onCancel: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
function MessageReactionGroup({ children }) {
|
function MessageReactionGroup({ children }) {
|
||||||
return (
|
return (
|
||||||
<div className="message__reactions text text-b3 noselect">
|
<div className="message__reactions text text-b3 noselect">
|
||||||
@@ -196,7 +218,7 @@ MessageOptions.propTypes = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function Message({
|
function Message({
|
||||||
avatar, header, reply, content, reactions, options,
|
avatar, header, reply, content, editContent, reactions, options,
|
||||||
}) {
|
}) {
|
||||||
const msgClass = header === null ? ' message--content-only' : ' message--full';
|
const msgClass = header === null ? ' message--content-only' : ' message--full';
|
||||||
return (
|
return (
|
||||||
@@ -207,7 +229,8 @@ function Message({
|
|||||||
<div className="message__main-container">
|
<div className="message__main-container">
|
||||||
{header !== null && header}
|
{header !== null && header}
|
||||||
{reply !== null && reply}
|
{reply !== null && reply}
|
||||||
{content}
|
{content !== null && content}
|
||||||
|
{editContent !== null && editContent}
|
||||||
{reactions !== null && reactions}
|
{reactions !== null && reactions}
|
||||||
{options !== null && options}
|
{options !== null && options}
|
||||||
</div>
|
</div>
|
||||||
@@ -218,6 +241,8 @@ Message.defaultProps = {
|
|||||||
avatar: null,
|
avatar: null,
|
||||||
header: null,
|
header: null,
|
||||||
reply: null,
|
reply: null,
|
||||||
|
content: null,
|
||||||
|
editContent: null,
|
||||||
reactions: null,
|
reactions: null,
|
||||||
options: null,
|
options: null,
|
||||||
};
|
};
|
||||||
@@ -225,7 +250,8 @@ Message.propTypes = {
|
|||||||
avatar: PropTypes.node,
|
avatar: PropTypes.node,
|
||||||
header: PropTypes.node,
|
header: PropTypes.node,
|
||||||
reply: PropTypes.node,
|
reply: PropTypes.node,
|
||||||
content: PropTypes.node.isRequired,
|
content: PropTypes.node,
|
||||||
|
editContent: PropTypes.node,
|
||||||
reactions: PropTypes.node,
|
reactions: PropTypes.node,
|
||||||
options: PropTypes.node,
|
options: PropTypes.node,
|
||||||
};
|
};
|
||||||
@@ -235,6 +261,7 @@ export {
|
|||||||
MessageHeader,
|
MessageHeader,
|
||||||
MessageReply,
|
MessageReply,
|
||||||
MessageContent,
|
MessageContent,
|
||||||
|
MessageEdit,
|
||||||
MessageReactionGroup,
|
MessageReactionGroup,
|
||||||
MessageReaction,
|
MessageReaction,
|
||||||
MessageOptions,
|
MessageOptions,
|
||||||
|
|||||||
@@ -94,8 +94,10 @@
|
|||||||
|
|
||||||
.message__reply,
|
.message__reply,
|
||||||
.message__content,
|
.message__content,
|
||||||
|
.message__edit,
|
||||||
.message__reactions {
|
.message__reactions {
|
||||||
max-width: 640px;
|
max-width: 640px;
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -163,8 +165,27 @@
|
|||||||
color: var(--tc-surface-low);
|
color: var(--tc-surface-low);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.message__edit {
|
||||||
|
padding: var(--sp-extra-tight) 0;
|
||||||
|
&-btns button {
|
||||||
|
margin: var(--sp-tight) var(--sp-tight) 0 0;
|
||||||
|
[dir=rtl] & {
|
||||||
|
margin: var(--sp-tight) 0 0 var(--sp-tight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
.message__reactions {
|
.message__reactions {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
& .ic-btn-surface {
|
||||||
|
display: none;
|
||||||
|
padding: var(--sp-ultra-tight);
|
||||||
|
margin-top: var(--sp-extra-tight);
|
||||||
|
}
|
||||||
|
&:hover .ic-btn-surface {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.msg__reaction {
|
.msg__reaction {
|
||||||
margin: var(--sp-extra-tight) var(--sp-extra-tight) 0 0;
|
margin: var(--sp-extra-tight) var(--sp-extra-tight) 0 0;
|
||||||
@@ -227,6 +248,7 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 60px;
|
right: 60px;
|
||||||
|
z-index: 999;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
|
|
||||||
border-radius: var(--bo-radius);
|
border-radius: var(--bo-radius);
|
||||||
@@ -343,4 +365,37 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
& ul.contains-task-list {
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
& table {
|
||||||
|
background-color: var(--bg-surface-hover);
|
||||||
|
border-radius: calc(var(--bo-radius) / 2);
|
||||||
|
border-spacing: 0;
|
||||||
|
border: 1px solid var(--bg-surface-border);
|
||||||
|
|
||||||
|
& td, & th {
|
||||||
|
padding: var(--sp-extra-tight);
|
||||||
|
border: 1px solid var(--bg-surface-border);
|
||||||
|
border-width: 0 1px 1px 0;
|
||||||
|
&:last-child {
|
||||||
|
border-width: 0;
|
||||||
|
border-bottom-width: 1px;
|
||||||
|
[dir=rtl] & {
|
||||||
|
border-width: 0 1px 1px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[dir=rtl] &:first-child {
|
||||||
|
border-width: 0;
|
||||||
|
border-bottom-width: 1px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
& tbody tr:nth-child(2n + 1) {
|
||||||
|
background-color: var(--bg-surface-hover);
|
||||||
|
}
|
||||||
|
& tr:last-child td {
|
||||||
|
border-bottom-width: 0px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,7 @@ import InviteCancelArraowIC from '../../../../public/res/ic/outlined/invite-canc
|
|||||||
import UserIC from '../../../../public/res/ic/outlined/user.svg';
|
import UserIC from '../../../../public/res/ic/outlined/user.svg';
|
||||||
import TickMarkIC from '../../../../public/res/ic/outlined/tick-mark.svg';
|
import TickMarkIC from '../../../../public/res/ic/outlined/tick-mark.svg';
|
||||||
|
|
||||||
function TimelineChange({ variant, content, time }) {
|
function TimelineChange({ variant, content, time, onClick }) {
|
||||||
let iconSrc;
|
let iconSrc;
|
||||||
|
|
||||||
switch (variant) {
|
switch (variant) {
|
||||||
@@ -42,7 +42,7 @@ function TimelineChange({ variant, content, time }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="timeline-change">
|
<button style={{ cursor: onClick === null ? 'default' : 'pointer' }} onClick={onClick} type="button" className="timeline-change">
|
||||||
<div className="timeline-change__avatar-container">
|
<div className="timeline-change__avatar-container">
|
||||||
<RawIcon src={iconSrc} size="extra-small" />
|
<RawIcon src={iconSrc} size="extra-small" />
|
||||||
</div>
|
</div>
|
||||||
@@ -55,12 +55,13 @@ function TimelineChange({ variant, content, time }) {
|
|||||||
<div className="timeline-change__time">
|
<div className="timeline-change__time">
|
||||||
<Text variant="b3">{time}</Text>
|
<Text variant="b3">{time}</Text>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
TimelineChange.defaultProps = {
|
TimelineChange.defaultProps = {
|
||||||
variant: 'other',
|
variant: 'other',
|
||||||
|
onClick: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
TimelineChange.propTypes = {
|
TimelineChange.propTypes = {
|
||||||
@@ -74,6 +75,7 @@ TimelineChange.propTypes = {
|
|||||||
PropTypes.node,
|
PropTypes.node,
|
||||||
]).isRequired,
|
]).isRequired,
|
||||||
time: PropTypes.string.isRequired,
|
time: PropTypes.string.isRequired,
|
||||||
|
onClick: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default TimelineChange;
|
export default TimelineChange;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
padding-right: var(--sp-extra-tight);
|
padding-right: var(--sp-extra-tight);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: var(--bg-surface-hover);
|
background-color: var(--bg-surface-hover);
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import './ChannelViewCmdBar.scss';
|
import './ChannelViewCmdBar.scss';
|
||||||
import Fuse from 'fuse.js';
|
|
||||||
import parse from 'html-react-parser';
|
import parse from 'html-react-parser';
|
||||||
import twemoji from 'twemoji';
|
import twemoji from 'twemoji';
|
||||||
|
|
||||||
@@ -15,8 +14,10 @@ import {
|
|||||||
openCreateChannel,
|
openCreateChannel,
|
||||||
openPublicChannels,
|
openPublicChannels,
|
||||||
openInviteUser,
|
openInviteUser,
|
||||||
|
openReadReceipts,
|
||||||
} from '../../../client/action/navigation';
|
} from '../../../client/action/navigation';
|
||||||
import { searchEmoji } from '../emoji-board/emoji';
|
import { emojis } from '../emoji-board/emoji';
|
||||||
|
import AsyncSearch from '../../../util/AsyncSearch';
|
||||||
|
|
||||||
import Text from '../../atoms/text/Text';
|
import Text from '../../atoms/text/Text';
|
||||||
import Button from '../../atoms/button/Button';
|
import Button from '../../atoms/button/Button';
|
||||||
@@ -73,6 +74,7 @@ function CmdHelp() {
|
|||||||
<Text variant="b2">{'>@people_name'}</Text>
|
<Text variant="b2">{'>@people_name'}</Text>
|
||||||
<MenuHeader>Autofill command</MenuHeader>
|
<MenuHeader>Autofill command</MenuHeader>
|
||||||
<Text variant="b2">:emoji_name:</Text>
|
<Text variant="b2">:emoji_name:</Text>
|
||||||
|
<Text variant="b2">@name</Text>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
render={(toggleMenu) => (
|
render={(toggleMenu) => (
|
||||||
@@ -143,11 +145,13 @@ function FollowingMembers({ roomId, roomTimeline, viewEvent }) {
|
|||||||
};
|
};
|
||||||
}, [roomTimeline]);
|
}, [roomTimeline]);
|
||||||
|
|
||||||
|
const lastMEvent = roomTimeline.timeline[roomTimeline.timeline.length - 1];
|
||||||
return followingMembers.length !== 0 && (
|
return followingMembers.length !== 0 && (
|
||||||
<TimelineChange
|
<TimelineChange
|
||||||
variant="follow"
|
variant="follow"
|
||||||
content={getUsersActionJsx(followingMembers, 'following the conversation.')}
|
content={getUsersActionJsx(roomId, followingMembers, 'following the conversation.')}
|
||||||
time=""
|
time=""
|
||||||
|
onClick={() => openReadReceipts(roomId, lastMEvent.getId())}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -173,6 +177,7 @@ function getCmdActivationMessage(prefix) {
|
|||||||
'>#': () => genMessage('Go-to command mode activated. ', 'Type channel name for suggestions.'),
|
'>#': () => genMessage('Go-to command mode activated. ', 'Type channel name for suggestions.'),
|
||||||
'>@': () => genMessage('Go-to command mode activated. ', 'Type people name for suggestions.'),
|
'>@': () => genMessage('Go-to command mode activated. ', 'Type people name for suggestions.'),
|
||||||
':': () => genMessage('Emoji autofill command mode activated. ', 'Type emoji shortcut for suggestions.'),
|
':': () => genMessage('Emoji autofill command mode activated. ', 'Type emoji shortcut for suggestions.'),
|
||||||
|
'@': () => genMessage('Name autofill command mode activated. ', 'Type name for suggestions.'),
|
||||||
};
|
};
|
||||||
return cmd[prefix]?.();
|
return cmd[prefix]?.();
|
||||||
}
|
}
|
||||||
@@ -189,163 +194,166 @@ CmdItem.propTypes = {
|
|||||||
children: PropTypes.node.isRequired,
|
children: PropTypes.node.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
function searchInRoomIds(roomIds, term) {
|
function getCmdSuggestions({ prefix, option, suggestions }, fireCmd) {
|
||||||
const rooms = roomIds.map((rId) => {
|
function getGenCmdSuggestions(cmdPrefix, cmds) {
|
||||||
const room = initMatrix.matrixClient.getRoom(rId);
|
const cmdOptString = (typeof option === 'string') ? `/${option}` : '/?';
|
||||||
return {
|
return cmds.map((cmd) => (
|
||||||
name: room.name,
|
|
||||||
roomId: room.roomId,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
const fuse = new Fuse(rooms, {
|
|
||||||
includeScore: true,
|
|
||||||
keys: ['name'],
|
|
||||||
threshold: '0.3',
|
|
||||||
});
|
|
||||||
return fuse.search(term);
|
|
||||||
}
|
|
||||||
|
|
||||||
function searchCommands(term) {
|
|
||||||
const fuse = new Fuse(commands, {
|
|
||||||
includeScore: true,
|
|
||||||
keys: ['name'],
|
|
||||||
threshold: '0.3',
|
|
||||||
});
|
|
||||||
return fuse.search(term);
|
|
||||||
}
|
|
||||||
|
|
||||||
let perfectMatchCmd = null;
|
|
||||||
function getCmdSuggestions({ prefix, slug }, fireCmd, viewEvent) {
|
|
||||||
function getRoomsSuggestion(cmdPrefix, rooms, roomSlug) {
|
|
||||||
const result = searchInRoomIds(rooms, roomSlug);
|
|
||||||
if (result.length === 0) viewEvent.emit('cmd_error');
|
|
||||||
perfectMatchCmd = {
|
|
||||||
prefix: cmdPrefix,
|
|
||||||
slug: roomSlug,
|
|
||||||
result: result[0]?.item || null,
|
|
||||||
};
|
|
||||||
return result.map((finding) => (
|
|
||||||
<CmdItem
|
<CmdItem
|
||||||
key={finding.item.roomId}
|
key={cmd.name}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
fireCmd({
|
fireCmd({
|
||||||
prefix: cmdPrefix,
|
prefix: cmdPrefix,
|
||||||
slug: roomSlug,
|
option,
|
||||||
result: finding.item,
|
result: cmd,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text variant="b2">{finding.item.name}</Text>
|
<Text variant="b2">{`${cmd.name}${cmd.isOptions ? cmdOptString : ''}`}</Text>
|
||||||
</CmdItem>
|
</CmdItem>
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGenCmdSuggestions(cmdPrefix, cmdSlug) {
|
function getRoomsSuggestion(cmdPrefix, rooms) {
|
||||||
const cmdSlugParts = cmdSlug.split('/');
|
return rooms.map((room) => (
|
||||||
const cmdSlugOption = cmdSlugParts[1];
|
<CmdItem
|
||||||
const result = searchCommands(cmdSlugParts[0]);
|
key={room.roomId}
|
||||||
if (result.length === 0) viewEvent.emit('cmd_error');
|
onClick={() => {
|
||||||
perfectMatchCmd = {
|
fireCmd({
|
||||||
prefix: cmdPrefix,
|
prefix: cmdPrefix,
|
||||||
slug: cmdSlug,
|
result: room,
|
||||||
option: cmdSlugOption,
|
});
|
||||||
result: result[0]?.item || null,
|
}}
|
||||||
};
|
>
|
||||||
return result.map((finding) => {
|
<Text variant="b2">{room.name}</Text>
|
||||||
let option = '';
|
</CmdItem>
|
||||||
if (finding.item.isOptions) {
|
));
|
||||||
if (typeof cmdSlugOption === 'string') option = `/${cmdSlugOption}`;
|
|
||||||
else option = '/?';
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<CmdItem
|
|
||||||
key={finding.item.name}
|
|
||||||
onClick={() => {
|
|
||||||
fireCmd({
|
|
||||||
prefix: cmdPrefix,
|
|
||||||
slug: cmdSlug,
|
|
||||||
option: cmdSlugOption,
|
|
||||||
result: finding.item,
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Text variant="b2">{`${finding.item.name}${option}`}</Text>
|
|
||||||
</CmdItem>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEmojiSuggestion(emPrefix, shortcutSlug) {
|
function getEmojiSuggestion(emPrefix, emos) {
|
||||||
let searchTerm = shortcutSlug;
|
return emos.map((emoji) => (
|
||||||
if (searchTerm.length <= 3) {
|
|
||||||
if (searchTerm.match(/^[-]?(\))/)) searchTerm = 'smile';
|
|
||||||
else if (searchTerm.match(/^[-]?(s|S)/)) searchTerm = 'confused';
|
|
||||||
else if (searchTerm.match(/^[-]?(o|O|0)/)) searchTerm = 'astonished';
|
|
||||||
else if (searchTerm.match(/^[-]?(\|)/)) searchTerm = 'neutral_face';
|
|
||||||
else if (searchTerm.match(/^[-]?(d|D)/)) searchTerm = 'grin';
|
|
||||||
else if (searchTerm.match(/^[-]?(\/)/)) searchTerm = 'frown';
|
|
||||||
else if (searchTerm.match(/^[-]?(p|P)/)) searchTerm = 'stick_out_tongue';
|
|
||||||
else if (searchTerm.match(/^'[-]?(\()/)) searchTerm = 'cry';
|
|
||||||
else if (searchTerm.match(/^[-]?(x|X)/)) searchTerm = 'dizzy_face';
|
|
||||||
else if (searchTerm.match(/^[-]?(\()/)) searchTerm = 'pleading_face';
|
|
||||||
else if (searchTerm.match(/^[-]?(\$)/)) searchTerm = 'money';
|
|
||||||
else if (searchTerm.match(/^(<3)/)) searchTerm = 'heart';
|
|
||||||
}
|
|
||||||
const result = searchEmoji(searchTerm);
|
|
||||||
if (result.length === 0) viewEvent.emit('cmd_error');
|
|
||||||
perfectMatchCmd = {
|
|
||||||
prefix: emPrefix,
|
|
||||||
slug: shortcutSlug,
|
|
||||||
result: result[0]?.item || null,
|
|
||||||
};
|
|
||||||
return result.map((finding) => (
|
|
||||||
<CmdItem
|
<CmdItem
|
||||||
key={finding.item.hexcode}
|
key={emoji.hexcode}
|
||||||
onClick={() => fireCmd({
|
onClick={() => fireCmd({
|
||||||
prefix: emPrefix,
|
prefix: emPrefix,
|
||||||
slug: shortcutSlug,
|
result: emoji,
|
||||||
result: finding.item,
|
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
parse(twemoji.parse(
|
parse(twemoji.parse(
|
||||||
finding.item.unicode,
|
emoji.unicode,
|
||||||
{
|
{
|
||||||
attributes: () => ({
|
attributes: () => ({
|
||||||
unicode: finding.item.unicode,
|
unicode: emoji.unicode,
|
||||||
shortcodes: finding.item.shortcodes?.toString(),
|
shortcodes: emoji.shortcodes?.toString(),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
<Text variant="b2">{`:${emoji.shortcode}:`}</Text>
|
||||||
|
</CmdItem>
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNameSuggestion(namePrefix, members) {
|
||||||
|
return members.map((member) => (
|
||||||
|
<CmdItem
|
||||||
|
key={member.userId}
|
||||||
|
onClick={() => {
|
||||||
|
fireCmd({
|
||||||
|
prefix: namePrefix,
|
||||||
|
result: member,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text variant="b2">{member.name}</Text>
|
||||||
</CmdItem>
|
</CmdItem>
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
const { roomList } = initMatrix;
|
|
||||||
const cmd = {
|
const cmd = {
|
||||||
'/': (command) => getGenCmdSuggestions(prefix, command),
|
'/': (cmds) => getGenCmdSuggestions(prefix, cmds),
|
||||||
'>*': (space) => getRoomsSuggestion(prefix, [...roomList.spaces], space),
|
'>*': (spaces) => getRoomsSuggestion(prefix, spaces),
|
||||||
'>#': (channel) => getRoomsSuggestion(prefix, [...roomList.rooms], channel),
|
'>#': (channels) => getRoomsSuggestion(prefix, channels),
|
||||||
'>@': (people) => getRoomsSuggestion(prefix, [...roomList.directs], people),
|
'>@': (peoples) => getRoomsSuggestion(prefix, peoples),
|
||||||
':': (emojiShortcut) => getEmojiSuggestion(prefix, emojiShortcut),
|
':': (emos) => getEmojiSuggestion(prefix, emos),
|
||||||
|
'@': (members) => getNameSuggestion(prefix, members),
|
||||||
};
|
};
|
||||||
return cmd[prefix]?.(slug);
|
return cmd[prefix]?.(suggestions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const asyncSearch = new AsyncSearch();
|
||||||
|
let cmdPrefix;
|
||||||
|
let cmdOption;
|
||||||
function ChannelViewCmdBar({ roomId, roomTimeline, viewEvent }) {
|
function ChannelViewCmdBar({ roomId, roomTimeline, viewEvent }) {
|
||||||
const [cmd, setCmd] = useState(null);
|
const [cmd, setCmd] = useState(null);
|
||||||
|
|
||||||
|
function displaySuggestions(suggestions) {
|
||||||
|
if (suggestions.length === 0) {
|
||||||
|
setCmd({ prefix: cmd?.prefix || cmdPrefix, error: 'No suggestion found.' });
|
||||||
|
viewEvent.emit('cmd_error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setCmd({ prefix: cmd?.prefix || cmdPrefix, suggestions, option: cmdOption });
|
||||||
|
}
|
||||||
|
|
||||||
function processCmd(prefix, slug) {
|
function processCmd(prefix, slug) {
|
||||||
setCmd({ prefix, slug });
|
let searchTerm = slug;
|
||||||
|
cmdOption = undefined;
|
||||||
|
cmdPrefix = prefix;
|
||||||
|
if (prefix === '/') {
|
||||||
|
const cmdSlugParts = slug.split('/');
|
||||||
|
[searchTerm, cmdOption] = cmdSlugParts;
|
||||||
|
}
|
||||||
|
if (prefix === ':') {
|
||||||
|
if (searchTerm.length <= 3) {
|
||||||
|
if (searchTerm.match(/^[-]?(\))$/)) searchTerm = 'smile';
|
||||||
|
else if (searchTerm.match(/^[-]?(s|S)$/)) searchTerm = 'confused';
|
||||||
|
else if (searchTerm.match(/^[-]?(o|O|0)$/)) searchTerm = 'astonished';
|
||||||
|
else if (searchTerm.match(/^[-]?(\|)$/)) searchTerm = 'neutral_face';
|
||||||
|
else if (searchTerm.match(/^[-]?(d|D)$/)) searchTerm = 'grin';
|
||||||
|
else if (searchTerm.match(/^[-]?(\/)$/)) searchTerm = 'frown';
|
||||||
|
else if (searchTerm.match(/^[-]?(p|P)$/)) searchTerm = 'stuck_out_tongue';
|
||||||
|
else if (searchTerm.match(/^'[-]?(\()$/)) searchTerm = 'cry';
|
||||||
|
else if (searchTerm.match(/^[-]?(x|X)$/)) searchTerm = 'dizzy_face';
|
||||||
|
else if (searchTerm.match(/^[-]?(\()$/)) searchTerm = 'pleading_face';
|
||||||
|
else if (searchTerm.match(/^[-]?(\$)$/)) searchTerm = 'money';
|
||||||
|
else if (searchTerm.match(/^(<3)$/)) searchTerm = 'heart';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
asyncSearch.search(searchTerm);
|
||||||
}
|
}
|
||||||
function activateCmd(prefix) {
|
function activateCmd(prefix) {
|
||||||
setCmd({ prefix });
|
setCmd({ prefix });
|
||||||
perfectMatchCmd = null;
|
cmdPrefix = prefix;
|
||||||
|
|
||||||
|
const { roomList, matrixClient } = initMatrix;
|
||||||
|
function getRooms(roomIds) {
|
||||||
|
return roomIds.map((rId) => {
|
||||||
|
const room = matrixClient.getRoom(rId);
|
||||||
|
return {
|
||||||
|
name: room.name,
|
||||||
|
roomId: room.roomId,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const setupSearch = {
|
||||||
|
'/': () => asyncSearch.setup(commands, { keys: ['name'], isContain: true }),
|
||||||
|
'>*': () => asyncSearch.setup(getRooms([...roomList.spaces]), { keys: ['name'], limit: 20 }),
|
||||||
|
'>#': () => asyncSearch.setup(getRooms([...roomList.rooms]), { keys: ['name'], limit: 20 }),
|
||||||
|
'>@': () => asyncSearch.setup(getRooms([...roomList.directs]), { keys: ['name'], limit: 20 }),
|
||||||
|
':': () => asyncSearch.setup(emojis, { keys: ['shortcode'], limit: 20 }),
|
||||||
|
'@': () => asyncSearch.setup(matrixClient.getRoom(roomId).getJoinedMembers().map((member) => ({
|
||||||
|
name: member.name,
|
||||||
|
userId: member.userId.slice(1),
|
||||||
|
})), { keys: ['name', 'userId'], limit: 20 }),
|
||||||
|
};
|
||||||
|
setupSearch[prefix]?.();
|
||||||
}
|
}
|
||||||
function deactivateCmd() {
|
function deactivateCmd() {
|
||||||
setCmd(null);
|
setCmd(null);
|
||||||
perfectMatchCmd = null;
|
cmdOption = undefined;
|
||||||
|
cmdPrefix = undefined;
|
||||||
}
|
}
|
||||||
function fireCmd(myCmd) {
|
function fireCmd(myCmd) {
|
||||||
if (myCmd.prefix.match(/^>[*#@]$/)) {
|
if (myCmd.prefix.match(/^>[*#@]$/)) {
|
||||||
@@ -361,34 +369,63 @@ function ChannelViewCmdBar({ roomId, roomTimeline, viewEvent }) {
|
|||||||
replace: myCmd.result.unicode,
|
replace: myCmd.result.unicode,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (myCmd.prefix === '@') {
|
||||||
|
viewEvent.emit('cmd_fired', {
|
||||||
|
replace: myCmd.result.name,
|
||||||
|
});
|
||||||
|
}
|
||||||
deactivateCmd();
|
deactivateCmd();
|
||||||
}
|
}
|
||||||
function executeCmd() {
|
function executeCmd() {
|
||||||
if (perfectMatchCmd === null) return;
|
if (cmd.suggestions.length === 0) return;
|
||||||
if (perfectMatchCmd.result === null) return;
|
fireCmd({
|
||||||
fireCmd(perfectMatchCmd);
|
prefix: cmd.prefix,
|
||||||
|
option: cmd.option,
|
||||||
|
result: cmd.suggestions[0],
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function errorCmd() {
|
|
||||||
setCmd({ error: 'No suggestion found.' });
|
function listenKeyboard(event) {
|
||||||
|
const { activeElement } = document;
|
||||||
|
const lastCmdItem = document.activeElement.parentNode.lastElementChild;
|
||||||
|
if (event.keyCode === 27) {
|
||||||
|
if (activeElement.className !== 'cmd-item') return;
|
||||||
|
viewEvent.emit('focus_msg_input');
|
||||||
|
}
|
||||||
|
if (event.keyCode === 9) {
|
||||||
|
if (lastCmdItem.className !== 'cmd-item') return;
|
||||||
|
if (lastCmdItem !== activeElement) return;
|
||||||
|
if (event.shiftKey) return;
|
||||||
|
viewEvent.emit('focus_msg_input');
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
viewEvent.on('cmd_activate', activateCmd);
|
viewEvent.on('cmd_activate', activateCmd);
|
||||||
viewEvent.on('cmd_process', processCmd);
|
|
||||||
viewEvent.on('cmd_deactivate', deactivateCmd);
|
viewEvent.on('cmd_deactivate', deactivateCmd);
|
||||||
viewEvent.on('cmd_exe', executeCmd);
|
|
||||||
viewEvent.on('cmd_error', errorCmd);
|
|
||||||
return () => {
|
return () => {
|
||||||
deactivateCmd();
|
deactivateCmd();
|
||||||
viewEvent.removeListener('cmd_activate', activateCmd);
|
viewEvent.removeListener('cmd_activate', activateCmd);
|
||||||
viewEvent.removeListener('cmd_process', processCmd);
|
|
||||||
viewEvent.removeListener('cmd_deactivate', deactivateCmd);
|
viewEvent.removeListener('cmd_deactivate', deactivateCmd);
|
||||||
viewEvent.removeListener('cmd_exe', executeCmd);
|
|
||||||
viewEvent.removeListener('cmd_error', errorCmd);
|
|
||||||
};
|
};
|
||||||
}, [roomId]);
|
}, [roomId]);
|
||||||
|
|
||||||
if (cmd !== null && typeof cmd.error !== 'undefined') {
|
useEffect(() => {
|
||||||
|
if (cmd !== null) document.body.addEventListener('keydown', listenKeyboard);
|
||||||
|
viewEvent.on('cmd_process', processCmd);
|
||||||
|
viewEvent.on('cmd_exe', executeCmd);
|
||||||
|
asyncSearch.on(asyncSearch.RESULT_SENT, displaySuggestions);
|
||||||
|
return () => {
|
||||||
|
if (cmd !== null) document.body.removeEventListener('keydown', listenKeyboard);
|
||||||
|
|
||||||
|
viewEvent.removeListener('cmd_process', processCmd);
|
||||||
|
viewEvent.removeListener('cmd_exe', executeCmd);
|
||||||
|
asyncSearch.removeListener(asyncSearch.RESULT_SENT, displaySuggestions);
|
||||||
|
};
|
||||||
|
}, [cmd]);
|
||||||
|
|
||||||
|
if (typeof cmd?.error === 'string') {
|
||||||
return (
|
return (
|
||||||
<div className="cmd-bar">
|
<div className="cmd-bar">
|
||||||
<div className="cmd-bar__info">
|
<div className="cmd-bar__info">
|
||||||
@@ -405,8 +442,8 @@ function ChannelViewCmdBar({ roomId, roomTimeline, viewEvent }) {
|
|||||||
<div className="cmd-bar">
|
<div className="cmd-bar">
|
||||||
<div className="cmd-bar__info">
|
<div className="cmd-bar__info">
|
||||||
{cmd === null && <CmdHelp />}
|
{cmd === null && <CmdHelp />}
|
||||||
{cmd !== null && typeof cmd.slug === 'undefined' && <div className="cmd-bar__info-indicator" /> }
|
{cmd !== null && typeof cmd.suggestions === 'undefined' && <div className="cmd-bar__info-indicator" /> }
|
||||||
{cmd !== null && typeof cmd.slug === 'string' && <Text variant="b3">TAB</Text>}
|
{cmd !== null && typeof cmd.suggestions !== 'undefined' && <Text variant="b3">TAB</Text>}
|
||||||
</div>
|
</div>
|
||||||
<div className="cmd-bar__content">
|
<div className="cmd-bar__content">
|
||||||
{cmd === null && (
|
{cmd === null && (
|
||||||
@@ -416,10 +453,10 @@ function ChannelViewCmdBar({ roomId, roomTimeline, viewEvent }) {
|
|||||||
viewEvent={viewEvent}
|
viewEvent={viewEvent}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{cmd !== null && typeof cmd.slug === 'undefined' && <Text className="cmd-bar__content-help" variant="b2">{getCmdActivationMessage(cmd.prefix)}</Text>}
|
{cmd !== null && typeof cmd.suggestions === 'undefined' && <Text className="cmd-bar__content-help" variant="b2">{getCmdActivationMessage(cmd.prefix)}</Text>}
|
||||||
{cmd !== null && typeof cmd.slug === 'string' && (
|
{cmd !== null && typeof cmd.suggestions !== 'undefined' && (
|
||||||
<ScrollView horizontal vertical={false} invisible>
|
<ScrollView horizontal vertical={false} invisible>
|
||||||
<div className="cmd-bar__content__suggestions">{getCmdSuggestions(cmd, fireCmd, viewEvent)}</div>
|
<div className="cmd-bar__content__suggestions">{getCmdSuggestions(cmd, fireCmd)}</div>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -117,14 +117,10 @@
|
|||||||
border-radius: var(--bo-radius) var(--bo-radius) 0 0;
|
border-radius: var(--bo-radius) var(--bo-radius) 0 0;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
[dir=rtl] & {
|
|
||||||
margin-right: 0;
|
|
||||||
margin-left: var(--sp-extra-tight);
|
|
||||||
}
|
|
||||||
|
|
||||||
& .emoji {
|
& .emoji {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
|
margin-right: var(--sp-ultra-tight);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
@@ -136,4 +132,13 @@
|
|||||||
border-bottom: 2px solid transparent;
|
border-bottom: 2px solid transparent;
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[dir=rtl] & {
|
||||||
|
margin-right: 0;
|
||||||
|
margin-left: var(--sp-extra-tight);
|
||||||
|
& .emoji {
|
||||||
|
margin-right: 0;
|
||||||
|
margin-left: var(--sp-ultra-tight);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -7,19 +7,22 @@ import dateFormat from 'dateformat';
|
|||||||
|
|
||||||
import initMatrix from '../../../client/initMatrix';
|
import initMatrix from '../../../client/initMatrix';
|
||||||
import cons from '../../../client/state/cons';
|
import cons from '../../../client/state/cons';
|
||||||
import { redact } from '../../../client/action/room';
|
import { redactEvent, sendReaction } from '../../../client/action/roomTimeline';
|
||||||
import { getUsername, doesRoomHaveUnread } from '../../../util/matrixUtil';
|
import { getUsername, getUsernameOfRoomMember, doesRoomHaveUnread } from '../../../util/matrixUtil';
|
||||||
import colorMXID from '../../../util/colorMXID';
|
import colorMXID from '../../../util/colorMXID';
|
||||||
import { diffMinutes, isNotInSameDay } from '../../../util/common';
|
import { diffMinutes, isNotInSameDay } from '../../../util/common';
|
||||||
|
import { openEmojiBoard, openReadReceipts } from '../../../client/action/navigation';
|
||||||
|
|
||||||
import Divider from '../../atoms/divider/Divider';
|
import Divider from '../../atoms/divider/Divider';
|
||||||
import Avatar from '../../atoms/avatar/Avatar';
|
import Avatar from '../../atoms/avatar/Avatar';
|
||||||
import IconButton from '../../atoms/button/IconButton';
|
import IconButton from '../../atoms/button/IconButton';
|
||||||
|
import ContextMenu, { MenuHeader, MenuItem, MenuBorder } from '../../atoms/context-menu/ContextMenu';
|
||||||
import {
|
import {
|
||||||
Message,
|
Message,
|
||||||
MessageHeader,
|
MessageHeader,
|
||||||
MessageReply,
|
MessageReply,
|
||||||
MessageContent,
|
MessageContent,
|
||||||
|
MessageEdit,
|
||||||
MessageReactionGroup,
|
MessageReactionGroup,
|
||||||
MessageReaction,
|
MessageReaction,
|
||||||
MessageOptions,
|
MessageOptions,
|
||||||
@@ -30,12 +33,160 @@ import ChannelIntro from '../../molecules/channel-intro/ChannelIntro';
|
|||||||
import TimelineChange from '../../molecules/message/TimelineChange';
|
import TimelineChange from '../../molecules/message/TimelineChange';
|
||||||
|
|
||||||
import ReplyArrowIC from '../../../../public/res/ic/outlined/reply-arrow.svg';
|
import ReplyArrowIC from '../../../../public/res/ic/outlined/reply-arrow.svg';
|
||||||
|
import EmojiAddIC from '../../../../public/res/ic/outlined/emoji-add.svg';
|
||||||
|
import VerticalMenuIC from '../../../../public/res/ic/outlined/vertical-menu.svg';
|
||||||
|
import PencilIC from '../../../../public/res/ic/outlined/pencil.svg';
|
||||||
|
import TickMarkIC from '../../../../public/res/ic/outlined/tick-mark.svg';
|
||||||
import BinIC from '../../../../public/res/ic/outlined/bin.svg';
|
import BinIC from '../../../../public/res/ic/outlined/bin.svg';
|
||||||
|
|
||||||
import { parseReply, parseTimelineChange } from './common';
|
import { parseReply, parseTimelineChange } from './common';
|
||||||
|
|
||||||
const MAX_MSG_DIFF_MINUTES = 5;
|
const MAX_MSG_DIFF_MINUTES = 5;
|
||||||
|
|
||||||
|
function genPlaceholders() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<PlaceholderMessage key="placeholder-1" />
|
||||||
|
<PlaceholderMessage key="placeholder-2" />
|
||||||
|
<PlaceholderMessage key="placeholder-3" />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isMedia(mE) {
|
||||||
|
return (
|
||||||
|
mE.getContent()?.msgtype === 'm.file'
|
||||||
|
|| mE.getContent()?.msgtype === 'm.image'
|
||||||
|
|| mE.getContent()?.msgtype === 'm.audio'
|
||||||
|
|| mE.getContent()?.msgtype === 'm.video'
|
||||||
|
|| mE.getType() === 'm.sticker'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function genMediaContent(mE) {
|
||||||
|
const mx = initMatrix.matrixClient;
|
||||||
|
const mContent = mE.getContent();
|
||||||
|
if (!mContent || !mContent.body) return <span style={{ color: 'var(--bg-danger)' }}>Malformed event</span>;
|
||||||
|
|
||||||
|
let mediaMXC = mContent?.url;
|
||||||
|
const isEncryptedFile = typeof mediaMXC === 'undefined';
|
||||||
|
if (isEncryptedFile) mediaMXC = mContent?.file?.url;
|
||||||
|
|
||||||
|
let thumbnailMXC = mContent?.info?.thumbnail_url;
|
||||||
|
|
||||||
|
if (typeof mediaMXC === 'undefined' || mediaMXC === '') return <span style={{ color: 'var(--bg-danger)' }}>Malformed event</span>;
|
||||||
|
|
||||||
|
let msgType = mE.getContent()?.msgtype;
|
||||||
|
if (mE.getType() === 'm.sticker') msgType = 'm.image';
|
||||||
|
|
||||||
|
switch (msgType) {
|
||||||
|
case 'm.file':
|
||||||
|
return (
|
||||||
|
<Media.File
|
||||||
|
name={mContent.body}
|
||||||
|
link={mx.mxcUrlToHttp(mediaMXC)}
|
||||||
|
type={mContent.info?.mimetype}
|
||||||
|
file={mContent.file || null}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
case 'm.image':
|
||||||
|
return (
|
||||||
|
<Media.Image
|
||||||
|
name={mContent.body}
|
||||||
|
width={typeof mContent.info?.w === 'number' ? mContent.info?.w : null}
|
||||||
|
height={typeof mContent.info?.h === 'number' ? mContent.info?.h : null}
|
||||||
|
link={mx.mxcUrlToHttp(mediaMXC)}
|
||||||
|
file={isEncryptedFile ? mContent.file : null}
|
||||||
|
type={mContent.info?.mimetype}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
case 'm.audio':
|
||||||
|
return (
|
||||||
|
<Media.Audio
|
||||||
|
name={mContent.body}
|
||||||
|
link={mx.mxcUrlToHttp(mediaMXC)}
|
||||||
|
type={mContent.info?.mimetype}
|
||||||
|
file={mContent.file || null}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
case 'm.video':
|
||||||
|
if (typeof thumbnailMXC === 'undefined') {
|
||||||
|
thumbnailMXC = mContent.info?.thumbnail_file?.url || null;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<Media.Video
|
||||||
|
name={mContent.body}
|
||||||
|
link={mx.mxcUrlToHttp(mediaMXC)}
|
||||||
|
thumbnail={thumbnailMXC === null ? null : mx.mxcUrlToHttp(thumbnailMXC)}
|
||||||
|
thumbnailFile={isEncryptedFile ? mContent.info?.thumbnail_file : null}
|
||||||
|
thumbnailType={mContent.info?.thumbnail_info?.mimetype || null}
|
||||||
|
width={typeof mContent.info?.w === 'number' ? mContent.info?.w : null}
|
||||||
|
height={typeof mContent.info?.h === 'number' ? mContent.info?.h : null}
|
||||||
|
file={isEncryptedFile ? mContent.file : null}
|
||||||
|
type={mContent.info?.mimetype}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return <span style={{ color: 'var(--bg-danger)' }}>Malformed event</span>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function genChannelIntro(mEvent, roomTimeline) {
|
||||||
|
const mx = initMatrix.matrixClient;
|
||||||
|
const roomTopic = roomTimeline.room.currentState.getStateEvents('m.room.topic')[0]?.getContent().topic;
|
||||||
|
const isDM = initMatrix.roomList.directs.has(roomTimeline.roomId);
|
||||||
|
let avatarSrc = roomTimeline.room.getAvatarUrl(mx.baseUrl, 80, 80, 'crop');
|
||||||
|
avatarSrc = isDM ? roomTimeline.room.getAvatarFallbackMember()?.getAvatarUrl(mx.baseUrl, 80, 80, 'crop') : avatarSrc;
|
||||||
|
return (
|
||||||
|
<ChannelIntro
|
||||||
|
key={mEvent ? mEvent.getId() : 'channel-intro'}
|
||||||
|
roomId={roomTimeline.roomId}
|
||||||
|
avatarSrc={avatarSrc}
|
||||||
|
name={roomTimeline.room.name}
|
||||||
|
heading={`Welcome to ${roomTimeline.room.name}`}
|
||||||
|
desc={`This is the beginning of ${roomTimeline.room.name} channel.${typeof roomTopic !== 'undefined' ? (` Topic: ${roomTopic}`) : ''}`}
|
||||||
|
time={mEvent ? `Created at ${dateFormat(mEvent.getDate(), 'dd mmmm yyyy, hh:MM TT')}` : null}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getMyEmojiEventId(emojiKey, eventId, roomTimeline) {
|
||||||
|
const mx = initMatrix.matrixClient;
|
||||||
|
const rEvents = roomTimeline.reactionTimeline.get(eventId);
|
||||||
|
let rEventId = null;
|
||||||
|
rEvents?.find((rE) => {
|
||||||
|
if (rE.getRelation() === null) return false;
|
||||||
|
if (rE.getRelation().key === emojiKey && rE.getSender() === mx.getUserId()) {
|
||||||
|
rEventId = rE.getId();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
return rEventId;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleEmoji(roomId, eventId, emojiKey, roomTimeline) {
|
||||||
|
const myAlreadyReactEventId = getMyEmojiEventId(emojiKey, eventId, roomTimeline);
|
||||||
|
if (typeof myAlreadyReactEventId === 'string') {
|
||||||
|
if (myAlreadyReactEventId.indexOf('~') === 0) return;
|
||||||
|
redactEvent(roomId, myAlreadyReactEventId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sendReaction(roomId, eventId, emojiKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pickEmoji(e, roomId, eventId, roomTimeline) {
|
||||||
|
const boxInfo = e.target.getBoundingClientRect();
|
||||||
|
openEmojiBoard({
|
||||||
|
x: boxInfo.x,
|
||||||
|
y: boxInfo.y,
|
||||||
|
detail: e.detail,
|
||||||
|
}, (emoji) => {
|
||||||
|
toggleEmoji(roomId, eventId, emoji.unicode, roomTimeline);
|
||||||
|
e.target.click();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let wasAtBottom = true;
|
let wasAtBottom = true;
|
||||||
function ChannelViewContent({
|
function ChannelViewContent({
|
||||||
roomId, roomTimeline, timelineScroll, viewEvent,
|
roomId, roomTimeline, timelineScroll, viewEvent,
|
||||||
@@ -43,6 +194,7 @@ function ChannelViewContent({
|
|||||||
const [isReachedTimelineEnd, setIsReachedTimelineEnd] = useState(false);
|
const [isReachedTimelineEnd, setIsReachedTimelineEnd] = useState(false);
|
||||||
const [onStateUpdate, updateState] = useState(null);
|
const [onStateUpdate, updateState] = useState(null);
|
||||||
const [onPagination, setOnPagination] = useState(null);
|
const [onPagination, setOnPagination] = useState(null);
|
||||||
|
const [editEvent, setEditEvent] = useState(null);
|
||||||
const mx = initMatrix.matrixClient;
|
const mx = initMatrix.matrixClient;
|
||||||
|
|
||||||
function autoLoadTimeline() {
|
function autoLoadTimeline() {
|
||||||
@@ -120,91 +272,257 @@ function ChannelViewContent({
|
|||||||
}, [onStateUpdate]);
|
}, [onStateUpdate]);
|
||||||
|
|
||||||
let prevMEvent = null;
|
let prevMEvent = null;
|
||||||
function renderMessage(mEvent) {
|
function genMessage(mEvent) {
|
||||||
function isMedia(mE) {
|
const myPowerlevel = roomTimeline.room.getMember(mx.getUserId()).powerLevel;
|
||||||
return (
|
const canIRedact = roomTimeline.room.currentState.hasSufficientPowerLevelFor('redact', myPowerlevel);
|
||||||
mE.getContent()?.msgtype === 'm.file'
|
|
||||||
|| mE.getContent()?.msgtype === 'm.image'
|
|
||||||
|| mE.getContent()?.msgtype === 'm.audio'
|
|
||||||
|| mE.getContent()?.msgtype === 'm.video'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
function genMediaContent(mE) {
|
|
||||||
const mContent = mE.getContent();
|
|
||||||
let mediaMXC = mContent.url;
|
|
||||||
let thumbnailMXC = mContent?.info?.thumbnail_url;
|
|
||||||
const isEncryptedFile = typeof mediaMXC === 'undefined';
|
|
||||||
if (isEncryptedFile) mediaMXC = mContent.file.url;
|
|
||||||
|
|
||||||
switch (mE.getContent()?.msgtype) {
|
const isContentOnly = (
|
||||||
case 'm.file':
|
prevMEvent !== null
|
||||||
return (
|
&& prevMEvent.getType() !== 'm.room.member'
|
||||||
<Media.File
|
&& diffMinutes(mEvent.getDate(), prevMEvent.getDate()) <= MAX_MSG_DIFF_MINUTES
|
||||||
name={mContent.body}
|
&& prevMEvent.getSender() === mEvent.getSender()
|
||||||
link={mx.mxcUrlToHttp(mediaMXC)}
|
);
|
||||||
file={mContent.file}
|
|
||||||
type={mContent.info.mimetype}
|
let content = mEvent.getContent().body;
|
||||||
/>
|
if (typeof content === 'undefined') return null;
|
||||||
);
|
let reply = null;
|
||||||
case 'm.image':
|
let reactions = null;
|
||||||
return (
|
let isMarkdown = mEvent.getContent().format === 'org.matrix.custom.html';
|
||||||
<Media.Image
|
const isReply = typeof mEvent.getWireContent()['m.relates_to']?.['m.in_reply_to'] !== 'undefined';
|
||||||
name={mContent.body}
|
const isEdited = roomTimeline.editedTimeline.has(mEvent.getId());
|
||||||
width={mContent.info.w || null}
|
const haveReactions = roomTimeline.reactionTimeline.has(mEvent.getId());
|
||||||
height={mContent.info.h || null}
|
|
||||||
link={mx.mxcUrlToHttp(mediaMXC)}
|
if (isReply) {
|
||||||
file={isEncryptedFile ? mContent.file : null}
|
const parsedContent = parseReply(content);
|
||||||
type={mContent.info.mimetype}
|
if (parsedContent !== null) {
|
||||||
/>
|
const c = roomTimeline.room.currentState;
|
||||||
);
|
const displayNameToUserIds = c.getUserIdsWithDisplayName(parsedContent.displayName);
|
||||||
case 'm.audio':
|
const ID = parsedContent.userId || displayNameToUserIds[0];
|
||||||
return (
|
reply = {
|
||||||
<Media.Audio
|
color: colorMXID(ID || parsedContent.displayName),
|
||||||
name={mContent.body}
|
to: parsedContent.displayName || getUsername(parsedContent.userId),
|
||||||
link={mx.mxcUrlToHttp(mediaMXC)}
|
content: parsedContent.replyContent,
|
||||||
type={mContent.info.mimetype}
|
};
|
||||||
file={mContent.file}
|
content = parsedContent.content;
|
||||||
/>
|
|
||||||
);
|
|
||||||
case 'm.video':
|
|
||||||
if (typeof thumbnailMXC === 'undefined') {
|
|
||||||
thumbnailMXC = mContent.info?.thumbnail_file?.url || null;
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<Media.Video
|
|
||||||
name={mContent.body}
|
|
||||||
link={mx.mxcUrlToHttp(mediaMXC)}
|
|
||||||
thumbnail={thumbnailMXC === null ? null : mx.mxcUrlToHttp(thumbnailMXC)}
|
|
||||||
thumbnailFile={isEncryptedFile ? mContent.info.thumbnail_file : null}
|
|
||||||
thumbnailType={mContent.info.thumbnail_info?.mimetype || null}
|
|
||||||
width={mContent.info.w || null}
|
|
||||||
height={mContent.info.h || null}
|
|
||||||
file={isEncryptedFile ? mContent.file : null}
|
|
||||||
type={mContent.info.mimetype}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
default:
|
|
||||||
return 'Unable to attach media file!';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mEvent.getType() === 'm.room.create') {
|
if (isEdited) {
|
||||||
const roomTopic = roomTimeline.room.currentState.getStateEvents('m.room.topic')[0]?.getContent().topic;
|
const editedList = roomTimeline.editedTimeline.get(mEvent.getId());
|
||||||
return (
|
const latestEdited = editedList[editedList.length - 1];
|
||||||
<ChannelIntro
|
if (typeof latestEdited.getContent()['m.new_content'] === 'undefined') return null;
|
||||||
key={mEvent.getId()}
|
const latestEditBody = latestEdited.getContent()['m.new_content'].body;
|
||||||
avatarSrc={roomTimeline.room.getAvatarUrl(initMatrix.matrixClient.baseUrl, 80, 80, 'crop')}
|
const parsedEditedContent = parseReply(latestEditBody);
|
||||||
name={roomTimeline.room.name}
|
isMarkdown = latestEdited.getContent()['m.new_content'].format === 'org.matrix.custom.html';
|
||||||
heading={`Welcome to ${roomTimeline.room.name}`}
|
if (parsedEditedContent === null) {
|
||||||
desc={`This is the beginning of ${roomTimeline.room.name} channel.${typeof roomTopic !== 'undefined' ? (` Topic: ${roomTopic}`) : ''}`}
|
content = latestEditBody;
|
||||||
time={`Created at ${dateFormat(mEvent.getDate(), 'dd mmmm yyyy, hh:MM TT')}`}
|
} else {
|
||||||
/>
|
content = parsedEditedContent.content;
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (haveReactions) {
|
||||||
|
reactions = [];
|
||||||
|
roomTimeline.reactionTimeline.get(mEvent.getId()).forEach((rEvent) => {
|
||||||
|
if (rEvent.getRelation() === null) return;
|
||||||
|
function alreadyHaveThisReaction(rE) {
|
||||||
|
for (let i = 0; i < reactions.length; i += 1) {
|
||||||
|
if (reactions[i].key === rE.getRelation().key) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (alreadyHaveThisReaction(rEvent)) {
|
||||||
|
for (let i = 0; i < reactions.length; i += 1) {
|
||||||
|
if (reactions[i].key === rEvent.getRelation().key) {
|
||||||
|
reactions[i].users.push(rEvent.getSender());
|
||||||
|
if (reactions[i].isActive !== true) {
|
||||||
|
const myUserId = initMatrix.matrixClient.getUserId();
|
||||||
|
reactions[i].isActive = rEvent.getSender() === myUserId;
|
||||||
|
if (reactions[i].isActive) reactions[i].id = rEvent.getId();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reactions.push({
|
||||||
|
id: rEvent.getId(),
|
||||||
|
key: rEvent.getRelation().key,
|
||||||
|
users: [rEvent.getSender()],
|
||||||
|
isActive: (rEvent.getSender() === initMatrix.matrixClient.getUserId()),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const senderMXIDColor = colorMXID(mEvent.sender.userId);
|
||||||
|
const userAvatar = isContentOnly ? null : (
|
||||||
|
<Avatar
|
||||||
|
imageSrc={mEvent.sender.getAvatarUrl(initMatrix.matrixClient.baseUrl, 36, 36, 'crop')}
|
||||||
|
text={getUsernameOfRoomMember(mEvent.sender).slice(0, 1)}
|
||||||
|
bgColor={senderMXIDColor}
|
||||||
|
size="small"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
const userHeader = isContentOnly ? null : (
|
||||||
|
<MessageHeader
|
||||||
|
userId={mEvent.sender.userId}
|
||||||
|
name={getUsernameOfRoomMember(mEvent.sender)}
|
||||||
|
color={senderMXIDColor}
|
||||||
|
time={`${dateFormat(mEvent.getDate(), 'hh:MM TT')}`}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
const userReply = reply === null ? null : (
|
||||||
|
<MessageReply
|
||||||
|
name={reply.to}
|
||||||
|
color={reply.color}
|
||||||
|
content={reply.content}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
const userContent = (
|
||||||
|
<MessageContent
|
||||||
|
isMarkdown={isMarkdown}
|
||||||
|
content={isMedia(mEvent) ? genMediaContent(mEvent) : content}
|
||||||
|
isEdited={isEdited}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
const userReactions = reactions === null ? null : (
|
||||||
|
<MessageReactionGroup>
|
||||||
|
{
|
||||||
|
reactions.map((reaction) => (
|
||||||
|
<MessageReaction
|
||||||
|
key={reaction.id}
|
||||||
|
reaction={reaction.key}
|
||||||
|
users={reaction.users}
|
||||||
|
isActive={reaction.isActive}
|
||||||
|
onClick={() => {
|
||||||
|
toggleEmoji(roomId, mEvent.getId(), reaction.key, roomTimeline);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
<IconButton
|
||||||
|
onClick={(e) => pickEmoji(e, roomId, mEvent.getId(), roomTimeline)}
|
||||||
|
src={EmojiAddIC}
|
||||||
|
size="extra-small"
|
||||||
|
tooltip="Add reaction"
|
||||||
|
/>
|
||||||
|
</MessageReactionGroup>
|
||||||
|
);
|
||||||
|
const userOptions = (
|
||||||
|
<MessageOptions>
|
||||||
|
<IconButton
|
||||||
|
onClick={(e) => pickEmoji(e, roomId, mEvent.getId(), roomTimeline)}
|
||||||
|
src={EmojiAddIC}
|
||||||
|
size="extra-small"
|
||||||
|
tooltip="Add reaction"
|
||||||
|
/>
|
||||||
|
<IconButton
|
||||||
|
onClick={() => {
|
||||||
|
viewEvent.emit('reply_to', mEvent.getSender(), mEvent.getId(), isMedia(mEvent) ? mEvent.getContent().body : content);
|
||||||
|
}}
|
||||||
|
src={ReplyArrowIC}
|
||||||
|
size="extra-small"
|
||||||
|
tooltip="Reply"
|
||||||
|
/>
|
||||||
|
{(mEvent.getSender() === mx.getUserId() && !isMedia(mEvent)) && (
|
||||||
|
<IconButton
|
||||||
|
onClick={() => setEditEvent(mEvent)}
|
||||||
|
src={PencilIC}
|
||||||
|
size="extra-small"
|
||||||
|
tooltip="Edit"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<ContextMenu
|
||||||
|
content={() => (
|
||||||
|
<>
|
||||||
|
<MenuHeader>Options</MenuHeader>
|
||||||
|
<MenuItem
|
||||||
|
iconSrc={EmojiAddIC}
|
||||||
|
onClick={(e) => pickEmoji(e, roomId, mEvent.getId(), roomTimeline)}
|
||||||
|
>
|
||||||
|
Add reaction
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem
|
||||||
|
iconSrc={ReplyArrowIC}
|
||||||
|
onClick={() => {
|
||||||
|
viewEvent.emit('reply_to', mEvent.getSender(), mEvent.getId(), isMedia(mEvent) ? mEvent.getContent().body : content);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Reply
|
||||||
|
</MenuItem>
|
||||||
|
{(mEvent.getSender() === mx.getUserId() && !isMedia(mEvent)) && (
|
||||||
|
<MenuItem iconSrc={PencilIC} onClick={() => setEditEvent(mEvent)}>Edit</MenuItem>
|
||||||
|
)}
|
||||||
|
<MenuItem
|
||||||
|
iconSrc={TickMarkIC}
|
||||||
|
onClick={() => openReadReceipts(roomId, mEvent.getId())}
|
||||||
|
>
|
||||||
|
Read receipts
|
||||||
|
</MenuItem>
|
||||||
|
{(canIRedact || mEvent.getSender() === mx.getUserId()) && (
|
||||||
|
<>
|
||||||
|
<MenuBorder />
|
||||||
|
<MenuItem
|
||||||
|
variant="danger"
|
||||||
|
iconSrc={BinIC}
|
||||||
|
onClick={() => {
|
||||||
|
if (window.confirm('Are you sure you want to delete this event')) {
|
||||||
|
redactEvent(roomId, mEvent.getId());
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Delete
|
||||||
|
</MenuItem>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
render={(toggleMenu) => (
|
||||||
|
<IconButton
|
||||||
|
onClick={toggleMenu}
|
||||||
|
src={VerticalMenuIC}
|
||||||
|
size="extra-small"
|
||||||
|
tooltip="Options"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</MessageOptions>
|
||||||
|
);
|
||||||
|
|
||||||
|
const isEditingEvent = editEvent?.getId() === mEvent.getId();
|
||||||
|
const myMessageEl = (
|
||||||
|
<Message
|
||||||
|
key={mEvent.getId()}
|
||||||
|
avatar={userAvatar}
|
||||||
|
header={userHeader}
|
||||||
|
reply={userReply}
|
||||||
|
content={editEvent !== null && isEditingEvent ? null : userContent}
|
||||||
|
editContent={editEvent !== null && isEditingEvent ? (
|
||||||
|
<MessageEdit
|
||||||
|
content={content}
|
||||||
|
onSave={(newBody) => {
|
||||||
|
if (newBody !== content) {
|
||||||
|
initMatrix.roomsInput.sendEditedMessage(roomId, mEvent, newBody);
|
||||||
|
}
|
||||||
|
setEditEvent(null);
|
||||||
|
}}
|
||||||
|
onCancel={() => setEditEvent(null)}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
reactions={userReactions}
|
||||||
|
options={editEvent !== null && isEditingEvent ? null : userOptions}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
return myMessageEl;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderMessage(mEvent) {
|
||||||
|
if (mEvent.getType() === 'm.room.create') return genChannelIntro(mEvent, roomTimeline);
|
||||||
if (
|
if (
|
||||||
mEvent.getType() !== 'm.room.message'
|
mEvent.getType() !== 'm.room.message'
|
||||||
&& mEvent.getType() !== 'm.room.encrypted'
|
&& mEvent.getType() !== 'm.room.encrypted'
|
||||||
&& mEvent.getType() !== 'm.room.member'
|
&& mEvent.getType() !== 'm.room.member'
|
||||||
|
&& mEvent.getType() !== 'm.sticker'
|
||||||
) return false;
|
) return false;
|
||||||
if (mEvent.getRelation()?.rel_type === 'm.replace') return false;
|
if (mEvent.getRelation()?.rel_type === 'm.replace') return false;
|
||||||
|
|
||||||
@@ -217,173 +535,16 @@ function ChannelViewContent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mEvent.getType() !== 'm.room.member') {
|
if (mEvent.getType() !== 'm.room.member') {
|
||||||
const isContentOnly = (
|
const messageComp = genMessage(mEvent);
|
||||||
prevMEvent !== null
|
|
||||||
&& prevMEvent.getType() !== 'm.room.member'
|
|
||||||
&& diffMinutes(mEvent.getDate(), prevMEvent.getDate()) <= MAX_MSG_DIFF_MINUTES
|
|
||||||
&& prevMEvent.getSender() === mEvent.getSender()
|
|
||||||
);
|
|
||||||
|
|
||||||
const myPowerlevel = roomTimeline.room.getMember(mx.getUserId()).powerLevel;
|
|
||||||
const canIRedact = roomTimeline.room.currentState.hasSufficientPowerLevelFor('redact', myPowerlevel);
|
|
||||||
|
|
||||||
let content = mEvent.getContent().body;
|
|
||||||
if (typeof content === 'undefined') return null;
|
|
||||||
let reply = null;
|
|
||||||
let reactions = null;
|
|
||||||
let isMarkdown = mEvent.getContent().format === 'org.matrix.custom.html';
|
|
||||||
const isReply = typeof mEvent.getWireContent()['m.relates_to']?.['m.in_reply_to'] !== 'undefined';
|
|
||||||
const isEdited = roomTimeline.editedTimeline.has(mEvent.getId());
|
|
||||||
const haveReactions = roomTimeline.reactionTimeline.has(mEvent.getId());
|
|
||||||
|
|
||||||
if (isReply) {
|
|
||||||
const parsedContent = parseReply(content);
|
|
||||||
|
|
||||||
if (parsedContent !== null) {
|
|
||||||
const username = getUsername(parsedContent.userId);
|
|
||||||
reply = {
|
|
||||||
userId: parsedContent.userId,
|
|
||||||
color: colorMXID(parsedContent.userId),
|
|
||||||
to: username,
|
|
||||||
content: parsedContent.replyContent,
|
|
||||||
};
|
|
||||||
content = parsedContent.content;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isEdited) {
|
|
||||||
const editedList = roomTimeline.editedTimeline.get(mEvent.getId());
|
|
||||||
const latestEdited = editedList[editedList.length - 1];
|
|
||||||
if (typeof latestEdited.getContent()['m.new_content'] === 'undefined') return null;
|
|
||||||
const latestEditBody = latestEdited.getContent()['m.new_content'].body;
|
|
||||||
const parsedEditedContent = parseReply(latestEditBody);
|
|
||||||
isMarkdown = latestEdited.getContent()['m.new_content'].format === 'org.matrix.custom.html';
|
|
||||||
if (parsedEditedContent === null) {
|
|
||||||
content = latestEditBody;
|
|
||||||
} else {
|
|
||||||
content = parsedEditedContent.content;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (haveReactions) {
|
|
||||||
reactions = [];
|
|
||||||
roomTimeline.reactionTimeline.get(mEvent.getId()).forEach((rEvent) => {
|
|
||||||
if (rEvent.getRelation() === null) return;
|
|
||||||
function alreadyHaveThisReaction(rE) {
|
|
||||||
for (let i = 0; i < reactions.length; i += 1) {
|
|
||||||
if (reactions[i].key === rE.getRelation().key) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (alreadyHaveThisReaction(rEvent)) {
|
|
||||||
for (let i = 0; i < reactions.length; i += 1) {
|
|
||||||
if (reactions[i].key === rEvent.getRelation().key) {
|
|
||||||
reactions[i].users.push(rEvent.getSender());
|
|
||||||
if (reactions[i].isActive !== true) {
|
|
||||||
const myUserId = initMatrix.matrixClient.getUserId();
|
|
||||||
reactions[i].isActive = rEvent.getSender() === myUserId;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
reactions.push({
|
|
||||||
id: rEvent.getId(),
|
|
||||||
key: rEvent.getRelation().key,
|
|
||||||
users: [rEvent.getSender()],
|
|
||||||
isActive: (rEvent.getSender() === initMatrix.matrixClient.getUserId()),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const senderMXIDColor = colorMXID(mEvent.sender.userId);
|
|
||||||
const userAvatar = isContentOnly ? null : (
|
|
||||||
<Avatar
|
|
||||||
imageSrc={mEvent.sender.getAvatarUrl(initMatrix.matrixClient.baseUrl, 36, 36, 'crop')}
|
|
||||||
text={getUsername(mEvent.sender.userId).slice(0, 1)}
|
|
||||||
bgColor={senderMXIDColor}
|
|
||||||
size="small"
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
const userHeader = isContentOnly ? null : (
|
|
||||||
<MessageHeader
|
|
||||||
userId={mEvent.sender.userId}
|
|
||||||
name={getUsername(mEvent.sender.userId)}
|
|
||||||
color={senderMXIDColor}
|
|
||||||
time={`${dateFormat(mEvent.getDate(), 'hh:MM TT')}`}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
const userReply = reply === null ? null : (
|
|
||||||
<MessageReply
|
|
||||||
userId={reply.userId}
|
|
||||||
name={reply.to}
|
|
||||||
color={reply.color}
|
|
||||||
content={reply.content}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
const userContent = (
|
|
||||||
<MessageContent
|
|
||||||
isMarkdown={isMarkdown}
|
|
||||||
content={isMedia(mEvent) ? genMediaContent(mEvent) : content}
|
|
||||||
isEdited={isEdited}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
const userReactions = reactions === null ? null : (
|
|
||||||
<MessageReactionGroup>
|
|
||||||
{
|
|
||||||
reactions.map((reaction) => (
|
|
||||||
<MessageReaction
|
|
||||||
key={reaction.id}
|
|
||||||
reaction={reaction.key}
|
|
||||||
users={reaction.users}
|
|
||||||
isActive={reaction.isActive}
|
|
||||||
onClick={() => alert('Sending reactions is yet to be implemented.')}
|
|
||||||
/>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</MessageReactionGroup>
|
|
||||||
);
|
|
||||||
const userOptions = (
|
|
||||||
<MessageOptions>
|
|
||||||
<IconButton
|
|
||||||
onClick={() => {
|
|
||||||
viewEvent.emit('reply_to', mEvent.getSender(), mEvent.getId(), isMedia(mEvent) ? mEvent.getContent().body : content);
|
|
||||||
}}
|
|
||||||
src={ReplyArrowIC}
|
|
||||||
size="extra-small"
|
|
||||||
tooltip="Reply"
|
|
||||||
/>
|
|
||||||
{(canIRedact || mEvent.getSender() === mx.getUserId()) && (
|
|
||||||
<IconButton
|
|
||||||
onClick={() => {
|
|
||||||
if (window.confirm('Are you sure you want to delete this event')) {
|
|
||||||
redact(roomId, mEvent.getId());
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
src={BinIC}
|
|
||||||
size="extra-small"
|
|
||||||
tooltip="Delete"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</MessageOptions>
|
|
||||||
);
|
|
||||||
|
|
||||||
const myMessageEl = (
|
|
||||||
<Message
|
|
||||||
key={mEvent.getId()}
|
|
||||||
avatar={userAvatar}
|
|
||||||
header={userHeader}
|
|
||||||
reply={userReply}
|
|
||||||
content={userContent}
|
|
||||||
reactions={userReactions}
|
|
||||||
options={userOptions}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
||||||
prevMEvent = mEvent;
|
prevMEvent = mEvent;
|
||||||
return myMessageEl;
|
return (
|
||||||
|
<React.Fragment key={`box-${mEvent.getId()}`}>
|
||||||
|
{divider}
|
||||||
|
{messageComp}
|
||||||
|
</React.Fragment>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
prevMEvent = mEvent;
|
prevMEvent = mEvent;
|
||||||
const timelineChange = parseTimelineChange(mEvent);
|
const timelineChange = parseTimelineChange(mEvent);
|
||||||
if (timelineChange === null) return null;
|
if (timelineChange === null) return null;
|
||||||
@@ -400,30 +561,11 @@ function ChannelViewContent({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const roomTopic = roomTimeline.room.currentState.getStateEvents('m.room.topic')[0]?.getContent().topic;
|
|
||||||
return (
|
return (
|
||||||
<div className="channel-view__content">
|
<div className="channel-view__content">
|
||||||
<div className="timeline__wrapper">
|
<div className="timeline__wrapper">
|
||||||
{
|
{ roomTimeline.timeline[0].getType() !== 'm.room.create' && !isReachedTimelineEnd && genPlaceholders() }
|
||||||
roomTimeline.timeline[0].getType() !== 'm.room.create' && !isReachedTimelineEnd && (
|
{ roomTimeline.timeline[0].getType() !== 'm.room.create' && isReachedTimelineEnd && genChannelIntro(undefined, roomTimeline)}
|
||||||
<>
|
|
||||||
<PlaceholderMessage key={Math.random().toString(20).substr(2, 6)} />
|
|
||||||
<PlaceholderMessage key={Math.random().toString(20).substr(2, 6)} />
|
|
||||||
<PlaceholderMessage key={Math.random().toString(20).substr(2, 6)} />
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
{
|
|
||||||
roomTimeline.timeline[0].getType() !== 'm.room.create' && isReachedTimelineEnd && (
|
|
||||||
<ChannelIntro
|
|
||||||
key={Math.random().toString(20).substr(2, 6)}
|
|
||||||
avatarSrc={roomTimeline.room.getAvatarUrl(initMatrix.matrixClient.baseUrl, 80, 80, 'crop')}
|
|
||||||
name={roomTimeline.room.name}
|
|
||||||
heading={`Welcome to ${roomTimeline.room.name}`}
|
|
||||||
desc={`This is the beginning of ${roomTimeline.room.name} channel.${typeof roomTopic !== 'undefined' ? (` Topic: ${roomTopic}`) : ''}`}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
{ roomTimeline.timeline.map(renderMessage) }
|
{ roomTimeline.timeline.map(renderMessage) }
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -432,14 +574,7 @@ function ChannelViewContent({
|
|||||||
ChannelViewContent.propTypes = {
|
ChannelViewContent.propTypes = {
|
||||||
roomId: PropTypes.string.isRequired,
|
roomId: PropTypes.string.isRequired,
|
||||||
roomTimeline: PropTypes.shape({}).isRequired,
|
roomTimeline: PropTypes.shape({}).isRequired,
|
||||||
timelineScroll: PropTypes.shape({
|
timelineScroll: PropTypes.shape({}).isRequired,
|
||||||
reachBottom: PropTypes.func,
|
|
||||||
autoReachBottom: PropTypes.func,
|
|
||||||
tryRestoringScroll: PropTypes.func,
|
|
||||||
enableSmoothScroll: PropTypes.func,
|
|
||||||
disableSmoothScroll: PropTypes.func,
|
|
||||||
isScrollable: PropTypes.func,
|
|
||||||
}).isRequired,
|
|
||||||
viewEvent: PropTypes.shape({}).isRequired,
|
viewEvent: PropTypes.shape({}).isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ function ChannelViewFloating({
|
|||||||
function getTypingMessage(members) {
|
function getTypingMessage(members) {
|
||||||
const userIds = members;
|
const userIds = members;
|
||||||
userIds.delete(mx.getUserId());
|
userIds.delete(mx.getUserId());
|
||||||
return getUsersActionJsx([...userIds], 'typing...');
|
return getUsersActionJsx(roomId, [...userIds], 'typing...');
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTyping(members) {
|
function updateTyping(members) {
|
||||||
|
|||||||
@@ -19,13 +19,15 @@ import AddUserIC from '../../../../public/res/ic/outlined/add-user.svg';
|
|||||||
|
|
||||||
function ChannelViewHeader({ roomId }) {
|
function ChannelViewHeader({ roomId }) {
|
||||||
const mx = initMatrix.matrixClient;
|
const mx = initMatrix.matrixClient;
|
||||||
const avatarSrc = mx.getRoom(roomId).getAvatarUrl(mx.baseUrl, 36, 36, 'crop');
|
const isDM = initMatrix.roomList.directs.has(roomId);
|
||||||
|
let avatarSrc = mx.getRoom(roomId).getAvatarUrl(mx.baseUrl, 36, 36, 'crop');
|
||||||
|
avatarSrc = isDM ? mx.getRoom(roomId).getAvatarFallbackMember()?.getAvatarUrl(mx.baseUrl, 36, 36, 'crop') : avatarSrc;
|
||||||
const roomName = mx.getRoom(roomId).name;
|
const roomName = mx.getRoom(roomId).name;
|
||||||
const roomTopic = mx.getRoom(roomId).currentState.getStateEvents('m.room.topic')[0]?.getContent().topic;
|
const roomTopic = mx.getRoom(roomId).currentState.getStateEvents('m.room.topic')[0]?.getContent().topic;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Header>
|
<Header>
|
||||||
<Avatar imageSrc={avatarSrc} text={roomName.slice(0, 1)} bgColor={colorMXID(roomName)} size="small" />
|
<Avatar imageSrc={avatarSrc} text={roomName.slice(0, 1)} bgColor={colorMXID(roomId)} size="small" />
|
||||||
<TitleWrapper>
|
<TitleWrapper>
|
||||||
<Text variant="h2">{roomName}</Text>
|
<Text variant="h2">{roomName}</Text>
|
||||||
{ typeof roomTopic !== 'undefined' && <p title={roomTopic} className="text text-b3">{roomTopic}</p>}
|
{ typeof roomTopic !== 'undefined' && <p title={roomTopic} className="text text-b3">{roomTopic}</p>}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import TextareaAutosize from 'react-autosize-textarea';
|
|||||||
import initMatrix from '../../../client/initMatrix';
|
import initMatrix from '../../../client/initMatrix';
|
||||||
import cons from '../../../client/state/cons';
|
import cons from '../../../client/state/cons';
|
||||||
import settings from '../../../client/state/settings';
|
import settings from '../../../client/state/settings';
|
||||||
|
import { openEmojiBoard } from '../../../client/action/navigation';
|
||||||
import { bytesToSize } from '../../../util/common';
|
import { bytesToSize } from '../../../util/common';
|
||||||
import { getUsername } from '../../../util/matrixUtil';
|
import { getUsername } from '../../../util/matrixUtil';
|
||||||
import colorMXID from '../../../util/colorMXID';
|
import colorMXID from '../../../util/colorMXID';
|
||||||
@@ -15,10 +16,8 @@ import colorMXID from '../../../util/colorMXID';
|
|||||||
import Text from '../../atoms/text/Text';
|
import Text from '../../atoms/text/Text';
|
||||||
import RawIcon from '../../atoms/system-icons/RawIcon';
|
import RawIcon from '../../atoms/system-icons/RawIcon';
|
||||||
import IconButton from '../../atoms/button/IconButton';
|
import IconButton from '../../atoms/button/IconButton';
|
||||||
import ContextMenu from '../../atoms/context-menu/ContextMenu';
|
|
||||||
import ScrollView from '../../atoms/scroll/ScrollView';
|
import ScrollView from '../../atoms/scroll/ScrollView';
|
||||||
import { MessageReply } from '../../molecules/message/Message';
|
import { MessageReply } from '../../molecules/message/Message';
|
||||||
import EmojiBoard from '../emoji-board/EmojiBoard';
|
|
||||||
|
|
||||||
import CirclePlusIC from '../../../../public/res/ic/outlined/circle-plus.svg';
|
import CirclePlusIC from '../../../../public/res/ic/outlined/circle-plus.svg';
|
||||||
import EmojiIC from '../../../../public/res/ic/outlined/emoji.svg';
|
import EmojiIC from '../../../../public/res/ic/outlined/emoji.svg';
|
||||||
@@ -30,7 +29,7 @@ import MarkdownIC from '../../../../public/res/ic/outlined/markdown.svg';
|
|||||||
import FileIC from '../../../../public/res/ic/outlined/file.svg';
|
import FileIC from '../../../../public/res/ic/outlined/file.svg';
|
||||||
import CrossIC from '../../../../public/res/ic/outlined/cross.svg';
|
import CrossIC from '../../../../public/res/ic/outlined/cross.svg';
|
||||||
|
|
||||||
const CMD_REGEX = /(\/|>[#*@]|:)(\S*)$/;
|
const CMD_REGEX = /(\/|>[#*@]|:|@)(\S*)$/;
|
||||||
let isTyping = false;
|
let isTyping = false;
|
||||||
let isCmdActivated = false;
|
let isCmdActivated = false;
|
||||||
let cmdCursorPos = null;
|
let cmdCursorPos = null;
|
||||||
@@ -46,15 +45,23 @@ function ChannelViewInput({
|
|||||||
const uploadInputRef = useRef(null);
|
const uploadInputRef = useRef(null);
|
||||||
const uploadProgressRef = useRef(null);
|
const uploadProgressRef = useRef(null);
|
||||||
const rightOptionsRef = useRef(null);
|
const rightOptionsRef = useRef(null);
|
||||||
|
const escBtnRef = useRef(null);
|
||||||
|
|
||||||
const TYPING_TIMEOUT = 5000;
|
const TYPING_TIMEOUT = 5000;
|
||||||
const mx = initMatrix.matrixClient;
|
const mx = initMatrix.matrixClient;
|
||||||
const { roomsInput } = initMatrix;
|
const { roomsInput } = initMatrix;
|
||||||
|
|
||||||
|
function requestFocusInput() {
|
||||||
|
if (textAreaRef === null) return;
|
||||||
|
textAreaRef.current.focus();
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
settings.on(cons.events.settings.MARKDOWN_TOGGLED, setIsMarkdown);
|
settings.on(cons.events.settings.MARKDOWN_TOGGLED, setIsMarkdown);
|
||||||
|
viewEvent.on('focus_msg_input', requestFocusInput);
|
||||||
return () => {
|
return () => {
|
||||||
settings.removeListener(cons.events.settings.MARKDOWN_TOGGLED, setIsMarkdown);
|
settings.removeListener(cons.events.settings.MARKDOWN_TOGGLED, setIsMarkdown);
|
||||||
|
viewEvent.removeListener('focus_msg_input', requestFocusInput);
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -91,20 +98,32 @@ function ChannelViewInput({
|
|||||||
|
|
||||||
function activateCmd(prefix) {
|
function activateCmd(prefix) {
|
||||||
isCmdActivated = true;
|
isCmdActivated = true;
|
||||||
inputBaseRef.current.style.boxShadow = '0 0 0 1px var(--bg-positive)';
|
requestAnimationFrame(() => {
|
||||||
|
inputBaseRef.current.style.boxShadow = '0 0 0 1px var(--bg-positive)';
|
||||||
|
escBtnRef.current.style.display = 'block';
|
||||||
|
});
|
||||||
rightOptionsA11Y(false);
|
rightOptionsA11Y(false);
|
||||||
viewEvent.emit('cmd_activate', prefix);
|
viewEvent.emit('cmd_activate', prefix);
|
||||||
}
|
}
|
||||||
function deactivateCmd() {
|
function deactivateCmd() {
|
||||||
if (inputBaseRef.current !== null) {
|
if (inputBaseRef.current !== null) {
|
||||||
inputBaseRef.current.style.boxShadow = 'var(--bs-surface-border)';
|
requestAnimationFrame(() => {
|
||||||
|
inputBaseRef.current.style.boxShadow = 'var(--bs-surface-border)';
|
||||||
|
escBtnRef.current.style.display = 'none';
|
||||||
|
});
|
||||||
rightOptionsA11Y(true);
|
rightOptionsA11Y(true);
|
||||||
}
|
}
|
||||||
isCmdActivated = false;
|
isCmdActivated = false;
|
||||||
cmdCursorPos = null;
|
cmdCursorPos = null;
|
||||||
}
|
}
|
||||||
|
function deactivateCmdAndEmit() {
|
||||||
|
deactivateCmd();
|
||||||
|
viewEvent.emit('cmd_deactivate');
|
||||||
|
}
|
||||||
function errorCmd() {
|
function errorCmd() {
|
||||||
inputBaseRef.current.style.boxShadow = '0 0 0 1px var(--bg-danger)';
|
requestAnimationFrame(() => {
|
||||||
|
inputBaseRef.current.style.boxShadow = '0 0 0 1px var(--bg-danger)';
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function setCursorPosition(pos) {
|
function setCursorPosition(pos) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -128,9 +147,15 @@ function ChannelViewInput({
|
|||||||
deactivateCmd();
|
deactivateCmd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function focusInput() {
|
||||||
|
if (settings.isTouchScreenDevice) return;
|
||||||
|
textAreaRef.current.focus();
|
||||||
|
}
|
||||||
|
|
||||||
function setUpReply(userId, eventId, content) {
|
function setUpReply(userId, eventId, content) {
|
||||||
setReplyTo({ userId, eventId, content });
|
setReplyTo({ userId, eventId, content });
|
||||||
roomsInput.setReplyTo(roomId, { userId, eventId, content });
|
roomsInput.setReplyTo(roomId, { userId, eventId, content });
|
||||||
|
focusInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -142,7 +167,7 @@ function ChannelViewInput({
|
|||||||
viewEvent.on('reply_to', setUpReply);
|
viewEvent.on('reply_to', setUpReply);
|
||||||
if (textAreaRef?.current !== null) {
|
if (textAreaRef?.current !== null) {
|
||||||
isTyping = false;
|
isTyping = false;
|
||||||
textAreaRef.current.focus();
|
focusInput();
|
||||||
textAreaRef.current.value = roomsInput.getMessage(roomId);
|
textAreaRef.current.value = roomsInput.getMessage(roomId);
|
||||||
setAttachment(roomsInput.getAttachment(roomId));
|
setAttachment(roomsInput.getAttachment(roomId));
|
||||||
setReplyTo(roomsInput.getReplyTo(roomId));
|
setReplyTo(roomsInput.getReplyTo(roomId));
|
||||||
@@ -168,11 +193,6 @@ function ChannelViewInput({
|
|||||||
}, [roomId]);
|
}, [roomId]);
|
||||||
|
|
||||||
async function sendMessage() {
|
async function sendMessage() {
|
||||||
if (isCmdActivated) {
|
|
||||||
viewEvent.emit('cmd_exe');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const msgBody = textAreaRef.current.value;
|
const msgBody = textAreaRef.current.value;
|
||||||
if (roomsInput.isSending(roomId)) return;
|
if (roomsInput.isSending(roomId)) return;
|
||||||
if (msgBody.trim() === '' && attachment === null) return;
|
if (msgBody.trim() === '' && attachment === null) return;
|
||||||
@@ -187,7 +207,7 @@ function ChannelViewInput({
|
|||||||
await roomsInput.sendInput(roomId);
|
await roomsInput.sendInput(roomId);
|
||||||
textAreaRef.current.disabled = false;
|
textAreaRef.current.disabled = false;
|
||||||
textAreaRef.current.style.cursor = 'unset';
|
textAreaRef.current.style.cursor = 'unset';
|
||||||
textAreaRef.current.focus();
|
focusInput();
|
||||||
|
|
||||||
textAreaRef.current.value = roomsInput.getMessage(roomId);
|
textAreaRef.current.value = roomsInput.getMessage(roomId);
|
||||||
timelineScroll.reachBottom();
|
timelineScroll.reachBottom();
|
||||||
@@ -218,10 +238,7 @@ function ChannelViewInput({
|
|||||||
|
|
||||||
const cmdParts = targetInput.match(CMD_REGEX);
|
const cmdParts = targetInput.match(CMD_REGEX);
|
||||||
if (cmdParts === null) {
|
if (cmdParts === null) {
|
||||||
if (isCmdActivated) {
|
if (isCmdActivated) deactivateCmdAndEmit();
|
||||||
deactivateCmd();
|
|
||||||
viewEvent.emit('cmd_deactivate');
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const cmdPrefix = cmdParts[1];
|
const cmdPrefix = cmdParts[1];
|
||||||
@@ -231,8 +248,7 @@ function ChannelViewInput({
|
|||||||
// skip emoji autofill command if link is suspected.
|
// skip emoji autofill command if link is suspected.
|
||||||
const checkForLink = targetInput.slice(0, cmdParts.index);
|
const checkForLink = targetInput.slice(0, cmdParts.index);
|
||||||
if (checkForLink.match(/(http|https|mailto|matrix|ircs|irc)$/)) {
|
if (checkForLink.match(/(http|https|mailto|matrix|ircs|irc)$/)) {
|
||||||
deactivateCmd();
|
deactivateCmdAndEmit();
|
||||||
viewEvent.emit('cmd_deactivate');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,7 +259,9 @@ function ChannelViewInput({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!isCmdActivated) activateCmd(cmdPrefix);
|
if (!isCmdActivated) activateCmd(cmdPrefix);
|
||||||
inputBaseRef.current.style.boxShadow = '0 0 0 1px var(--bg-caution)';
|
requestAnimationFrame(() => {
|
||||||
|
inputBaseRef.current.style.boxShadow = '0 0 0 1px var(--bg-caution)';
|
||||||
|
});
|
||||||
viewEvent.emit('cmd_process', cmdPrefix, cmdSlug);
|
viewEvent.emit('cmd_process', cmdPrefix, cmdSlug);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,7 +274,14 @@ function ChannelViewInput({
|
|||||||
function handleKeyDown(e) {
|
function handleKeyDown(e) {
|
||||||
if (e.keyCode === 13 && e.shiftKey === false) {
|
if (e.keyCode === 13 && e.shiftKey === false) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
sendMessage();
|
|
||||||
|
if (isCmdActivated) {
|
||||||
|
viewEvent.emit('cmd_exe');
|
||||||
|
} else sendMessage();
|
||||||
|
}
|
||||||
|
if (e.keyCode === 27 && isCmdActivated) {
|
||||||
|
deactivateCmdAndEmit();
|
||||||
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,14 +322,20 @@ function ChannelViewInput({
|
|||||||
</Text>
|
</Text>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
{isMarkdown && <RawIcon size="extra-small" src={MarkdownIC} />}
|
{isMarkdown && <RawIcon size="extra-small" src={MarkdownIC} />}
|
||||||
|
<button ref={escBtnRef} tabIndex="-1" onClick={deactivateCmdAndEmit} className="btn-cmd-esc" type="button"><Text variant="b3">ESC</Text></button>
|
||||||
</div>
|
</div>
|
||||||
<div ref={rightOptionsRef} className="channel-input__option-container">
|
<div ref={rightOptionsRef} className="channel-input__option-container">
|
||||||
<ContextMenu
|
<IconButton
|
||||||
placement="top"
|
onClick={(e) => {
|
||||||
content={(
|
const boxInfo = e.target.getBoundingClientRect();
|
||||||
<EmojiBoard onSelect={addEmoji} />
|
openEmojiBoard({
|
||||||
)}
|
x: boxInfo.x + (document.dir === 'rtl' ? -80 : 80),
|
||||||
render={(toggleMenu) => <IconButton onClick={toggleMenu} tooltip="Emoji" src={EmojiIC} />}
|
y: boxInfo.y - 250,
|
||||||
|
detail: e.detail,
|
||||||
|
}, addEmoji);
|
||||||
|
}}
|
||||||
|
tooltip="Emoji"
|
||||||
|
src={EmojiIC}
|
||||||
/>
|
/>
|
||||||
<IconButton onClick={sendMessage} tooltip="Send" src={SendIC} />
|
<IconButton onClick={sendMessage} tooltip="Send" src={SendIC} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -25,6 +25,17 @@
|
|||||||
transform: scale(0.8);
|
transform: scale(0.8);
|
||||||
margin: 0 var(--sp-extra-tight);
|
margin: 0 var(--sp-extra-tight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
& .btn-cmd-esc {
|
||||||
|
display: none;
|
||||||
|
margin: 0 var(--sp-extra-tight);
|
||||||
|
padding: var(--sp-ultra-tight) var(--sp-extra-tight);
|
||||||
|
border-radius: calc(var(--bo-radius) / 2);
|
||||||
|
box-shadow: var(--bs-surface-border);
|
||||||
|
cursor: pointer;
|
||||||
|
& .text { color: var(--tc-surface-normal); }
|
||||||
|
}
|
||||||
|
|
||||||
& .scrollbar {
|
& .scrollbar {
|
||||||
max-height: 50vh;
|
max-height: 50vh;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
|||||||
import './PeopleDrawer.scss';
|
import './PeopleDrawer.scss';
|
||||||
|
|
||||||
import initMatrix from '../../../client/initMatrix';
|
import initMatrix from '../../../client/initMatrix';
|
||||||
import { getUsername } from '../../../util/matrixUtil';
|
import { getUsernameOfRoomMember } from '../../../util/matrixUtil';
|
||||||
import colorMXID from '../../../util/colorMXID';
|
import colorMXID from '../../../util/colorMXID';
|
||||||
import { openInviteUser } from '../../../client/action/navigation';
|
import { openInviteUser } from '../../../client/action/navigation';
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ function PeopleDrawer({ roomId }) {
|
|||||||
key={member.userId}
|
key={member.userId}
|
||||||
onClick={() => alert('Viewing profile is yet to be implemented')}
|
onClick={() => alert('Viewing profile is yet to be implemented')}
|
||||||
avatarSrc={member.getAvatarUrl(initMatrix.matrixClient.baseUrl, 24, 24, 'crop')}
|
avatarSrc={member.getAvatarUrl(initMatrix.matrixClient.baseUrl, 24, 24, 'crop')}
|
||||||
name={getUsername(member.userId)}
|
name={getUsernameOfRoomMember(member)}
|
||||||
color={colorMXID(member.userId)}
|
color={colorMXID(member.userId)}
|
||||||
peopleRole={getPowerLabel(member.powerLevel)}
|
peopleRole={getPowerLabel(member.powerLevel)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { getUsername } from '../../../util/matrixUtil';
|
import initMatrix from '../../../client/initMatrix';
|
||||||
|
import { getUsername, getUsernameOfRoomMember } from '../../../util/matrixUtil';
|
||||||
|
|
||||||
function getTimelineJSXMessages() {
|
function getTimelineJSXMessages() {
|
||||||
return {
|
return {
|
||||||
@@ -12,11 +13,13 @@ function getTimelineJSXMessages() {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
leave(user) {
|
leave(user, reason) {
|
||||||
|
const reasonMsg = (typeof reason === 'string') ? `: ${reason}` : '';
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<b>{user}</b>
|
<b>{user}</b>
|
||||||
{' left the channel'}
|
{' left the channel'}
|
||||||
|
{reasonMsg}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -48,7 +51,7 @@ function getTimelineJSXMessages() {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
kick(actor, user, reason) {
|
kick(actor, user, reason) {
|
||||||
const reasonMsg = (typeof reason === 'string') ? ` for ${reason}` : '';
|
const reasonMsg = (typeof reason === 'string') ? `: ${reason}` : '';
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<b>{actor}</b>
|
<b>{actor}</b>
|
||||||
@@ -59,7 +62,7 @@ function getTimelineJSXMessages() {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
ban(actor, user, reason) {
|
ban(actor, user, reason) {
|
||||||
const reasonMsg = (typeof reason === 'string') ? ` for ${reason}` : '';
|
const reasonMsg = (typeof reason === 'string') ? `: ${reason}` : '';
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<b>{actor}</b>
|
<b>{actor}</b>
|
||||||
@@ -132,8 +135,13 @@ function getTimelineJSXMessages() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUsersActionJsx(userIds, actionStr) {
|
function getUsersActionJsx(roomId, userIds, actionStr) {
|
||||||
const getUserJSX = (username) => <b>{getUsername(username)}</b>;
|
const room = initMatrix.matrixClient.getRoom(roomId);
|
||||||
|
const getUserDisplayName = (userId) => {
|
||||||
|
if (room?.getMember(userId)) return getUsernameOfRoomMember(room.getMember(userId));
|
||||||
|
return getUsername(userId);
|
||||||
|
};
|
||||||
|
const getUserJSX = (userId) => <b>{getUserDisplayName(userId)}</b>;
|
||||||
if (!Array.isArray(userIds)) return 'Idle';
|
if (!Array.isArray(userIds)) return 'Idle';
|
||||||
if (userIds.length === 0) return 'Idle';
|
if (userIds.length === 0) return 'Idle';
|
||||||
const MAX_VISIBLE_COUNT = 3;
|
const MAX_VISIBLE_COUNT = 3;
|
||||||
@@ -159,17 +167,20 @@ function getUsersActionJsx(userIds, actionStr) {
|
|||||||
|
|
||||||
function parseReply(rawContent) {
|
function parseReply(rawContent) {
|
||||||
if (rawContent.indexOf('>') !== 0) return null;
|
if (rawContent.indexOf('>') !== 0) return null;
|
||||||
let content = rawContent.slice(rawContent.indexOf('@'));
|
let content = rawContent.slice(rawContent.indexOf('<') + 1);
|
||||||
const userId = content.slice(0, content.indexOf('>'));
|
const user = content.slice(0, content.indexOf('>'));
|
||||||
|
|
||||||
content = content.slice(content.indexOf('>') + 2);
|
content = content.slice(content.indexOf('>') + 2);
|
||||||
const replyContent = content.slice(0, content.indexOf('\n\n'));
|
const replyContent = content.slice(0, content.indexOf('\n\n'));
|
||||||
content = content.slice(content.indexOf('\n\n') + 2);
|
content = content.slice(content.indexOf('\n\n') + 2);
|
||||||
|
|
||||||
if (userId === '') return null;
|
if (user === '') return null;
|
||||||
|
|
||||||
|
const isUserId = user.match(/^@.+:.+/);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
userId,
|
userId: isUserId ? user : null,
|
||||||
|
displayName: isUserId ? null : user,
|
||||||
replyContent,
|
replyContent,
|
||||||
content,
|
content,
|
||||||
};
|
};
|
||||||
@@ -209,7 +220,7 @@ function parseTimelineChange(mEvent) {
|
|||||||
if (sender === mEvent.getStateKey()) {
|
if (sender === mEvent.getStateKey()) {
|
||||||
switch (prevContent.membership) {
|
switch (prevContent.membership) {
|
||||||
case 'invite': return makeReturnObj('invite-cancel', tJSXMsgs.rejectInvite(senderName));
|
case 'invite': return makeReturnObj('invite-cancel', tJSXMsgs.rejectInvite(senderName));
|
||||||
default: return makeReturnObj('leave', tJSXMsgs.leave(senderName));
|
default: return makeReturnObj('leave', tJSXMsgs.leave(senderName, content.reason));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (prevContent.membership) {
|
switch (prevContent.membership) {
|
||||||
|
|||||||
@@ -4,11 +4,10 @@ import React, { useState, useEffect, useRef } from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import './EmojiBoard.scss';
|
import './EmojiBoard.scss';
|
||||||
|
|
||||||
import EventEmitter from 'events';
|
|
||||||
|
|
||||||
import parse from 'html-react-parser';
|
import parse from 'html-react-parser';
|
||||||
import twemoji from 'twemoji';
|
import twemoji from 'twemoji';
|
||||||
import { emojiGroups, searchEmoji } from './emoji';
|
import { emojiGroups, emojis } from './emoji';
|
||||||
|
import AsyncSearch from '../../../util/AsyncSearch';
|
||||||
|
|
||||||
import Text from '../../atoms/text/Text';
|
import Text from '../../atoms/text/Text';
|
||||||
import RawIcon from '../../atoms/system-icons/RawIcon';
|
import RawIcon from '../../atoms/system-icons/RawIcon';
|
||||||
@@ -26,20 +25,18 @@ import BulbIC from '../../../../public/res/ic/outlined/bulb.svg';
|
|||||||
import PeaceIC from '../../../../public/res/ic/outlined/peace.svg';
|
import PeaceIC from '../../../../public/res/ic/outlined/peace.svg';
|
||||||
import FlagIC from '../../../../public/res/ic/outlined/flag.svg';
|
import FlagIC from '../../../../public/res/ic/outlined/flag.svg';
|
||||||
|
|
||||||
const viewEvent = new EventEmitter();
|
function EmojiGroup({ name, groupEmojis }) {
|
||||||
|
|
||||||
function EmojiGroup({ name, emojis }) {
|
|
||||||
function getEmojiBoard() {
|
function getEmojiBoard() {
|
||||||
|
const emojiBoard = [];
|
||||||
const ROW_EMOJIS_COUNT = 7;
|
const ROW_EMOJIS_COUNT = 7;
|
||||||
const emojiRows = [];
|
const totalEmojis = groupEmojis.length;
|
||||||
const totalEmojis = emojis.length;
|
|
||||||
|
|
||||||
for (let r = 0; r < totalEmojis; r += ROW_EMOJIS_COUNT) {
|
for (let r = 0; r < totalEmojis; r += ROW_EMOJIS_COUNT) {
|
||||||
const emojiRow = [];
|
const emojiRow = [];
|
||||||
for (let c = r; c < r + ROW_EMOJIS_COUNT; c += 1) {
|
for (let c = r; c < r + ROW_EMOJIS_COUNT; c += 1) {
|
||||||
const emojiIndex = r + c;
|
const emojiIndex = c;
|
||||||
if (emojiIndex >= totalEmojis) break;
|
if (emojiIndex >= totalEmojis) break;
|
||||||
const emoji = emojis[emojiIndex];
|
const emoji = groupEmojis[emojiIndex];
|
||||||
emojiRow.push(
|
emojiRow.push(
|
||||||
<span key={emojiIndex}>
|
<span key={emojiIndex}>
|
||||||
{
|
{
|
||||||
@@ -49,6 +46,7 @@ function EmojiGroup({ name, emojis }) {
|
|||||||
attributes: () => ({
|
attributes: () => ({
|
||||||
unicode: emoji.unicode,
|
unicode: emoji.unicode,
|
||||||
shortcodes: emoji.shortcodes?.toString(),
|
shortcodes: emoji.shortcodes?.toString(),
|
||||||
|
hexcode: emoji.hexcode,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
@@ -56,23 +54,24 @@ function EmojiGroup({ name, emojis }) {
|
|||||||
</span>,
|
</span>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
emojiRows.push(<div key={r} className="emoji-row">{emojiRow}</div>);
|
emojiBoard.push(<div key={r} className="emoji-row">{emojiRow}</div>);
|
||||||
}
|
}
|
||||||
return emojiRows;
|
return emojiBoard;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="emoji-group">
|
<div className="emoji-group">
|
||||||
<Text className="emoji-group__header" variant="b2">{name}</Text>
|
<Text className="emoji-group__header" variant="b2">{name}</Text>
|
||||||
<div className="emoji-set">{getEmojiBoard()}</div>
|
{groupEmojis.length !== 0 && <div className="emoji-set">{getEmojiBoard()}</div>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
EmojiGroup.propTypes = {
|
EmojiGroup.propTypes = {
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
emojis: PropTypes.arrayOf(PropTypes.shape({
|
groupEmojis: PropTypes.arrayOf(PropTypes.shape({
|
||||||
length: PropTypes.number,
|
length: PropTypes.number,
|
||||||
unicode: PropTypes.string,
|
unicode: PropTypes.string,
|
||||||
|
hexcode: PropTypes.string,
|
||||||
shortcodes: PropTypes.oneOfType([
|
shortcodes: PropTypes.oneOfType([
|
||||||
PropTypes.string,
|
PropTypes.string,
|
||||||
PropTypes.arrayOf(PropTypes.string),
|
PropTypes.arrayOf(PropTypes.string),
|
||||||
@@ -80,40 +79,47 @@ EmojiGroup.propTypes = {
|
|||||||
})).isRequired,
|
})).isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const asyncSearch = new AsyncSearch();
|
||||||
|
asyncSearch.setup(emojis, { keys: ['shortcode'], limit: 30 });
|
||||||
function SearchedEmoji() {
|
function SearchedEmoji() {
|
||||||
const [searchedEmojis, setSearchedEmojis] = useState([]);
|
const [searchedEmojis, setSearchedEmojis] = useState(null);
|
||||||
|
|
||||||
function handleSearchEmoji(term) {
|
function handleSearchEmoji(resultEmojis, term) {
|
||||||
if (term.trim() === '') {
|
if (term === '' || resultEmojis.length === 0) {
|
||||||
setSearchedEmojis([]);
|
if (term === '') setSearchedEmojis(null);
|
||||||
|
else setSearchedEmojis([]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setSearchedEmojis(searchEmoji(term).map((finding) => finding.item));
|
setSearchedEmojis(resultEmojis);
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
viewEvent.on('search-emoji', handleSearchEmoji);
|
asyncSearch.on(asyncSearch.RESULT_SENT, handleSearchEmoji);
|
||||||
return () => {
|
return () => {
|
||||||
viewEvent.removeListener('search-emoji', handleSearchEmoji);
|
asyncSearch.removeListener(asyncSearch.RESULT_SENT, handleSearchEmoji);
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return searchedEmojis.length !== 0 && <EmojiGroup key="-1" name="Search results" emojis={searchedEmojis} />;
|
if (searchedEmojis === null) return false;
|
||||||
|
|
||||||
|
return <EmojiGroup key="-1" name={searchedEmojis.length === 0 ? 'No search result found' : 'Search results'} groupEmojis={searchedEmojis} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
function EmojiBoard({ onSelect }) {
|
function EmojiBoard({ onSelect }) {
|
||||||
const searchRef = useRef(null);
|
const searchRef = useRef(null);
|
||||||
const scrollEmojisRef = useRef(null);
|
const scrollEmojisRef = useRef(null);
|
||||||
|
const emojiInfo = useRef(null);
|
||||||
|
|
||||||
function isTargetNotEmoji(target) {
|
function isTargetNotEmoji(target) {
|
||||||
return target.classList.contains('emoji') === false;
|
return target.classList.contains('emoji') === false;
|
||||||
}
|
}
|
||||||
function getEmojiDataFromTarget(target) {
|
function getEmojiDataFromTarget(target) {
|
||||||
const unicode = target.getAttribute('unicode');
|
const unicode = target.getAttribute('unicode');
|
||||||
|
const hexcode = target.getAttribute('hexcode');
|
||||||
let shortcodes = target.getAttribute('shortcodes');
|
let shortcodes = target.getAttribute('shortcodes');
|
||||||
if (typeof shortcodes === 'undefined') shortcodes = undefined;
|
if (typeof shortcodes === 'undefined') shortcodes = undefined;
|
||||||
else shortcodes = shortcodes.split(',');
|
else shortcodes = shortcodes.split(',');
|
||||||
return { unicode, shortcodes };
|
return { unicode, hexcode, shortcodes };
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectEmoji(e) {
|
function selectEmoji(e) {
|
||||||
@@ -123,27 +129,35 @@ function EmojiBoard({ onSelect }) {
|
|||||||
onSelect(getEmojiDataFromTarget(emoji));
|
onSelect(getEmojiDataFromTarget(emoji));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setEmojiInfo(emoji) {
|
||||||
|
const infoEmoji = emojiInfo.current.firstElementChild.firstElementChild;
|
||||||
|
const infoShortcode = emojiInfo.current.lastElementChild;
|
||||||
|
|
||||||
|
const emojiSrc = infoEmoji.src;
|
||||||
|
infoEmoji.src = `${emojiSrc.slice(0, emojiSrc.lastIndexOf('/') + 1)}${emoji.hexcode.toLowerCase()}.png`;
|
||||||
|
infoShortcode.textContent = `:${emoji.shortcode}:`;
|
||||||
|
}
|
||||||
|
|
||||||
function hoverEmoji(e) {
|
function hoverEmoji(e) {
|
||||||
if (isTargetNotEmoji(e.target)) return;
|
if (isTargetNotEmoji(e.target)) return;
|
||||||
|
|
||||||
const emoji = e.target;
|
const emoji = e.target;
|
||||||
const { shortcodes } = getEmojiDataFromTarget(emoji);
|
const { shortcodes, hexcode } = getEmojiDataFromTarget(emoji);
|
||||||
|
|
||||||
if (typeof shortcodes === 'undefined') {
|
if (typeof shortcodes === 'undefined') {
|
||||||
searchRef.current.placeholder = 'Search';
|
searchRef.current.placeholder = 'Search';
|
||||||
|
setEmojiInfo({ hexcode: '1f643', shortcode: 'slight_smile' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (searchRef.current.placeholder === shortcodes[0]) return;
|
if (searchRef.current.placeholder === shortcodes[0]) return;
|
||||||
searchRef.current.setAttribute('placeholder', `:${shortcodes[0]}:`);
|
searchRef.current.setAttribute('placeholder', shortcodes[0]);
|
||||||
|
setEmojiInfo({ hexcode, shortcode: shortcodes[0] });
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSearchChange(e) {
|
function handleSearchChange(e) {
|
||||||
const term = e.target.value;
|
const term = e.target.value;
|
||||||
setTimeout(() => {
|
asyncSearch.search(term);
|
||||||
if (e.target.value !== term) return;
|
scrollEmojisRef.current.scrollTop = 0;
|
||||||
viewEvent.emit('search-emoji', term);
|
|
||||||
scrollEmojisRef.current.scrollTop = 0;
|
|
||||||
}, 500);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function openGroup(groupOrder) {
|
function openGroup(groupOrder) {
|
||||||
@@ -157,21 +171,25 @@ function EmojiBoard({ onSelect }) {
|
|||||||
return (
|
return (
|
||||||
<div id="emoji-board" className="emoji-board">
|
<div id="emoji-board" className="emoji-board">
|
||||||
<div className="emoji-board__content">
|
<div className="emoji-board__content">
|
||||||
<div className="emoji-board__emojis">
|
<div className="emoji-board__content__search">
|
||||||
|
<RawIcon size="small" src={SearchIC} />
|
||||||
|
<Input onChange={handleSearchChange} forwardRef={searchRef} placeholder="Search" />
|
||||||
|
</div>
|
||||||
|
<div className="emoji-board__content__emojis">
|
||||||
<ScrollView ref={scrollEmojisRef} autoHide>
|
<ScrollView ref={scrollEmojisRef} autoHide>
|
||||||
<div onMouseMove={hoverEmoji} onClick={selectEmoji}>
|
<div onMouseMove={hoverEmoji} onClick={selectEmoji}>
|
||||||
<SearchedEmoji />
|
<SearchedEmoji />
|
||||||
{
|
{
|
||||||
emojiGroups.map((group) => (
|
emojiGroups.map((group) => (
|
||||||
<EmojiGroup key={group.name} name={group.name} emojis={group.emojis} />
|
<EmojiGroup key={group.name} name={group.name} groupEmojis={group.emojis} />
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</div>
|
</div>
|
||||||
<div className="emoji-board__search">
|
<div ref={emojiInfo} className="emoji-board__content__info">
|
||||||
<RawIcon size="small" src={SearchIC} />
|
<div>{ parse(twemoji.parse('🙂')) }</div>
|
||||||
<Input onChange={handleSearchChange} forwardRef={searchRef} placeholder="Search" />
|
<Text>:slight_smile:</Text>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="emoji-board__nav">
|
<div className="emoji-board__nav">
|
||||||
|
|||||||
@@ -10,14 +10,15 @@
|
|||||||
|
|
||||||
.emoji-board {
|
.emoji-board {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
&__content {
|
&__content {
|
||||||
@extend .emoji-board-flexItem;
|
@extend .emoji-board-flexItem;
|
||||||
@extend .emoji-board-flexBoxV;
|
@extend .emoji-board-flexBoxV;
|
||||||
height: 360px;
|
height: 400px;
|
||||||
|
width: 286px;
|
||||||
}
|
}
|
||||||
&__nav {
|
&__nav {
|
||||||
@extend .emoji-board-flexBoxV;
|
@extend .emoji-board-flexBoxV;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
padding: 4px 6px;
|
padding: 4px 6px;
|
||||||
background-color: var(--bg-surface-low);
|
background-color: var(--bg-surface-low);
|
||||||
@@ -29,30 +30,62 @@
|
|||||||
|
|
||||||
& > .ic-btn-surface {
|
& > .ic-btn-surface {
|
||||||
margin: calc(var(--sp-ultra-tight) / 2) 0;
|
margin: calc(var(--sp-ultra-tight) / 2) 0;
|
||||||
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.emoji-board__content__search {
|
||||||
|
padding: var(--sp-extra-tight);
|
||||||
|
position: relative;
|
||||||
|
|
||||||
.emoji-board__emojis {
|
& .ic-raw {
|
||||||
@extend .emoji-board-flexItem;
|
position: absolute;
|
||||||
}
|
left: var(--sp-normal);
|
||||||
.emoji-board__search {
|
top: var(--sp-normal);
|
||||||
display: flex;
|
transform: translateY(1px);
|
||||||
align-items: center;
|
[dir=rtl] & {
|
||||||
padding: calc(var(--sp-ultra-tight) / 2) var(--sp-normal);
|
left: unset;
|
||||||
|
right: var(--sp-normal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
& .input-container {
|
& .input-container {
|
||||||
@extend .emoji-board-flexItem;
|
|
||||||
& .input {
|
& .input {
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
width: 0;
|
width: 0;
|
||||||
background-color: transparent;
|
padding: var(--sp-extra-tight) 36px;
|
||||||
border: none !important;
|
border-radius: calc(var(--bo-radius) / 2);
|
||||||
box-shadow: none !important;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.emoji-board__content__emojis {
|
||||||
|
@extend .emoji-board-flexItem;
|
||||||
|
@extend .emoji-board-flexBoxV;
|
||||||
|
}
|
||||||
|
.emoji-board__content__info {
|
||||||
|
margin: 0 var(--sp-extra-tight);
|
||||||
|
padding: var(--sp-tight) var(--sp-extra-tight);
|
||||||
|
border-top: 1px solid var(--bg-surface-border);
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
& > div:first-child {
|
||||||
|
line-height: 0;
|
||||||
|
.emoji {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
& > p:last-child {
|
||||||
|
@extend .emoji-board-flexItem;
|
||||||
|
margin: 0 var(--sp-tight);
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.emoji-group {
|
.emoji-group {
|
||||||
--emoji-padding: 6px;
|
--emoji-padding: 6px;
|
||||||
@@ -65,12 +98,19 @@
|
|||||||
z-index: 99;
|
z-index: 99;
|
||||||
background-color: var(--bg-surface);
|
background-color: var(--bg-surface);
|
||||||
|
|
||||||
padding: var(--sp-tight) var(--sp-normal);
|
margin-left: var(--sp-extra-tight);
|
||||||
|
padding: var(--sp-extra-tight) var(--sp-ultra-tight);
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
box-shadow: 0 -4px 0 0 var(--bg-surface);
|
||||||
|
border-bottom: 1px solid var(--bg-surface-border);
|
||||||
|
[dir=rtl] & {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: var(--sp-extra-tight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
& .emoji-set {
|
& .emoji-set {
|
||||||
margin: 0 calc(var(--sp-normal) - var(--emoji-padding));
|
margin: var(--sp-extra-tight) calc(var(--sp-normal) - var(--emoji-padding));
|
||||||
margin-right: calc(var(--sp-extra-tight) - var(--emoji-padding));
|
margin-right: calc(var(--sp-extra-tight) - var(--emoji-padding));
|
||||||
[dir=rtl] & {
|
[dir=rtl] & {
|
||||||
margin-right: calc(var(--sp-normal) - var(--emoji-padding));
|
margin-right: calc(var(--sp-normal) - var(--emoji-padding));
|
||||||
@@ -79,6 +119,7 @@
|
|||||||
}
|
}
|
||||||
& .emoji {
|
& .emoji {
|
||||||
width: 38px;
|
width: 38px;
|
||||||
|
height: 38px;
|
||||||
padding: var(--emoji-padding);
|
padding: var(--emoji-padding);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
&:hover {
|
&:hover {
|
||||||
|
|||||||
74
src/app/organisms/emoji-board/EmojiBoardOpener.jsx
Normal file
74
src/app/organisms/emoji-board/EmojiBoardOpener.jsx
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
import React, { useEffect, useRef } from 'react';
|
||||||
|
|
||||||
|
import cons from '../../../client/state/cons';
|
||||||
|
import navigation from '../../../client/state/navigation';
|
||||||
|
|
||||||
|
import ContextMenu from '../../atoms/context-menu/ContextMenu';
|
||||||
|
import EmojiBoard from './EmojiBoard';
|
||||||
|
|
||||||
|
let requestCallback = null;
|
||||||
|
let isEmojiBoardVisible = false;
|
||||||
|
function EmojiBoardOpener() {
|
||||||
|
const openerRef = useRef(null);
|
||||||
|
|
||||||
|
function openEmojiBoard(cords, requestEmojiCallback) {
|
||||||
|
if (requestCallback !== null || isEmojiBoardVisible) {
|
||||||
|
requestCallback = null;
|
||||||
|
if (cords.detail === 0) openerRef.current.click();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
openerRef.current.style.transform = `translate(${cords.x}px, ${cords.y}px)`;
|
||||||
|
requestCallback = requestEmojiCallback;
|
||||||
|
openerRef.current.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
function afterEmojiBoardToggle(isVisible) {
|
||||||
|
isEmojiBoardVisible = isVisible;
|
||||||
|
if (!isVisible) {
|
||||||
|
setTimeout(() => {
|
||||||
|
if (!isEmojiBoardVisible) requestCallback = null;
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addEmoji(emoji) {
|
||||||
|
requestCallback(emoji);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
navigation.on(cons.events.navigation.EMOJIBOARD_OPENED, openEmojiBoard);
|
||||||
|
return () => {
|
||||||
|
navigation.removeListener(cons.events.navigation.EMOJIBOARD_OPENED, openEmojiBoard);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ContextMenu
|
||||||
|
content={(
|
||||||
|
<EmojiBoard onSelect={addEmoji} />
|
||||||
|
)}
|
||||||
|
afterToggle={afterEmojiBoardToggle}
|
||||||
|
render={(toggleMenu) => (
|
||||||
|
<input
|
||||||
|
ref={openerRef}
|
||||||
|
onClick={toggleMenu}
|
||||||
|
type="button"
|
||||||
|
style={{
|
||||||
|
width: '32px',
|
||||||
|
height: '32px',
|
||||||
|
backgroundColor: 'transparent',
|
||||||
|
position: 'absolute',
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
padding: 0,
|
||||||
|
border: 'none',
|
||||||
|
visibility: 'hidden',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default EmojiBoardOpener;
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import emojisData from 'emojibase-data/en/compact.json';
|
import emojisData from 'emojibase-data/en/compact.json';
|
||||||
import shortcodes from 'emojibase-data/en/shortcodes/joypixels.json';
|
import shortcodes from 'emojibase-data/en/shortcodes/joypixels.json';
|
||||||
import Fuse from 'fuse.js';
|
|
||||||
|
|
||||||
const emojiGroups = [{
|
const emojiGroups = [{
|
||||||
name: 'Smileys & people',
|
name: 'Smileys & people',
|
||||||
@@ -47,30 +46,22 @@ function addToGroup(emoji) {
|
|||||||
else if (emoji.group === 6) addEmoji(emoji, 3);
|
else if (emoji.group === 6) addEmoji(emoji, 3);
|
||||||
else if (emoji.group === 5) addEmoji(emoji, 4);
|
else if (emoji.group === 5) addEmoji(emoji, 4);
|
||||||
else if (emoji.group === 7) addEmoji(emoji, 5);
|
else if (emoji.group === 7) addEmoji(emoji, 5);
|
||||||
else if (emoji.group === 8) addEmoji(emoji, 6);
|
else if (emoji.group === 8 || typeof emoji.group === 'undefined') addEmoji(emoji, 6);
|
||||||
else if (emoji.group === 9) addEmoji(emoji, 7);
|
else if (emoji.group === 9) addEmoji(emoji, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
const emojis = [];
|
const emojis = [];
|
||||||
emojisData.forEach((emoji) => {
|
emojisData.forEach((emoji) => {
|
||||||
const em = { ...emoji, shortcodes: shortcodes[emoji.hexcode] };
|
const myShortCodes = shortcodes[emoji.hexcode];
|
||||||
|
const em = {
|
||||||
|
...emoji,
|
||||||
|
shortcode: Array.isArray(myShortCodes) ? myShortCodes[0] : myShortCodes,
|
||||||
|
shortcodes: myShortCodes,
|
||||||
|
};
|
||||||
addToGroup(em);
|
addToGroup(em);
|
||||||
emojis.push(em);
|
emojis.push(em);
|
||||||
});
|
});
|
||||||
|
|
||||||
function searchEmoji(term) {
|
|
||||||
const options = {
|
|
||||||
includeScore: true,
|
|
||||||
keys: ['shortcodes', 'annotation', 'tags'],
|
|
||||||
threshold: '0.3',
|
|
||||||
};
|
|
||||||
const fuse = new Fuse(emojis, options);
|
|
||||||
|
|
||||||
let result = fuse.search(term);
|
|
||||||
if (result.length > 20) result = result.slice(0, 20);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
emojis, emojiGroups, searchEmoji,
|
emojis, emojiGroups,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ function InviteUser({
|
|||||||
>
|
>
|
||||||
<div className="invite-user">
|
<div className="invite-user">
|
||||||
<form className="invite-user__form" onSubmit={(e) => { e.preventDefault(); searchUser(usernameRef.current.value); }}>
|
<form className="invite-user__form" onSubmit={(e) => { e.preventDefault(); searchUser(usernameRef.current.value); }}>
|
||||||
<Input value={searchTerm} forwardRef={usernameRef} label="Username or userId" />
|
<Input value={searchTerm} forwardRef={usernameRef} label="Name or userId" />
|
||||||
<Button disabled={isSearching} iconSrc={UserIC} variant="primary" type="submit">Search</Button>
|
<Button disabled={isSearching} iconSrc={UserIC} variant="primary" type="submit">Search</Button>
|
||||||
</form>
|
</form>
|
||||||
<div className="invite-user__search-status">
|
<div className="invite-user__search-status">
|
||||||
|
|||||||
@@ -177,10 +177,10 @@ function PublicChannels({ isOpen, searchTerm, onRequestClose }) {
|
|||||||
onRequestClose();
|
onRequestClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
function joinChannel(roomId) {
|
function joinChannel(roomIdOrAlias) {
|
||||||
joiningChannels.add(roomId);
|
joiningChannels.add(roomIdOrAlias);
|
||||||
updateJoiningChannels(new Set(Array.from(joiningChannels)));
|
updateJoiningChannels(new Set(Array.from(joiningChannels)));
|
||||||
roomActions.join(roomId, false);
|
roomActions.join(roomIdOrAlias, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderChannelList(channels) {
|
function renderChannelList(channels) {
|
||||||
@@ -199,7 +199,7 @@ function PublicChannels({ isOpen, searchTerm, onRequestClose }) {
|
|||||||
options={(
|
options={(
|
||||||
<>
|
<>
|
||||||
{isJoined && <Button onClick={() => handleViewChannel(channel.room_id)}>Open</Button>}
|
{isJoined && <Button onClick={() => handleViewChannel(channel.room_id)}>Open</Button>}
|
||||||
{!isJoined && (joiningChannels.has(channel.room_id) ? <Spinner size="small" /> : <Button onClick={() => joinChannel(channel.room_id)} variant="primary">Join</Button>)}
|
{!isJoined && (joiningChannels.has(channel.room_id) ? <Spinner size="small" /> : <Button onClick={() => joinChannel(channel.aliases?.[0] || channel.room_id)} variant="primary">Join</Button>)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
13
src/app/organisms/pw/Dialogs.jsx
Normal file
13
src/app/organisms/pw/Dialogs.jsx
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import ReadReceipts from '../read-receipts/ReadReceipts';
|
||||||
|
|
||||||
|
function Dialogs() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<ReadReceipts />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Dialogs;
|
||||||
83
src/app/organisms/read-receipts/ReadReceipts.jsx
Normal file
83
src/app/organisms/read-receipts/ReadReceipts.jsx
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
import React, { useState, useEffect } from 'react';
|
||||||
|
|
||||||
|
import initMatrix from '../../../client/initMatrix';
|
||||||
|
import cons from '../../../client/state/cons';
|
||||||
|
import navigation from '../../../client/state/navigation';
|
||||||
|
import { getUsername, getUsernameOfRoomMember } from '../../../util/matrixUtil';
|
||||||
|
import colorMXID from '../../../util/colorMXID';
|
||||||
|
|
||||||
|
import IconButton from '../../atoms/button/IconButton';
|
||||||
|
import PeopleSelector from '../../molecules/people-selector/PeopleSelector';
|
||||||
|
import Dialog from '../../molecules/dialog/Dialog';
|
||||||
|
|
||||||
|
import CrossIC from '../../../../public/res/ic/outlined/cross.svg';
|
||||||
|
|
||||||
|
function ReadReceipts() {
|
||||||
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
const [roomId, setRoomId] = useState(null);
|
||||||
|
const [readReceipts, setReadReceipts] = useState([]);
|
||||||
|
|
||||||
|
function loadReadReceipts(myRoomId, eventId) {
|
||||||
|
const mx = initMatrix.matrixClient;
|
||||||
|
const room = mx.getRoom(myRoomId);
|
||||||
|
const { timeline } = room;
|
||||||
|
const myReadReceipts = [];
|
||||||
|
|
||||||
|
const myEventIndex = timeline.findIndex((mEvent) => mEvent.getId() === eventId);
|
||||||
|
|
||||||
|
for (let eventIndex = myEventIndex; eventIndex < timeline.length; eventIndex += 1) {
|
||||||
|
myReadReceipts.push(...room.getReceiptsForEvent(timeline[eventIndex]));
|
||||||
|
}
|
||||||
|
|
||||||
|
setReadReceipts(myReadReceipts);
|
||||||
|
setRoomId(myRoomId);
|
||||||
|
setIsOpen(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
navigation.on(cons.events.navigation.READRECEIPTS_OPENED, loadReadReceipts);
|
||||||
|
return () => {
|
||||||
|
navigation.removeListener(cons.events.navigation.READRECEIPTS_OPENED, loadReadReceipts);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isOpen === false) {
|
||||||
|
setRoomId(null);
|
||||||
|
setReadReceipts([]);
|
||||||
|
}
|
||||||
|
}, [isOpen]);
|
||||||
|
|
||||||
|
function renderPeople(receipt) {
|
||||||
|
const room = initMatrix.matrixClient.getRoom(roomId);
|
||||||
|
const member = room.getMember(receipt.userId);
|
||||||
|
const getUserDisplayName = (userId) => {
|
||||||
|
if (room?.getMember(userId)) return getUsernameOfRoomMember(room.getMember(userId));
|
||||||
|
return getUsername(userId);
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<PeopleSelector
|
||||||
|
key={receipt.userId}
|
||||||
|
onClick={() => alert('Viewing profile is yet to be implemented')}
|
||||||
|
avatarSrc={member?.getAvatarUrl(initMatrix.matrixClient.baseUrl, 24, 24, 'crop')}
|
||||||
|
name={getUserDisplayName(receipt.userId)}
|
||||||
|
color={colorMXID(receipt.userId)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog
|
||||||
|
isOpen={isOpen}
|
||||||
|
title="Seen by"
|
||||||
|
onRequestClose={() => setIsOpen(false)}
|
||||||
|
contentOptions={<IconButton src={CrossIC} onClick={() => setIsOpen(false)} tooltip="Close" />}
|
||||||
|
>
|
||||||
|
{
|
||||||
|
readReceipts.map(renderPeople)
|
||||||
|
}
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ReadReceipts;
|
||||||
@@ -62,7 +62,10 @@ function SecuritySection() {
|
|||||||
<div className="set-security settings-content">
|
<div className="set-security settings-content">
|
||||||
<SettingTile
|
<SettingTile
|
||||||
title={`Device ID: ${initMatrix.matrixClient.getDeviceId()}`}
|
title={`Device ID: ${initMatrix.matrixClient.getDeviceId()}`}
|
||||||
content={<Text variant="b3">Use this device ID to verify or manage this session from Element client.</Text>}
|
/>
|
||||||
|
<SettingTile
|
||||||
|
title={`Device key: ${initMatrix.matrixClient.getDeviceEd25519Key().match(/.{1,4}/g).join(' ')}`}
|
||||||
|
content={<Text variant="b3">Use this device ID-key combo to verify or manage this session from Element client.</Text>}
|
||||||
/>
|
/>
|
||||||
<SettingTile
|
<SettingTile
|
||||||
title="Import E2E room keys"
|
title="Import E2E room keys"
|
||||||
@@ -85,7 +88,7 @@ function AboutSection() {
|
|||||||
<div>
|
<div>
|
||||||
<Text variant="h2">
|
<Text variant="h2">
|
||||||
Cinny
|
Cinny
|
||||||
<span className="text text-b3" style={{ margin: '0 var(--sp-extra-tight)' }}>v1.1.0</span>
|
<span className="text text-b3" style={{ margin: '0 var(--sp-extra-tight)' }}>v1.2.0</span>
|
||||||
</Text>
|
</Text>
|
||||||
<Text>Yet another matrix client</Text>
|
<Text>Yet another matrix client</Text>
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import CinnySvg from '../../../../public/res/svg/cinny.svg';
|
|||||||
|
|
||||||
// This regex validates historical usernames, which don't satisy today's username requirements.
|
// This regex validates historical usernames, which don't satisy today's username requirements.
|
||||||
// See https://matrix.org/docs/spec/appendices#id13 for more info.
|
// See https://matrix.org/docs/spec/appendices#id13 for more info.
|
||||||
const LOCALPART_LOGIN_REGEX = /^[!-9|;-~]+$/;
|
const LOCALPART_LOGIN_REGEX = /.*/;
|
||||||
const LOCALPART_SIGNUP_REGEX = /^[a-z0-9_\-.=/]+$/;
|
const LOCALPART_SIGNUP_REGEX = /^[a-z0-9_\-.=/]+$/;
|
||||||
const BAD_LOCALPART_ERROR = 'Username must contain only a-z, 0-9, ., _, =, -, and /.';
|
const BAD_LOCALPART_ERROR = 'Username must contain only a-z, 0-9, ., _, =, -, and /.';
|
||||||
const USER_ID_TOO_LONG_ERROR = 'Your user ID, including the hostname, can\'t be more than 255 characters long.';
|
const USER_ID_TOO_LONG_ERROR = 'Your user ID, including the hostname, can\'t be more than 255 characters long.';
|
||||||
@@ -120,11 +120,6 @@ function Auth({ type }) {
|
|||||||
/** @type {string} */
|
/** @type {string} */
|
||||||
const normalizedUsername = normalizeUsername(rawUsername);
|
const normalizedUsername = normalizeUsername(rawUsername);
|
||||||
|
|
||||||
if (!isValidInput(normalizedUsername, LOCALPART_LOGIN_REGEX)) {
|
|
||||||
showBadInputError(usernameRef.current, BAD_LOCALPART_ERROR);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auth.login(normalizedUsername, homeserverRef.current.value, passwordRef.current.value)
|
auth.login(normalizedUsername, homeserverRef.current.value, passwordRef.current.value)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
document.getElementById('auth_submit-btn').disabled = false;
|
document.getElementById('auth_submit-btn').disabled = false;
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import Spinner from '../../atoms/spinner/Spinner';
|
|||||||
import Navigation from '../../organisms/navigation/Navigation';
|
import Navigation from '../../organisms/navigation/Navigation';
|
||||||
import Channel from '../../organisms/channel/Channel';
|
import Channel from '../../organisms/channel/Channel';
|
||||||
import Windows from '../../organisms/pw/Windows';
|
import Windows from '../../organisms/pw/Windows';
|
||||||
|
import Dialogs from '../../organisms/pw/Dialogs';
|
||||||
|
import EmojiBoardOpener from '../../organisms/emoji-board/EmojiBoardOpener';
|
||||||
|
|
||||||
import initMatrix from '../../../client/initMatrix';
|
import initMatrix from '../../../client/initMatrix';
|
||||||
|
|
||||||
@@ -40,6 +42,8 @@ function Client() {
|
|||||||
<Channel />
|
<Channel />
|
||||||
</div>
|
</div>
|
||||||
<Windows />
|
<Windows />
|
||||||
|
<Dialogs />
|
||||||
|
<EmojiBoardOpener />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,22 @@ function openSettings() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openEmojiBoard(cords, requestEmojiCallback) {
|
||||||
|
appDispatcher.dispatch({
|
||||||
|
type: cons.actions.navigation.OPEN_EMOJIBOARD,
|
||||||
|
cords,
|
||||||
|
requestEmojiCallback,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function openReadReceipts(roomId, eventId) {
|
||||||
|
appDispatcher.dispatch({
|
||||||
|
type: cons.actions.navigation.OPEN_READRECEIPTS,
|
||||||
|
roomId,
|
||||||
|
eventId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
handleTabChange,
|
handleTabChange,
|
||||||
selectRoom,
|
selectRoom,
|
||||||
@@ -63,4 +79,6 @@ export {
|
|||||||
openCreateChannel,
|
openCreateChannel,
|
||||||
openInviteUser,
|
openInviteUser,
|
||||||
openSettings,
|
openSettings,
|
||||||
|
openEmojiBoard,
|
||||||
|
openReadReceipts,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -85,8 +85,9 @@ function guessDMRoomTargetId(room, myUserId) {
|
|||||||
*/
|
*/
|
||||||
async function join(roomIdOrAlias, isDM) {
|
async function join(roomIdOrAlias, isDM) {
|
||||||
const mx = initMatrix.matrixClient;
|
const mx = initMatrix.matrixClient;
|
||||||
|
const roomIdParts = roomIdOrAlias.split(':');
|
||||||
try {
|
try {
|
||||||
const resultRoom = await mx.joinRoom(roomIdOrAlias);
|
const resultRoom = await mx.joinRoom(roomIdOrAlias, { viaServers: [roomIdParts[1]] });
|
||||||
|
|
||||||
if (isDM) {
|
if (isDM) {
|
||||||
const targetUserId = guessDMRoomTargetId(mx.getRoom(resultRoom.roomId), mx.getUserId());
|
const targetUserId = guessDMRoomTargetId(mx.getRoom(resultRoom.roomId), mx.getUserId());
|
||||||
@@ -189,19 +190,7 @@ async function invite(roomId, userId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function redact(roomId, eventId, reason) {
|
|
||||||
const mx = initMatrix.matrixClient;
|
|
||||||
|
|
||||||
try {
|
|
||||||
await mx.redactEvent(roomId, eventId, undefined, typeof reason === 'undefined' ? undefined : { reason });
|
|
||||||
return true;
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
join, leave,
|
join, leave,
|
||||||
create, invite,
|
create, invite,
|
||||||
redact,
|
|
||||||
};
|
};
|
||||||
|
|||||||
33
src/client/action/roomTimeline.js
Normal file
33
src/client/action/roomTimeline.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import initMatrix from '../initMatrix';
|
||||||
|
|
||||||
|
async function redactEvent(roomId, eventId, reason) {
|
||||||
|
const mx = initMatrix.matrixClient;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await mx.redactEvent(roomId, eventId, undefined, typeof reason === 'undefined' ? undefined : { reason });
|
||||||
|
return true;
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function sendReaction(roomId, toEventId, reaction) {
|
||||||
|
const mx = initMatrix.matrixClient;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await mx.sendEvent(roomId, 'm.reaction', {
|
||||||
|
'm.relates_to': {
|
||||||
|
event_id: toEventId,
|
||||||
|
key: reaction,
|
||||||
|
rel_type: 'm.annotation',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
redactEvent,
|
||||||
|
sendReaction,
|
||||||
|
};
|
||||||
@@ -32,6 +32,7 @@ class RoomTimeline extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.ongoingDecryptionCount !== 0) return;
|
if (this.ongoingDecryptionCount !== 0) return;
|
||||||
|
if (this.isOngoingPagination) return;
|
||||||
this.emit(cons.events.roomTimeline.EVENT);
|
this.emit(cons.events.roomTimeline.EVENT);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import EventEmitter from 'events';
|
import EventEmitter from 'events';
|
||||||
import { Parser, HtmlRenderer } from 'commonmark';
|
import { micromark } from 'micromark';
|
||||||
|
import { gfm, gfmHtml } from 'micromark-extension-gfm';
|
||||||
import encrypt from 'browser-encrypt-attachment';
|
import encrypt from 'browser-encrypt-attachment';
|
||||||
import cons from './cons';
|
import cons from './cons';
|
||||||
import settings from './settings';
|
import settings from './settings';
|
||||||
@@ -81,21 +82,26 @@ function getVideoThumbnail(video, width, height, mimeType) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getFormattedBody(markdown) {
|
function getFormattedBody(markdown) {
|
||||||
const reader = new Parser();
|
const result = micromark(markdown, {
|
||||||
const writer = new HtmlRenderer();
|
extensions: [gfm()],
|
||||||
const parsed = reader.parse(markdown);
|
htmlExtensions: [gfmHtml],
|
||||||
return writer.render(parsed);
|
});
|
||||||
|
const bodyParts = result.match(/^(<p>)(.*)(<\/p>)$/);
|
||||||
|
if (bodyParts === null) return result;
|
||||||
|
if (bodyParts[2].indexOf('</p>') >= 0) return result;
|
||||||
|
return bodyParts[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getReplyFormattedBody(roomId, reply) {
|
function getReplyFormattedBody(roomId, reply) {
|
||||||
const replyToLink = `<a href="https://matrix.to/#/${roomId}/${reply.eventId}">In reply to</a>`;
|
const replyToLink = `<a href="https://matrix.to/#/${roomId}/${reply.eventId}">In reply to</a>`;
|
||||||
const userLink = `<a href="https://matrix.to/#/${reply.userId}">${reply.userId}</a>`;
|
const userLink = `<a href="https://matrix.to/#/${reply.userId}">${reply.userId}</a>`;
|
||||||
return `<mx-reply><blockquote>${replyToLink}${userLink}<br />${reply.content}</blockquote></mx-reply>`;
|
const formattedReply = getFormattedBody(reply.content.replaceAll('\n', '\n> '));
|
||||||
|
return `<mx-reply><blockquote>${replyToLink}${userLink}<br />${formattedReply}</blockquote></mx-reply>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function bindReplyToContent(roomId, reply, content) {
|
function bindReplyToContent(roomId, reply, content) {
|
||||||
const newContent = { ...content };
|
const newContent = { ...content };
|
||||||
newContent.body = `> <${reply.userId}> ${reply.content}`;
|
newContent.body = `> <${reply.userId}> ${reply.content.replaceAll('\n', '\n> ')}`;
|
||||||
newContent.body += `\n\n${content.body}`;
|
newContent.body += `\n\n${content.body}`;
|
||||||
newContent.format = 'org.matrix.custom.html';
|
newContent.format = 'org.matrix.custom.html';
|
||||||
newContent['m.relates_to'] = content['m.relates_to'] || {};
|
newContent['m.relates_to'] = content['m.relates_to'] || {};
|
||||||
@@ -200,6 +206,7 @@ class RoomsInput extends EventEmitter {
|
|||||||
this.roomIdToInput.set(roomId, input);
|
this.roomIdToInput.set(roomId, input);
|
||||||
if (input.attachment) {
|
if (input.attachment) {
|
||||||
await this.sendFile(roomId, input.attachment.file);
|
await this.sendFile(roomId, input.attachment.file);
|
||||||
|
if (!this.isSending(roomId)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getMessage(roomId).trim() !== '') {
|
if (this.getMessage(roomId).trim() !== '') {
|
||||||
@@ -208,8 +215,11 @@ class RoomsInput extends EventEmitter {
|
|||||||
msgtype: 'm.text',
|
msgtype: 'm.text',
|
||||||
};
|
};
|
||||||
if (settings.isMarkdown) {
|
if (settings.isMarkdown) {
|
||||||
content.format = 'org.matrix.custom.html';
|
const formattedBody = getFormattedBody(input.message);
|
||||||
content.formatted_body = getFormattedBody(input.message);
|
if (formattedBody !== input.message) {
|
||||||
|
content.format = 'org.matrix.custom.html';
|
||||||
|
content.formatted_body = formattedBody;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (typeof input.replyTo !== 'undefined') {
|
if (typeof input.replyTo !== 'undefined') {
|
||||||
content = bindReplyToContent(roomId, input.replyTo, content);
|
content = bindReplyToContent(roomId, input.replyTo, content);
|
||||||
@@ -322,6 +332,45 @@ class RoomsInput extends EventEmitter {
|
|||||||
}
|
}
|
||||||
return { url };
|
return { url };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async sendEditedMessage(roomId, mEvent, editedBody) {
|
||||||
|
const isReply = typeof mEvent.getWireContent()['m.relates_to']?.['m.in_reply_to'] !== 'undefined';
|
||||||
|
|
||||||
|
const content = {
|
||||||
|
body: ` * ${editedBody}`,
|
||||||
|
msgtype: 'm.text',
|
||||||
|
'm.new_content': {
|
||||||
|
body: editedBody,
|
||||||
|
msgtype: 'm.text',
|
||||||
|
},
|
||||||
|
'm.relates_to': {
|
||||||
|
event_id: mEvent.getId(),
|
||||||
|
rel_type: 'm.replace',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
if (settings.isMarkdown) {
|
||||||
|
const formattedBody = getFormattedBody(editedBody);
|
||||||
|
if (formattedBody !== editedBody) {
|
||||||
|
content.formatted_body = ` * ${formattedBody}`;
|
||||||
|
content.format = 'org.matrix.custom.html';
|
||||||
|
content['m.new_content'].formatted_body = formattedBody;
|
||||||
|
content['m.new_content'].format = 'org.matrix.custom.html';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isReply) {
|
||||||
|
const evBody = mEvent.getContent().body;
|
||||||
|
const replyHead = evBody.slice(0, evBody.indexOf('\n\n'));
|
||||||
|
const evFBody = mEvent.getContent().formatted_body;
|
||||||
|
const fReplyHead = evFBody.slice(0, evFBody.indexOf('</mx-reply>'));
|
||||||
|
|
||||||
|
content.format = 'org.matrix.custom.html';
|
||||||
|
content.formatted_body = `${fReplyHead}</mx-reply>${(content.formatted_body || content.body)}`;
|
||||||
|
|
||||||
|
content.body = `${replyHead}\n\n${content.body}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.matrixClient.sendMessage(roomId, content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default RoomsInput;
|
export default RoomsInput;
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ const cons = {
|
|||||||
OPEN_CREATE_CHANNEL: 'OPEN_CREATE_CHANNEL',
|
OPEN_CREATE_CHANNEL: 'OPEN_CREATE_CHANNEL',
|
||||||
OPEN_INVITE_USER: 'OPEN_INVITE_USER',
|
OPEN_INVITE_USER: 'OPEN_INVITE_USER',
|
||||||
OPEN_SETTINGS: 'OPEN_SETTINGS',
|
OPEN_SETTINGS: 'OPEN_SETTINGS',
|
||||||
|
OPEN_EMOJIBOARD: 'OPEN_EMOJIBOARD',
|
||||||
|
OPEN_READRECEIPTS: 'OPEN_READRECEIPTS',
|
||||||
},
|
},
|
||||||
room: {
|
room: {
|
||||||
JOIN: 'JOIN',
|
JOIN: 'JOIN',
|
||||||
@@ -39,6 +41,8 @@ const cons = {
|
|||||||
CREATE_CHANNEL_OPENED: 'CREATE_CHANNEL_OPENED',
|
CREATE_CHANNEL_OPENED: 'CREATE_CHANNEL_OPENED',
|
||||||
INVITE_USER_OPENED: 'INVITE_USER_OPENED',
|
INVITE_USER_OPENED: 'INVITE_USER_OPENED',
|
||||||
SETTINGS_OPENED: 'SETTINGS_OPENED',
|
SETTINGS_OPENED: 'SETTINGS_OPENED',
|
||||||
|
EMOJIBOARD_OPENED: 'EMOJIBOARD_OPENED',
|
||||||
|
READRECEIPTS_OPENED: 'READRECEIPTS_OPENED',
|
||||||
},
|
},
|
||||||
roomList: {
|
roomList: {
|
||||||
ROOMLIST_UPDATED: 'ROOMLIST_UPDATED',
|
ROOMLIST_UPDATED: 'ROOMLIST_UPDATED',
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class Navigation extends EventEmitter {
|
|||||||
super();
|
super();
|
||||||
|
|
||||||
this.activeTab = 'channels';
|
this.activeTab = 'channels';
|
||||||
this.selectedRoom = null;
|
this.activeRoomId = null;
|
||||||
this.isPeopleDrawerVisible = true;
|
this.isPeopleDrawerVisible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15,8 +15,8 @@ class Navigation extends EventEmitter {
|
|||||||
return this.activeTab;
|
return this.activeTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
getActiveRoom() {
|
getActiveRoomId() {
|
||||||
return this.selectedRoom;
|
return this.activeRoomId;
|
||||||
}
|
}
|
||||||
|
|
||||||
navigate(action) {
|
navigate(action) {
|
||||||
@@ -26,8 +26,8 @@ class Navigation extends EventEmitter {
|
|||||||
this.emit(cons.events.navigation.TAB_CHANGED, this.activeTab);
|
this.emit(cons.events.navigation.TAB_CHANGED, this.activeTab);
|
||||||
},
|
},
|
||||||
[cons.actions.navigation.SELECT_ROOM]: () => {
|
[cons.actions.navigation.SELECT_ROOM]: () => {
|
||||||
this.selectedRoom = action.roomId;
|
this.activeRoomId = action.roomId;
|
||||||
this.emit(cons.events.navigation.ROOM_SELECTED, this.selectedRoom);
|
this.emit(cons.events.navigation.ROOM_SELECTED, this.activeRoomId);
|
||||||
},
|
},
|
||||||
[cons.actions.navigation.TOGGLE_PEOPLE_DRAWER]: () => {
|
[cons.actions.navigation.TOGGLE_PEOPLE_DRAWER]: () => {
|
||||||
this.isPeopleDrawerVisible = !this.isPeopleDrawerVisible;
|
this.isPeopleDrawerVisible = !this.isPeopleDrawerVisible;
|
||||||
@@ -48,6 +48,19 @@ class Navigation extends EventEmitter {
|
|||||||
[cons.actions.navigation.OPEN_SETTINGS]: () => {
|
[cons.actions.navigation.OPEN_SETTINGS]: () => {
|
||||||
this.emit(cons.events.navigation.SETTINGS_OPENED);
|
this.emit(cons.events.navigation.SETTINGS_OPENED);
|
||||||
},
|
},
|
||||||
|
[cons.actions.navigation.OPEN_EMOJIBOARD]: () => {
|
||||||
|
this.emit(
|
||||||
|
cons.events.navigation.EMOJIBOARD_OPENED,
|
||||||
|
action.cords, action.requestEmojiCallback,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
[cons.actions.navigation.OPEN_READRECEIPTS]: () => {
|
||||||
|
this.emit(
|
||||||
|
cons.events.navigation.READRECEIPTS_OPENED,
|
||||||
|
action.roomId,
|
||||||
|
action.eventId,
|
||||||
|
);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
actions[action.type]?.();
|
actions[action.type]?.();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ class Settings extends EventEmitter {
|
|||||||
this.themeIndex = this.getThemeIndex();
|
this.themeIndex = this.getThemeIndex();
|
||||||
|
|
||||||
this.isMarkdown = this.getIsMarkdown();
|
this.isMarkdown = this.getIsMarkdown();
|
||||||
|
|
||||||
|
this.isTouchScreenDevice = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
getThemeIndex() {
|
getThemeIndex() {
|
||||||
|
|||||||
128
src/util/AsyncSearch.js
Normal file
128
src/util/AsyncSearch.js
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
import EventEmitter from 'events';
|
||||||
|
|
||||||
|
class AsyncSearch extends EventEmitter {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this._reset();
|
||||||
|
|
||||||
|
this.RESULT_SENT = 'RESULT_SENT';
|
||||||
|
}
|
||||||
|
|
||||||
|
_reset() {
|
||||||
|
this.dataList = null;
|
||||||
|
this.term = null;
|
||||||
|
this.searchKeys = null;
|
||||||
|
this.isContain = false;
|
||||||
|
this.isCaseSensitive = false;
|
||||||
|
this.ignoreWhitespace = true;
|
||||||
|
this.limit = null;
|
||||||
|
this.findingList = [];
|
||||||
|
|
||||||
|
this.searchUptoIndex = 0;
|
||||||
|
this.sessionStartTimestamp = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_softReset() {
|
||||||
|
this.term = null;
|
||||||
|
this.findingList = [];
|
||||||
|
this.searchUptoIndex = 0;
|
||||||
|
this.sessionStartTimestamp = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup the search.
|
||||||
|
* opts.keys are required when dataList items are object.
|
||||||
|
*
|
||||||
|
* @param {[string | object]} dataList - A list to search in
|
||||||
|
* @param {object} opts - Options
|
||||||
|
* @param {string | [string]} [opts.keys=null]
|
||||||
|
* @param {boolean} [opts.isContain=false] - Add finding to result if it contain search term
|
||||||
|
* @param {boolean} [opts.isCaseSensitive=false]
|
||||||
|
* @param {boolean} [opts.ignoreWhitespace=true]
|
||||||
|
* @param {number} [opts.limit=null] - Stop search after limit
|
||||||
|
*/
|
||||||
|
setup(dataList, opts) {
|
||||||
|
this._reset();
|
||||||
|
this.dataList = dataList;
|
||||||
|
this.searchKeys = opts?.keys || null;
|
||||||
|
this.isContain = opts?.isContain || false;
|
||||||
|
this.isCaseSensitive = opts?.isCaseSensitive || false;
|
||||||
|
this.ignoreWhitespace = opts?.ignoreWhitespace || true;
|
||||||
|
this.limit = opts?.limit || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
search(term) {
|
||||||
|
this._softReset();
|
||||||
|
|
||||||
|
this.term = (this.isCaseSensitive) ? term : term.toLocaleLowerCase();
|
||||||
|
if (this.ignoreWhitespace) this.term = this.term.replace(' ', '');
|
||||||
|
if (this.term === '') {
|
||||||
|
this._sendFindings();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._find(this.sessionStartTimestamp, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
_find(sessionTimestamp, lastFindingCount) {
|
||||||
|
if (sessionTimestamp !== this.sessionStartTimestamp) return;
|
||||||
|
this.sessionStartTimestamp = window.performance.now();
|
||||||
|
|
||||||
|
for (
|
||||||
|
let searchIndex = this.searchUptoIndex;
|
||||||
|
searchIndex < this.dataList.length;
|
||||||
|
searchIndex += 1
|
||||||
|
) {
|
||||||
|
if (this._match(this.dataList[searchIndex])) {
|
||||||
|
this.findingList.push(this.dataList[searchIndex]);
|
||||||
|
if (typeof this.limit === 'number' && this.findingList.length >= this.limit) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const calcFinishTime = window.performance.now();
|
||||||
|
if (calcFinishTime - this.sessionStartTimestamp > 8) {
|
||||||
|
const thisFindingCount = this.findingList.length;
|
||||||
|
const thisSessionTimestamp = this.sessionStartTimestamp;
|
||||||
|
if (lastFindingCount !== thisFindingCount) this._sendFindings();
|
||||||
|
|
||||||
|
this.searchUptoIndex = searchIndex + 1;
|
||||||
|
setTimeout(() => this._find(thisSessionTimestamp, thisFindingCount));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastFindingCount !== this.findingList.length
|
||||||
|
|| lastFindingCount === 0) this._sendFindings();
|
||||||
|
this._softReset();
|
||||||
|
}
|
||||||
|
|
||||||
|
_match(item) {
|
||||||
|
if (typeof item === 'string') {
|
||||||
|
return this._compare(item);
|
||||||
|
}
|
||||||
|
if (typeof item === 'object') {
|
||||||
|
if (Array.isArray(this.searchKeys)) {
|
||||||
|
return !!this.searchKeys.find((key) => this._compare(item[key]));
|
||||||
|
}
|
||||||
|
if (typeof this.searchKeys === 'string') {
|
||||||
|
return this._compare(item[this.searchKeys]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_compare(item) {
|
||||||
|
if (typeof item !== 'string') return false;
|
||||||
|
let myItem = (this.isCaseSensitive) ? item : item.toLocaleLowerCase();
|
||||||
|
if (this.ignoreWhitespace) myItem = myItem.replace(' ', '');
|
||||||
|
|
||||||
|
if (this.isContain) return myItem.indexOf(this.term) !== -1;
|
||||||
|
return myItem.startsWith(this.term);
|
||||||
|
}
|
||||||
|
|
||||||
|
_sendFindings() {
|
||||||
|
this.emit(this.RESULT_SENT, this.findingList, this.term);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AsyncSearch;
|
||||||
@@ -25,6 +25,10 @@ function getUsername(userId) {
|
|||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getUsernameOfRoomMember(roomMember) {
|
||||||
|
return roomMember.name || roomMember.userId;
|
||||||
|
}
|
||||||
|
|
||||||
async function isRoomAliasAvailable(alias) {
|
async function isRoomAliasAvailable(alias) {
|
||||||
try {
|
try {
|
||||||
const myUserId = initMatrix.matrixClient.getUserId();
|
const myUserId = initMatrix.matrixClient.getUserId();
|
||||||
@@ -44,6 +48,7 @@ async function isRoomAliasAvailable(alias) {
|
|||||||
function doesRoomHaveUnread(room) {
|
function doesRoomHaveUnread(room) {
|
||||||
const userId = initMatrix.matrixClient.getUserId();
|
const userId = initMatrix.matrixClient.getUserId();
|
||||||
const readUpToId = room.getEventReadUpTo(userId);
|
const readUpToId = room.getEventReadUpTo(userId);
|
||||||
|
const supportEvents = ['m.room.message', 'm.room.encrypted', 'm.sticker'];
|
||||||
|
|
||||||
if (room.timeline.length
|
if (room.timeline.length
|
||||||
&& room.timeline[room.timeline.length - 1].sender
|
&& room.timeline[room.timeline.length - 1].sender
|
||||||
@@ -56,12 +61,15 @@ function doesRoomHaveUnread(room) {
|
|||||||
const event = room.timeline[i];
|
const event = room.timeline[i];
|
||||||
|
|
||||||
if (event.getId() === readUpToId) return false;
|
if (event.getId() === readUpToId) return false;
|
||||||
return true;
|
|
||||||
|
if (supportEvents.includes(event.getType())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getBaseUrl, getUsername,
|
getBaseUrl, getUsername, getUsernameOfRoomMember,
|
||||||
isRoomAliasAvailable, doesRoomHaveUnread,
|
isRoomAliasAvailable, doesRoomHaveUnread,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
|
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
|
||||||
|
const webpack = require('webpack');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: {
|
entry: {
|
||||||
@@ -14,6 +15,7 @@ module.exports = {
|
|||||||
'fs': require.resolve('browserify-fs'),
|
'fs': require.resolve('browserify-fs'),
|
||||||
'stream': require.resolve('stream-browserify'),
|
'stream': require.resolve('stream-browserify'),
|
||||||
'util': require.resolve('util/'),
|
'util': require.resolve('util/'),
|
||||||
|
'assert': require.resolve('assert/'),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
node: {
|
node: {
|
||||||
@@ -64,6 +66,9 @@ module.exports = {
|
|||||||
appleStartup: false,
|
appleStartup: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'process.env': JSON.stringify(process.env),
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user