Skip to content

Commit

Permalink
InvisibleTyping 1.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
domi-btnr committed Aug 30, 2024
1 parent 9dc0565 commit 872322a
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 29 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ jobs:
node-version: 20.x

- name: Install dependencies
run: npm install --no-audit --no-fund
run: >-
npm cache clean --force
npm install --no-audit --no-fund
- name: Detect changed files
id: files
Expand Down
7 changes: 1 addition & 6 deletions InvisibleTyping/components/typingButton.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
.invisibleTypingButton svg {
color: var(--interactive-normal);
overflow: visible;
padding: 4px;
margin-top: 5px;
margin-top: 2.5px;
}

.invisibleTypingButton .disabledStrokeThrough {
Expand All @@ -13,10 +12,6 @@
.invisibleTypingButton {
background: transparent;

align-self: flex-end;
position: sticky;
height: var(--custom-channel-textarea-text-area-height);

&:hover:not(.disabled) svg {
color: var(--interactive-hover);
}
Expand Down
44 changes: 26 additions & 18 deletions InvisibleTyping/components/typingbutton.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React from "react";
import { Components, ContextMenu, UI } from "@api";
import { Components, ContextMenu, UI, Webpack } from "@api";
import Keyboard from "./icons/keyboard";
import styles from "./typingButton.scss";
import Settings from "../modules/settings";
import { buildClassName, TypingModule, useStateFromStores } from "../modules/shared";

const ChatBarClasses = Webpack.getByKeys("channelTextArea", "button");

const removeItem = function (array: any[], item: any) {
while (array.includes(item)) {
array.splice(array.indexOf(item), 1);
Expand Down Expand Up @@ -67,23 +69,29 @@ export default function InvisibleTypingButton({ channel, isEmpty }) {
}, [enabled]);

return (
<Components.Tooltip text={enabled ? "Typing Enabled" : "Typing Disabled"}>
{props => (
<button
{...props}
className={
buildClassName(styles.invisibleTypingButton, {
enabled,
disabled: !enabled
})
}
onClick={handleClick}
onContextMenu={handleContextMenu}
>
<Keyboard disabled={!enabled} />
</button>
)}
</Components.Tooltip>
<div
style={{ marginRight: "2.5px" }}
className={ChatBarClasses.buttons}
>
<Components.Tooltip text={enabled ? "Typing Enabled" : "Typing Disabled"}>
{props => (
<button
{...props}
className={
buildClassName(styles.invisibleTypingButton, {
enabled,
disabled: !enabled
})

}
onClick={handleClick}
onContextMenu={handleContextMenu}
>
<Keyboard disabled={!enabled} />
</button>
)}
</Components.Tooltip>
</div>
);
}

Expand Down
6 changes: 4 additions & 2 deletions InvisibleTyping/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ export default class InvisibleTyping {

patchTyping() {
Patcher.instead(TypingModule, "startTyping", (_, [channelId]: [string], originalMethod) => {
const globalTypingEnabled = Settings.get("autoEnable", true);
const excludeList: string[] = Settings.get("exclude", []);
if (excludeList.includes(channelId)) return;
return originalMethod(channelId);
const shouldType = globalTypingEnabled ? !excludeList.includes(channelId) : excludeList.includes(channelId);
if (!shouldType) return;
originalMethod(channelId);
});
}

Expand Down
4 changes: 2 additions & 2 deletions InvisibleTyping/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "InvisibleTyping",
"version": "1.3.4",
"version": "1.3.5",
"author": "Strencher",
"authorId": "415849376598982656",
"description": "Enhanced version of silent typing.",
Expand All @@ -10,7 +10,7 @@
{
"title": "Fixed",
"type": "fixed",
"items": ["The Plugin works again"]
"items": ["The Plugin works again", "Fixed some logic issues", "Fixed sticky button"]
}
],
"changelogDate": "2024-08-29"
Expand Down

0 comments on commit 872322a

Please sign in to comment.