From 290d831cd47f7218db9d81adae4e3a33702b1522 Mon Sep 17 00:00:00 2001 From: TheGlitching <77061501+TheGlitching@users.noreply.github.com> Date: Fri, 31 Jul 2026 11:11:47 +0200 Subject: [PATCH] feat(extension): add Slack to enabled domains by default --- README.md | 22 +++++++++---------- src/settings.ts | 3 ++- test/content.test.ts | 50 +++++++++++++++++++++++++++++++++++++++++++ test/settings.test.ts | 18 ++++++++++++---- 4 files changed, 77 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 590464a..efb7fee 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ It keeps the workflow inside the editor you are already using and calls the mode 1. Install Simple Words from the [Chrome Web Store](https://chromewebstore.google.com/detail/simple-words/kmlhfcjpmhcoclpcghckibfkgpfbjfbb). 2. Use the options page that opens after install to choose a model provider. -3. Write a rough reply in Gmail, Outlook, Yahoo Mail, iCloud Mail, Proton Mail, or another enabled domain. +3. Write a rough reply in Gmail, Outlook, Yahoo Mail, iCloud Mail, Proton Mail, Slack, or another enabled domain. 4. Click **Simple Words**, review the refined draft, then click **Replace draft**. ## Install @@ -137,16 +137,16 @@ If the button or panel disappears after the extension reloads or updates while a Simple Words stores configuration in `chrome.storage.local`. There is no hosted Simple Words backend in the request path. -| Setting | Default | -| --------------- | ------------------------------------------------------------------------------------------------------------- | -| Provider | `openai` | -| OpenAI base URL | `https://api.openai.com/v1` | -| OpenAI model | `gpt-5.5` | -| Codex base URL | `https://chatgpt.com/backend-api/codex` | -| Codex model | `gpt-5.5-fast` | -| Ollama base URL | `http://localhost:11434/v1` | -| Ollama model | `gemma4` | -| Enabled domains | `mail.google.com`, `outlook.live.com`, `outlook.office.com`, `mail.yahoo.com`, `icloud.com`, `mail.proton.me` | +| Setting | Default | +| --------------- | ------------------------------------------------------------------------------------------------------------------------------ | +| Provider | `openai` | +| OpenAI base URL | `https://api.openai.com/v1` | +| OpenAI model | `gpt-5.5` | +| Codex base URL | `https://chatgpt.com/backend-api/codex` | +| Codex model | `gpt-5.5-fast` | +| Ollama base URL | `http://localhost:11434/v1` | +| Ollama model | `gemma4` | +| Enabled domains | `mail.google.com`, `outlook.live.com`, `outlook.office.com`, `mail.yahoo.com`, `icloud.com`, `mail.proton.me`, `app.slack.com` | ## Development diff --git a/src/settings.ts b/src/settings.ts index e92bd2f..36c773a 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -38,7 +38,8 @@ export const DEFAULT_ENABLED_DOMAINS = [ 'outlook.office.com', 'mail.yahoo.com', 'icloud.com', - 'mail.proton.me' + 'mail.proton.me', + 'app.slack.com' ] export const DEFAULT_SETTINGS: SimpleWordsSettings = { diff --git a/test/content.test.ts b/test/content.test.ts index 39ff68d..32de68e 100644 --- a/test/content.test.ts +++ b/test/content.test.ts @@ -1167,4 +1167,54 @@ describe('content script button visibility', () => { }) ) }) + + test('attaches to a Quill composer without following its off-screen clipboard node', () => { + document.body.innerHTML = ` +
+

hey

can you take a look

+
+
+ ` + + const composer = document.querySelector('.ql-editor') as HTMLDivElement + const clipboard = document.querySelector('.ql-clipboard') as HTMLDivElement + Object.defineProperty(composer, 'isContentEditable', { value: true }) + Object.defineProperty(clipboard, 'isContentEditable', { value: true }) + vi.spyOn(composer, 'getBoundingClientRect').mockReturnValue({ + top: 500, + left: 100, + right: 950, + bottom: 538, + width: 850, + height: 38, + x: 100, + y: 500, + toJSON: () => null + }) + vi.spyOn(clipboard, 'getBoundingClientRect').mockReturnValue({ + top: 0, + left: -99363, + right: -99362, + bottom: 1, + width: 1, + height: 1, + x: -99363, + y: 0, + toJSON: () => null + }) + + composer.dispatchEvent(new FocusEvent('focusin', { bubbles: true })) + + const button = document.getElementById( + 'simplewords-button' + ) as HTMLButtonElement + expect(button.hidden).toBe(false) + expect(Number.parseFloat(button.style.top)).toBeGreaterThanOrEqual(500) + expect(Number.parseFloat(button.style.top)).toBeLessThan(538) + expect(Number.parseFloat(button.style.left)).toBeLessThan(950) + + clipboard.dispatchEvent(new FocusEvent('focusin', { bubbles: true })) + + expect(button.hidden).toBe(true) + }) }) diff --git a/test/settings.test.ts b/test/settings.test.ts index 1b69cec..b51826a 100644 --- a/test/settings.test.ts +++ b/test/settings.test.ts @@ -13,18 +13,19 @@ import { normalizeSettings } from '../src/settings' -const DEFAULT_EMAIL_DOMAINS = [ +const DEFAULT_DOMAINS = [ 'mail.google.com', 'outlook.live.com', 'outlook.office.com', 'mail.yahoo.com', 'icloud.com', - 'mail.proton.me' + 'mail.proton.me', + 'app.slack.com' ] describe('domain enablement settings', () => { - test('enables Simple Words by default only on popular email services', () => { - expect(DEFAULT_SETTINGS.enabledDomains).toEqual(DEFAULT_EMAIL_DOMAINS) + test('enables Simple Words by default on popular email and chat clients', () => { + expect(DEFAULT_SETTINGS.enabledDomains).toEqual(DEFAULT_DOMAINS) }) test('normalizes configured domains to lowercase unique entries', () => { @@ -63,9 +64,18 @@ describe('domain enablement settings', () => { expect( isSimpleWordsEnabledForUrl?.(DEFAULT_SETTINGS, 'https://www.icloud.com/') ).toBe(true) + expect( + isSimpleWordsEnabledForUrl?.( + DEFAULT_SETTINGS, + 'https://app.slack.com/client/T0123ABCD/C0123ABCD' + ) + ).toBe(true) expect( isSimpleWordsEnabledForUrl?.(DEFAULT_SETTINGS, 'https://docs.google.com/') ).toBe(false) + expect( + isSimpleWordsEnabledForUrl?.(DEFAULT_SETTINGS, 'https://slack.com/') + ).toBe(false) }) })