Compare commits

...

5 Commits

Author SHA1 Message Date
DarkSky
046e126054 feat: bump typescript (#14507)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Chores**
  * Upgraded TypeScript toolchain to v5.9.3 across packages and tooling.
* Removed legacy ts-node and migrated developer tooling to newer
runtimes (tsx/SWC) where applicable.
* **Documentation**
* Updated developer CLI docs and runtime behavior notes to reflect the
new loader/runtime for running TypeScript files; no changes to public
APIs or end-user behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-02-24 13:22:46 +08:00
DarkSky
c2c7dde06c chore: bump deps (#14506)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Chores**
  * Version bumped to 0.26.3 across the project and Helm charts.
  * Removed an unused dependency (minimatch) from multiple packages.
* Updated build/tooling and packaging metadata, including packaging
maker replacement.
  * Adjusted app release metadata and platform packaging config.

* **Tests**
* Updated test snapshots to reflect minor presentational styling
adjustments.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-02-24 09:11:41 +08:00
DarkSky
5fb1c11a96 fix: image proxy url (#14505)
#### PR Dependency Tree


* **PR #14505** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Improvements**
* Better image-proxy detection to avoid double-proxying already proxied
images.
* Improved runtime image proxy configuration so images load consistently
across deployments.
* More robust image URL handling for optimized image loading and fewer
redundant requests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-02-24 03:29:17 +08:00
passabilities.eth
3e39dbb298 fix(mobile): fixed toolbar position (#14329)
## Summary
Fixed the text formatting toolbar not working properly on mobile web
browsers.

## Problem
The toolbar had multiple issues on mobile devices:
- It would render off-screen or be covered by the virtual keyboard
- The flag-based rendering system caused visibility issues on mobile
- Long-press text selection didn't trigger the toolbar
- Wide toolbars could overflow the viewport

<img
src="https://github.com/user-attachments/assets/8f54590c-1d2c-4c87-abab-32206df17ebf"
width="250">

## Solution
- Use fixed positioning at bottom of screen on mobile devices
- Position toolbar above virtual keyboard using Visual Viewport API
- Handle toolbar visibility directly via `selectionchange` event
- Bypass flag-based rendering system on mobile to avoid rendering issues
- Add `touchend` listener to handle long-press text selection
- Limit toolbar max-width to viewport minus padding
- Enable horizontal scrolling for overflow content

<img
src="https://github.com/user-attachments/assets/45130860-f01a-45c1-87c5-d43264f88613"
width="250">

## Test plan
- [x] Tested on mobile Safari (iOS)
- [x] Tested on mobile Chrome (Android)
- [x] Verified desktop browsers still work correctly
- [x] Verified the toolbar is fixed to the bottom of the screen and
above virtual keyboard
- [x] Verified long-press text selection triggers toolbar

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Improvements**
* Mobile toolbar now anchors to the bottom, adapts width, and
repositions dynamically to stay above on-screen keyboards.
* Toolbar visibility is context-aware, showing when native-like text
selections occur and hiding otherwise; touch interactions are handled
for reliable toggling.
  * Desktop experience and public APIs remain unchanged.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-02-24 01:36:09 +08:00
DarkSky
e617740974 chore: improve cors 2026-02-24 00:51:08 +08:00
165 changed files with 2110 additions and 1365 deletions

View File

@@ -3,4 +3,4 @@ name: affine
description: AFFiNE cloud chart
type: application
version: 0.0.0
appVersion: "0.26.1"
appVersion: "0.26.3"

View File

@@ -3,7 +3,7 @@ name: doc
description: AFFiNE doc server
type: application
version: 0.0.0
appVersion: "0.26.1"
appVersion: "0.26.3"
dependencies:
- name: gcloud-sql-proxy
version: 0.0.0

View File

@@ -3,7 +3,7 @@ name: front
description: AFFiNE front server
type: application
version: 0.0.0
appVersion: "0.26.1"
appVersion: "0.26.3"
dependencies:
- name: gcloud-sql-proxy
version: 0.0.0

View File

@@ -3,7 +3,7 @@ name: graphql
description: AFFiNE GraphQL server
type: application
version: 0.0.0
appVersion: "0.26.1"
appVersion: "0.26.3"
dependencies:
- name: gcloud-sql-proxy
version: 0.0.0

View File

@@ -296,7 +296,7 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1",
"version": "0.26.3",
"devDependencies": {
"@vanilla-extract/vite-plugin": "^5.0.0",
"msw": "^2.12.4",

View File

@@ -26,7 +26,6 @@
"@toeverything/theme": "^1.1.23",
"file-type": "^21.0.0",
"lit": "^3.2.0",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"zod": "^3.25.76"
},
@@ -41,5 +40,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -26,7 +26,6 @@
"@preact/signals-core": "^1.8.0",
"@toeverything/theme": "^1.1.23",
"lit": "^3.2.0",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"yjs": "^13.6.27",
"zod": "^3.25.76"
@@ -45,5 +44,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -30,7 +30,6 @@
"@types/mdast": "^4.0.4",
"emoji-mart": "^5.6.0",
"lit": "^3.2.0",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"zod": "^3.25.76"
},
@@ -45,5 +44,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -31,7 +31,6 @@
"@toeverything/theme": "^1.1.23",
"@types/mdast": "^4.0.4",
"lit": "^3.2.0",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"shiki": "^3.19.0",
"zod": "^3.25.76"
@@ -48,5 +47,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -27,7 +27,6 @@
"@toeverything/theme": "^1.1.23",
"@types/mdast": "^4.0.4",
"lit": "^3.2.0",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"zod": "^3.25.76"
},
@@ -42,5 +41,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -32,7 +32,6 @@
"@types/mdast": "^4.0.4",
"date-fns": "^4.0.0",
"lit": "^3.2.0",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"yjs": "^13.6.27",
"zod": "^3.25.76"
@@ -48,5 +47,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -24,7 +24,6 @@
"@toeverything/theme": "^1.1.23",
"@types/mdast": "^4.0.4",
"lit": "^3.2.0",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"zod": "^3.25.76"
},
@@ -39,5 +38,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -28,7 +28,6 @@
"@preact/signals-core": "^1.8.0",
"@toeverything/theme": "^1.1.23",
"lit": "^3.2.0",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"zod": "^3.25.76"
},
@@ -43,5 +42,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -30,7 +30,6 @@
"@types/lodash-es": "^4.17.12",
"lit": "^3.2.0",
"lodash-es": "^4.17.23",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"yjs": "^13.6.27",
"zod": "^3.25.76"
@@ -49,5 +48,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -30,7 +30,6 @@
"@types/lodash-es": "^4.17.12",
"lit": "^3.2.0",
"lodash-es": "^4.17.23",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"yjs": "^13.6.27",
"zod": "^3.25.76"
@@ -49,5 +48,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -28,7 +28,6 @@
"@toeverything/theme": "^1.1.23",
"@types/mdast": "^4.0.4",
"lit": "^3.2.0",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"yjs": "^13.6.27",
"zod": "^3.25.76"
@@ -44,5 +43,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -28,7 +28,6 @@
"@toeverything/theme": "^1.1.23",
"file-type": "^21.0.0",
"lit": "^3.2.0",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"zod": "^3.25.76"
},
@@ -44,5 +43,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -30,7 +30,6 @@
"@types/mdast": "^4.0.4",
"katex": "^0.16.27",
"lit": "^3.2.0",
"minimatch": "^10.1.1",
"remark-math": "^6.0.0",
"rxjs": "^7.8.2",
"zod": "^3.25.76"
@@ -46,5 +45,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -27,7 +27,6 @@
"@toeverything/theme": "^1.1.23",
"@types/mdast": "^4.0.4",
"lit": "^3.2.0",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"zod": "^3.25.76"
},
@@ -46,5 +45,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -33,7 +33,6 @@
"@vanilla-extract/css": "^1.17.0",
"lit": "^3.2.0",
"lodash-es": "^4.17.23",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"zod": "^3.25.76"
},
@@ -49,5 +48,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -26,7 +26,6 @@
"@toeverything/theme": "^1.1.23",
"@types/mdast": "^4.0.4",
"lit": "^3.2.0",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"zod": "^3.25.76"
},
@@ -42,5 +41,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -50,7 +50,6 @@
"html2canvas": "^1.4.1",
"lit": "^3.2.0",
"lodash-es": "^4.17.23",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"yjs": "^13.6.27",
"zod": "^3.25.76"
@@ -67,5 +66,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -45,5 +45,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -46,5 +46,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -42,5 +42,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -82,5 +82,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -48,5 +48,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -26,5 +26,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -42,5 +42,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -35,5 +35,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -26,7 +26,6 @@
"@preact/signals-core": "^1.8.0",
"@toeverything/theme": "^1.1.23",
"lit": "^3.2.0",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"zod": "^3.25.76"
},
@@ -40,5 +39,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -28,7 +28,6 @@
"@types/lodash-es": "^4.17.12",
"lit": "^3.2.0",
"lodash-es": "^4.17.23",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"zod": "^3.25.76"
},
@@ -42,5 +41,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -27,7 +27,6 @@
"@toeverything/theme": "^1.1.23",
"@vanilla-extract/css": "^1.17.0",
"lit": "^3.2.0",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"zod": "^3.25.76"
},
@@ -41,5 +40,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -27,7 +27,6 @@
"@types/lodash-es": "^4.17.12",
"lit": "^3.2.0",
"lodash-es": "^4.17.23",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"yjs": "^13.6.27",
"zod": "^3.25.76"
@@ -43,5 +42,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -28,7 +28,6 @@
"@types/lodash-es": "^4.17.12",
"lit": "^3.2.0",
"lodash-es": "^4.17.23",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"yjs": "^13.6.27",
"zod": "^3.25.76"
@@ -44,5 +43,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -29,7 +29,6 @@
"fractional-indexing": "^3.2.0",
"lit": "^3.2.0",
"lodash-es": "^4.17.23",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"yjs": "^13.6.27",
"zod": "^3.25.76"
@@ -48,5 +47,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -30,7 +30,6 @@
"@types/lodash-es": "^4.17.12",
"lit": "^3.2.0",
"lodash-es": "^4.17.23",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"yjs": "^13.6.27",
"zod": "^3.25.76"
@@ -45,5 +44,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -34,7 +34,6 @@
"@types/lodash-es": "^4.17.12",
"lit": "^3.2.0",
"lodash-es": "^4.17.23",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"simple-xml-to-json": "^1.2.2",
"yjs": "^13.6.27",
@@ -51,5 +50,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -30,7 +30,6 @@
"@types/lodash-es": "^4.17.12",
"lit": "^3.2.0",
"lodash-es": "^4.17.23",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"yjs": "^13.6.27",
"zod": "^3.25.76"
@@ -45,5 +44,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -27,7 +27,6 @@
"@types/lodash-es": "^4.17.12",
"lit": "^3.2.0",
"lodash-es": "^4.17.23",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"yjs": "^13.6.27",
"zod": "^3.25.76"
@@ -45,5 +44,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -28,7 +28,6 @@
"@types/lodash-es": "^4.17.12",
"lit": "^3.2.0",
"lodash-es": "^4.17.23",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"yjs": "^13.6.27",
"zod": "^3.25.76"
@@ -44,5 +43,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -29,7 +29,6 @@
"@types/lodash-es": "^4.17.12",
"lit": "^3.2.0",
"lodash-es": "^4.17.23",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"yjs": "^13.6.27",
"zod": "^3.25.76"
@@ -44,5 +43,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -27,7 +27,6 @@
"@types/lodash-es": "^4.17.12",
"lit": "^3.2.0",
"lodash-es": "^4.17.23",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"yjs": "^13.6.27",
"zod": "^3.25.76"
@@ -43,5 +42,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -25,5 +25,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -42,5 +42,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -47,5 +47,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -50,5 +50,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -44,5 +44,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -42,5 +42,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -56,5 +56,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -43,5 +43,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -30,5 +30,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -41,5 +41,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -39,7 +39,6 @@
"micromark-extension-gfm-table": "^2.1.0",
"micromark-extension-gfm-task-list-item": "^2.1.0",
"micromark-util-combine-extensions": "^2.0.0",
"minimatch": "^10.1.1",
"pdfmake": "^0.2.20",
"quick-lru": "^7.3.0",
"rehype-parse": "^9.0.0",
@@ -77,5 +76,5 @@
"@types/pdfmake": "^0.2.12",
"vitest": "^3.2.4"
},
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -21,12 +21,24 @@ const imageProxyMiddlewareBuilder = () => {
};
};
const IMAGE_PROXY_PATH = '/api/worker/image-proxy';
export const isImageProxyURL = (imageUrl: string) => {
try {
const url = new URL(imageUrl, globalThis.location.origin);
return url.pathname === IMAGE_PROXY_PATH && url.searchParams.has('url');
} catch {
return false;
}
};
const defaultImageProxyMiddlewarBuilder = imageProxyMiddlewareBuilder();
export const setImageProxyMiddlewareURL = defaultImageProxyMiddlewarBuilder.set;
export const defaultImageProxyMiddleware =
defaultImageProxyMiddlewarBuilder.get();
export const defaultImageProxyMiddleware: TransformerMiddleware = args => {
return defaultImageProxyMiddlewarBuilder.get()(args);
};
// TODO(@mirone): this should be configured when setup instead of runtime
export class ImageProxyService extends StoreExtension {
@@ -40,7 +52,7 @@ export class ImageProxyService extends StoreExtension {
}
buildUrl(imageUrl: string) {
if (imageUrl.startsWith(this.imageProxyURL)) {
if (imageUrl.startsWith(this.imageProxyURL) || isImageProxyURL(imageUrl)) {
return imageUrl;
}

View File

@@ -31,7 +31,6 @@
"@types/lodash-es": "^4.17.12",
"lit": "^3.2.0",
"lodash-es": "^4.17.23",
"minimatch": "^10.1.1",
"rxjs": "^7.8.2",
"zod": "^3.25.76"
},
@@ -45,5 +44,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -34,5 +34,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -36,5 +36,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -40,5 +40,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -38,5 +38,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -36,5 +36,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -34,5 +34,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -55,5 +55,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -43,5 +43,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -37,5 +37,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -37,5 +37,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -35,5 +35,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -30,5 +30,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -36,5 +36,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -38,5 +38,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -20,6 +20,7 @@ import {
} from '@blocksuite/affine-shared/services';
import { unsafeCSSVar, unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';
import { matchModels } from '@blocksuite/affine-shared/utils';
import { IS_MOBILE } from '@blocksuite/global/env';
import {
Bound,
getCommonBound,
@@ -109,6 +110,17 @@ export class AffineToolbarWidget extends WidgetComponent {
}
}
editor-toolbar[data-mobile='true'] {
position: fixed;
top: auto;
left: 50%;
bottom: 16px;
transform: translateX(-50%);
max-width: calc(100vw - 32px);
overflow-x: auto;
touch-action: pan-x;
}
${unsafeCSS(darkToolbarStyles('editor-toolbar'))}
${unsafeCSS(lightToolbarStyles('editor-toolbar'))}
`;
@@ -268,9 +280,110 @@ export class AffineToolbarWidget extends WidgetComponent {
const { flags, flavour$, message$, placement$ } = toolbarRegistry;
const context = new ToolbarContext(std);
// TODO(@fundon): fix toolbar position shaking when the wheel scrolls
// document.body.append(toolbar);
this.shadowRoot!.append(toolbar);
const isNativeTextSelection = () => {
const dbSel = std.selection.find(DatabaseSelection);
const dbViewSel = dbSel?.viewSelection;
if (
dbViewSel &&
((dbViewSel.selectionType === 'area' && dbViewSel.isEditing) ||
(dbViewSel.selectionType === 'cell' && dbViewSel.isEditing))
) {
return true;
}
const tableViewSelection = std.selection.find(TableSelection)?.data;
return tableViewSelection?.type === 'area';
};
let updateMobilePosition: (() => void) | null = null;
if (IS_MOBILE) {
toolbar.dataset.mobile = 'true';
this.shadowRoot!.append(toolbar);
// Position toolbar above virtual keyboard using Visual Viewport API
updateMobilePosition = () => {
const vv = window.visualViewport;
if (!vv) return;
const keyboardHeight = window.innerHeight - vv.height - vv.offsetTop;
toolbar.style.bottom = `${Math.max(16, keyboardHeight + 16)}px`;
};
if (window.visualViewport) {
disposables.addFromEvent(
window.visualViewport,
'resize',
updateMobilePosition
);
disposables.addFromEvent(
window.visualViewport,
'scroll',
updateMobilePosition
);
}
// Keep mobile selection in sync with toolbar flags. On some mobile browsers,
// long-press selection may skip the std selection stream intermittently.
const syncMobileTextSelection = () => {
if (!context.activated) {
flags.toggle(Flag.Text, false);
return;
}
if (isNativeTextSelection()) {
flags.toggle(Flag.Text, false);
return;
}
const selection = window.getSelection();
const hasSelection =
selection &&
selection.rangeCount > 0 &&
!selection.isCollapsed &&
selection.toString().length > 0;
const range = hasSelection ? selection.getRangeAt(0) : null;
const inEditor = Boolean(
range && host.contains(range.commonAncestorContainer)
);
batch(() => {
flags.toggle(Flag.Text, inEditor);
if (!inEditor || !range) return;
this.setReferenceElementWithRange(range);
sideOptions$.value = null;
flavour$.value = 'affine:note';
placement$.value = toolbarRegistry.getModulePlacement('affine:note');
flags.refresh(Flag.Text);
});
};
let selectionTimeout: ReturnType<typeof setTimeout> | null = null;
let touchTimeout: ReturnType<typeof setTimeout> | null = null;
const scheduleSyncMobileTextSelection = (delay: number) => {
if (selectionTimeout) clearTimeout(selectionTimeout);
selectionTimeout = setTimeout(syncMobileTextSelection, delay);
};
const scheduleTouchSync = (delay: number) => {
if (touchTimeout) clearTimeout(touchTimeout);
touchTimeout = setTimeout(syncMobileTextSelection, delay);
};
disposables.addFromEvent(document, 'selectionchange', () => {
scheduleSyncMobileTextSelection(50);
});
disposables.addFromEvent(host, 'touchend', () => {
scheduleTouchSync(100);
});
disposables.add(() => {
if (selectionTimeout) clearTimeout(selectionTimeout);
if (touchTimeout) clearTimeout(touchTimeout);
});
// Ensures a stable initial offset before the first viewport event arrives.
updateMobilePosition?.();
} else {
this.shadowRoot!.append(toolbar);
}
// Formatting
// Selects text in note.
@@ -305,30 +418,12 @@ export class AffineToolbarWidget extends WidgetComponent {
disposables.addFromEvent(document, 'selectionchange', () => {
const range = std.range.value ?? null;
let activated = context.activated && Boolean(range && !range.collapsed);
let isNative = false;
if (activated) {
const result = std.selection.find(DatabaseSelection);
const viewSelection = result?.viewSelection;
if (viewSelection) {
isNative =
(viewSelection.selectionType === 'area' &&
viewSelection.isEditing) ||
(viewSelection.selectionType === 'cell' && viewSelection.isEditing);
}
if (!isNative) {
const result = std.selection.find(TableSelection);
const viewSelection = result?.data;
if (viewSelection) {
isNative = viewSelection.type === 'area';
}
}
activated = isNativeTextSelection();
}
batch(() => {
activated &&= isNative;
// Focues outside: `doc-title`
if (
flags.check(Flag.Text) &&
@@ -662,6 +757,14 @@ export class AffineToolbarWidget extends WidgetComponent {
disposables.add(
effect(() => {
if (IS_MOBILE) {
const value = flags.value$.value;
if (!context.activated) return;
if (Flag.None === value || flags.contains(Flag.Hiding, value)) return;
updateMobilePosition?.();
return;
}
if (!abortController.signal.aborted) {
abortController.abort();
}

View File

@@ -35,5 +35,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -17,5 +17,5 @@
"dependencies": {
"@blocksuite/affine": "workspace:*"
},
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -64,5 +64,5 @@
"devDependencies": {
"vitest": "^3.2.4"
},
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -47,5 +47,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -19,7 +19,7 @@
"lodash.clonedeep": "^4.5.0",
"lodash.ismatch": "^4.4.0",
"lodash.merge": "^4.6.2",
"minimatch": "^10.1.1",
"minimatch": "^10.2.2",
"nanoid": "^5.1.6",
"rxjs": "^7.8.2",
"y-protocols": "^1.0.6",
@@ -42,5 +42,5 @@
"!dist/__tests__",
"shim.d.ts"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -33,5 +33,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -46,5 +46,5 @@
"vite-plugin-wasm": "^3.5.0",
"vitest": "^3.2.4"
},
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -46,5 +46,5 @@
"vite-plugin-wasm": "^3.5.0",
"vite-plugin-web-components-hmr": "^0.1.3"
},
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -7,9 +7,9 @@
"dev": "nodemon --exec 'typedoc --options ../../typedoc.json' & serve dist/"
},
"devDependencies": {
"nodemon": "^3.1.11",
"serve": "^14.2.4",
"typedoc": "^0.28.15"
"nodemon": "^3.1.14",
"serve": "^14.2.5",
"typedoc": "^0.28.17"
},
"nodemonConfig": {
"watch": [
@@ -19,5 +19,5 @@
],
"ext": "ts,md,json"
},
"version": "0.26.1"
"version": "0.26.3"
}

View File

@@ -1,6 +1,6 @@
{
"name": "@affine/monorepo",
"version": "0.26.1",
"version": "0.26.3",
"private": true,
"author": "toeverything",
"license": "MIT",
@@ -86,8 +86,7 @@
"oxlint": "^1.47.0",
"prettier": "^3.7.4",
"semver": "^7.7.3",
"serve": "^14.2.4",
"typescript": "^5.7.2",
"typescript": "^5.9.3",
"typescript-eslint": "^8.55.0",
"unplugin-swc": "^1.5.9",
"vite": "^7.2.7",

View File

@@ -1,6 +1,6 @@
{
"name": "@affine/server-native",
"version": "0.26.1",
"version": "0.26.3",
"engines": {
"node": ">= 10.16.0 < 11 || >= 11.8.0"
},

View File

@@ -1,7 +1,7 @@
{
"name": "@affine/server",
"private": true,
"version": "0.26.1",
"version": "0.26.3",
"description": "Affine Node.js server",
"type": "module",
"bin": {
@@ -72,7 +72,7 @@
"@prisma/client": "^6.6.0",
"@prisma/instrumentation": "^6.7.0",
"@queuedash/api": "^3.16.0",
"@react-email/components": "0.0.38",
"@react-email/components": "^0.5.7",
"@socket.io/redis-adapter": "^8.3.0",
"ai": "^5.0.118",
"bullmq": "^5.40.2",
@@ -96,9 +96,7 @@
"is-mobile": "^5.0.0",
"jose": "^6.1.3",
"jsonwebtoken": "^9.0.3",
"keyv": "^5.2.2",
"lodash-es": "^4.17.23",
"mixpanel": "^0.18.0",
"mustache": "^4.2.0",
"nanoid": "^5.1.6",
"nest-commander": "^3.15.0",
@@ -128,6 +126,7 @@
"@faker-js/faker": "^10.1.0",
"@nestjs/swagger": "^11.2.0",
"@nestjs/testing": "patch:@nestjs/testing@npm%3A10.4.15#~/.yarn/patches/@nestjs-testing-npm-10.4.15-d591a1705a.patch",
"@react-email/preview-server": "^4.3.2",
"@types/cookie-parser": "^1.4.8",
"@types/express": "^5.0.1",
"@types/express-serve-static-core": "^5.0.6",
@@ -135,7 +134,6 @@
"@types/http-errors": "^2.0.4",
"@types/jsonwebtoken": "^9.0.9",
"@types/lodash-es": "^4.17.12",
"@types/mixpanel": "^2.14.9",
"@types/mustache": "^4.2.5",
"@types/node": "^22.0.0",
"@types/nodemailer": "^7.0.0",
@@ -147,13 +145,12 @@
"@types/supertest": "^6.0.2",
"ava": "^6.4.0",
"c8": "^10.1.3",
"nodemon": "^3.1.11",
"react-email": "4.0.11",
"nodemon": "^3.1.14",
"react-email": "^4.3.2",
"sinon": "^21.0.1",
"socket.io-client": "^4.8.3",
"supertest": "^7.1.4",
"ts-node": "^10.9.2",
"typescript": "^5.7.2",
"typescript": "^5.9.3",
"why-is-node-running": "^3.2.2"
},
"nodemonConfig": {

View File

@@ -342,7 +342,6 @@ await prunePrismaEngines(APP_ROOT, targetKey);
await Promise.all([
rmrf(path.join(APP_ROOT, 'node_modules', 'typescript')).catch(() => {}),
rmrf(path.join(APP_ROOT, 'node_modules', 'ts-node')).catch(() => {}),
rmrf(path.join(APP_ROOT, 'node_modules', '@types')).catch(() => {}),
rmrf(path.join(APP_ROOT, 'src')).catch(() => {}),
rmrf(path.join(APP_ROOT, '.gitignore')).catch(() => {}),

View File

@@ -141,7 +141,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro/magic-link?token=123456&amp;email=test@test.com"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -281,7 +281,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro/magic-link?token=123456&amp;email=test@test.com"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -389,7 +389,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -478,7 +478,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -585,7 +585,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -692,7 +692,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -783,7 +783,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -944,7 +944,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -1043,7 +1043,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -1210,7 +1210,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -1572,7 +1572,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -1666,7 +1666,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -1761,7 +1761,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -1865,7 +1865,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -1964,7 +1964,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -2065,7 +2065,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -2179,7 +2179,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -2295,7 +2295,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -2482,7 +2482,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -2584,7 +2584,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊
@@ -2755,7 +2755,7 @@ Generated by [AVA](https://avajs.dev).
<tr style="width:100%">␊
<a␊
href="https://app.affine.pro"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px;padding-top:8px;padding-right:18px;padding-bottom:8px;padding-left:18px"␊
target="_blank"␊
><span␊
><!--[if mso␊

View File

@@ -2,8 +2,8 @@ import test from 'ava';
import { createModule } from '../../../__tests__/create-module';
import { InvalidAppConfig } from '../../error';
import { ConfigFactory, ConfigModule } from '..';
import { Config } from '../config';
import { ConfigFactory, ConfigModule } from '../index';
import { override } from '../register';
const module = await createModule();

View File

@@ -8,8 +8,8 @@ import Sinon from 'sinon';
import { createTestingModule } from '../../../../__tests__/utils';
import { ConfigModule } from '../../../config';
import { metrics } from '../../../metrics';
import { JobModule, JobQueue, OnJob } from '..';
import { JobExecutor } from '../executor';
import { JobModule, JobQueue, OnJob } from '../index';
import { JobHandlerScanner } from '../scanner';
let module: TestingModule;

View File

@@ -5,7 +5,7 @@ import test from 'ava';
import { createModule } from '../../../__tests__/create-module';
import { Mockers } from '../../../__tests__/mocks';
import { Comment, CommentChangeAction } from '../../../models';
import { CommentModule } from '..';
import { CommentModule } from '../index';
import { CommentService } from '../service';
const module = await createModule({

View File

@@ -10,8 +10,8 @@ import {
type TestingModule,
} from '../../../__tests__/utils';
import { Models, User, Workspace } from '../../../models';
import { DocReader, PgWorkspaceDocStorageAdapter as Adapter } from '..';
import { DocEventsListener } from '../event';
import { DocReader, PgWorkspaceDocStorageAdapter as Adapter } from '../index';
interface Context {
module: TestingModule;

View File

@@ -7,7 +7,11 @@ import { applyUpdate, Doc as YDoc } from 'yjs';
import { createModule } from '../../../__tests__/create-module';
import { Mockers } from '../../../__tests__/mocks';
import { Models } from '../../../models';
import { DocReader, DocStorageModule, PgWorkspaceDocStorageAdapter } from '..';
import {
DocReader,
DocStorageModule,
PgWorkspaceDocStorageAdapter,
} from '../index';
import { DatabaseDocReader } from '../reader';
const module = await createModule({

View File

@@ -16,7 +16,7 @@ import {
DocReader,
DocStorageModule,
PgWorkspaceDocStorageAdapter,
} from '..';
} from '../index';
import { RpcDocReader } from '../reader';
const module = await createModule({

View File

@@ -20,7 +20,7 @@ import { FeatureModule } from '../../features';
import { MailModule } from '../../mail';
import { PermissionModule } from '../../permission';
import { StorageModule } from '../../storage';
import { NotificationModule } from '..';
import { NotificationModule } from '../index';
import { NotificationService } from '../service';
const module = await createModule({

View File

@@ -8,8 +8,8 @@ import {
WorkspaceMemberStatus,
WorkspaceRole,
} from '../../../models';
import { PermissionModule } from '..';
import { DocAccessController } from '../doc';
import { PermissionModule } from '../index';
import { DocRole, mapDocRoleToPermissions } from '../types';
let module: TestingModule;

View File

@@ -2,8 +2,8 @@ import test from 'ava';
import { createModule } from '../../../__tests__/create-module';
import { Mockers } from '../../../__tests__/mocks';
import { DocRole, PermissionModule, WorkspaceRole } from '..';
import { AccessControllerBuilder } from '../builder';
import { DocRole, PermissionModule, WorkspaceRole } from '../index';
const module = await createModule({
imports: [PermissionModule],

View File

@@ -8,7 +8,7 @@ import {
WorkspaceMemberStatus,
WorkspaceRole,
} from '../../../models';
import { PermissionModule } from '..';
import { PermissionModule } from '../index';
import { mapWorkspaceRoleToPermissions } from '../types';
import { WorkspaceAccessController } from '../workspace';

View File

@@ -6,7 +6,7 @@ import test from 'ava';
import { createModule } from '../../../__tests__/create-module';
import { Mockers } from '../../../__tests__/mocks';
import { Models } from '../../../models';
import { CommentAttachmentStorage, StorageModule } from '..';
import { CommentAttachmentStorage, StorageModule } from '../index';
const module = await createModule({
imports: [StorageModule],

View File

@@ -6,6 +6,8 @@ import { TelemetryDeduper } from './deduper';
import { Ga4Client } from './ga4-client';
import { TelemetryAck, TelemetryBatch } from './types';
const TELEMETRY_ROUTE_PATTERN = /\/api\/telemetry(?:\/|$)/;
@Injectable()
export class TelemetryService {
private readonly logger = new Logger(TelemetryService.name);
@@ -71,6 +73,13 @@ export class TelemetryService {
return false;
}
getAllowedOrigins(routePath?: string): string[] {
if (routePath && TELEMETRY_ROUTE_PATTERN.test(routePath)) {
return [...this.allowedOrigins];
}
return [];
}
async collectBatch(batch: TelemetryBatch): Promise<TelemetryAck> {
if (!batch || batch.schemaVersion !== 1 || !Array.isArray(batch.events)) {
return {

View File

@@ -1,4 +1,5 @@
import { render as rawRender } from '@react-email/components';
import { type ComponentType, createElement, type ReactElement } from 'react';
import { Comment, CommentMention, Mention } from './docs';
import {
@@ -40,16 +41,14 @@ type EmailContent = {
html: string;
};
function render(component: React.ReactElement) {
return rawRender(component, {
pretty: env.testing,
});
function render(component: ReactElement) {
return rawRender(component, { pretty: env.testing });
}
type Props<T> = T extends React.ComponentType<infer P> ? P : never;
type Props<T> = T extends ComponentType<infer P> ? P : never;
export type EmailRenderer<Props> = (props: Props) => Promise<EmailContent>;
function make<T extends React.ComponentType<any>>(
function make<T extends ComponentType<any>>(
Component: T,
subject: string | ((props: Props<T>) => string)
): EmailRenderer<Props<T>> {
@@ -60,7 +59,7 @@ function make<T extends React.ComponentType<any>>(
}
return {
subject: typeof subject === 'function' ? subject(props) : subject,
html: await render(<Component {...props} />),
html: await render(createElement(Component, props)),
};
};
}

View File

@@ -4,7 +4,7 @@ import test from 'ava';
import { createModule } from '../../__tests__/create-module';
import { Mockers } from '../../__tests__/mocks';
import { Due } from '../../base';
import { Models } from '..';
import { Models } from '../index';
const module = await createModule();
const models = module.get(Models);

Some files were not shown because too many files have changed in this diff Show More