Compare commits

...

209 Commits

Author SHA1 Message Date
fengmk2
5599c39e97 feat(server): add read doc tool (#12811)
close AI-186















#### PR Dependency Tree


* **PR #12811** 👈

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

- **New Features**
- Added a new tool enabling users to read document content and metadata
within a workspace, with enforced access control.
- **Improvements**
- Updated tool interfaces and outputs to support the document reading
functionality seamlessly.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-30 03:37:34 +00:00
EYHN
6b2639cbbb fix(ios): fix xcode marketing version (#12963)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved version handling to ensure only the main version number is
used, ignoring any suffixes after a hyphen when updating the iOS
marketing version.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-30 03:35:45 +00:00
Richard Lora
82b3c0d264 feat(core): add allowGuestDemoWorkspace flag to force login (#12779)
https://github.com/user-attachments/assets/41a659c9-6def-4492-be8e-5910eb148d6f

This PR enforces login‑first access (#8716) by disabling or enabling the
guest demo workspace via Admin Server Client Page and redirecting
unauthenticated users straight to `/sign‑in`.

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

* **New Features**
* Added a configuration option to control whether guest users can create
demo workspaces.
* Updated server and client interfaces, GraphQL schema, and queries to
support the new guest demo workspace flag.

* **Bug Fixes**
* Improved sign-out behavior to redirect users appropriately based on
guest demo workspace permissions.
* Enhanced navigation flow to handle guest demo workspace access and
user authentication state.

* **Tests**
* Added tests to verify sign-out logic when guest demo workspaces are
enabled or disabled.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: liuyi <forehalo@gmail.com>
Co-authored-by: fengmk2 <fengmk2@gmail.com>
2025-06-29 14:17:18 +00:00
Wu Yue
a4680d236d fix(core): ai make it real ci timeout (#12954)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Refactor**
* Replaced the boolean flag for selecting AI workflow endpoints with a
clear and flexible enum, enhancing clarity and maintainability for
AI-powered features.

* **Tests**
  * Simplified example text in AI action tests to improve consistency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>
2025-06-28 12:56:12 +00:00
github-actions[bot]
f88e1dffb6 chore(i18n): sync translations (#12604)
New Crowdin translations by [Crowdin GH
Action](https://github.com/crowdin/github-action)

Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
Co-authored-by: fengmk2 <fengmk2@gmail.com>
2025-06-28 09:00:17 +00:00
fengmk2
e773930256 feat(server): add comment-attachment model (#12909)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Introduced support for comment attachments, allowing users to add,
view, and manage attachments linked to comments within documents.
* **Tests**
* Added comprehensive tests to ensure correct behavior for adding,
updating, deleting, listing, and retrieving comment attachments.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->


#### PR Dependency Tree


* **PR #12909** 👈
  * **PR #12911**
    * **PR #12761**
      * **PR #12924**
        * **PR #12925**

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)
2025-06-28 08:45:24 +00:00
DarkSky
1c1dade2d5 feat(server): add morph doc edit tool (#12789)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced support for the Morph provider in the copilot module,
enabling integration with the Morph LLM API.
- Added a new document editing tool that allows users to propose and
apply edits to existing documents via AI assistance.
- **Configuration**
- Added configuration options for the Morph provider in both backend and
admin interfaces.
- **Enhancements**
- Expanded tool support to include document editing capabilities within
the copilot feature set.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-28 08:27:08 +00:00
fengmk2
e2a799c70a feat(server): comment model (#12760)
close CLOUD-226

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

- **New Features**
- Introduced support for comments and replies within workspaces and
documents, enabling users to create, update, delete, and resolve
comments, as well as manage threaded replies.
- **Bug Fixes**
- Added user-friendly error messages and handling for situations where
comments or replies are not found.
- **Tests**
- Added comprehensive tests to ensure correct behavior of comment and
reply operations.
- **Localization**
  - Added English translations for new comment and reply error messages.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->














#### PR Dependency Tree


* **PR #12760** 👈
  * **PR #12909**
    * **PR #12911**
      * **PR #12761**
        * **PR #12924**
          * **PR #12925**

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)
2025-06-28 08:01:53 +00:00
DarkSky
9b881eb59a feat(server): faster reranking based on confidence (#12957)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Improved document reranking with a more streamlined and accurate
scoring system.
* Enhanced support for binary ("yes"/"no") document relevance judgments.

* **Improvements**
* Simplified user prompts and output formats for reranking tasks, making
results easier to interpret.
  * Increased reliability and consistency in document ranking results.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-28 03:41:53 +00:00
DarkSky
e6f91cced6 feat(server): remove context prefetch & integrate context search (#12956)
fix AI-173
2025-06-27 23:45:49 +08:00
Cats Juice
ad306edcf1 fix(core): persist right sidebar open state correctly for desktop (#12953)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Improved the method for updating the right sidebar's open state to
enhance maintainability. No visible changes to end-user functionality.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-27 09:57:30 +00:00
fengmk2
dc55518c5b feat(server): support multiple hosts in one deployment (#12950)
close CLOUD-233



#### PR Dependency Tree


* **PR #12950** 👈

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

* **New Features**
* Added support for configuring multiple server hosts across backend and
frontend settings.
* Enhanced deployment and Helm chart configuration to allow specifying
multiple ingress hosts.
* Updated admin and configuration interfaces to display and manage
multiple server hosts.

* **Improvements**
* Improved URL generation, OAuth, and worker service logic to
dynamically handle requests from multiple hosts.
  * Enhanced captcha verification to support multiple allowed hostnames.
* Updated frontend logic for platform-specific server base URLs and
allowed origins, including Apple app domains.
  * Expanded test coverage for multi-host scenarios.

* **Bug Fixes**
* Corrected backend logic to consistently use dynamic base URLs and
origins based on request host context.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-27 09:41:37 +00:00
Cats Juice
5c45c66ce8 fix(core): correct workspace selector position in sidebar fallback (#12945)
- prevent drag-handle being clipped in header

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

## Summary by CodeRabbit

* **Style**
* Reduced horizontal padding and header height in the app sidebar
fallback view for a more compact layout.
* Updated header padding in the workbench view and introduced
conditional left padding based on sidebar switch visibility.

* **Refactor**
* Simplified and centralized the logic for displaying the sidebar
switch, improving code clarity and maintainability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-27 07:47:55 +00:00
Lakr
9a1ce2ba3c chore: define view model (#12949)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Introduced a chat interface with message list, empty state view, and
support for user, assistant, and system messages.
* Added a chat manager for session and message handling, including
session creation, message sending, and error management.
* Implemented various chat cell types (attachments, context references,
workflow status, loading, and error cells) with corresponding data
models and view models.
* Enabled asynchronous message sending from the input box with error
alerts and automatic session creation.
* Added workflow and context-related models for advanced chat features.

* **Enhancements**
* Improved UI responsiveness with table view updates and dynamic empty
state handling.
  * Provided a method to clear all attachments in the input box.

* **Bug Fixes / Style**
* Refined code formatting, access control, and minor stylistic
improvements across multiple files for consistency.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-27 06:36:37 +00:00
Peng Xiao
f80b69273f feat(editor): allow embedding any iframes (#12895)
fix BS-3606




#### PR Dependency Tree


* **PR #12892**
  * **PR #12895** 👈

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

* **New Features**
* Introduced support for embedding generic iframes with customizable
dimensions and permissions, while ensuring only secure, non-AFFiNE URLs
are allowed.
* Enhanced embedding options by prioritizing custom embed blocks over
iframe blocks for a richer embedding experience across toolbars and link
actions.
* Added URL validation to support secure and flexible embedding
configurations.

* **Bug Fixes**
* Improved iframe embedding reliability by removing restrictive HTTP
headers and certain Content Security Policy directives that could block
iframe usage in the Electron app.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-27 04:49:54 +00:00
Peng Xiao
ec66b6d660 fix(electron): adjust some command line flags (#12597)
some flags are copied from vscode.
In some cases that Electron is running in HDR mode, the color toning
will be over exposed. Force using srgb to workaround this issue.

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

- **New Features**
- Improved app performance and compatibility by enabling and disabling
specific Electron features.
- Enhanced color profile handling by forcing the color profile to
"srgb".
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-27 04:16:27 +00:00
Wu Yue
a7185e419c feat(core): add ai tool call error type and ui (#12941)
<img width="775" alt="截屏2025-06-26 16 17 05"
src="https://github.com/user-attachments/assets/ed6bcae3-94af-4eb1-81e8-710f36ef5e46"
/>


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

## Summary by CodeRabbit

* **New Features**
  * Introduced a tool to crawl web pages and extract key information.
* Added a visual component to display tool call failures in the AI
interface.
* Enhanced error reporting for document and web search tools with
structured error messages.

* **Improvements**
* Updated error handling across AI tools and components for more
consistent and informative feedback.
* Default values added for tool card components to improve reliability
and display.

* **Bug Fixes**
* Improved handling of error and empty states in web crawl and web
search result displays.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-26 09:38:19 +00:00
Wu Yue
2171d1bfe2 feat(core): add ai playground feature flag and remove model switch feature flag (#12934)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Added support for the "AI Playground" experimental feature, including
new settings and localization entries.

* **Refactor**
* Renamed configuration and service references from "Model Switch" to
"Playground" across the AI chat and playground interfaces.
* Updated feature flag from "enable_ai_model_switch" to
"enable_ai_playground" for consistency.

* **Bug Fixes**
* The "Model" submenu in AI chat preferences is now always visible,
simplifying menu options.

* **Chores**
  * Removed outdated Claude model options from the chat prompt.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-26 09:04:57 +00:00
DarkSky
5e193b58c0 fix(server): allow fork empty session in playground (#12940)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved session forking by allowing sessions to be forked even when
no messages are provided, preventing unnecessary errors.
* Reduced unnecessary database operations by only updating messages when
there are messages to update.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-26 09:04:25 +00:00
EYHN
eef2e05d83 feat(ios): update code sign identity script (#12942) 2025-06-26 08:59:01 +00:00
EYHN
f3a2a75743 feat(ios): update code sign identity script (#12938)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
* Improved the iOS release workflow to include automated version setup
and code signing identity updates during the release process.
* Introduced a script to automatically update iOS project code signing
settings for enhanced reliability.
* Enhanced versioning script to update the iOS marketing version in the
project file.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-26 08:05:14 +00:00
L-Sun
a6edb6192f fix(editor): improve performence of link card render (#12937)
Close
[BS-3097](https://linear.app/affine-design/issue/BS-3607/linkdoccard-重复渲染导致卡顿)

![CleanShot 2025-06-26 at 14 58
54](https://github.com/user-attachments/assets/2787f88b-3596-4a34-a9a8-91966b83418d)


#### PR Dependency Tree


* **PR #12937** 👈

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

* **Refactor**
* Improved the handling of updates for embedded linked documents,
reducing unnecessary reloads when the document list changes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-26 07:13:15 +00:00
EYHN
320d2f5bdf feat(editor): use affine container url in preview (#12919)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Bug Fixes**
- Improved code block preview rendering to only display the preview when
appropriate, preventing unwanted previews.

- **Refactor**
- Simplified the HTML preview system by always using a secure
iframe-based approach and removing the WebContainer integration.
- Updated iframe permissions and content delivery for enhanced security
and compatibility.

- **Chores**
- Removed the "Enable Web Container" feature flag and all related
internal logic.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-26 02:50:38 +00:00
Cats Juice
ea7678f17e feat(component): new component to edit icon and name (#12921)
https://github.com/user-attachments/assets/994f7f58-bcbe-4f26-9142-282ffa5025f9



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

- **New Features**
- Introduced an icon and name editor component, allowing users to select
emoji icons and edit names within a menu popover.
- Added an emoji picker for icon selection, supporting theme adaptation.
- **Style**
- Applied new styles for the icon and name editor, including emoji
picker appearance.
- **Documentation**
- Added Storybook stories to showcase and demonstrate the new icon and
name editor component.
- **Chores**
- Added emoji-related dependencies to support emoji selection features.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-26 02:39:16 +00:00
DarkSky
06f27e8d6a feat(server): allow multiple session attach to doc (#12933)
fix AI-236
2025-06-26 02:15:31 +00:00
DarkSky
e32c9a814a feat(server): improve session modify (#12928)
fix AI-248
2025-06-25 12:02:21 +00:00
Lakr
697e0bf9ba feat: completed input box ui + ux (#12927)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced a document picker UI for embedding and selecting AFFiNE
documents, with improved search and recent document functionality.
- Added support for searching and fetching recently updated documents
within a workspace.
- Enhanced error handling for login and metadata validation during
document operations.
  - Added ability to attach documents directly from the input box.

- **Improvements**
- Refined UI animations and layout behaviors for attachment and document
picker components.
- Updated attachment and header views for clearer pluralization and
display logic.
- Improved selection indicators and search experience in the document
picker.
- Enhanced delegate handling for user actions across input and
attachment components.

- **Bug Fixes**
- Fixed progress indicators and error alerts for failed document
operations.

- **Chores**
- Updated project configuration for improved build and signing
processes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-06-25 09:54:06 +00:00
DarkSky
07ec427021 fix(server): copilot permission check (#12923)
fix AI-176
2025-06-25 17:01:58 +08:00
Peng Xiao
e00a37cd00 fix(electron): embeded youtube videos not playable (#12892)
#### PR Dependency Tree


* **PR #12892** 👈

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

- **Bug Fixes**
- Improved handling of CORS headers to ensure they are only removed for
responses from non-whitelisted domains, enhancing compatibility with
certain sites.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->


#### PR Dependency Tree


* **PR #12892** 👈
  * **PR #12895**

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)
2025-06-25 06:51:40 +00:00
Lakr
c37df9fb94 chore: made attachment header & management sheet (#12922)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced file, image, and document attachment support in the input
box, including new UI components for managing and previewing
attachments.
- Added a searchable document picker view and a file attachment header
with interactive management options.
- Enabled an attachment management controller for viewing and deleting
attachments.
- Improved image attachment bar with horizontal scrolling and removal
functionality.
- Enhanced error handling for file attachments, providing user-facing
alerts.

- **Improvements**
  - Updated attachment menus for clearer file type indications.
- Streamlined attachment handling logic and UI updates for a smoother
user experience.

- **Bug Fixes**
- Addressed error notification by replacing console logging with user
alerts when file attachment issues occur.

- **Refactor**
- Replaced and reorganized the input box view model and attachment bar
for better modularity and maintainability.

- **Chores**
- Updated asset catalogs to include new attachment icons for various
file types.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-25 05:30:00 +00:00
EYHN
aa4874a55c feat(core): use cloud indexer for search (#12899)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added enhanced error handling and user-friendly error messages in
quick search and document search menus.
  - Introduced loading state indicators for search operations.
  - Quick Search now provides explicit error feedback in the UI.

- **Improvements**
- Search and aggregation operations can now prefer remote or local
indexers based on user or system preference.
- Streamlined indexer logic for more consistent and reliable search
experiences.
- Refined error handling in messaging and synchronization layers for
improved stability.
- Enhanced error object handling in messaging for clearer error
propagation.
- Updated cloud workspace storage to always use IndexedDB locally and
CloudIndexer remotely.
- Shifted indexer operations to use synchronized indexer layer for
better consistency.
  - Simplified indexer client by consolidating storage and sync layers.
- Improved error propagation in messaging handlers by wrapping error
objects.
- Updated document search to prioritize remote indexer results by
default.

- **Bug Fixes**
- Improved robustness of search features by handling errors gracefully
and preventing potential runtime issues.

- **Style**
  - Added new styles for displaying error messages in search interfaces.

- **Chores**
- Removed the obsolete "Enable Cloud Indexer" feature flag; cloud
indexer behavior is now always enabled where applicable.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-25 02:55:27 +00:00
Cats Juice
6813d84deb fix(core): adjust workspace selector style in import page (#12916)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Style**
- Updated padding for workspace selector elements to provide a more
uniform appearance.
- Adjusted container height and workspace selector width for improved
layout consistency.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-25 01:03:55 +00:00
fengmk2
f0671cf2dd fix(server): should check doc public attribute when snapshot not exists (#12913)
close CLOUD-232



#### PR Dependency Tree


* **PR #12913** 👈

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

- **Bug Fixes**
- The visibility status of documents now accurately reflects their
public status instead of always showing as private.
- **Tests**
- Added an end-to-end test to verify correct handling of the public
attribute for documents without snapshots.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-24 11:40:21 +00:00
doufa
3186fb8306 feat(electron): upgrade flatpak runtimeversion (#12025)
Close: #9577 

@electron-forge/maker-flatpak use @malept/electron-installer-flatpak for
make installer, in @malept/electron-installer-flatpak use zypak as
module to allow run Chromium based applications that require a sandbox
in a Flatpak environment.

electron-installer-flatpak add zypak module with v2021.01 as default
which may not compatible with runtimeVersion 24.08.

Add modules config in forge.config with zypak v2024.01.17 for
runtimeVersion 24.08 to override the default zypak version.

The flatpak info shows:

![flatpak-24
08](https://github.com/user-attachments/assets/8b4e2309-e420-47fd-bab1-e59e9ff7b342)


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

## Summary by CodeRabbit

- **Chores**
- Updated the Flatpak configuration for Linux, including a newer runtime
version and additional module support.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Peng Xiao <pengxiao@outlook.com>
2025-06-24 08:53:23 +00:00
liuyi
fd962b57db ci: tag candidate images with app version 2025-06-24 16:02:29 +08:00
liuyi
cece56802b ci: failed to detect new canary version 2025-06-24 15:24:12 +08:00
liuyi
9e1fa23c5e chore: bump base version 2025-06-24 14:43:39 +08:00
liuyi
8f0812ae12 ci: change canary release tag format 2025-06-24 14:38:54 +08:00
liuyi
d2a9b048ad ci: use docker buildx to release channel tag 2025-06-24 14:03:10 +08:00
Lakr
10139205b4 chore: update graphql support for fetching initial user status (#12905)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced a new context management system for intelligent features,
enabling the collection and preparation of metadata from both web view
and GraphQL sources.
- Added a service for managing GraphQL API interactions, including user,
workspace, subscription, and quota queries.
- Enabled searching documents within a workspace using a new GraphQL
query and input structure.

- **Enhancements**
- Expanded chat session and chat history search capabilities with
additional filter and pagination options.

- **Refactor**
- Replaced the previous context management class with a more
comprehensive and modular implementation.
- Improved handling of cookies for network requests to ensure session
continuity.

- **Style**
- Minor code style and formatting improvements for clarity and
consistency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-24 05:03:35 +00:00
Wu Yue
63de20c3d5 feat(core): support objects render in ai chat block (#12906)
Close [AI-195](https://linear.app/affine-design/issue/AI-195)


<img width="1219" alt="截屏2025-06-24 10 55 18"
src="https://github.com/user-attachments/assets/8c54ad41-2bbf-443a-a41a-9cea9aede7b4"
/>


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

- **New Features**
- Introduced a new component to render various AI stream objects within
chat messages, supporting richer content types like reasoning blocks and
tool calls.

- **Improvements**
- Enhanced chat message rendering by consolidating message properties
into a single object and simplifying component interfaces.
- Improved scrolling behavior with smooth, throttled scrolling and
better synchronization with chat status.
- Updated chat history and streaming updates to use immutable data
handling for more reliable message updates.
- Refined rendering keys and content merging for more accurate display
of streamed AI responses.
- Improved handling and display of tool results and web search/crawl
outputs.

- **Bug Fixes**
- Ensured consistent presence of attachments and streaming objects in
chat message data.
- Enhanced parsing and merging of streamed AI responses for better
message accuracy.

- **Refactor**
- Streamlined imports, component registrations, and internal message
handling for maintainability.
- Updated type definitions to support new optional message properties
and improve compatibility.

- **Style**
- Adjusted layout by moving history clear controls for a more intuitive
chat interface.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-24 05:03:11 +00:00
Cats Juice
616e755dde fix(core): center align user avatar in doc property (#12908)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Added an option to center-align user labels in components displaying
user information, improving visual alignment of avatars and usernames.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-24 05:01:56 +00:00
Peng Xiao
4e6f40b30e chore(electron): update icons (#12907) 2025-06-24 05:01:18 +00:00
Cats Juice
8754d1b164 feat(core): limit visible doc inline stack tags (#12647)
![CleanShot 2025-05-29 at
18.06.32@2x.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/LakojjjzZNf6ogjOVwKE/09538910-0577-48cc-9532-53591d76f759.png)



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

## Summary by CodeRabbit

- **New Features**
- Tag lists now display a maximum of three tags, with an additional "+N
Tags" indicator if more tags are present.
- The "+N Tags" indicator label is localized based on your language
settings.

- **Style**
  - Improved spacing for the "+N Tags" indicator in tag lists.

- **Bug Fixes**
- Icons in certain property views are now only shown when available,
preventing empty icon placeholders.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-24 03:08:32 +00:00
Cats Juice
d743082d83 fix(mobile): change mobile docs display config and prevent opening doc when close menu (#12903)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Improvements**
- Updated document explorer to hide quick favorite and document icons,
and display more detailed system properties for each document.
- Enhanced link behavior in the workbench to prevent unintended clicks
from triggering navigation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-24 02:17:57 +00:00
L-Sun
1686b92adb fix(editor): middle click open new tab (#12902)
Close
[BS-3251](https://linear.app/affine-design/issue/BS-3251/正文的inline链接,chrome中,中键开新窗口的行为丢失了)

#### PR Dependency Tree


* **PR #12902** 👈

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

- **New Features**
- Middle-clicking on links and references now opens them in a new
browser tab.
- Linux platform detection has been added for improved
environment-specific behavior.

- **Bug Fixes**
- Middle-click paste prevention is now limited to Linux environments
when the relevant setting is disabled and excludes clicks on links and
references.

- **Tests**
- Added end-to-end tests to verify that middle-clicking links opens them
in a new tab for external links, internal links, and reference
documents.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-23 12:33:51 +00:00
Richard Lora
a8c18cd631 feat(editor): streamline cell editing and navigation with improved keyboard support (#12770)
https://github.com/user-attachments/assets/6bce5fa3-fb25-4906-bef1-50d4da4a13f6

This PR addresses #12769 and improves table editing UX by making Enter
commit changes and move focus down, and Tab/Shift+Tab move focus
horizontally—matching spreadsheet-like behavior.

Typing now immediately enters edit mode for selected cells without
double-clicking.
These updates apply to both the standard and virtual table views.

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

- **New Features**
- You can now start editing a table cell by simply typing any character
while the cell is selected.
- **Improvements**
- Pressing Enter while editing a cell will exit editing and move focus
down.
- Pressing Tab or Shift-Tab while editing a cell will exit editing and
move focus right or left, respectively.
- **Tests**
- Added unit tests for table cell hotkey behaviors to ensure reliable
editing and navigation.
- **Chores**
- Introduced Vitest configuration for streamlined testing and coverage
reporting.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: L-Sun <zover.v@gmail.com>
2025-06-23 20:24:22 +08:00
Richard Lora
74106ba7c6 fix(core): persist sidebar open state and width to prevent flash on load (#12743)
https://github.com/user-attachments/assets/6b61c9f2-80bd-4f2c-943d-1fd610a69ecf

This PR change updates the sidebar initialization so it reads the open
and width values from persistent storage. This prevents the UI from
flashing open by default on startup.

Both left and right sidebars restore correctly from the last known state
from storage.

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

- **New Features**
- Sidebar and workbench panels now retain their open/closed status and
width based on your previously saved preferences, providing a more
personalized and consistent experience across sessions.
- **Tests**
- Added comprehensive tests to ensure sidebar state persistence and
behavior are reliable and consistent.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Norkz <richardlora557@gmail.com>
2025-06-23 10:46:10 +00:00
Cats Juice
4507c88792 fix(core): remove list view doc preview skeleton (#12621)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Refactor**
- Updated the document preview in the list view to remove the loading
placeholder, resulting in a simplified and cleaner display when loading
previews.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-23 10:36:46 +00:00
Cats Juice
dd1b8ff920 fix(core): show toolbar when quick select doc explorer (#12601)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Selection mode is now automatically activated when a document is
selected or deselected in the quick actions view.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-23 10:35:02 +00:00
Cats Juice
ea92e2291d fix(core): adjust new doc list filter style (#12629)
close AF-2678, AF-2677, AF-2674, AF-2655

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

- **New Features**
  - Added customizable spacing for dividers.
  - Introduced a flexible filter value menu for easier filter editing.
- Added options to control visibility of creation actions in empty
document views.

- **Improvements**
- Enhanced menu components for filter values with a more declarative and
simplified interface.
  - Improved vertical alignment in some UI containers.
  - Updated divider spacing for more consistent UI appearance.

- **Bug Fixes**
  - Menu popups for filters now appear in correct positions.

- **Removals**
- Removed support for the "zotero" integration type from integration
settings and filters.

- **Style**
  - Updated CSS for better menu positioning and alignment.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-23 10:34:00 +00:00
Cats Juice
24b205ae83 feat(mobile): add delete operation for detail page menu (#12900)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Added a "Move to Trash" option in the page header menu, allowing users
to move documents to trash with confirmation and permission checks.

- **Refactor**
- Centralized and reorganized tab-related type definitions for improved
maintainability.
  - Updated tab components to use shared constants and types.

- **Style**
- Updated menu item styling for the new trash action to indicate a
destructive operation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-23 10:33:24 +00:00
liuyi
934e377054 ci: update docker image name 2025-06-23 15:57:02 +08:00
liuyi
8d77c480e0 ci: bring ios & android canary tests back 2025-06-23 15:34:49 +08:00
fengmk2
862a50c982 fix(server): use job queue instead event on doc indexing changes (#12893)
close CLOUD-231



#### PR Dependency Tree


* **PR #12893** 👈

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

- **Refactor**
- Updated background processing for document indexing and deletion to
use a job queue system instead of event-based triggers.
- **Bug Fixes**
- Improved reliability of embedding updates and deletions by ensuring
tasks are properly queued and processed.
- **Tests**
- Adjusted tests to verify that document operations correctly trigger
job queue actions.
  
No changes to user-facing features or interface.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-23 06:56:04 +00:00
liuyi
705d2e9bbe ci: fix release workflow 2025-06-23 14:49:15 +08:00
Yii
e6d8008d4f ci: group cloud, desktop, mobile in one release workflow (#12802)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced new workflows for preparing releases, cloud deployment, and
coordinated multi-platform releases with manual approval for stable
Docker images.
- Added a reusable action to output app version, Git hash, and build
type for consistent release metadata.

- **Refactor**
- Simplified and unified input handling across workflows, requiring
explicit version and build metadata inputs.
- Updated release workflows (desktop, mobile, cloud) to use direct
inputs instead of deriving values internally.

- **Chores**
- Removed several legacy and redundant workflows, including automatic
deployment, release, label checking, auto-assign, and Helm chart
publishing.
- Deleted jobs and workflows related to self-hosted image builds, mobile
app test builds, and previous deployment processes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-23 14:30:23 +08:00
Richard Lora
e976fcfc04 docs: clarify and fix desktop build instructions (#12881)
This PR changes documentation files related to building the desktop
client app to allow other contributors to develop and test without
becoming stuck due to outdated docs.

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

- **Documentation**
- Improved build instructions for native dependencies and E2E testing,
including updated commands and clearer server startup steps.
- Enhanced desktop client app documentation with clarified build steps,
corrected artifact paths, and added Linux installation guidance.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-23 12:30:41 +08:00
Yifeng Wang
76568bae9f feat(editor): support connector dom renderer (#12505)
### TL;DR

Added DOM-based renderer for connector elements in the AFFiNE editor.

### What changed?

- Created a new DOM-based renderer for connector elements that uses SVG
for rendering
- Implemented `ConnectorDomRendererExtension` to register the DOM
renderer for connector elements
- Added support for rendering connector paths, endpoints (arrows,
triangles, circles, diamonds), stroke styles, and labels
- Registered the new DOM renderer extension in the connector view setup
- Added comprehensive tests to verify DOM rendering functionality

### How to test?

1. Enable the DOM renderer flag in the editor
2. Create connector elements between shapes or with fixed positions
3. Verify that connectors render correctly with different styles:
   - Try different stroke styles (solid, dashed)
   - Test various endpoint styles (Arrow, Triangle, Circle, Diamond)
   - Add text labels to connectors
4. Check that connectors update properly when connected elements move
5. Verify that connectors are removed when deleted

### Why make this change?

The DOM-based renderer provides an alternative to the Canvas-based
renderer, offering better accessibility and potentially improved
performance for certain use cases. This implementation allows connectors
to be rendered as SVG elements within the DOM, which can be more easily
inspected, styled with CSS, and interacted with by assistive
technologies.
2025-06-23 03:59:45 +00:00
Wu Yue
12fce1f21a feat(core): ai tools css style adjustment (#12891)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added collapsible behavior to tool result cards, allowing users to
expand or collapse detailed results.
- Footer icons are now displayed on collapsed cards, showing up to three
relevant icons for quick reference.
- Improved icon rendering ensures consistent display, including
fallbacks when favicons are missing.
- Tool result cards and chat messages now dynamically adjust to panel
width, enhancing responsive display.
- Web crawl and web search tools display favicons in result footers for
better visual context.

- **Style**
- Enhanced UI interaction with updated margins, cursor styles, and
overlapping icon visuals for a cleaner look.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-23 03:44:24 +00:00
fengmk2
011f92f7da feat(server): add search docs by keyword gql api (#12866)
close AI-220









#### PR Dependency Tree


* **PR #12866** 👈

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

- **New Features**
- Introduced a new document search capability, allowing users to search
for documents by keyword within a workspace.
- Search results include document details such as title, highlights,
creation and update timestamps, and creator/updater information.
  - Added support for limiting the number of search results returned.
- **Tests**
- Added comprehensive end-to-end and snapshot tests to ensure accuracy
and access control for the new search functionality.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-20 11:29:37 +00:00
Lakr
10e981aa6d chore: update codegen cli and apollo version on iOS (#12879)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Added support for creating new documents from markdown and retrieving
the current locale in the iOS app.
- Introduced a shell script to automate Apollo iOS code generation
tasks.

- **Improvements**
- Upgraded the Apollo iOS library to version 1.22.0 for improved
performance and compatibility.
- Enhanced metadata handling in the app to include document ID,
workspace ID, server URL, and locale.
- Improved JavaScript execution integration for document and workspace
operations.

- **Bug Fixes**
- Fixed button appearance in the input bar by setting a static corner
radius for the send button.

- **Chores**
- Removed unused dependencies and updated .gitignore entries for cleaner
project management.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-20 11:03:16 +00:00
fengmk2
e978147a16 feat(server): add doc keyword search tool (#12837)
close AI-185

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

- **New Features**
- Introduced a keyword-based document search tool, allowing users to
search for relevant documents within their workspace using keywords.
- Search results include document titles, summaries, and direct links,
enhancing document discovery and navigation.
- **Bug Fixes**
  - None.
- **Tests**
- Added new tests to verify document search by IDs and by keywords,
ensuring accurate and reliable search functionality.
- **Documentation**
  - None.
- **Chores**
- Updated configuration file organization for improved clarity; no
changes to functionality.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->








#### PR Dependency Tree


* **PR #12867**
  * **PR #12863**
    * **PR #12837** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)
2025-06-20 10:50:34 +00:00
Cats Juice
3a124b67bd feat(core): enable quick select for trash page (#12878)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enabled quick select functionality in the Trash page, allowing users
to more efficiently select multiple items.
- Improved selection mode activation when using quick select actions in
document explorer views.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-20 10:49:09 +00:00
Peng Xiao
da980876cb fix(core): iframe rendering issue for youtube videos (#12880)
#### PR Dependency Tree


* **PR #12880** 👈

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

- **Bug Fixes**
- Improved iframe preview behavior for code blocks, enabling enhanced
compatibility and resource access within previews.
- **Chores**
- Updated internal server configuration to no longer set custom
cross-origin headers during development.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-20 10:19:28 +00:00
fengmk2
62d74de810 feat(server): search docs by keywork from indexer (#12863)
#### PR Dependency Tree


* **PR #12867**
  * **PR #12863** 👈
    * **PR #12837**
    * **PR #12866**

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)
2025-06-20 09:48:30 +00:00
fengmk2
bebe4349a9 fix(server): convert date and timestamp value to Date instance (#12867)
#### PR Dependency Tree


* **PR #12867** 👈
  * **PR #12863**
    * **PR #12837**
    * **PR #12866**

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

- **New Features**
- Date fields in search results are now returned as JavaScript Date
objects instead of strings or numeric timestamps.
- **Bug Fixes**
- Improved consistency and correctness of date field types across
different search providers.
- **Tests**
- Added tests to verify that date fields are correctly returned as Date
objects.
- Updated existing test snapshots to reflect the new Date object format
for date fields.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-20 09:21:29 +00:00
DarkSky
13b64c6780 fix(server): session update check (#12877)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved validation to prevent updates to sessions with action prompts
and restrict certain updates on forked sessions.
- **Tests**
- Expanded and clarified test coverage for session updates, pinning
behavior, and session type conversions, with more explicit error
handling and validation scenarios.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-20 08:53:48 +00:00
DarkSky
c7113b0195 feat(server): add pinned & action filter for session query (#12876)
fix AI-222
2025-06-20 08:31:04 +00:00
renovate[bot]
fb250c6374 chore: bump up SnapKit/SnapKit version to from: "5.7.1" (#12873)
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [SnapKit/SnapKit](https://redirect.github.com/SnapKit/SnapKit) | minor
| `from: "5.0.1"` -> `from: "5.7.1"` |

---

### Release Notes

<details>
<summary>SnapKit/SnapKit (SnapKit/SnapKit)</summary>

###
[`v5.7.1`](https://redirect.github.com/SnapKit/SnapKit/releases/tag/5.7.1)

[Compare
Source](https://redirect.github.com/SnapKit/SnapKit/compare/5.7.0...5.7.1)

- Podspec bump with privacy manifest support via Cocoapods

###
[`v5.7.0`](https://redirect.github.com/SnapKit/SnapKit/releases/tag/5.7.0)

[Compare
Source](https://redirect.github.com/SnapKit/SnapKit/compare/5.6.0...5.7.0)

Minor release:

- Update minimum deployment targets (iOS 12.0, macOS 10.13)
- Add `PrivacyInfo.xcprivacy` for Swift PM targets, Cocoapods
unsupported due to
[#&#8203;10325](https://redirect.github.com/CocoaPods/CocoaPods/issues/10325)

Happy New Year!

###
[`v5.6.0`](https://redirect.github.com/SnapKit/SnapKit/releases/tag/5.6.0)

[Compare
Source](https://redirect.github.com/SnapKit/SnapKit/compare/5.0.1...5.6.0)

- Upgrade to syntax compatibility of Swift 5.6
- Upgrade dependency manager integrations
- Small tweaks and fixes

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/toeverything/AFFiNE).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC42MC4xIiwidXBkYXRlZEluVmVyIjoiNDAuNjAuMSIsInRhcmdldEJyYW5jaCI6ImNhbmFyeSIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-20 07:02:07 +00:00
fengmk2
c62627427c fix(server): save snapshot and delete updates in the same transaction (#12856)
close CLOUD-229



#### PR Dependency Tree


* **PR #12856** 👈

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

- **Refactor**
- Improved the internal handling of document updates and snapshots to
enhance reliability and maintainability. No changes to user-facing
features or functionality.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-20 05:23:34 +00:00
Lakr
eb5a2ffe05 chore: basic setup of v2 AI (#12864)
Co-authored-by: Hwang <hwangdev97@gmail.com>
2025-06-20 05:09:33 +00:00
fengmk2
5a87d3d9f6 fix(server): don't use global AFFiNELogger (#12871)
![image](https://github.com/user-attachments/assets/0e5d313f-e72b-436b-9f13-9f0a1cff8685)

#### PR Dependency Tree


* **PR #12871** 👈

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

- **Refactor**
- Updated internal logging mechanism to use a standard logger, resulting
in a simplified and more consistent logging approach. No changes to
user-facing features or functionality.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->


#### PR Dependency Tree


* **PR #12871** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)
2025-06-20 05:02:42 +00:00
liuyi
07328d1348 ci: add merge queue 2025-06-20 11:47:36 +08:00
fengmk2
ad5722f637 feat(server): get recently updated docs (#12861)
close AI-218



#### PR Dependency Tree


* **PR #12861** 👈

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

- **New Features**
- Added a "Recently Updated Documents" feature, allowing users to view a
paginated list of the most recently updated documents within a
workspace.
- Document metadata now includes a "title" field for easier
identification.
- **Tests**
- Introduced new end-to-end tests to verify the recently updated
documents query and its pagination behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-20 11:35:39 +08:00
fengmk2
5623d808bf fix(server): set empty embedding on empty doc (#12857)
#### PR Dependency Tree


* **PR #12857** 👈

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

- **Bug Fixes**
- Improved error handling in document embedding jobs to log and skip
errors instead of interrupting the process.
- Enhanced logging with clearer messages about embedding outcomes and
skipped operations.
- Added warnings when documents or summaries are missing during
embedding.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-20 10:30:53 +08:00
DarkSky
dfaf69475b fix(server): session unique index conflict (#12865) 2025-06-20 08:36:22 +08:00
Cats Juice
7376926553 chore(core): adjust tab height and windows control, remove input background (#12862)
close AF-2697, AF-2696

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

## Summary by CodeRabbit

- **Style**
- Made the AI chat input field background transparent for improved
visual consistency.
- Reduced the size of window app control buttons and removed extra
padding from the close button.
- Decreased the height of tabs and the width of the window app controls
placeholder for a more compact layout.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-19 20:12:40 +08:00
Wu Yue
3886babcf4 feat(core): add ai web-search and web-crawl tools ui components (#12854) 2025-06-19 19:15:46 +08:00
L-Sun
2edc8e43e2 fix(android): graphql service type error (#12858)
#### PR Dependency Tree


* **PR #12858** 👈

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

- **Refactor**
- Improved consistency in how session data is handled when starting a
Copilot session.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-19 16:22:47 +08:00
DarkSky
bd04930560 feat(server): allow chat session dangling & pin session support (#12849)
fix AI-181
fix AI-179
fix AI-178
fix PD-2682
fix PD-2683
2025-06-19 13:17:01 +08:00
fengmk2
d80bfac1d2 feat(server): parse ydoc to ai editable markdown format (#12846)
close AI-213









#### PR Dependency Tree


* **PR #12846** 👈
  * **PR #12811**

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

- **New Features**
- Introduced support for AI-editable blocks in document parsing,
allowing blocks to include metadata for AI-based editing.
  - Added rendering for todo list items with markdown checkbox syntax.
- Unsupported block types are now marked with placeholders in the parsed
output.

- **Tests**
- Added new test cases and snapshots to verify parsing behavior with
AI-editable content enabled.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-19 11:27:04 +08:00
Cats Juice
380f40ebed style(core): adjust app sidebar style (#12852)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Style**
- Adjusted layout and spacing in sidebar and quick search components for
a more compact appearance.
- Reduced header and tab heights in the desktop app, increasing main
view space.
- Updated add-page button size, padding, and font for improved
usability.
  - Refined menu positioning in workspace selector for dense layouts.
  - Improved macOS window button positioning for better alignment.
  - Updated and restructured iOS app dependencies.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: fengmk2 <fengmk2@gmail.com>
2025-06-19 10:15:42 +08:00
fengmk2
73402c8447 feat(server): parse ydoc to markdown (#12812)
close AI-190

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

- **New Features**
- Introduced an endpoint to retrieve a document's markdown content and
title.
- Added backend support for parsing document snapshots directly into
markdown format.

- **Tests**
- Added comprehensive tests and snapshot files for markdown retrieval,
including success and error scenarios.
- Improved test coverage for content type validation and markdown
parsing utilities.

- **Documentation**
- Enhanced internal documentation through detailed test cases and
snapshot references for new markdown features.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->








#### PR Dependency Tree


* **PR #12812** 👈
  * **PR #12846**
    * **PR #12811**

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)
2025-06-19 09:14:00 +08:00
Wu Yue
6169cdab3a feat(core): add stream object api (#12841)
Close [AI-193](https://linear.app/affine-design/issue/AI-193)

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

- **New Features**
- Added support for streaming structured AI chat responses as objects,
enabling richer and more interactive chat experiences.
- Chat messages now include a new field displaying structured stream
objects, such as reasoning steps, text deltas, tool calls, and tool
results.
- GraphQL APIs and queries updated to expose these structured streaming
objects in chat histories.
  - Introduced a new streaming chat endpoint for object-based responses.

- **Bug Fixes**
- Improved error handling for streaming responses to ensure more robust
and informative error reporting.

- **Refactor**
- Centralized and streamlined session preparation and streaming logic
for AI chat providers.
  - Unified streaming setup across multiple AI model providers.

- **Tests**
- Extended test coverage for streaming object responses to ensure
reliability and correctness.

- **Documentation**
- Updated type definitions and schemas to reflect new streaming object
capabilities in both backend and frontend code.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>
2025-06-19 09:13:18 +08:00
Peng Xiao
ce951ec316 feat(editor): by default render code iframe for html preview (#12848)
#### PR Dependency Tree


* **PR #12848** 👈

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

- **New Features**
- Introduced a feature flag to enable or disable web container
functionality for code block previews.
- **Improvements**
- Code block HTML previews now support an alternative rendering method
based on the new feature flag, enhancing flexibility.
- **Chores**
- Updated feature flag settings by removing an obsolete flag and adding
the new web container flag.
- **Tests**
- Simplified code block preview tests for faster and more direct
validation of HTML preview content.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-19 09:12:33 +08:00
Peng Xiao
e046260deb feat(core): allow importing affine file within import dialog (#12850) 2025-06-18 20:33:41 +08:00
DarkSky
31e65d96d4 fix(server): ci nextest (#12851)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Chores**
- Updated testing workflow to use a specific version of the testing tool
for improved consistency across jobs.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-18 20:20:00 +08:00
Peng Xiao
899ffd1ad3 feat(native): windows audio monitoring & recording (#12615)
fix AF-2692

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

- **New Features**
- Added comprehensive Windows support for audio and application capture,
including real-time microphone usage detection, combined microphone and
system audio recording, and application state monitoring.
  - The "meetings" setting is now enabled on Windows as well as macOS.
- Conditional UI styling and attributes introduced for Windows
environments in the Electron renderer.

- **Bug Fixes**
- Enhanced file path handling and validation for Windows in Electron
file requests.

- **Refactor**
- Unified application info handling across platforms by consolidating
types into a single `ApplicationInfo` structure.
- Updated native module APIs by removing deprecated types, refining
method signatures, and improving error messages.
- Streamlined audio tapping APIs to use process IDs and consistent
callback types.

- **Documentation**
- Added detailed documentation for the Windows-specific audio recording
and microphone listener modules.

- **Chores**
  - Updated development dependencies in multiple packages.
- Reorganized and added platform-specific dependencies and configuration
for Windows support.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->





#### PR Dependency Tree


* **PR #12615** 👈

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

---------

Co-authored-by: LongYinan <lynweklm@gmail.com>
2025-06-18 13:57:01 +08:00
DarkSky
c844786a7f chore(server): bump gemini to ga version (#12845)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Chores**
- Updated Gemini model identifiers from preview versions to their latest
stable versions across prompts and provider configurations. This ensures
continued compatibility and access to the latest Gemini 2.5 Flash and
Pro models. No changes to user-facing features or prompt content.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-18 12:42:19 +08:00
renovate[bot]
138c35a0f9 chore: bump up manticoresearch/manticore Docker tag to v10 (#12816)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| manticoresearch/manticore | service | major | `9.3.2` -> `10.1.0` |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/toeverything/AFFiNE).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC41MC4wIiwidXBkYXRlZEluVmVyIjoiNDAuNTAuMCIsInRhcmdldEJyYW5jaCI6ImNhbmFyeSIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: fengmk2 <fengmk2@gmail.com>
2025-06-18 09:57:55 +08:00
renovate[bot]
29826e1c1e chore: bump up happy-dom version to v18 (#12799)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [happy-dom](https://redirect.github.com/capricorn86/happy-dom) |
[`^17.0.0` ->
`^18.0.0`](https://renovatebot.com/diffs/npm/happy-dom/17.4.7/18.0.1) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/happy-dom/18.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/happy-dom/18.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/happy-dom/17.4.7/18.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/happy-dom/17.4.7/18.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>capricorn86/happy-dom (happy-dom)</summary>

###
[`v18.0.1`](https://redirect.github.com/capricorn86/happy-dom/releases/tag/v18.0.1)

[Compare
Source](https://redirect.github.com/capricorn86/happy-dom/compare/v18.0.0...v18.0.1)

##### 👷‍♂️ Patch fixes

- Addresses an issue where an error occurred if the Element ID was set
to the same name as a Window property with a null value - By
**[@&#8203;capricorn86](https://redirect.github.com/capricorn86)** in
task
[#&#8203;1841](https://redirect.github.com/capricorn86/happy-dom/issues/1841)

###
[`v18.0.0`](https://redirect.github.com/capricorn86/happy-dom/releases/tag/v18.0.0)

[Compare
Source](https://redirect.github.com/capricorn86/happy-dom/compare/v17.6.3...v18.0.0)

##### 💣 Breaking Changes

- Makes the types for Happy DOM strict - By
**[@&#8203;capricorn86](https://redirect.github.com/capricorn86)** in
task
[#&#8203;1154](https://redirect.github.com/capricorn86/happy-dom/issues/1154)
- This makes it possible to use the option `skipLibCheck` set to "false"
in the typescript configuration for projects with a strict configuration
- This change has resulted in that some types has changed and is
therefore considered as a breaking change
- `BrowserContext.close()` now throws an error when trying to close the
default context of a browser - By
**[@&#8203;capricorn86](https://redirect.github.com/capricorn86)** in
task
[#&#8203;1154](https://redirect.github.com/capricorn86/happy-dom/issues/1154)

##### 🎨 Features

- Adds support for `Browser.closed`, `BrowserContext.closed`,
`BrowserPage.closed` and `BrowserFrame.closed` - By
**[@&#8203;capricorn86](https://redirect.github.com/capricorn86)** in
task
[#&#8203;1154](https://redirect.github.com/capricorn86/happy-dom/issues/1154)
- Adds support for `VirtualConsolePrinter.close()` and
`VirtualConsolePrinter.closed` - By
**[@&#8203;capricorn86](https://redirect.github.com/capricorn86)** in
task
[#&#8203;1154](https://redirect.github.com/capricorn86/happy-dom/issues/1154)
- Adds support for `CookieContainer.clearCookies()` - By
**[@&#8203;capricorn86](https://redirect.github.com/capricorn86)** in
task
[#&#8203;1154](https://redirect.github.com/capricorn86/happy-dom/issues/1154)

###
[`v17.6.3`](https://redirect.github.com/capricorn86/happy-dom/releases/tag/v17.6.3)

[Compare
Source](https://redirect.github.com/capricorn86/happy-dom/compare/v17.6.2...v17.6.3)

##### 👷‍♂️ Patch fixes

- Removes global typescript definition that was used for custom elements
- By **[@&#8203;capricorn86](https://redirect.github.com/capricorn86)**
in task
[#&#8203;1154](https://redirect.github.com/capricorn86/happy-dom/issues/1154)

###
[`v17.6.2`](https://redirect.github.com/capricorn86/happy-dom/releases/tag/v17.6.2)

[Compare
Source](https://redirect.github.com/capricorn86/happy-dom/compare/v17.6.1...v17.6.2)

##### 👷‍♂️ Patch fixes

- Updates Typescript to the latest version - By
**[@&#8203;capricorn86](https://redirect.github.com/capricorn86)** in
task
[#&#8203;1154](https://redirect.github.com/capricorn86/happy-dom/issues/1154)

###
[`v17.6.1`](https://redirect.github.com/capricorn86/happy-dom/releases/tag/v17.6.1)

[Compare
Source](https://redirect.github.com/capricorn86/happy-dom/compare/v17.6.0...v17.6.1)

##### 🎨 Features

- Adds support for disabling validation of certificates, to allow for
self-signed certificates to be used - By
**[@&#8203;capricorn86](https://redirect.github.com/capricorn86)** in
task
[#&#8203;1763](https://redirect.github.com/capricorn86/happy-dom/issues/1763)
- Read more about the new setting `fetch.disableStrictSSL` under
[IBrowserSettings](https://redirect.github.com/capricorn86/happy-dom/wiki/IBrowserSettings)
in the Wiki

###
[`v17.6.0`](https://redirect.github.com/capricorn86/happy-dom/compare/v17.5.9...v17.6.0)

[Compare
Source](https://redirect.github.com/capricorn86/happy-dom/compare/v17.5.9...v17.6.0)

###
[`v17.5.9`](https://redirect.github.com/capricorn86/happy-dom/releases/tag/v17.5.9)

[Compare
Source](https://redirect.github.com/capricorn86/happy-dom/compare/v17.5.8...v17.5.9)

##### 👷‍♂️ Patch fixes

- Adds missing null check in `HTMLLinkElement` for a browser frame
property that becomes null during teardown of a `Window` - By
**[@&#8203;capricorn86](https://redirect.github.com/capricorn86)** in
task
[#&#8203;1800](https://redirect.github.com/capricorn86/happy-dom/issues/1800)

###
[`v17.5.8`](https://redirect.github.com/capricorn86/happy-dom/releases/tag/v17.5.8)

[Compare
Source](https://redirect.github.com/capricorn86/happy-dom/compare/v17.5.7...v17.5.8)

##### 👷‍♂️ Patch fixes

- Incorrect cache matching caused `Element.classList` to return the
wrong items - By
**[@&#8203;capricorn86](https://redirect.github.com/capricorn86)** in
task
[#&#8203;1812](https://redirect.github.com/capricorn86/happy-dom/issues/1812)

###
[`v17.5.7`](https://redirect.github.com/capricorn86/happy-dom/releases/tag/v17.5.7)

[Compare
Source](https://redirect.github.com/capricorn86/happy-dom/compare/v17.5.6...v17.5.7)

##### 👷‍♂️ Patch fixes

- Handle wider range of valid characters in unquoted attribute value
parsing - By **[@&#8203;AudunWA](https://redirect.github.com/AudunWA)**
in task
[#&#8203;1817](https://redirect.github.com/capricorn86/happy-dom/issues/1817)

###
[`v17.5.6`](https://redirect.github.com/capricorn86/happy-dom/releases/tag/v17.5.6)

[Compare
Source](https://redirect.github.com/capricorn86/happy-dom/compare/v17.5.5...v17.5.6)

##### 👷‍♂️ Patch fixes

- Removes the min and max boundary check when setting the value of an
input field of type "date" - By
**[@&#8203;zgrybus](https://redirect.github.com/zgrybus)** in task
[#&#8203;1815](https://redirect.github.com/capricorn86/happy-dom/issues/1815)

###
[`v17.5.5`](https://redirect.github.com/capricorn86/happy-dom/compare/v17.5.4...v17.5.5)

[Compare
Source](https://redirect.github.com/capricorn86/happy-dom/compare/v17.5.4...v17.5.5)

###
[`v17.5.4`](https://redirect.github.com/capricorn86/happy-dom/releases/tag/v17.5.4)

[Compare
Source](https://redirect.github.com/capricorn86/happy-dom/compare/v17.5.3...v17.5.4)

##### 👷‍♂️ Patch fixes

- Fixes issue where the body of a `ReadableStream` was locked after
being cloned - By
**[@&#8203;MarcMcIntosh](https://redirect.github.com/MarcMcIntosh)** in
task
[#&#8203;1493](https://redirect.github.com/capricorn86/happy-dom/issues/1493)

###
[`v17.5.3`](https://redirect.github.com/capricorn86/happy-dom/releases/tag/v17.5.3)

[Compare
Source](https://redirect.github.com/capricorn86/happy-dom/compare/v17.5.2...v17.5.3)

##### 👷‍♂️ Patch fixes

- Adds `previousSibling` and `nextSibling` to `MutationObserver` records
when a child is removed - By
**[@&#8203;uxuip](https://redirect.github.com/uxuip)** in task
[#&#8203;1803](https://redirect.github.com/capricorn86/happy-dom/issues/1803)

###
[`v17.5.2`](https://redirect.github.com/capricorn86/happy-dom/releases/tag/v17.5.2)

[Compare
Source](https://redirect.github.com/capricorn86/happy-dom/compare/v17.5.1...v17.5.2)

##### 👷‍♂️ Patch fixes

- Adds support for the unicode characters `«` and `»` in query selectors
used by the React 19.1 "useId" hook - By
**[@&#8203;terrymun](https://redirect.github.com/terrymun)** in task
[#&#8203;1785](https://redirect.github.com/capricorn86/happy-dom/issues/1785)

###
[`v17.5.1`](https://redirect.github.com/capricorn86/happy-dom/releases/tag/v17.5.1)

[Compare
Source](https://redirect.github.com/capricorn86/happy-dom/compare/v17.5.0...v17.5.1)

##### 👷‍♂️ Patch fixes

- Existing URL query string should be overwritten on form submit when
method is "GET" - By
**[@&#8203;rslabbert](https://redirect.github.com/rslabbert)** in task
[#&#8203;1786](https://redirect.github.com/capricorn86/happy-dom/issues/1786)

###
[`v17.5.0`](https://redirect.github.com/capricorn86/happy-dom/releases/tag/v17.5.0)

[Compare
Source](https://redirect.github.com/capricorn86/happy-dom/compare/v17.4.9...v17.5.0)

##### 🎨 Features

- Adds support for `XMLHttpRequest.overrideMimeType()` - By
**[@&#8203;maxmil](https://redirect.github.com/maxmil)** in task
[#&#8203;1782](https://redirect.github.com/capricorn86/happy-dom/issues/1782)

###
[`v17.4.9`](https://redirect.github.com/capricorn86/happy-dom/releases/tag/v17.4.9)

[Compare
Source](https://redirect.github.com/capricorn86/happy-dom/compare/v17.4.8...v17.4.9)

##### 👷‍♂️ Patch fixes

- A disabled input element should not be parsed in `FormData` - By
**[@&#8203;juandiegombr](https://redirect.github.com/juandiegombr)** in
task
[#&#8203;1790](https://redirect.github.com/capricorn86/happy-dom/issues/1790)

###
[`v17.4.8`](https://redirect.github.com/capricorn86/happy-dom/releases/tag/v17.4.8)

[Compare
Source](https://redirect.github.com/capricorn86/happy-dom/compare/v17.4.7...v17.4.8)

##### 👷‍♂️ Patch fixes

- Fixes issue where CSS variables where not being parsed in color
functions - By
**[@&#8203;hampustagerud](https://redirect.github.com/hampustagerud)**
in task
[#&#8203;1822](https://redirect.github.com/capricorn86/happy-dom/issues/1822)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/toeverything/AFFiNE).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC41MC4wIiwidXBkYXRlZEluVmVyIjoiNDAuNTAuMCIsInRhcmdldEJyYW5jaCI6ImNhbmFyeSIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: fengmk2 <fengmk2@gmail.com>
2025-06-17 22:52:01 +08:00
Peng Xiao
f4c20056a0 feat(core): moving in affine-reader doc parsers (#12840)
fix AI-191

#### PR Dependency Tree


* **PR #12840** 👈

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

- **New Features**
- Introduced the ability to convert rich text documents into Markdown,
supporting a wide range of content types such as headings, lists,
tables, images, code blocks, attachments, and embedded documents.
- Added support for parsing collaborative document structures and
rendering them as structured Markdown or parsed representations.
- Enhanced handling of database and table blocks, including conversion
to Markdown tables with headers and cell content.

- **Documentation**
  - Added a README noting the use of a forked Markdown converter.

- **Tests**
  - Added new test coverage for document parsing features.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->


#### PR Dependency Tree


* **PR #12840** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)
2025-06-17 16:32:11 +08:00
Cats Juice
dfe4c22a75 feat(core): linked doc visiblity setting and new sidebar layout (#12836)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added a setting to control the visibility of linked document
structures in the sidebar, enabled by default.
- Introduced a "dense" mode for workspace selectors and cards, providing
a more compact display.

- **Improvements**
- Refined sidebar and navigation panel layouts with updated padding,
spacing, and avatar/button sizing for a cleaner and more consistent
appearance.
- Enhanced sidebar appearance settings UI, including new localization
for the linked doc visibility option.
- Updated color theming and spacing in sidebar menu items and quick
search input for better usability.
- Enabled collapsible behavior control for navigation panel tree nodes,
improving user interaction flexibility.

- **Style**
- Adjusted various component styles for improved compactness and
alignment across the sidebar and navigation panels.
- Reduced sizes and padding of buttons and icons for a tidier interface.
- Updated CSS variables and dynamic sizing for workspace cards to
support dense mode.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-17 16:09:34 +08:00
L-Sun
ba718b955a fix(editor): unexpectedly update edgeless note in readonly mode (#12839)
#### PR Dependency Tree


* **PR #12839** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)
2025-06-17 15:42:47 +08:00
DarkSky
09c3aa0a92 chore(server): improve semantic search (#12838)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Updated document-related tools in chat prompts, including new options
for document keyword and semantic search.

- **Refactor**
- Renamed and reorganized document search tools for improved clarity in
tool selection and results display.

- **Bug Fixes**
- Ensured tool identifiers and results are consistent across chat and
search features.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-17 15:01:02 +08:00
Yii
a4d929b19c ci: remove graphite pre check (#12834)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Chores**
- Updated the CI workflow by removing the "optimize_ci" job and all
related dependencies and conditions. All remaining jobs now run
unconditionally.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-17 13:37:10 +08:00
EYHN
c1691157f9 feat(core): enable socket cors (#12823)
fix android & ios selfhost syncing

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

## Summary by CodeRabbit

- **Bug Fixes**
- Improved WebSocket connection compatibility by enabling cross-origin
requests with credentials and restricting allowed HTTP methods to GET
and POST.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: fengmk2 <fengmk2@gmail.com>
2025-06-17 09:40:08 +08:00
Cats Juice
2366c1aba6 feat(core): adjust the layout, style, and structure of the AI chat input (#12828)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Added support for image uploads in the chat panel, including upload
limits and user feedback when limits are exceeded.
- Introduced a unified chat input preference menu for selecting AI
models, toggling extended thinking, and enabling web search.
- Menu buttons and menus now support test identifiers for improved
testing.

- **Improvements**
- Updated chat input UI with enhanced styling, consolidated controls,
and simplified feature toggling.
  - Improved layout and spacing for chat chips and image preview grids.
  - Chat abort icon now adapts to the current color theme.

- **Refactor**
- Replaced the separate AI model selection component with the new chat
input preference menu.
- Streamlined imports and custom element registrations for chat input
preferences.

- **Tests**
- Enhanced test utilities to support the new chat input preference menu
interactions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-17 09:26:29 +08:00
DarkSky
cdaaa52845 feat(server): embedding search tool (#12810) 2025-06-17 09:22:56 +08:00
Mirone
0785438cfe docs(editor): add typedoc for schema module (#12830)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Documentation**
- Added comprehensive documentation for the `Schema` class, detailing
its methods, properties, and usage.
- Improved formatting and linking in the documentation for the `Store`
class, enhancing clarity and navigation.
- Updated the README to include a direct link to the new `Schema` class
documentation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-16 22:24:40 +08:00
Mirone
8f5851e8bf chore: disable code block html preview (#12829)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Chores**
- Updated the default setting for the code block HTML preview feature
flag; it is now disabled by default. This change affects only
experimental builds.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: L-Sun <zover.v@gmail.com>
2025-06-16 21:28:42 +08:00
Aadi
1fb68e3933 fix(editor): filterableList - prevent undefined item selection in keyboard nav (#12818)
Fixes error in FilterableList when pressing Enter on empty search
results.


![image](https://github.com/user-attachments/assets/3929c7ab-b20e-40d9-bc3d-808762ada8f3)


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

## Summary by CodeRabbit

- **Bug Fixes**
- Resolved an issue where pressing Enter could cause errors if no item
was focused in filterable lists. Now, selection only occurs when a valid
item is focused.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-16 18:05:49 +08:00
DarkSky
e118db4387 chore(ios): update gql schema (#12825)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Introduced advanced search and aggregation capabilities, including
support for new search query types, options, and pagination.
- Added new GraphQL mutations and queries for managing workspace
embedding files and ignored documents.
- Extended user and workspace management with new fields and
configuration options.
- Added support for sending test emails and validating app
configuration.

- **Improvements**
- Enhanced license management with updated fragments and additional
fields.
- Improved invitation and member management workflows, including removal
of deprecated arguments and streamlined APIs.
- Expanded support for audio transcription actions and retry
functionality.
- Added new enum values for OAuth providers, server features, and
workspace member status.

- **Removals**
- Deprecated and removed legacy queries and mutations related to user
roles and invitations.

- **Bug Fixes**
- Corrected field types and documentation comments for improved
consistency and clarity.

- **Other**
- Numerous schema and type updates to support new features and enhance
data modeling.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-16 16:35:15 +08:00
fengmk2
c0c813edfd feat(server): search blob names from indexer (#12822)
#### PR Dependency Tree


* **PR #12822** 👈

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

- **New Features**
- Added the ability to search for blob names by their IDs within a
workspace.
- **Tests**
- Introduced new test cases and snapshot tests to validate searching
blob names and reading filenames from document snapshots.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-16 16:34:23 +08:00
renovate[bot]
4f75111055 chore: bump up sinon version to v21 (#12827)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [sinon](https://sinonjs.org/)
([source](https://redirect.github.com/sinonjs/sinon)) | [`^20.0.0` ->
`^21.0.0`](https://renovatebot.com/diffs/npm/sinon/20.0.0/21.0.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/sinon/21.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/sinon/21.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/sinon/20.0.0/21.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/sinon/20.0.0/21.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>sinonjs/sinon (sinon)</summary>

###
[`v21.0.0`](https://redirect.github.com/sinonjs/sinon/blob/HEAD/CHANGES.md#2100)

[Compare
Source](https://redirect.github.com/sinonjs/sinon/compare/v20.0.0...52b0d97a0ff32888a26941325b9dc0a059fdf739)

-
[`fd10f13f`](fd10f13f3f)
chore!: remove assert.failException property
([#&#8203;2659](https://redirect.github.com/sinonjs/sinon/issues/2659))
(Morgan Roderick)
> This was used for allowing customisation of the thrown error between
> sandboxes and for customisation for integrations (most likely from the
    > days of BusterJS).
    >
> To my knowledge and what I've been able to find on GitHub, this has
    > never had any *production* use by end users.
    >
    > BREAKING CHANGE: this removes assert.failException from the API

*Released by Morgan Roderick on 2025-06-13.*

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/toeverything/AFFiNE).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC41MC4wIiwidXBkYXRlZEluVmVyIjoiNDAuNTAuMCIsInRhcmdldEJyYW5jaCI6ImNhbmFyeSIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-16 16:23:37 +08:00
renovate[bot]
3335f9bb00 chore: bump up @nestjs-cls/transactional-adapter-prisma version to v1.2.24 (#12826)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[@nestjs-cls/transactional-adapter-prisma](https://papooch.github.io/nestjs-cls/)
([source](https://redirect.github.com/Papooch/nestjs-cls)) | [`1.2.23`
->
`1.2.24`](https://renovatebot.com/diffs/npm/@nestjs-cls%2ftransactional-adapter-prisma/1.2.23/1.2.24)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@nestjs-cls%2ftransactional-adapter-prisma/1.2.24?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@nestjs-cls%2ftransactional-adapter-prisma/1.2.24?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@nestjs-cls%2ftransactional-adapter-prisma/1.2.23/1.2.24?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@nestjs-cls%2ftransactional-adapter-prisma/1.2.23/1.2.24?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>Papooch/nestjs-cls
(@&#8203;nestjs-cls/transactional-adapter-prisma)</summary>

###
[`v1.2.24`](https://redirect.github.com/Papooch/nestjs-cls/compare/@nestjs-cls/transactional-adapter-prisma@1.2.23...@nestjs-cls/transactional-adapter-prisma@1.2.24)

[Compare
Source](https://redirect.github.com/Papooch/nestjs-cls/compare/@nestjs-cls/transactional-adapter-prisma@1.2.23...@nestjs-cls/transactional-adapter-prisma@1.2.24)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/toeverything/AFFiNE).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC41MC4wIiwidXBkYXRlZEluVmVyIjoiNDAuNTAuMCIsInRhcmdldEJyYW5jaCI6ImNhbmFyeSIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-16 15:54:27 +08:00
renovate[bot]
566ff7470e chore: bump up oxlint version to v1.1.0 (#12509)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [oxlint](https://oxc.rs)
([source](https://redirect.github.com/oxc-project/oxc/tree/HEAD/npm/oxlint))
| [`0.16.11` ->
`0.18.1`](https://renovatebot.com/diffs/npm/oxlint/0.16.11/0.18.1) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/oxlint/0.18.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/oxlint/0.18.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/oxlint/0.16.11/0.18.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/oxlint/0.16.11/0.18.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>oxc-project/oxc (oxlint)</summary>

###
[`v0.18.1`](https://redirect.github.com/oxc-project/oxc/releases/tag/oxlint_v0.18.1):
oxlint v0.18.1

[Compare
Source](https://redirect.github.com/oxc-project/oxc/compare/oxlint_v0.18.0...oxlint_v0.18.1)

#### \[0.18.1] - 2025-06-09

##### 🐛 Bug Fixes

-
[`6d68568`](https://redirect.github.com/oxc-project/oxc/commit/6d68568)
linter: False negative in typescript/array-type
([#&#8203;11574](https://redirect.github.com/oxc-project/oxc/issues/11574))
(camc314)
-
[`6a856a0`](https://redirect.github.com/oxc-project/oxc/commit/6a856a0)
linter/no-magic-numbers: Fix typo in error message
([#&#8203;11560](https://redirect.github.com/oxc-project/oxc/issues/11560))
(overlookmotel)
-
[`3952e01`](https://redirect.github.com/oxc-project/oxc/commit/3952e01)
linter: False negative in jsx-a11y/aria-role
([#&#8203;11547](https://redirect.github.com/oxc-project/oxc/issues/11547))
(camc314)
-
[`b0e3e08`](https://redirect.github.com/oxc-project/oxc/commit/b0e3e08)
linter: Misplaced quote in jsx-curly-brace-presence test case
([#&#8203;11546](https://redirect.github.com/oxc-project/oxc/issues/11546))
(camc314)
-
[`a833ed1`](https://redirect.github.com/oxc-project/oxc/commit/a833ed1)
linter: Misplaced quote in anchor-is-valid test case
([#&#8203;11545](https://redirect.github.com/oxc-project/oxc/issues/11545))
(camc314)
-
[`4e53b80`](https://redirect.github.com/oxc-project/oxc/commit/4e53b80)
linter: Misplaced backtick in exhaustive-deps test case
([#&#8203;11544](https://redirect.github.com/oxc-project/oxc/issues/11544))
(camc314)
-
[`e8a04b6`](https://redirect.github.com/oxc-project/oxc/commit/e8a04b6)
linter: Misplaced backtick in no-object-constructor test case
([#&#8203;11543](https://redirect.github.com/oxc-project/oxc/issues/11543))
(camc314)
-
[`65311d0`](https://redirect.github.com/oxc-project/oxc/commit/65311d0)
linter: Remove duplicate rule/scope from diagnostic
([#&#8203;11531](https://redirect.github.com/oxc-project/oxc/issues/11531))
(camc314)

##### 🚜 Refactor

-
[`7ab84c2`](https://redirect.github.com/oxc-project/oxc/commit/7ab84c2)
editor: Use pattern for textDocument filter
([#&#8203;11559](https://redirect.github.com/oxc-project/oxc/issues/11559))
(Sysix)
-
[`9b475ad`](https://redirect.github.com/oxc-project/oxc/commit/9b475ad)
linter: Use one instance of rope per file
([#&#8203;11552](https://redirect.github.com/oxc-project/oxc/issues/11552))
(Sysix)

##### 📚 Documentation

-
[`e13ed51`](https://redirect.github.com/oxc-project/oxc/commit/e13ed51)
editor/vscode: Fix typo in README
([#&#8203;11572](https://redirect.github.com/oxc-project/oxc/issues/11572))
(David)
-
[`fa924ab`](https://redirect.github.com/oxc-project/oxc/commit/fa924ab)
linter: Cleanup docs for multiple linter rules
([#&#8203;11551](https://redirect.github.com/oxc-project/oxc/issues/11551))
(Ulrich Stark)

#####  Performance

-
[`7bf25cb`](https://redirect.github.com/oxc-project/oxc/commit/7bf25cb)
language_server: Transform `MessageWithPosition` to `Diagnostic` with
less allocations
([#&#8203;11561](https://redirect.github.com/oxc-project/oxc/issues/11561))
(Sysix)

###
[`v0.18.0`](https://redirect.github.com/oxc-project/oxc/releases/tag/oxlint_v0.18.0):
oxlint v0.18.0

[Compare
Source](https://redirect.github.com/oxc-project/oxc/compare/oxlint_v0.17.0...oxlint_v0.18.0)

#### \[0.18.0] - 2025-06-06

-
[`bd9dd88`](https://redirect.github.com/oxc-project/oxc/commit/bd9dd88)
linter: \[**BREAKING**] Add more info to json reporter
([#&#8203;11524](https://redirect.github.com/oxc-project/oxc/issues/11524))
(camc314)

##### Features

-
[`825d40c`](https://redirect.github.com/oxc-project/oxc/commit/825d40c)
linter: Fix casing in unicorn/no-useless-promise-resolve-reject
([#&#8203;11528](https://redirect.github.com/oxc-project/oxc/issues/11528))
(camc314)
-
[`2faee3d`](https://redirect.github.com/oxc-project/oxc/commit/2faee3d)
linter: Fix grammer in react/exhaustive-deps
([#&#8203;11527](https://redirect.github.com/oxc-project/oxc/issues/11527))
(camc314)

##### Bug Fixes

-
[`1a71d7c`](https://redirect.github.com/oxc-project/oxc/commit/1a71d7c)
linter: Misplaced backtick in unicorn/no-array-for-each diagnostic
([#&#8203;11529](https://redirect.github.com/oxc-project/oxc/issues/11529))
(camc314)
-
[`7430b14`](https://redirect.github.com/oxc-project/oxc/commit/7430b14)
linter: Grammer in jest/valid-expect diagnostic
([#&#8203;11522](https://redirect.github.com/oxc-project/oxc/issues/11522))
(camc314)
-
[`b92ac41`](https://redirect.github.com/oxc-project/oxc/commit/b92ac41)
linter: Grammer in eslint/no-redeclare diagnostic
([#&#8203;11521](https://redirect.github.com/oxc-project/oxc/issues/11521))
(camc314)
-
[`17883e3`](https://redirect.github.com/oxc-project/oxc/commit/17883e3)
linter: Improve eslint/no-unsafe-negation diagnostic
([#&#8203;11520](https://redirect.github.com/oxc-project/oxc/issues/11520))
(camc314)
-
[`8c89937`](https://redirect.github.com/oxc-project/oxc/commit/8c89937)
linter: Improve eslint/no-shadow-restricted-names diagnostic
([#&#8203;11519](https://redirect.github.com/oxc-project/oxc/issues/11519))
(camc314)
-
[`3f0d889`](https://redirect.github.com/oxc-project/oxc/commit/3f0d889)
linter: Add missing article to oxc/bad-array-method-on-arguments
diagnostic
([#&#8203;11518](https://redirect.github.com/oxc-project/oxc/issues/11518))
(camc314)
-
[`cf0c24c`](https://redirect.github.com/oxc-project/oxc/commit/cf0c24c)
linter: Improve message in react/prefer-es6-class diagnostic
([#&#8203;11516](https://redirect.github.com/oxc-project/oxc/issues/11516))
(camc314)
-
[`91855df`](https://redirect.github.com/oxc-project/oxc/commit/91855df)
linter: Fix message in react/rules-of-hooks diagnostic
([#&#8203;11515](https://redirect.github.com/oxc-project/oxc/issues/11515))
(camc314)
-
[`b272194`](https://redirect.github.com/oxc-project/oxc/commit/b272194)
linter: Misplaced backtick in jest/no-conditional-expect diagnostic
([#&#8203;11514](https://redirect.github.com/oxc-project/oxc/issues/11514))
(camc314)
-
[`3403303`](https://redirect.github.com/oxc-project/oxc/commit/3403303)
linter: Misplaced backtick in unicorn/prefer-dom-node-dataset diagnostic
([#&#8203;11513](https://redirect.github.com/oxc-project/oxc/issues/11513))
(camc314)
-
[`d5ca872`](https://redirect.github.com/oxc-project/oxc/commit/d5ca872)
linter: Misplaced backtick in eslint/radix diagnostic
([#&#8203;11512](https://redirect.github.com/oxc-project/oxc/issues/11512))
(camc314)
-
[`2dcf8be`](https://redirect.github.com/oxc-project/oxc/commit/2dcf8be)
linter: Improve diagnostic message when function name is referenced
([#&#8203;11509](https://redirect.github.com/oxc-project/oxc/issues/11509))
(camc314)
-
[`0de0c9c`](https://redirect.github.com/oxc-project/oxc/commit/0de0c9c)
linter: Improve diagnostic message for no-unsafe-declaration-merging
([#&#8203;11508](https://redirect.github.com/oxc-project/oxc/issues/11508))
(camc314)
-
[`0946dac`](https://redirect.github.com/oxc-project/oxc/commit/0946dac)
linter: Correctly inherit categories when plugins are enabled
([#&#8203;11353](https://redirect.github.com/oxc-project/oxc/issues/11353))
(Cameron)
-
[`510c1c6`](https://redirect.github.com/oxc-project/oxc/commit/510c1c6)
linter: Add missing `allowArrowFunctions` option for eslint/func-style
([#&#8203;11455](https://redirect.github.com/oxc-project/oxc/issues/11455))
(yefan)
-
[`c77787c`](https://redirect.github.com/oxc-project/oxc/commit/c77787c)
linter: Improve `eslint/no-loss-of-precision`
([#&#8203;11437](https://redirect.github.com/oxc-project/oxc/issues/11437))
(magic-akari)
-
[`11d4523`](https://redirect.github.com/oxc-project/oxc/commit/11d4523)
linter: False positive in react/exhaustive-deps
([#&#8203;11438](https://redirect.github.com/oxc-project/oxc/issues/11438))
(camc314)
-
[`616b613`](https://redirect.github.com/oxc-project/oxc/commit/616b613)
linter/switch-case-braces: Align the logic with `unicorn`
([#&#8203;11405](https://redirect.github.com/oxc-project/oxc/issues/11405))
(shulaoda)

##### Refactor

-
[`db0b099`](https://redirect.github.com/oxc-project/oxc/commit/db0b099)
language_server: Convert only once uri to path when creating
`ServerLinter`
([#&#8203;11503](https://redirect.github.com/oxc-project/oxc/issues/11503))
(Sysix)
-
[`ccceb52`](https://redirect.github.com/oxc-project/oxc/commit/ccceb52)
language_server: Simplify `workspace/didChangeConfiguration` call
([#&#8203;11462](https://redirect.github.com/oxc-project/oxc/issues/11462))
(Sysix)
-
[`0fdc51e`](https://redirect.github.com/oxc-project/oxc/commit/0fdc51e)
linter: Simplify `OxlintRules::override_rules`
([#&#8203;11510](https://redirect.github.com/oxc-project/oxc/issues/11510))
(camc314)

##### Testing

-
[`2ba2893`](https://redirect.github.com/oxc-project/oxc/commit/2ba2893)
editor: Fix test for auto `fixAll` on save
([#&#8203;11448](https://redirect.github.com/oxc-project/oxc/issues/11448))
(Sysix)

###
[`v0.17.0`](https://redirect.github.com/oxc-project/oxc/releases/tag/oxlint_v0.17.0):
oxlint v0.17.0

[Compare
Source](https://redirect.github.com/oxc-project/oxc/compare/oxlint_v0.16.12...oxlint_v0.17.0)

#### \[0.17.0] - 2025-05-30

-
[`ead5309`](https://redirect.github.com/oxc-project/oxc/commit/ead5309)
linter: \[**BREAKING**] Remove react from default plugin set
([#&#8203;11382](https://redirect.github.com/oxc-project/oxc/issues/11382))
(camc314)

##### Features

-
[`2d25bd8`](https://redirect.github.com/oxc-project/oxc/commit/2d25bd8)
linter: Remove `unicorn/no-for-loop` over `typescript/prefer-for-of`
([#&#8203;11354](https://redirect.github.com/oxc-project/oxc/issues/11354))
(camc314)
-
[`bbb7eb1`](https://redirect.github.com/oxc-project/oxc/commit/bbb7eb1)
linter: Add auto-fix to react/forward-ref-uses-ref
([#&#8203;11342](https://redirect.github.com/oxc-project/oxc/issues/11342))
(yefan)
-
[`590c27b`](https://redirect.github.com/oxc-project/oxc/commit/590c27b)
linter: Add auto-fix to unicorn/no-await-expression-member
([#&#8203;11306](https://redirect.github.com/oxc-project/oxc/issues/11306))
(yefan)
-
[`7824f01`](https://redirect.github.com/oxc-project/oxc/commit/7824f01)
linter: Implement suggestion for `jsx/no-useless-fragment`
([#&#8203;10800](https://redirect.github.com/oxc-project/oxc/issues/10800))
(Cam McHenry)
-
[`2083d33`](https://redirect.github.com/oxc-project/oxc/commit/2083d33)
linter/language_server: Add second editor suggestion for
`react/forward-ref-uses-ref`
([#&#8203;11375](https://redirect.github.com/oxc-project/oxc/issues/11375))
(Sysix)

##### Bug Fixes

-
[`f6424dd`](https://redirect.github.com/oxc-project/oxc/commit/f6424dd)
linter: Reflect react plugin is disabled by default in cli
([#&#8203;11397](https://redirect.github.com/oxc-project/oxc/issues/11397))
(camc314)
-
[`25ecbfe`](https://redirect.github.com/oxc-project/oxc/commit/25ecbfe)
linter: Remove use of `FrameworkFlags::React` to decide whether rules
should run
([#&#8203;11383](https://redirect.github.com/oxc-project/oxc/issues/11383))
(camc314)
-
[`0d240e4`](https://redirect.github.com/oxc-project/oxc/commit/0d240e4)
linter: False positive in react/exhaustive-deps with default formal
parameter
([#&#8203;11395](https://redirect.github.com/oxc-project/oxc/issues/11395))
(camc314)
-
[`c91697e`](https://redirect.github.com/oxc-project/oxc/commit/c91697e)
linter: Fix panic in multi byte char in `TryFrom` aria
([#&#8203;11350](https://redirect.github.com/oxc-project/oxc/issues/11350))
(camc314)
-
[`9798ef1`](https://redirect.github.com/oxc-project/oxc/commit/9798ef1)
linter: Stack overflow in no-async-endpoint-handlers
([#&#8203;11317](https://redirect.github.com/oxc-project/oxc/issues/11317))
(camc314)
-
[`348ad97`](https://redirect.github.com/oxc-project/oxc/commit/348ad97)
linter: Skip no-unused-vars on astro files
([#&#8203;11303](https://redirect.github.com/oxc-project/oxc/issues/11303))
(camc314)
-
[`183d7f0`](https://redirect.github.com/oxc-project/oxc/commit/183d7f0)
linter: Make `jest/no-large-snapshots` error easier to comprehend
([#&#8203;11294](https://redirect.github.com/oxc-project/oxc/issues/11294))
(Ulrich Stark)
-
[`4e606a5`](https://redirect.github.com/oxc-project/oxc/commit/4e606a5)
linter: Improve `jest/no-large-snapshots`
([#&#8203;11291](https://redirect.github.com/oxc-project/oxc/issues/11291))
(Ulrich Stark)
-
[`14f790f`](https://redirect.github.com/oxc-project/oxc/commit/14f790f)
linter: Improve `jest/no-restricted-matchers`
([#&#8203;11292](https://redirect.github.com/oxc-project/oxc/issues/11292))
(Ulrich Stark)
-
[`a2c82be`](https://redirect.github.com/oxc-project/oxc/commit/a2c82be)
linter/block-scoped-var: Better diagnostic messages
([#&#8203;11290](https://redirect.github.com/oxc-project/oxc/issues/11290))
(DonIsaac)
-
[`19772e5`](https://redirect.github.com/oxc-project/oxc/commit/19772e5)
linter/no-unused-vars: Panic when variable is redeclared as function in
same scope
([#&#8203;11280](https://redirect.github.com/oxc-project/oxc/issues/11280))
(Dunqing)
-
[`7af5bb1`](https://redirect.github.com/oxc-project/oxc/commit/7af5bb1)
oxc_language_server: Include save option for text document sync
capability
([#&#8203;11297](https://redirect.github.com/oxc-project/oxc/issues/11297))
(Nicholas Rayburn)

##### Performance

-
[`0ed6c1a`](https://redirect.github.com/oxc-project/oxc/commit/0ed6c1a)
language_server: Use `Arc<RwLock>` instead of `Mutex` for workspace
workers
([#&#8203;11328](https://redirect.github.com/oxc-project/oxc/issues/11328))
(Sysix)
-
[`a0ee946`](https://redirect.github.com/oxc-project/oxc/commit/a0ee946)
linter: Reduce code size in `globals`
([#&#8203;11333](https://redirect.github.com/oxc-project/oxc/issues/11333))
(shulaoda)
-
[`c90c5e9`](https://redirect.github.com/oxc-project/oxc/commit/c90c5e9)
linter/no-unused-vars: Simplify checking self call usage
([#&#8203;11281](https://redirect.github.com/oxc-project/oxc/issues/11281))
(Dunqing)

##### Documentation

-
[`eae51ca`](https://redirect.github.com/oxc-project/oxc/commit/eae51ca)
linter: Clarify jsdoc/check-tag-names configuration
([#&#8203;11394](https://redirect.github.com/oxc-project/oxc/issues/11394))
(Rägnar O'ock)
-
[`cd354d4`](https://redirect.github.com/oxc-project/oxc/commit/cd354d4)
oxlint: Remove incorrect doc comment
([#&#8203;11326](https://redirect.github.com/oxc-project/oxc/issues/11326))
(camc314)

##### Refactor

-
[`42738f0`](https://redirect.github.com/oxc-project/oxc/commit/42738f0)
linter: Shorten code of match arms
([#&#8203;11389](https://redirect.github.com/oxc-project/oxc/issues/11389))
(Ulrich Stark)
-
[`8a34447`](https://redirect.github.com/oxc-project/oxc/commit/8a34447)
linter: Improve `unicorn/text-encoding-identifier-case`
([#&#8203;11386](https://redirect.github.com/oxc-project/oxc/issues/11386))
(shulaoda)
-
[`eaa605e`](https://redirect.github.com/oxc-project/oxc/commit/eaa605e)
linter: Avoid some `Arc::clone` in linter runtime
([#&#8203;11388](https://redirect.github.com/oxc-project/oxc/issues/11388))
(Boshen)
-
[`1cd8b9c`](https://redirect.github.com/oxc-project/oxc/commit/1cd8b9c)
linter: Fixes in `react/forward-ref-uses-ref` are suggestions
([#&#8203;11376](https://redirect.github.com/oxc-project/oxc/issues/11376))
(Sysix)
-
[`50ef691`](https://redirect.github.com/oxc-project/oxc/commit/50ef691)
linter: Add `diagnostics_with_multiple_fixes` to `LintContext`
([#&#8203;11357](https://redirect.github.com/oxc-project/oxc/issues/11357))
(Sysix)
-
[`606bb34`](https://redirect.github.com/oxc-project/oxc/commit/606bb34)
linter: Accept `PossibleFixes` instead of `Fix` for `Messages`
([#&#8203;11295](https://redirect.github.com/oxc-project/oxc/issues/11295))
(Sysix)
-
[`042a3f3`](https://redirect.github.com/oxc-project/oxc/commit/042a3f3)
linter: Use `PossibleFixes` instead of `Option<Fix>`
([#&#8203;11284](https://redirect.github.com/oxc-project/oxc/issues/11284))
(Sysix)
-
[`ffcfb46`](https://redirect.github.com/oxc-project/oxc/commit/ffcfb46)
linter: Improve `unicorn/throw-new-error`
([#&#8203;11364](https://redirect.github.com/oxc-project/oxc/issues/11364))
(shulaoda)
-
[`8fb55c3`](https://redirect.github.com/oxc-project/oxc/commit/8fb55c3)
linter: Cleanup docs and simplify code of `eslint/no-fallthrough`
([#&#8203;11331](https://redirect.github.com/oxc-project/oxc/issues/11331))
(Ulrich Stark)
-
[`e2f0f0a`](https://redirect.github.com/oxc-project/oxc/commit/e2f0f0a)
linter: Improve docs and simplify code of `eslint/no-duplicate-imports`
([#&#8203;11320](https://redirect.github.com/oxc-project/oxc/issues/11320))
(Ulrich Stark)
-
[`b53b053`](https://redirect.github.com/oxc-project/oxc/commit/b53b053)
linter: Simplify accessing span of NameSpan
([#&#8203;11305](https://redirect.github.com/oxc-project/oxc/issues/11305))
(Ulrich Stark)
-
[`4bc2650`](https://redirect.github.com/oxc-project/oxc/commit/4bc2650)
linter: Improve `eslint/no-void`
([#&#8203;11285](https://redirect.github.com/oxc-project/oxc/issues/11285))
(shulaoda)

##### Styling

-
[`49b664c`](https://redirect.github.com/oxc-project/oxc/commit/49b664c)
linter: Remove needless newline in `declare_oxc_lint`
([#&#8203;11400](https://redirect.github.com/oxc-project/oxc/issues/11400))
(camc314)

##### Testing

-
[`c4f64aa`](https://redirect.github.com/oxc-project/oxc/commit/c4f64aa)
linter: Explicitly disable correctness for clarity
([#&#8203;11327](https://redirect.github.com/oxc-project/oxc/issues/11327))
(camc314)
-
[`a404b2c`](https://redirect.github.com/oxc-project/oxc/commit/a404b2c)
linter: `eslint/no-duplicate-imports` shouldn't report the same span
([#&#8203;11324](https://redirect.github.com/oxc-project/oxc/issues/11324))
(Ulrich Stark)

###
[`v0.16.12`](https://redirect.github.com/oxc-project/oxc/blob/HEAD/npm/oxlint/CHANGELOG.md#01612---2025-05-25)

[Compare
Source](https://redirect.github.com/oxc-project/oxc/compare/oxlint_v0.16.11...oxlint_v0.16.12)

##### Features

-
[`6a7018e`](https://redirect.github.com/oxc-project/oxc/commit/6a7018e)
linter: Generate stricter json schema for lint plugins
([#&#8203;11219](https://redirect.github.com/oxc-project/oxc/issues/11219))
(camc314)

##### Bug Fixes

-
[`e8470d9`](https://redirect.github.com/oxc-project/oxc/commit/e8470d9)
linter: Delay merging of oxlintrc configs
([#&#8203;10835](https://redirect.github.com/oxc-project/oxc/issues/10835))
(camc314)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/toeverything/AFFiNE).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC4xNi4wIiwidXBkYXRlZEluVmVyIjoiNDAuNTAuMCIsInRhcmdldEJyYW5jaCI6ImNhbmFyeSIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->


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

## Summary by CodeRabbit

- **Refactor**
- Simplified array element retrieval across multiple components and
utilities by replacing `.filter(...)[0]` with `.find(...)` or
`.findLast(...)`, improving code readability and efficiency.
- Improved JSX structure in the audio player component by nesting
elements directly rather than using a `children` prop.
- Enhanced code organization in the modal container by repositioning
functions and updating dependency arrays for better maintainability.
- Added a comment to disable a specific lint rule in a React hook for
clarity.

- **Chores**
- Updated the `oxlint` development dependency to allow for newer
compatible versions.

- **Tests**
- Refactored test setup logic for more direct and clear retrieval of
test data.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: LongYinan <lynweklm@gmail.com>
2025-06-16 15:20:48 +08:00
liuyi
a1abb60dec fix(server): should save end date of subscription in db (#12814)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Subscription end dates are now correctly saved and updated for Stripe
subscriptions, ensuring accurate display and management of subscription
periods.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-13 18:31:18 +08:00
EYHN
04f3d88e2c feat(nbstore): add more data to indexer (#12815)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Bug Fixes**
- Improved display of image and attachment blocks by ensuring image
captions are shown as content for images, while attachment names remain
as content for attachments.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->


#### PR Dependency Tree


* **PR #12815** 👈

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

---------

Co-authored-by: fengmk2 <fengmk2@gmail.com>
2025-06-13 18:30:57 +08:00
DarkSky
e98f035f97 feat(server): split embedding client (#12809) 2025-06-13 12:37:05 +08:00
fengmk2
1d4bc81e90 fix(server): use Query instead of Args (#12813)
#### PR Dependency Tree


* **PR #12813** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)
2025-06-13 04:12:54 +00:00
EYHN
deeea3428e feat(core): update build in server config (#12807)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Added support for Apple as an OAuth login provider across all server
configurations.
	- Introduced Copilot Embedding as a new server feature.

- **Changes**
- Updated server features to replace Captcha with Indexer in all
configurations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-13 10:28:49 +08:00
fengmk2
8b0dd3c067 fix(server): increase doc-service liveness probe timeout from 1s to 5s (#12804)
yjs operations may take more than 1 second

before

![image](https://github.com/user-attachments/assets/feb7e375-ea73-4f5f-84f2-d85934f94844)

after

![image](https://github.com/user-attachments/assets/e760ee1f-a1c6-4f9d-8dbc-a4796efbd77a)


#### PR Dependency Tree


* **PR #12804** 👈

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

- **New Features**
- Added configurable timeout settings for liveness and readiness probes
in Helm chart deployments, allowing users to specify probe timeout
duration.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-12 21:04:37 +08:00
Richard Lora
8ca17864f1 fix(editor): show added or deleted rows immediately in grouped table and Kanban views (#12731)
https://github.com/user-attachments/assets/214fbe4f-b667-44b7-85a3-77ef4cfa8cca

This PR fixes a bug where adding or deleting rows in a grouped table
view did not visually update the UI until the user manually refreshed
the page or navigated away and back. The issue gave the impression that
the action had not completed.

Same issue for Kanban cards.

The result now is:
Users now see new rows or deleted rows reflected in real-time without
needing to reload or navigate away. This applies to both grouped table
views and Kanban cards.

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

- **Bug Fixes**
- Ensured the UI updates immediately after adding, deleting, or moving
cards and rows in Kanban and Table views on both mobile and desktop.
- Fixed issues where UI changes were not reflected after certain
actions, such as ungrouping, deleting, or inserting items.
- Improved row locking behavior during add and delete operations to
prevent UI inconsistencies.
- **Tests**
- Added comprehensive tests for row operations and menu interactions to
verify UI updates and correct method calls in data views.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: zzj3720 <zuozijian1994@gmail.com>
2025-06-12 16:02:37 +08:00
Aadi
d2664480f7 fix(editor): unable to delete content backward in database title cell (#12738)
fix: https://github.com/toeverything/blocksuite/issues/8578

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

- **New Features**
- Improved keyboard event handling within inline editors for database
headers and table cells, enhancing user control over key interactions
like 'Tab' and 'Escape'.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-12 15:58:52 +08:00
Aadi
b986a39da3 fix(editor): cursor not visible on empty line when line numbers are disabled in code block (#12694)
This fixes an issue where, if line numbers are turned off in a code
block, focusing on an empty line would cause the text cursor to be
hidden.

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

- **Style**
- Updated code block layout to improve appearance when line numbers are
disabled.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: L-Sun <zover.v@gmail.com>
2025-06-12 15:52:54 +08:00
Aadi
097a63362c fix(editor): firefox can't paste image in edgeless (#12729)
fix: https://github.com/toeverything/blocksuite/issues/8718
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

- **Bug Fixes**
- Improved clipboard handling to prevent creating empty notes when
pasting blank text.
- Enhanced detection of files and SVG images in clipboard content for
more reliable pasting behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-12 15:52:14 +08:00
EYHN
7284320355 fix(nbstore): fix search slow (#12800)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved search results by ensuring links to the current document are
properly excluded from related document and database searches.
- Enhanced session management in quick search by ensuring all active
sessions are cleaned up before processing new search results.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-12 15:43:55 +08:00
DarkSky
b4401a8abf chore(server): bump model version (#12798) 2025-06-12 07:40:28 +00:00
Aadi
0351fbcb86 fix(editor): remove duplicate event listeners (#12735)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved keyboard interaction reliability in text and rich text cells
by eliminating duplicate event listeners.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-12 15:13:54 +08:00
Peng Xiao
6eed9c686b fix(component): fix storybook migration v9 (#12797) 2025-06-12 07:01:58 +00:00
L-Sun
8d2214424c fix(editor): behavior of deleting at the start of line (#12787)
Close BS-3182, #12736 




#### PR Dependency Tree


* **PR #12787** 👈

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

- **Bug Fixes**
- Improved the behavior when deleting empty lines and merging blocks,
ensuring more accurate handling of block deletion and cursor focus in
various scenarios.
- **Tests**
- Added new end-to-end tests to verify correct deletion of lines in
edgeless text and paragraph blocks, including checks for block removal
and cursor position.
- Introduced a utility function to retrieve block IDs for testing
purposes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-12 14:58:03 +08:00
Peng Xiao
d12954f8c3 fix(electron): web dev server ws does not work for electron renderer (#12711) 2025-06-12 14:44:30 +08:00
DarkSky
83733cd828 feat(server): improve prompts (#12788) 2025-06-12 13:31:16 +08:00
DarkSky
ed56f076ed feat(server): improve rerank performance (#12775)
fix AI-183
2025-06-12 13:31:01 +08:00
Cats Juice
2d17c265ca fix: memory leak due to missing unsubscribe (#12777)
- unsubscribe `Signal` not correctly
- missing un-subscription for `Livedata.signal`

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

- **Bug Fixes**
- Improved resource management to ensure subscriptions are properly
cleaned up, reducing potential memory leaks and improving overall app
stability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-12 12:35:14 +08:00
L-Sun
2a9f7e1835 fix(editor): can not clear embed card alias description (#12794)
Close
[BS-3600](https://linear.app/affine-design/issue/BS-3600/card-view下,编辑alias清空保存无效,无法实现清空)
Close
[BS-3599](https://linear.app/affine-design/issue/BS-3599/page-和canvas-mode下的note,对文本中的-embed-view-doc,隐藏掉-edit-按钮,避免误导,card)



#### PR Dependency Tree


* **PR #12794** 👈

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

- **New Features**
- The edit option has been removed from the toolbar for embedded synced
documents.
- **Bug Fixes**
- The description field is now always included when editing embedded
cards, even if left empty.
- **Tests**
- Removed tests related to editing and view switching of linked document
embeds.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-12 12:33:57 +08:00
Fangdun Tsai
a71904e641 feat(editor): add replace action in attachment toolbar (#12512)
Closes:
[BS-3549](https://linear.app/affine-design/issue/BS-3549/附件-toolbar-上添加-replace-action)

[Screen Recording 2025-06-04 at 15.37.40.mov <span
class="graphite__hidden">(uploaded via Graphite)</span> <img
class="graphite__hidden"
src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/8ypiIKZXudF5a0tIgIzf/480c8690-7ec9-4188-92fd-ee3339afb558.mov"
/>](https://app.graphite.dev/media/video/8ypiIKZXudF5a0tIgIzf/480c8690-7ec9-4188-92fd-ee3339afb558.mov)



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

- **New Features**
- Added the ability to replace attachments directly from the toolbar,
allowing users to select and update files seamlessly.
- **Bug Fixes**
- Improved handling when replacing embedded attachments with unsupported
file types, ensuring the view falls back to a card view as needed.
- **Tests**
- Introduced end-to-end tests to verify attachment replacement and
correct UI behavior in both standard and edgeless editing modes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-11 06:57:31 +00:00
L-Sun
814364489f chore(editor): remove unused codes (#12784)
Continue #12778 

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

## Summary by CodeRabbit

- **Chores**
- Removed internal string utility functions related to markdown prefix
and horizontal rule detection. No impact on user-facing features.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-11 06:40:51 +00:00
L-Sun
24448659a4 fix(editor): support markdown transform when using IME (#12778)
Fix #12284 
Close
[BS-3517](https://linear.app/affine-design/issue/BS-3517/微软新注音输入法无法使用markdown语法)

This PR refactor the markdown transform during inputting, including:
- Transfrom markdown syntax input in `inlineEditor.slots.inputting`,
where we can detect the space character inputed by IME like Microsoft
Bopomofo, but `keydown` event can't.
- Remove `markdown-input.ts` which was used in `KeymapExtension` of
paragraph, and refactor with `InlineMarkdownExtension`
- Adjust existing `InlineMarkdownExtension` since the space is included
in text.
- Add two `InlineMarkdownExtension` for paragraph and list to impl
Heading1-6, number, bullet, to-do list conversion.

Other changes:
- Improve type hint for parameter of `store.addBlock`

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

## Summary by CodeRabbit

- **New Features**
- Added markdown shortcuts for creating code blocks and dividers in the
rich text editor.
- Introduced enhanced paragraph markdown support for headings and
blockquotes with inline markdown patterns.
- Integrated new list markdown extension supporting numbered, bulleted,
and todo lists with checked states.

- **Improvements**
- Updated markdown formatting patterns to require trailing spaces for
links, LaTeX, and inline styles, improving detection accuracy.
- Markdown transformations now respond to input events instead of
keydown for smoother editing experience.
- Added focus management after markdown transformations to maintain
seamless editing flow.

- **Bug Fixes**
- Removed unnecessary prevention of default behavior on space and
shift-space key presses in list and paragraph editors.

- **Refactor**
- Enhanced event handling and typing for editor input events, improving
reliability and maintainability.
- Refined internal prefix text extraction logic for markdown processing.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-11 14:12:28 +08:00
darkskygit
c846c57a12 fix(server): list context status (#12771)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Bug Fixes**
  - Improved handling of document statuses to ensure documents without a finished or existing status are now explicitly marked as "processing" instead of remaining undefined.

- **Tests**
  - Added comprehensive new tests and snapshot entries to verify document status merging, including edge cases and concurrent operations, ensuring robust and consistent behavior.

- **Enhancements**
  - Updated context document listings to display the processing status for relevant documents.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-10 02:35:09 +00:00
L-Sun
e82c9d2ddc fix(editor): add title to edgeless page block ai context (#12763)
Close [BS-3590](https://linear.app/affine-design/issue/BS-3590/page-block-的标题没有被作为上下文输入)
2025-06-10 02:14:01 +00:00
yoyoyohamapi
3c29f62224 refactor(core): hide emebedding status tip if completed (#12720)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Added real-time embedding status tracking and progress messages to the AI chat composer, with automatic updates every 10 seconds.
- **Refactor**
  - Simplified the embedding status tooltip to display a static message, removing dynamic status updates and hover-based refresh.
- **Tests**
  - Enhanced embedding status tooltip test by creating sample documents and extending visibility timeout to 50 seconds.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-10 01:54:13 +00:00
fundon
b5ef361f87 fix(editor): toolbar shaking when setting inline style (#12765)
Closes: [BS-1748](https://linear.app/affine-design/issue/BS-1748/improvement-toolbar-应用样式后会移动)

[Screen Recording 2025-06-09 at 17.59.01.mov <span class="graphite__hidden">(uploaded via Graphite)</span> <img class="graphite__hidden" src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/8ypiIKZXudF5a0tIgIzf/a3941ec8-6b97-48e5-ba9b-484deb792d44.mov" />](https://app.graphite.dev/media/video/8ypiIKZXudF5a0tIgIzf/a3941ec8-6b97-48e5-ba9b-484deb792d44.mov)

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

## Summary by CodeRabbit

- **New Features**
  - Improved animation and transition effects for inline toolbars, providing a smoother user experience when toolbars appear or disappear.
- **Bug Fixes**
  - Ensured that the inline attribute is correctly removed when the toolbar is hidden, preventing visual inconsistencies.
- **Style**
  - Updated toolbar transition timing for more natural animations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-09 11:19:13 +00:00
mkihr-ojisan
4fa85416ae fix: size of canvas in PDFPageRenderer (#12722)
Co-authored-by: Fangdun Tsai <fundon@pindash.io>
2025-06-09 14:37:44 +08:00
Aadi
f69a98eb8c fix(editor): pasting into database multiselect input auto adds a new tag (#12693)
Co-authored-by: 3720 <zuozijian1994@gmail.com>
2025-06-09 09:37:54 +08:00
renovate
115496aa8e chore: bump up nestjs to v11.1.3 (#12737)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@nestjs/common](https://nestjs.com) ([source](https://redirect.github.com/nestjs/nest/tree/HEAD/packages/common)) | [`11.1.2` -> `11.1.3`](https://renovatebot.com/diffs/npm/@nestjs%2fcommon/11.1.2/11.1.3) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@nestjs%2fcommon/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@nestjs%2fcommon/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@nestjs%2fcommon/11.1.2/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@nestjs%2fcommon/11.1.2/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@nestjs/core](https://nestjs.com) ([source](https://redirect.github.com/nestjs/nest/tree/HEAD/packages/core)) | [`11.1.2` -> `11.1.3`](https://renovatebot.com/diffs/npm/@nestjs%2fcore/11.1.2/11.1.3) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@nestjs%2fcore/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@nestjs%2fcore/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@nestjs%2fcore/11.1.2/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@nestjs%2fcore/11.1.2/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@nestjs/platform-express](https://nestjs.com) ([source](https://redirect.github.com/nestjs/nest/tree/HEAD/packages/platform-express)) | [`11.1.2` -> `11.1.3`](https://renovatebot.com/diffs/npm/@nestjs%2fplatform-express/11.1.2/11.1.3) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@nestjs%2fplatform-express/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@nestjs%2fplatform-express/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@nestjs%2fplatform-express/11.1.2/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@nestjs%2fplatform-express/11.1.2/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@nestjs/platform-socket.io](https://nestjs.com) ([source](https://redirect.github.com/nestjs/nest/tree/HEAD/packages/platform-socket.io)) | [`11.1.2` -> `11.1.3`](https://renovatebot.com/diffs/npm/@nestjs%2fplatform-socket.io/11.1.2/11.1.3) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@nestjs%2fplatform-socket.io/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@nestjs%2fplatform-socket.io/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@nestjs%2fplatform-socket.io/11.1.2/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@nestjs%2fplatform-socket.io/11.1.2/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@nestjs/websockets](https://redirect.github.com/nestjs/nest) ([source](https://redirect.github.com/nestjs/nest/tree/HEAD/packages/websockets)) | [`11.1.2` -> `11.1.3`](https://renovatebot.com/diffs/npm/@nestjs%2fwebsockets/11.1.2/11.1.3) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@nestjs%2fwebsockets/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@nestjs%2fwebsockets/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@nestjs%2fwebsockets/11.1.2/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@nestjs%2fwebsockets/11.1.2/11.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>nestjs/nest (@&#8203;nestjs/common)</summary>

### [`v11.1.3`](https://redirect.github.com/nestjs/nest/compare/v11.1.2...1613f503cfd3fa5a6edddc0d7296aeca78f844a7)

[Compare Source](https://redirect.github.com/nestjs/nest/compare/v11.1.2...v11.1.3)

</details>

<details>
<summary>nestjs/nest (@&#8203;nestjs/core)</summary>

### [`v11.1.3`](https://redirect.github.com/nestjs/nest/compare/v11.1.2...1613f503cfd3fa5a6edddc0d7296aeca78f844a7)

[Compare Source](https://redirect.github.com/nestjs/nest/compare/v11.1.2...v11.1.3)

</details>

<details>
<summary>nestjs/nest (@&#8203;nestjs/platform-express)</summary>

### [`v11.1.3`](https://redirect.github.com/nestjs/nest/compare/v11.1.2...1613f503cfd3fa5a6edddc0d7296aeca78f844a7)

[Compare Source](https://redirect.github.com/nestjs/nest/compare/v11.1.2...v11.1.3)

</details>

<details>
<summary>nestjs/nest (@&#8203;nestjs/platform-socket.io)</summary>

### [`v11.1.3`](https://redirect.github.com/nestjs/nest/releases/tag/v11.1.3)

[Compare Source](https://redirect.github.com/nestjs/nest/compare/v11.1.2...v11.1.3)

#### v11.1.3 (2025-06-06)

##### Bug fixes

-   `core`
    -   [#&#8203;15201](https://redirect.github.com/nestjs/nest/pull/15201) fix(core): gracefully shutdown the app when repl exits ([@&#8203;dzhlobo](https://redirect.github.com/dzhlobo))

##### Enhancements

-   `common`
    -   [#&#8203;15209](https://redirect.github.com/nestjs/nest/pull/15209) feat: add string array type to disposition ([@&#8203;fjodor-rybakov](https://redirect.github.com/fjodor-rybakov))
-   `common`, `core`
    -   [#&#8203;15203](https://redirect.github.com/nestjs/nest/pull/15203) feat(core): defer initialization connected microservice ([@&#8203;isaryy](https://redirect.github.com/isaryy))

##### Dependencies

-   `platform-express`
    -   [#&#8203;15232](https://redirect.github.com/nestjs/nest/pull/15232) chore(deps): bump multer from 2.0.0 to 2.0.1 ([@&#8203;dependabot\[bot\]](https://redirect.github.com/apps/dependabot))

##### Committers: 3

-   Dmitry Zhlobo ([@&#8203;dzhlobo](https://redirect.github.com/dzhlobo))
-   [@&#8203;fjodor-rybakov](https://redirect.github.com/fjodor-rybakov)
-   [@&#8203;isaryy](https://redirect.github.com/isaryy)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/toeverything/AFFiNE).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC40MC4zIiwidXBkYXRlZEluVmVyIjoiNDAuNDAuMyIsInRhcmdldEJyYW5jaCI6ImNhbmFyeSIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->
2025-06-07 09:03:02 +00:00
EYHN
7aafbf12a5 chore(ios): update ios app version (#12734)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **Chores**
  - Updated the app version number to 0.22.2 for iOS.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-06 08:54:24 +00:00
pengx17
0f9b7d4a0d fix(electron): increase recording timeout (#12733)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Refactor**
  - Removed the automatic timeout that stopped recordings after 1.5 hours. Recordings will no longer be stopped automatically based on duration.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-06 08:40:05 +00:00
renovate
2817b5aec4 chore: bump up @googleapis/androidpublisher version to v28 (#12713)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@googleapis/androidpublisher](https://redirect.github.com/googleapis/google-api-nodejs-client) | [`^27.0.0` -> `^28.0.0`](https://renovatebot.com/diffs/npm/@googleapis%2fandroidpublisher/27.0.0/28.0.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@googleapis%2fandroidpublisher/28.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@googleapis%2fandroidpublisher/28.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@googleapis%2fandroidpublisher/27.0.0/28.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@googleapis%2fandroidpublisher/27.0.0/28.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/google-api-nodejs-client (@&#8203;googleapis/androidpublisher)</summary>

### [`v28.0.1`](https://redirect.github.com/googleapis/google-api-nodejs-client/releases/tag/v28.0.1): 28.0.1

[Compare Source](https://redirect.github.com/googleapis/google-api-nodejs-client/compare/v27.0.0...v28.0.1)

This release fixes the release bug in v28.0.0.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/toeverything/AFFiNE).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC40MC4zIiwidXBkYXRlZEluVmVyIjoiNDAuNDAuMyIsInRhcmdldEJyYW5jaCI6ImNhbmFyeSIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->
2025-06-06 08:24:22 +00:00
forehalo
72e66aca11 ci: do not deny rust nightly warnings 2025-06-06 12:02:36 +08:00
fundon
7d1f2adb7f fix(editor): support copying single image from edgeless and pasting to page (#12709)
Closes: [BS-3586](https://linear.app/affine-design/issue/BS-3586/复制白板图片,然后粘贴到-page,图片失败)

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

- **New Features**
  - Copying a single selected image in edgeless mode now places the image directly onto the system clipboard as a native image blob for smoother pasting.

- **Bug Fixes**
  - Enhanced clipboard handling to better manage image and text data inclusion, with improved fallback for snapshot HTML.

- **Tests**
  - Added an end-to-end test verifying image copy-paste functionality between edgeless and page editor modes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-06 01:17:58 +00:00
akumatus
512a908fd4 fix(core): generate the image cannot enter text prompt (#12717)
Close [AI-167](https://linear.app/affine-design/issue/AI-167)

![截屏2025-06-05 12.15.49.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/sJGviKxfE3Ap685cl5bj/c1afff0e-1197-46dc-ae43-ff7257039509.png)

![截屏2025-06-05 12.14.07.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/sJGviKxfE3Ap685cl5bj/1439b0a7-1cca-4848-aea2-84bc73c536c5.png)

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

- **New Features**
  - Improved AI panel behavior with explicit modes for input and answer generation, providing a more intuitive user experience when interacting with AI features.

- **Refactor**
  - Streamlined AI panel toggling logic for more consistent and predictable panel states during different actions.

- **Tests**
  - Enhanced AI image generation test to simulate user input and send actions for more accurate end-to-end validation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-05 09:17:28 +00:00
liuyi
71be1d424a fix(server): oidc registration (#12723) 2025-06-05 09:16:21 +00:00
renovate
d6a26b8093 chore: bump up multer version to v2.0.1 [SECURITY] (#12716)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [multer](https://redirect.github.com/expressjs/multer) | [`2.0.0` -> `2.0.1`](https://renovatebot.com/diffs/npm/multer/2.0.0/2.0.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/multer/2.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/multer/2.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/multer/2.0.0/2.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/multer/2.0.0/2.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

### GitHub Vulnerability Alerts

#### [CVE-2025-48997](https://redirect.github.com/expressjs/multer/security/advisories/GHSA-g5hg-p3ph-g8qg)

### Impact

A vulnerability in Multer versions >=1.4.4-lts.1, <2.0.1 allows an attacker to trigger a Denial of Service (DoS) by sending an upload file request with an empty string field name. This request causes an unhandled exception, leading to a crash of the process.

### Patches

Users should upgrade to `2.0.1`

### Workarounds

None

### References

35a3272b61
[https://github.com/expressjs/multer/issues/1233](https://redirect.github.com/expressjs/multer/issues/1233)
[https://github.com/expressjs/multer/pull/1256](https://redirect.github.com/expressjs/multer/pull/1256)

---

### Release Notes

<details>
<summary>expressjs/multer (multer)</summary>

### [`v2.0.1`](https://redirect.github.com/expressjs/multer/blob/HEAD/CHANGELOG.md#201)

[Compare Source](https://redirect.github.com/expressjs/multer/compare/v2.0.0...v2.0.1)

-   Fix [CVE-2025-48997](https://www.cve.org/CVERecord?id=CVE-2025-48997) ([GHSA-g5hg-p3ph-g8qg](https://redirect.github.com/expressjs/multer/security/advisories/GHSA-g5hg-p3ph-g8qg))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/toeverything/AFFiNE).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC40MC4zIiwidXBkYXRlZEluVmVyIjoiNDAuNDAuMyIsInRhcmdldEJyYW5jaCI6ImNhbmFyeSIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->
2025-06-05 07:39:03 +00:00
EYHN
5e05952f6e feat(core): optimize tag performance (#12719)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **Refactor**
  - Improved tag options management to use a reactive, real-time approach, ensuring tag options are always up to date throughout the application.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-05 07:13:31 +00:00
JimmFly
c1930c5937 chore: adjust general access button styles (#12718)
close AF-2685

When the button is disabled, the frontmost icon is not positioned correctly. This commit is to fix the icon position.

![CleanShot 2025-06-05 at 12 38 55@2x](https://github.com/user-attachments/assets/af2f80bc-69a0-4e33-bc8f-e5e169f769fc)

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

## Summary by CodeRabbit

- **Style**
  - Improved the layout of the share menu trigger text by aligning its content vertically and adding spacing between elements for a cleaner appearance.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-05 06:59:18 +00:00
fengmk2
b7ebd33389 chore(server): ignore rolled back error on the first time (#12714)
close #12692

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

- **Bug Fixes**
  - Improved error handling during migration rollbacks to better recognize and safely skip specific migration errors.
  - Enhanced logging for migration rollback failures to provide clearer information without interrupting the process.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-05 04:00:21 +00:00
Brooooooklyn
de9a3e1428 ci: fix missing environment in build-server-native (#12712)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Chores**
  - Updated workflow configuration to set the environment for the build process based on input parameters.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-05 03:44:35 +00:00
fengmk2
374eee9196 chore(server): disable indexer by default (#12710)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Chores**
	- Updated the default setting for the indexer feature to be disabled by default.
	- Added a sample environment variable for enabling the indexer in the example configuration file.
	- Introduced a new environment variable for the indexer in the CI workflow configuration.
- **Tests**
	- Adjusted test configurations to explicitly enable the indexer feature during test execution.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-05 03:28:12 +00:00
donteatfriedrice
1bdccdbd57 feat(editor): track citation events (#12664)
Closes: [BS-3551](https://linear.app/affine-design/issue/BS-3551/citation埋点)

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

- **New Features**
  - Enhanced citation tracking across attachments, bookmarks, embedded documents, paragraphs, footnotes, rename modals, and toolbars for actions like editing, deleting, expanding, and hovering on citations.
  - Introduced a centralized citation service to unify citation detection and telemetry event management.
- **Chores**
  - Updated service exports and telemetry modules to include the new citation service and citation-related event types.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-05 03:09:24 +00:00
donteatfriedrice
053efb61f0 fix(editor): should set event dispatcher active as false when document is hidden (#12559)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **New Features**
  - The application now automatically becomes inactive when the document is hidden, improving resource management and responsiveness to visibility changes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-05 02:28:32 +00:00
pengx17
c7aebd0412 fix(electron): revert back electron to v35 (#12704)
v36 breaks worker loading in Electron's renderer
this use to work by turning off "PlzDedicatedWorker"
related to https://github.com/electron/electron/issues/43556

Before we know the root cause, revert back the electron version.

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

## Summary by CodeRabbit

- **Chores**
  - Updated the version of Electron used in the application.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-04 15:17:51 +00:00
renovate
01aa6979eb chore: bump up @nestjs-cls/transactional-adapter-prisma version to v1.2.23 (#12680)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@nestjs-cls/transactional-adapter-prisma](https://papooch.github.io/nestjs-cls/) ([source](https://redirect.github.com/Papooch/nestjs-cls)) | [`1.2.21` -> `1.2.23`](https://renovatebot.com/diffs/npm/@nestjs-cls%2ftransactional-adapter-prisma/1.2.21/1.2.23) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@nestjs-cls%2ftransactional-adapter-prisma/1.2.23?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@nestjs-cls%2ftransactional-adapter-prisma/1.2.23?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@nestjs-cls%2ftransactional-adapter-prisma/1.2.21/1.2.23?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@nestjs-cls%2ftransactional-adapter-prisma/1.2.21/1.2.23?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>Papooch/nestjs-cls (@&#8203;nestjs-cls/transactional-adapter-prisma)</summary>

### [`v1.2.23`](https://redirect.github.com/Papooch/nestjs-cls/compare/@nestjs-cls/transactional-adapter-prisma@1.2.22...@nestjs-cls/transactional-adapter-prisma@1.2.23)

[Compare Source](https://redirect.github.com/Papooch/nestjs-cls/compare/@nestjs-cls/transactional-adapter-prisma@1.2.22...@nestjs-cls/transactional-adapter-prisma@1.2.23)

### [`v1.2.22`](https://redirect.github.com/Papooch/nestjs-cls/compare/@nestjs-cls/transactional-adapter-prisma@1.2.21...@nestjs-cls/transactional-adapter-prisma@1.2.22)

[Compare Source](https://redirect.github.com/Papooch/nestjs-cls/compare/@nestjs-cls/transactional-adapter-prisma@1.2.21...@nestjs-cls/transactional-adapter-prisma@1.2.22)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/toeverything/AFFiNE).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC4zMy42IiwidXBkYXRlZEluVmVyIjoiNDAuNDAuMyIsInRhcmdldEJyYW5jaCI6ImNhbmFyeSIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->
2025-06-04 13:00:41 +00:00
akumatus
c32f7c7964 fix(core): read-only editor does not support code preview (#12700)
Close [AI-160](https://linear.app/affine-design/issue/AI-160)

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

## Summary by CodeRabbit

- **New Features**
  - Improved preview state management for code blocks, ensuring consistent behavior in both editable and readonly modes.

- **Refactor**
  - Streamlined the way preview state is toggled and displayed for code blocks, resulting in a more reliable and maintainable user experience.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-04 12:41:10 +00:00
fengmk2
d219c92e98 chore(server): ignore never applied rolled back error (#12703)
closes #12701

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

## Summary by CodeRabbit

- **Bug Fixes**
  - Improved error handling during migration rollbacks to prevent unnecessary errors when migrations were never applied.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-04 11:37:32 +00:00
darkskygit
063072457c fix(server): chat with image (#12699)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Refactor**
  - Improved the handling of attachments in chat messages for more efficient processing of images and files without impacting user experience.
- **Chores**
  - Added internal logging to enhance monitoring of AI model interactions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-04 08:51:02 +00:00
darkskygit
13fa4f922a fix(server): token calculate (#12667) 2025-06-04 07:09:33 +00:00
fengmk2
f54bc0c047 chore(server): auto roll back failed migrations (#12697) 2025-06-04 14:45:42 +08:00
akumatus
1f0cc51462 fix(core): ai retry missing reasoning and webSearch params (#12690)
Close [AI-165](https://linear.app/affine-design/issue/AI-165)

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

- **New Features**
  - Enhanced chat components to support advanced reasoning and network search options, providing more control over AI-powered interactions.
  - Improved polling for context documents and files, now also triggered by additional chip types for more comprehensive updates.

- **Bug Fixes**
  - Ensured consistent application of configuration settings across all relevant chat components.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-04 03:42:25 +00:00
EYHN
160e4c2a38 feat(core): add title order by (#12696)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Added support for ordering documents by their title.
  - Introduced a new "title" system property type with an associated icon and display name.

- **Improvements**
  - Enhanced system property types to allow more flexible filtering options.
  - Improved filter condition handling to show an unknown filter UI when filtering methods or values are unavailable.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-04 02:41:55 +00:00
darkskygit
99198e246b fix: migration compatible for postgres (#12659)
fix AI-162

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

- **Chores**
  - Improved database migration scripts to prevent errors by ensuring changes are only applied if relevant tables exist. No visible changes to user features or functionality.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-04 02:21:57 +00:00
darkskygit
44e1eb503f feat(server): improve embedding & rerank speed (#12666)
fix AI-109
2025-06-03 11:12:35 +00:00
CatsJuice
2288cbe54d chore(core): remove calendar integration feature flag (#12689)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **New Features**
  - All available integrations are now shown without restriction; calendar integration is always visible.

- **Chores**
  - Removed an obsolete feature flag related to calendar integration.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-03 10:58:19 +00:00
JimmFly
23ff398994 feat(mobile): add delete account function (#12688)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Introduced a "Delete my account" option in mobile settings with role-based warnings and confirmation modals.
- **Enhancements**
  - Added flexible row and reverse row layout options for modal footers and action buttons on mobile.
- **Localization**
  - Added English translation for the "Delete my account" setting.
- **Style**
  - Updated styles for modal footers and action buttons on mobile.
  - Added styling for account deletion dialog descriptions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-03 10:17:45 +00:00
forehalo
ee931d546e fix(server): oauth should follow sign up restriction (#12683)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **New Features**
	- Enforced signup restrictions for OAuth login based on configuration settings. Users will not be able to sign up via OAuth if signup is disabled by the administrator.
- **Bug Fixes**
	- Improved error handling during OAuth login when signup is not permitted.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-03 08:53:00 +00:00
aki-chang-dev
a02eed382d feat(android): chat base feature (#12684)
- **feat(android): chat send & receive**
- **[WIP] feat(android): markdown style for chat**
- **fix(android): fix auto scroll & ai message id replacement**
- **feat(android): replace icons**
- **refactor(android): design system**
- **feat(android): markdown style for chat**

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

- **New Features**
  - Introduced a comprehensive custom theme system with new color palettes, typography, and theme modes (Light, Dark, System).
  - Added support for rendering Markdown-formatted text in chat messages with custom styling.
  - Integrated new vector icons for UI elements such as lists, camera, image, send, close, and more.
  - Added composable icon and icon button components for consistent icon usage across the app.

- **Enhancements**
  - Updated chat UI to use the new theme, icons, and Markdown rendering for AI messages.
  - Improved chat message management and send button state handling with enhanced session retrieval and SSE stream processing.
  - Refined app bar and dropdown menu components with updated icons and theme integration.
  - Enhanced floating action button appearance with tinted vector drawable.
  - Unified UI components and styling under the AFFiNE design system in chat input and app bars.

- **Bug Fixes**
  - Corrected application and theme class naming for consistency.

- **Chores**
  - Added new dependencies for rich text and Markdown support.
  - Updated color and icon resources for a unified visual style.
  - Removed deprecated headers from authentication requests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-03 07:35:48 +00:00
L-Sun
ab78b8e3ab fix(editor): playground init error (#12565)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Bug Fixes**
	- Improved stability when observing document title changes by ensuring internal checks before updating.
	- Enhanced document initialization to reuse existing documents when available, reducing unnecessary duplication and improving performance.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-03 07:18:29 +00:00
yoyoyohamapi
3fe2ac4e46 refactor(core): add to edgeless as note icon (#12656)
### TL;DR

refactor(core): add to edgeless as note icon

> CLOSE AI-152

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

- **Style**
  - Updated the icon for the "Add to Edgeless as Note" chat action to improve visual representation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-03 07:02:04 +00:00
Brooooooklyn
d02aa8c7e0 fix(native): opt out napi-derive noop feature (#12686)
It would cause the napi-derive not work as expect in workspace level

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

- **Refactor**
  - Improved internal handling and type definitions for document parsing, resulting in clearer and more maintainable data structures.
- **Chores**
  - Introduced a new feature flag for mobile native builds, enabling conditional compilation for enhanced flexibility across Android and iOS.
  - Updated build scripts to support the new feature flag for both Android and iOS platforms.
  - Updated iOS app dependencies to newer versions, including Apollo iOS, ChidoriMenu, and swift-collections, and removed SQLite.swift.
- **Tests**
  - Enhanced Rust linting and testing workflows to run selectively across workspace packages with the new feature flag enabled.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-03 06:46:55 +00:00
akumatus
cce756365a feat(core): use claude 4 as default chat model (#12596)
Support [AI-59](https://linear.app/affine-design/issue/AI-59)

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

- **New Features**
  - Updated the default AI model for chat prompts to use Claude Sonnet 4.
- **Bug Fixes**
  - Improved model selection logic to better support reasoning features across more AI models.
- **Tests**
  - Enhanced test cases with consistent instructions for response length.
  - Skipped certain chat-related tests to refine test suite stability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-03 06:32:27 +00:00
yoyoyohamapi
a88dcc0951 fix(core): copy & paste ai message failed (#12655)
### TL;DR
* fix: ai message copy bug
  * Select a section of content in the Page
  * Choose the user's question from the AI chat conversation history and copy it
  * The copied (pasted) content will be the selected section from the Page

* fix: ai message paste bug
  * Select a section of content in the Page
  * Choose the user's question from the AI chat conversation history and copy it
  * Paste it into the AI Input, and the content will be pasted back into the original Page text

> CLOSE AF-2683

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

- **Bug Fixes**
  - Improved handling of copy and paste events in chat components to prevent unintended interactions with surrounding elements.
  - Enhanced test stability by adding error handling during embedding progress checks.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-03 06:09:44 +00:00
darkskygit
57208a3de4 fix(server): lost context after merge template (#12682)
fix AI-163
fix AI-164

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

## Summary by CodeRabbit

- **Tests**
  - Added a new test to verify multi-turn chat interactions, ensuring accurate handling of chat history and correct responses for translation and explanation requests.
- **Bug Fixes**
  - Improved chat session logic to better merge user messages and attachments, enhancing the accuracy and continuity of multi-step conversations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-03 05:46:18 +00:00
L-Sun
d8cbeb1bb1 fix(editor): can move frame by dragging title (#12661)
Close [BS-3351](https://linear.app/affine-design/issue/BS-3351/无法通过拖拽frame-title来拖拽frame)

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

- **New Features**
  - Improved rendering performance and consistency for widgets within frames.
  - Frame titles are now directly associated with individual frames and are draggable.

- **Bug Fixes**
  - Selection logic for frames has been refined to better handle locked states and title area interactions.

- **Refactor**
  - Frame title widget and related components have been simplified for clarity and maintainability.
  - Removed dynamic positioning and click toggling from frame titles for a cleaner interaction model.

- **Tests**
  - Added a test to verify that frame titles are draggable.
  - Temporarily disabled tests related to frame title stacking and selection due to ongoing changes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-03 05:14:39 +00:00
yoyoyohamapi
418b38e8de test(core): support fast embedding progress (#12685)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **Tests**
  - Improved test stability by handling potential errors during embedding progress checks in end-to-end tests.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-03 05:00:21 +00:00
doouding
00ff373c01 fix: tuning drag and resize snapping (#12657)
### Changed
- Better snapping when resize elements

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

- **New Features**
  - Improved resizing behavior with enhanced alignment and snapping during element resizing, supporting rotation and multiple element selection.
  - Alignment lines now display more accurately when resizing elements.

- **Refactor**
  - Resizing logic updated to use scale factors instead of position deltas, enabling smoother and more precise resize operations.
  - Resize event data now includes richer details about handle positions, scaling, and original bounds.
  - Coordinate transformations and scaling now account for rotation and aspect ratio locking more robustly.
  - Cursor updates are disabled during active resize or rotate interactions for a smoother user experience.

- **Tests**
  - Updated resizing tests to use square shapes, ensuring consistent verification of aspect ratio maintenance.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-03 04:12:57 +00:00
darkskygit
39830a410a feat(server): add metrics for copilot job event (#12575)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Chores**
	- Improved internal monitoring for AI embedding operations to enhance reliability and performance tracking. No changes to user-facing features.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-03 03:37:02 +00:00
fundon
ef3be4a816 fix(editor): font weight of label on open doc menu (#12672)
Closes: [BS-3496](https://linear.app/affine-design/issue/BS-3496/toolbar-菜单字重)

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

## Summary by CodeRabbit

- **Style**
  - Updated dropdown menu appearance by removing bold styling from button labels.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-03 03:22:18 +00:00
fundon
658393159b fix(editor): should check url origin and ip address url (#12663)
Closes: [BS-3578](https://linear.app/affine-design/issue/BS-3578/复制本的-url-无法识别)

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

- **New Features**
  - Improved URL validation to recognize and allow IPv4 addresses when the origin matches the provided base URL.

- **Tests**
  - Added a test to ensure URLs with IP addresses (e.g., http://127.0.0.1) are considered valid when the origin matches.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-03 03:08:17 +00:00
renovate[bot]
ac3f247f01 chore: bump up apollographql/apollo-ios version to v1.22.0 (#12670)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-03 10:32:12 +08:00
LongYinan
065d9c3b73 ci: fix release-mobile pipeline 2025-06-02 13:28:13 +08:00
LongYinan
2e58c11799 ci: do not use namespace runner anymore 2025-06-01 14:54:12 +08:00
L-Sun
10da3ad28e fix(editor): update card style after dragging it to note (#12660)
Close [BS-3148](https://linear.app/affine-design/issue/BS-3148/拖拽到note后,更新card样式)

### What Changes
- fix the style of card not updated after draggin it from canvas to note
- narrow type of specific card style by using `as const satisfies EmbedCardStyle[]`
- add type hint to the `props`, the second parameter  of `store.updateBlock`

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

- **New Features**
  - Added middleware to automatically update card styles when dragging blocks into notes.
- **Bug Fixes**
  - Ensured that dragging a bookmark card into a note preserves its style.
- **Tests**
  - Introduced an end-to-end test to verify bookmark card style is retained after drag-and-drop.
- **Refactor**
  - Enhanced type safety and clarity for card style configurations and block properties.
- **Chores**
  - Refined type annotations and assertions across multiple block style constants and toolbar configurations.
  - Improved generic typing for block update methods to increase type precision.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 10:55:29 +00:00
darkskygit
887a496f8b feat(server): add attachment fallback for ai sdk (#12639)
fix AI-161
2025-05-30 08:39:32 +00:00
darkskygit
ada69c80f6 feat(server): only trigger embedding in workspace sync (#12634)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Bug Fixes**
  - Improved handling of workspace embedding events to ensure they are only triggered for workspace-type spaces.

- **Chores**
  - Added additional debug logging for document embedding jobs to aid in monitoring and troubleshooting.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 08:04:18 +00:00
doufa
7b82dd656b fix(editor): connector not added as frame child (#12611)
Co-authored-by: L-Sun <zover.v@gmail.com>
2025-05-30 13:29:42 +08:00
EYHN
5c96566dd8 feat(core): save all docs options by mode (#12654)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Refactor**
  - Improved state management for display preferences, view mode, and selected collection in the "All Docs" page, making the experience more modular and consistent, especially when using multiple views.
  - Updated the header component to handle view changes more directly, allowing smoother toggling between different document views.

- **New Features**
  - Enhanced support for independent display settings in split view or multiple "All Docs" instances.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 04:42:27 +00:00
zzj3720
a35e1b1882 feat(editor): add database filter event tracking (#12645)
close: BS-3568

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

## Summary by CodeRabbit

- **New Features**
	- Added event tracking for filter creation in database views to improve activity monitoring and analytics.

- **Chores**
	- Updated internal event types to support new database view tracking.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 04:27:31 +00:00
yoyoyohamapi
756847d3cb fix(core): prevent ai input tip loop-play (#12600)
### TL;DR

* fix(core): prevent ai input tip loop-play

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

- **New Features**
  - Added an option to control whether tips in the AI chat composer scroll continuously or stop after the last tip.

- **Style**
  - Improved layout and spacing in the embedding status tooltip for better readability and alignment.

- **Refactor**
  - Updated the structure of elements in the embedding status tooltip for more consistent formatting.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 03:40:11 +00:00
forehalo
3c3a8bb107 feat(server): time duration helper (#12562)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Introduced support for parsing and converting duration strings (e.g., "1h30m") into milliseconds and seconds.
  - Added utility methods to handle a wide range of time units and their combinations.
  - Added functions to calculate dates offset before or after a given date by specified durations.
- **Tests**
  - Implemented comprehensive automated tests to ensure accurate parsing and conversion of duration strings.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 03:21:31 +00:00
forehalo
88eec2cdfb chore(server): disable version check for oauth callback (#12640)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **Bug Fixes**
  - Improved Apple OAuth login reliability by ensuring client version checks do not block the callback process.

- **New Features**
  - Enhanced OAuth account information by including an optional display name field.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 03:05:38 +00:00
renovate
52777b0064 chore: bump up @types/mime-types version to v3 (#12653)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@types/mime-types](https://redirect.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mime-types) ([source](https://redirect.github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mime-types)) | [`^2.1.4` -> `^3.0.0`](https://renovatebot.com/diffs/npm/@types%2fmime-types/2.1.4/3.0.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@types%2fmime-types/3.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@types%2fmime-types/3.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@types%2fmime-types/2.1.4/3.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@types%2fmime-types/2.1.4/3.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/toeverything/AFFiNE).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC4zMy42IiwidXBkYXRlZEluVmVyIjoiNDAuMzMuNiIsInRhcmdldEJyYW5jaCI6ImNhbmFyeSIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->
2025-05-30 02:49:07 +00:00
JimmFly
00ccd2d865 chore: display join button text based on invitation type (#12650)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **New Features**
  - The button on the Request to Join page now dynamically updates its label to show "accept invitation" when an invitation is pending, improving clarity for users responding to workspace invites.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 02:18:25 +00:00
doodlewind
5d94bd41a4 feat(editor): support triangle and diamond shape in shape dom renderer (#12331)
![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/lEGcysB4lFTEbCwZ8jMv/ebfcee12-cebb-4b98-81e2-f9f670b4de96.png)

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

- **New Features**
  - Improved rendering for diamond and triangle shapes using SVG, resulting in more accurate stroke and fill display.
- **Bug Fixes**
  - Ensured background and border styles do not interfere with SVG-based shapes.
- **Tests**
  - Added tests to verify correct DOM rendering for diamond and triangle shapes.
- **Refactor**
  - Streamlined and clarified the rendering logic for polygonal shapes, separating SVG and CSS rendering paths.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 02:04:09 +00:00
fundon
20d8d6131a fix(editor): text color of buttons on toolbar (#12642)
Closes: [BS-3574](https://linear.app/affine-design/issue/BS-3574/affine-light-模式,画板dark-模式,toolbar配色崩坏)

<img width="1068" alt="Screenshot 2025-05-29 at 17 46 38" src="https://github.com/user-attachments/assets/66a731dc-0bc6-4b0c-9712-787a78525ddf" />
<img width="1095" alt="Screenshot 2025-05-29 at 17 46 17" src="https://github.com/user-attachments/assets/3317ea83-837f-4c50-abee-ebb859fce3d9" />
<img width="1075" alt="Screenshot 2025-05-29 at 17 46 05" src="https://github.com/user-attachments/assets/3291810b-3aa1-4fce-aa8b-415be5e10c46" />
<img width="1096" alt="Screenshot 2025-05-29 at 17 45 54" src="https://github.com/user-attachments/assets/a5ad5e41-4eb9-4578-85a6-c6b773a03da9" />

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

## Summary by CodeRabbit

- **Style**
  - Updated toolbar theme styles to include an additional color variable for improved customization.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 01:47:50 +00:00
doodlewind
94539ac0d0 perf(editor): lazy rendering for dom renderer (#12638)
Before (brush updated even when it's not being dragged):

https://github.com/user-attachments/assets/e56ce326-56ae-4cac-a5f8-86be35fd8fcd

After (fine-grained element level update):

https://github.com/user-attachments/assets/712f4e22-0830-455d-bbe1-0f575e8920ac

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

- **New Features**
  - Improved rendering performance by introducing incremental updates, ensuring only changed elements are updated instead of re-rendering everything.
  - Enhanced responsiveness when elements are added, removed, or updated, as well as during viewport, size, or zoom changes.

- **Bug Fixes**
  - Reduced unnecessary full re-renders, leading to smoother and more efficient user interactions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 01:32:36 +00:00
Brooooooklyn
e1ce42a6fc feat(native): upgrade NAPI-RS to 3.0.0 beta (#12652)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
	- Added a default export for the native binding in the frontend native module, allowing easier imports.

- **Refactor**
	- Streamlined and updated Rust-to-JavaScript type conversions and lifetime handling for improved safety and consistency.
	- Improved object and array construction in Rust modules for more idiomatic usage.
	- Simplified boolean and null value handling in JavaScript interop layers.

- **Chores**
	- Upgraded several dependencies and development tools to newer versions across backend, frontend, and common packages.
	- Updated build scripts for the frontend native package to simplify commands.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-29 16:09:32 +00:00
renovate
2a7f0162cf chore: bump up nestjs-cls version to v6 (#12648)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [nestjs-cls](https://papooch.github.io/nestjs-cls/) ([source](https://redirect.github.com/Papooch/nestjs-cls)) | [`^5.0.0` -> `^6.0.0`](https://renovatebot.com/diffs/npm/nestjs-cls/5.4.3/6.0.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/nestjs-cls/6.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/nestjs-cls/6.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/nestjs-cls/5.4.3/6.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/nestjs-cls/5.4.3/6.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>Papooch/nestjs-cls (nestjs-cls)</summary>

### [`v6.0.0`](https://redirect.github.com/Papooch/nestjs-cls/releases/tag/nestjs-cls%406.0.0)

[Compare Source](https://redirect.github.com/Papooch/nestjs-cls/compare/nestjs-cls@5.4.3...nestjs-cls@6.0.0)

##### Breaking Changes

-   The experimental Plugin API has been changed ([4623607](https://redirect.github.com/Papooch/nestjs-cls/commits/4623607))
-   Access to Proxy providers moved to a dedicated `proxy` property on the ClsService ([82cdeef](https://redirect.github.com/Papooch/nestjs-cls/commits/82cdeef))

##### Features

-   **core**: introduce hooks for the Plugin API ([#&#8203;283](https://redirect.github.com/Papooch/nestjs-cls/issues/283)) ([4623607](https://redirect.github.com/Papooch/nestjs-cls/commits/4623607))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/toeverything/AFFiNE).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC4zMy42IiwidXBkYXRlZEluVmVyIjoiNDAuMzMuNiIsInRhcmdldEJyYW5jaCI6ImNhbmFyeSIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->
2025-05-29 15:45:33 +00:00
renovate
34a5d9dec3 chore: bump up @nestjs-cls/transactional-adapter-prisma version to v1.2.21 (#12643)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@nestjs-cls/transactional-adapter-prisma](https://papooch.github.io/nestjs-cls/) ([source](https://redirect.github.com/Papooch/nestjs-cls)) | [`1.2.20` -> `1.2.21`](https://renovatebot.com/diffs/npm/@nestjs-cls%2ftransactional-adapter-prisma/1.2.20/1.2.21) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@nestjs-cls%2ftransactional-adapter-prisma/1.2.21?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@nestjs-cls%2ftransactional-adapter-prisma/1.2.21?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@nestjs-cls%2ftransactional-adapter-prisma/1.2.20/1.2.21?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@nestjs-cls%2ftransactional-adapter-prisma/1.2.20/1.2.21?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>Papooch/nestjs-cls (@&#8203;nestjs-cls/transactional-adapter-prisma)</summary>

### [`v1.2.21`](https://redirect.github.com/Papooch/nestjs-cls/compare/@nestjs-cls/transactional-adapter-prisma@1.2.20...@nestjs-cls/transactional-adapter-prisma@1.2.21)

[Compare Source](https://redirect.github.com/Papooch/nestjs-cls/compare/@nestjs-cls/transactional-adapter-prisma@1.2.20...@nestjs-cls/transactional-adapter-prisma@1.2.21)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/toeverything/AFFiNE).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC4zMy42IiwidXBkYXRlZEluVmVyIjoiNDAuMzMuNiIsInRhcmdldEJyYW5jaCI6ImNhbmFyeSIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->
2025-05-29 15:29:07 +00:00
renovate
c68598c0e0 chore: bump up opentelemetry (#12183)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@opentelemetry/exporter-prometheus](https://redirect.github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-prometheus) ([source](https://redirect.github.com/open-telemetry/opentelemetry-js)) | [`^0.57.0` -> `^0.201.0`](https://renovatebot.com/diffs/npm/@opentelemetry%2fexporter-prometheus/0.57.2/0.201.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@opentelemetry%2fexporter-prometheus/0.201.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@opentelemetry%2fexporter-prometheus/0.201.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@opentelemetry%2fexporter-prometheus/0.57.2/0.201.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@opentelemetry%2fexporter-prometheus/0.57.2/0.201.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@opentelemetry/host-metrics](https://redirect.github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/opentelemetry-host-metrics#readme) ([source](https://redirect.github.com/open-telemetry/opentelemetry-js-contrib)) | [`^0.35.4` -> `^0.36.0`](https://renovatebot.com/diffs/npm/@opentelemetry%2fhost-metrics/0.35.5/0.36.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@opentelemetry%2fhost-metrics/0.36.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@opentelemetry%2fhost-metrics/0.36.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@opentelemetry%2fhost-metrics/0.35.5/0.36.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@opentelemetry%2fhost-metrics/0.35.5/0.36.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@opentelemetry/instrumentation](https://redirect.github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation) ([source](https://redirect.github.com/open-telemetry/opentelemetry-js)) | [`^0.57.0` -> `^0.201.0`](https://renovatebot.com/diffs/npm/@opentelemetry%2finstrumentation/0.57.2/0.201.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@opentelemetry%2finstrumentation/0.201.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@opentelemetry%2finstrumentation/0.201.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@opentelemetry%2finstrumentation/0.57.2/0.201.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@opentelemetry%2finstrumentation/0.57.2/0.201.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@opentelemetry/instrumentation-graphql](https://redirect.github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-graphql#readme) ([source](https://redirect.github.com/open-telemetry/opentelemetry-js-contrib)) | [`^0.47.0` -> `^0.49.0`](https://renovatebot.com/diffs/npm/@opentelemetry%2finstrumentation-graphql/0.47.1/0.49.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@opentelemetry%2finstrumentation-graphql/0.49.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@opentelemetry%2finstrumentation-graphql/0.49.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@opentelemetry%2finstrumentation-graphql/0.47.1/0.49.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@opentelemetry%2finstrumentation-graphql/0.47.1/0.49.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@opentelemetry/instrumentation-http](https://redirect.github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-http) ([source](https://redirect.github.com/open-telemetry/opentelemetry-js)) | [`^0.57.0` -> `^0.201.0`](https://renovatebot.com/diffs/npm/@opentelemetry%2finstrumentation-http/0.57.2/0.201.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@opentelemetry%2finstrumentation-http/0.201.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@opentelemetry%2finstrumentation-http/0.201.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@opentelemetry%2finstrumentation-http/0.57.2/0.201.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@opentelemetry%2finstrumentation-http/0.57.2/0.201.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@opentelemetry/instrumentation-ioredis](https://redirect.github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-ioredis#readme) ([source](https://redirect.github.com/open-telemetry/opentelemetry-js-contrib)) | [`^0.47.0` -> `^0.49.0`](https://renovatebot.com/diffs/npm/@opentelemetry%2finstrumentation-ioredis/0.47.1/0.49.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@opentelemetry%2finstrumentation-ioredis/0.49.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@opentelemetry%2finstrumentation-ioredis/0.49.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@opentelemetry%2finstrumentation-ioredis/0.47.1/0.49.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@opentelemetry%2finstrumentation-ioredis/0.47.1/0.49.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@opentelemetry/instrumentation-nestjs-core](https://redirect.github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-nestjs-core#readme) ([source](https://redirect.github.com/open-telemetry/opentelemetry-js-contrib)) | [`^0.44.0` -> `^0.47.0`](https://renovatebot.com/diffs/npm/@opentelemetry%2finstrumentation-nestjs-core/0.44.1/0.47.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@opentelemetry%2finstrumentation-nestjs-core/0.47.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@opentelemetry%2finstrumentation-nestjs-core/0.47.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@opentelemetry%2finstrumentation-nestjs-core/0.44.1/0.47.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@opentelemetry%2finstrumentation-nestjs-core/0.44.1/0.47.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@opentelemetry/instrumentation-socket.io](https://redirect.github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-socket.io#readme) ([source](https://redirect.github.com/open-telemetry/opentelemetry-js-contrib)) | [`^0.46.0` -> `^0.48.0`](https://renovatebot.com/diffs/npm/@opentelemetry%2finstrumentation-socket.io/0.46.1/0.48.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@opentelemetry%2finstrumentation-socket.io/0.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@opentelemetry%2finstrumentation-socket.io/0.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@opentelemetry%2finstrumentation-socket.io/0.46.1/0.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@opentelemetry%2finstrumentation-socket.io/0.46.1/0.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@opentelemetry/sdk-node](https://redirect.github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-sdk-node) ([source](https://redirect.github.com/open-telemetry/opentelemetry-js)) | [`^0.57.0` -> `^0.201.0`](https://renovatebot.com/diffs/npm/@opentelemetry%2fsdk-node/0.57.2/0.201.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@opentelemetry%2fsdk-node/0.201.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@opentelemetry%2fsdk-node/0.201.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@opentelemetry%2fsdk-node/0.57.2/0.201.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@opentelemetry%2fsdk-node/0.57.2/0.201.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@opentelemetry/semantic-conventions](https://redirect.github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions) ([source](https://redirect.github.com/open-telemetry/opentelemetry-js)) | [`1.33.0` -> `1.34.0`](https://renovatebot.com/diffs/npm/@opentelemetry%2fsemantic-conventions/1.33.0/1.34.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@opentelemetry%2fsemantic-conventions/1.34.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@opentelemetry%2fsemantic-conventions/1.34.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@opentelemetry%2fsemantic-conventions/1.33.0/1.34.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@opentelemetry%2fsemantic-conventions/1.33.0/1.34.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>open-telemetry/opentelemetry-js (@&#8203;opentelemetry/exporter-prometheus)</summary>

### [`v0.201.1`](4ce5bd1651...9dbd1e446b)

[Compare Source](4ce5bd1651...9dbd1e446b)

### [`v0.201.0`](7fde94081e...4ce5bd1651)

[Compare Source](7fde94081e...4ce5bd1651)

### [`v0.200.0`](ac8641a5db...7fde94081e)

[Compare Source](ac8641a5db...7fde94081e)

</details>

<details>
<summary>open-telemetry/opentelemetry-js-contrib (@&#8203;opentelemetry/host-metrics)</summary>

### [`v0.36.0`](d4d3c4f14f...32abc4c3c0)

[Compare Source](d4d3c4f14f...32abc4c3c0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/toeverything/AFFiNE).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC43LjEiLCJ1cGRhdGVkSW5WZXIiOiI0MC4zMy42IiwidGFyZ2V0QnJhbmNoIjoiY2FuYXJ5IiwibGFiZWxzIjpbImRlcGVuZGVuY2llcyJdfQ==-->
2025-05-29 15:10:07 +00:00
Flrande
9c81c24fbe fix(editor): clear selection after toggle latex editor (#12637)
- **fix(editor): clear selection after toggle latex editor**
- **chore: remove useless test**

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

- **New Features**
  - LaTeX rendering now outputs MathML format for improved accessibility and compatibility.
  - Added support for KaTeX styling to enhance LaTeX display in the playground.

- **Bug Fixes**
  - Improved editor behavior by resetting the selection group before opening the LaTeX editor.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-29 14:37:41 +00:00
congzhou09
517aec79ba fix(editor): invoke subscriber.unsubscribe() during cleanup (#12628) 2025-05-29 22:30:55 +08:00
fengmk2
31a1841e25 chore(server): log removed job id (#12646)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **Chores**
	- Improved log messages to include job IDs when jobs are removed from the queue, enhancing traceability for users monitoring job activity.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-29 11:48:16 +00:00
L-Sun
625e8392a6 fix(editor): missing block in select-all set (#12627)
This PR fixed that the block is missing in the selecte-all set after undo a dragging from canvas to note. Related to #12473

### Before

https://github.com/user-attachments/assets/828b4f48-689a-4975-bba6-f380f324de3c

### After

https://github.com/user-attachments/assets/9996c1ca-c3ea-415c-ab2b-359d826a1ffa

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

- **Bug Fixes**
  - Improved handling of changes to child elements, ensuring more accurate updates when items are added or removed. This results in more reliable display and interaction with nested components.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-29 11:04:01 +00:00
pengx17
f616bd29d3 fix(core): adjust some uis for sharing (#12486)
fix AF-2660

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

## Summary by CodeRabbit

- **Style**
  - Improved visual appearance of sidebar buttons and quick search input, including reduced sizes, updated padding, and enhanced hover effects.
  - Adjusted layout spacing for quick search and new page elements in the sidebar.
  - Updated share button styling to use the primary variant.

- **New Features**
  - Notification cards now only display messages and action footers when relevant, providing a cleaner interface.

- **Refactor**
  - Removed shortcut hint and spotlight elements from the quick search input for a simplified user experience.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-29 09:40:11 +00:00
CatsJuice
d6b9e9c60a feat(mobile): share page support (#12351)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **New Features**
  - Improved server context awareness for workspaces on mobile web.
  - Enhanced handling for missing workspaces by displaying a share page when accessing a document detail route in mobile web environments.

- **Bug Fixes**
  - Workspace list now refreshes automatically when switching workspace IDs.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-29 09:16:13 +00:00
donteatfriedrice
bc67766bb9 fix(editor): cleanup transformer middleware slot subscriptions (#12630)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **New Features**
  - Improved resource management by introducing explicit cleanup for various middleware components, ensuring that resources are properly released when no longer needed.

- **Refactor**
  - Updated middleware logic to support cleanup functions, enhancing the stability and performance of the application by preventing potential memory leaks.

- **Chores**
  - Enhanced lifecycle management in core systems to automatically dispose of resources when appropriate.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-29 08:33:30 +00:00
L-Sun
9a96cfded0 fix(editor): viewportElement is undefined in edgeless root block (#12626)
This PR fixed that `rootComponent.viewportElement` is undefeined in edgeless mode, which leads that toast can not be render in playground.

388641bc89/blocksuite/affine/components/src/toast/create.ts (L23-L35)

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

## Summary by CodeRabbit

- **Refactor**
  - Improved internal code organization for better maintainability. No changes to visible features or functionality.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-29 08:10:54 +00:00
1181 changed files with 34967 additions and 16713 deletions

View File

@@ -1,7 +1,7 @@
name: affine
services:
affine:
image: ghcr.io/toeverything/affine-graphql:${AFFINE_REVISION:-stable}
image: ghcr.io/toeverything/affine:${AFFINE_REVISION:-stable}
container_name: affine_server
ports:
- '${PORT:-3010}:3010'
@@ -25,7 +25,7 @@ services:
restart: unless-stopped
affine_migration:
image: ghcr.io/toeverything/affine-graphql:${AFFINE_REVISION:-stable}
image: ghcr.io/toeverything/affine:${AFFINE_REVISION:-stable}
container_name: affine_migration_job
volumes:
# custom configurations

View File

@@ -540,6 +540,11 @@
"description": "Where the server get deployed(FQDN).\n@default \"localhost\"\n@environment `AFFINE_SERVER_HOST`",
"default": "localhost"
},
"hosts": {
"type": "array",
"description": "Multiple hosts the server will accept requests from.\n@default []",
"default": []
},
"port": {
"type": "number",
"description": "Which port the server will listen on.\n@default 3010\n@environment `AFFINE_SERVER_PORT`",
@@ -560,6 +565,11 @@
"type": "boolean",
"description": "Only allow users with early access features to access the app\n@default false",
"default": false
},
"allowGuestDemoWorkspace": {
"type": "boolean",
"description": "Whether allow guest users to create demo workspaces.\n@default true",
"default": true
}
}
},
@@ -587,6 +597,11 @@
"type": "string",
"description": "Allowed version range of the app that allowed to access the server. Requires 'client/versionControl.enabled' to be true to take effect.\n@default \">=0.20.0\"",
"default": ">=0.20.0"
},
"allowGuestDemoWorkspace": {
"type": "boolean",
"description": "Allow guests to access demo workspace.\n@default true",
"default": true
}
}
},
@@ -727,6 +742,11 @@
},
"default": {}
},
"providers.morph": {
"type": "object",
"description": "The config for the morph provider.\n@default {}",
"default": {}
},
"unsplash": {
"type": "object",
"description": "The config for the unsplash key.\n@default {\"key\":\"\"}",
@@ -864,30 +884,14 @@
}
}
},
"customerIo": {
"type": "object",
"description": "Configuration for customerIo module",
"properties": {
"enabled": {
"type": "boolean",
"description": "Enable customer.io integration\n@default false",
"default": false
},
"token": {
"type": "string",
"description": "Customer.io token\n@default \"\"",
"default": ""
}
}
},
"indexer": {
"type": "object",
"description": "Configuration for indexer module",
"properties": {
"enabled": {
"type": "boolean",
"description": "Enable indexer plugin\n@default true\n@environment `AFFINE_INDEXER_ENABLED`",
"default": true
"description": "Enable indexer plugin\n@default false\n@environment `AFFINE_INDEXER_ENABLED`",
"default": false
},
"provider.type": {
"type": "string",
@@ -921,6 +925,22 @@
}
}
},
"customerIo": {
"type": "object",
"description": "Configuration for customerIo module",
"properties": {
"enabled": {
"type": "boolean",
"description": "Enable customer.io integration\n@default false",
"default": false
},
"token": {
"type": "string",
"description": "Customer.io token\n@default \"\"",
"default": ""
}
}
},
"oauth": {
"type": "object",
"description": "Configuration for oauth module",

View File

@@ -1,9 +1,6 @@
name: 'Deploy to Cluster'
description: 'Deploy AFFiNE Cloud to cluster'
inputs:
build-type:
description: 'Align with App build type, canary|beta|stable|internal'
default: 'canary'
gcp-project-number:
description: 'GCP project number'
required: true
@@ -36,5 +33,3 @@ runs:
- name: Deploy
shell: bash
run: node ./.github/actions/deploy/deploy.mjs
env:
BUILD_TYPE: '${{ inputs.build-type }}'

View File

@@ -126,7 +126,10 @@ const createHelmCommand = ({ isDryRun }) => {
? 'internal'
: 'dev';
const host = DEPLOY_HOST || CANARY_DEPLOY_HOST;
const hosts = (DEPLOY_HOST || CANARY_DEPLOY_HOST)
.split(',')
.map(host => host.trim())
.filter(host => host);
const deployCommand = [
`helm upgrade --install affine .github/helm/affine`,
`--namespace ${namespace}`,
@@ -135,7 +138,9 @@ const createHelmCommand = ({ isDryRun }) => {
`--set-string global.app.buildType="${buildType}"`,
`--set global.ingress.enabled=true`,
`--set-json global.ingress.annotations="{ \\"kubernetes.io/ingress.class\\": \\"gce\\", \\"kubernetes.io/ingress.allow-http\\": \\"true\\", \\"kubernetes.io/ingress.global-static-ip-name\\": \\"${STATIC_IP_NAME}\\" }"`,
`--set-string global.ingress.host="${host}"`,
...hosts.map(
(host, index) => `--set global.ingress.hosts[${index}]=${host}`
),
`--set-string global.version="${APP_VERSION}"`,
...redisAndPostgres,
...indexerOptions,
@@ -143,14 +148,14 @@ const createHelmCommand = ({ isDryRun }) => {
`--set-string web.image.tag="${imageTag}"`,
`--set graphql.replicaCount=${replica.graphql}`,
`--set-string graphql.image.tag="${imageTag}"`,
`--set graphql.app.host=${host}`,
`--set graphql.app.host=${hosts[0]}`,
`--set sync.replicaCount=${replica.sync}`,
`--set-string sync.image.tag="${imageTag}"`,
`--set-string renderer.image.tag="${imageTag}"`,
`--set renderer.app.host=${host}`,
`--set renderer.app.host=${hosts[0]}`,
`--set renderer.replicaCount=${replica.renderer}`,
`--set-string doc.image.tag="${imageTag}"`,
`--set doc.app.host=${host}`,
`--set doc.app.host=${hosts[0]}`,
`--set doc.replicaCount=${replica.doc}`,
...serviceAnnotations,
...resources,

View File

@@ -0,0 +1,41 @@
name: Prepare Release
description: 'Prepare Release'
outputs:
APP_VERSION:
description: 'App Version'
value: ${{ steps.get-version.outputs.APP_VERSION }}
GIT_SHORT_HASH:
description: 'Git Short Hash'
value: ${{ steps.get-version.outputs.GIT_SHORT_HASH }}
BUILD_TYPE:
description: 'Build Type'
value: ${{ steps.get-version.outputs.BUILD_TYPE }}
runs:
using: 'composite'
steps:
- name: Get Version
id: get-version
shell: bash
run: |
GIT_SHORT_HASH=$(git rev-parse --short HEAD)
if [ "${{ github.ref_type }}" == "tag" ]; then
APP_VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//')
else
APP_VERSION=$(date '+%Y.%-m.%-d-canary.%-H%-M')
fi
if [[ "$APP_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
BUILD_TYPE=stable
elif [[ "$APP_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+-beta\.[0-9]+$ ]]; then
BUILD_TYPE=beta
elif [[ "$APP_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+-canary\.[0-9a-f]+$ ]]; then
BUILD_TYPE=canary
else
echo "Error: unsupported version string: $APP_VERSION" >&2
exit 1
fi
echo $APP_VERSION
echo $GIT_SHORT_HASH
echo $BUILD_TYPE
echo "APP_VERSION=$APP_VERSION" >> "$GITHUB_OUTPUT"
echo "GIT_SHORT_HASH=$GIT_SHORT_HASH" >> "$GITHUB_OUTPUT"
echo "BUILD_TYPE=$BUILD_TYPE" >> "$GITHUB_OUTPUT"

View File

@@ -1,24 +1,12 @@
name: Setup Version
description: 'Setup Version'
outputs:
APP_VERSION:
inputs:
app-version:
description: 'App Version'
value: ${{ steps.version.outputs.APP_VERSION }}
required: true
runs:
using: 'composite'
steps:
- name: 'Write Version'
id: version
shell: bash
run: |
if [ "${{ github.ref_type }}" == "tag" ]; then
APP_VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//')
else
PACKAGE_VERSION=$(node -p "require('./package.json').version")
TIME_VERSION=$(date +%Y%m%d%H%M)
GIT_SHORT_HASH=$(git rev-parse --short HEAD)
APP_VERSION=$PACKAGE_VERSION-nightly-$GIT_SHORT_HASH
fi
echo $APP_VERSION
echo "APP_VERSION=$APP_VERSION" >> "$GITHUB_OUTPUT"
./scripts/set-version.sh $APP_VERSION
run: ./scripts/set-version.sh ${{ inputs.app-version }}

View File

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

View File

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

View File

@@ -95,11 +95,13 @@ spec:
path: /info
port: http
initialDelaySeconds: {{ .Values.probe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.probe.timeoutSeconds }}
readinessProbe:
httpGet:
path: /info
port: http
initialDelaySeconds: {{ .Values.probe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.probe.timeoutSeconds }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}

View File

@@ -1,6 +1,6 @@
replicaCount: 1
image:
repository: ghcr.io/toeverything/affine-graphql
repository: ghcr.io/toeverything/affine
pullPolicy: IfNotPresent
tag: ''
@@ -36,6 +36,7 @@ resources:
probe:
initialDelaySeconds: 20
timeoutSeconds: 5
nodeSelector: {}
tolerations: []

View File

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

View File

@@ -1,6 +1,6 @@
replicaCount: 1
image:
repository: ghcr.io/toeverything/affine-graphql
repository: ghcr.io/toeverything/affine
pullPolicy: IfNotPresent
tag: ''

View File

@@ -3,7 +3,7 @@ name: renderer
description: AFFiNE renderer server
type: application
version: 0.0.0
appVersion: "0.16.0"
appVersion: "0.22.4"
dependencies:
- name: gcloud-sql-proxy
version: 0.0.0

View File

@@ -1,6 +1,6 @@
replicaCount: 1
image:
repository: ghcr.io/toeverything/affine-graphql
repository: ghcr.io/toeverything/affine
pullPolicy: IfNotPresent
tag: ''

View File

@@ -3,7 +3,7 @@ name: sync
description: AFFiNE Sync Server
type: application
version: 0.0.0
appVersion: "0.21.0"
appVersion: "0.22.4"
dependencies:
- name: gcloud-sql-proxy
version: 0.0.0

View File

@@ -1,6 +1,6 @@
replicaCount: 1
image:
repository: ghcr.io/toeverything/affine-graphql
repository: ghcr.io/toeverything/affine
pullPolicy: IfNotPresent
tag: ''

View File

@@ -36,7 +36,8 @@ spec:
{{- end }}
{{- end }}
rules:
- host: "{{ .Values.global.ingress.host }}"
{{- range .Values.global.ingress.hosts }}
- host: {{ . | quote }}
http:
paths:
- path: /socket.io
@@ -45,33 +46,34 @@ spec:
service:
name: affine-sync
port:
number: {{ .Values.sync.service.port }}
number: {{ $.Values.sync.service.port }}
- path: /graphql
pathType: Prefix
backend:
service:
name: affine-graphql
port:
number: {{ .Values.graphql.service.port }}
number: {{ $.Values.graphql.service.port }}
- path: /api
pathType: Prefix
backend:
service:
name: affine-graphql
port:
number: {{ .Values.graphql.service.port }}
number: {{ $.Values.graphql.service.port }}
- path: /workspace
pathType: Prefix
backend:
service:
name: affine-renderer
port:
number: {{ .Values.renderer.service.port }}
number: {{ $.Values.renderer.service.port }}
- path: /
pathType: Prefix
backend:
service:
name: affine-web
port:
number: {{ .Values.web.service.port }}
number: {{ $.Values.web.service.port }}
{{- end }}
{{- end }}

View File

@@ -4,7 +4,13 @@ global:
ingress:
enabled: false
className: ''
host: affine.pro
# hosts for ingress rules
# e.g.
# hosts:
# - affine.pro
# - www.affine.pro
hosts:
- affine.pro
tls: []
secret:
secretName: 'server-private-key'

View File

@@ -3,7 +3,13 @@ name: Build Images
on:
workflow_call:
inputs:
flavor:
build-type:
type: string
required: true
app-version:
type: string
required: true
git-short-hash:
type: string
required: true
@@ -16,12 +22,13 @@ jobs:
build-web:
name: Build @affine/web
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.flavor }}
environment: ${{ inputs.build-type }}
steps:
- uses: actions/checkout@v4
- name: Setup Version
id: version
uses: ./.github/actions/setup-version
with:
app-version: ${{ inputs.app-version }}
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Build Core
@@ -30,11 +37,11 @@ jobs:
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
BUILD_TYPE: ${{ github.event.inputs.flavor }}
BUILD_TYPE: ${{ inputs.build-type }}
CAPTCHA_SITE_KEY: ${{ secrets.CAPTCHA_SITE_KEY }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: 'affine-web'
SENTRY_RELEASE: ${{ steps.version.outputs.APP_VERSION }}
SENTRY_RELEASE: ${{ inputs.app-version }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
PERFSEE_TOKEN: ${{ secrets.PERFSEE_TOKEN }}
@@ -49,12 +56,13 @@ jobs:
build-admin:
name: Build @affine/admin
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.flavor }}
environment: ${{ inputs.build-type }}
steps:
- uses: actions/checkout@v4
- name: Setup Version
id: version
uses: ./.github/actions/setup-version
with:
app-version: ${{ inputs.app-version }}
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Build Admin
@@ -63,7 +71,7 @@ jobs:
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
BUILD_TYPE: ${{ github.event.inputs.flavor }}
BUILD_TYPE: ${{ inputs.build-type }}
CAPTCHA_SITE_KEY: ${{ secrets.CAPTCHA_SITE_KEY }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: 'affine-admin'
@@ -81,12 +89,13 @@ jobs:
build-mobile:
name: Build @affine/mobile
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.flavor }}
environment: ${{ inputs.build-type }}
steps:
- uses: actions/checkout@v4
- name: Setup Version
id: version
uses: ./.github/actions/setup-version
with:
app-version: ${{ inputs.app-version }}
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Build Mobile
@@ -95,7 +104,7 @@ jobs:
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
BUILD_TYPE: ${{ github.event.inputs.flavor }}
BUILD_TYPE: ${{ inputs.build-type }}
CAPTCHA_SITE_KEY: ${{ secrets.CAPTCHA_SITE_KEY }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: 'affine-mobile'
@@ -113,6 +122,7 @@ jobs:
build-server-native:
name: Build Server native - ${{ matrix.targets.name }}
runs-on: ubuntu-latest
environment: ${{ inputs.build-type }}
strategy:
fail-fast: false
matrix:
@@ -127,8 +137,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Version
id: version
uses: ./.github/actions/setup-version
with:
app-version: ${{ inputs.app-version }}
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
@@ -160,8 +171,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Version
id: version
uses: ./.github/actions/setup-version
with:
app-version: ${{ inputs.app-version }}
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
@@ -201,16 +213,6 @@ jobs:
with:
name: server-dist
path: ./packages/backend/server/dist
- name: Setup env
run: |
echo "GIT_SHORT_HASH=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
if [ -z "${{ inputs.flavor }}" ]
then
echo "RELEASE_FLAVOR=canary" >> "$GITHUB_ENV"
else
echo "RELEASE_FLAVOR=${{ inputs.flavor }}" >> "$GITHUB_ENV"
fi
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
@@ -262,8 +264,9 @@ jobs:
run: mv ./node_modules ./packages/backend/server
- name: Setup Version
id: version
uses: ./.github/actions/setup-version
with:
app-version: ${{ inputs.app-version }}
- name: Build front Dockerfile
uses: docker/build-push-action@v6
@@ -274,7 +277,7 @@ jobs:
platforms: linux/amd64,linux/arm64
provenance: true
file: .github/deployment/front/Dockerfile
tags: ghcr.io/toeverything/affine-front:${{env.RELEASE_FLAVOR}}-${{ env.GIT_SHORT_HASH }},ghcr.io/toeverything/affine-front:${{env.RELEASE_FLAVOR}}
tags: ghcr.io/toeverything/affine-front:${{inputs.build-type}}-${{ inputs.git-short-hash }}
- name: Build graphql Dockerfile
uses: docker/build-push-action@v6
@@ -285,4 +288,4 @@ jobs:
platforms: linux/amd64,linux/arm64,linux/arm/v7
provenance: true
file: .github/deployment/node/Dockerfile
tags: ghcr.io/toeverything/affine-graphql:${{env.RELEASE_FLAVOR}}-${{ env.GIT_SHORT_HASH }},ghcr.io/toeverything/affine-graphql:${{env.RELEASE_FLAVOR}}
tags: ghcr.io/toeverything/affine:${{inputs.build-type}}-${{ inputs.git-short-hash }}

View File

@@ -1,25 +0,0 @@
name: Build Selfhost Image
on:
workflow_dispatch:
inputs:
flavor:
description: 'Select distribution to build'
type: choice
default: canary
options:
- canary
- beta
- stable
permissions:
contents: 'write'
id-token: 'write'
packages: 'write'
jobs:
build-image:
name: Build Image
uses: ./.github/workflows/build-images.yml
with:
flavor: ${{ github.event.inputs.flavor }}

View File

@@ -11,6 +11,7 @@ on:
paths-ignore:
- README.md
pull_request:
merge_group:
env:
DEBUG: napi:*
@@ -20,32 +21,18 @@ env:
COVERAGE: true
MACOSX_DEPLOYMENT_TARGET: '10.13'
DEPLOYMENT_TYPE: affine
AFFINE_INDEXER_ENABLED: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
optimize_ci:
name: Optimize CI
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check_skip.outputs.skip }}
steps:
- uses: actions/checkout@v4
- name: Graphite CI Optimizer
uses: withgraphite/graphite-ci-action@main
id: check_skip
with:
graphite_token: ${{ secrets.GRAPHITE_CI_OPTIMIZER_TOKEN }}
analyze:
name: Analyze
runs-on: ubuntu-latest
env:
NODE_OPTIONS: --max-old-space-size=14384
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
permissions:
actions: read
contents: read
@@ -79,9 +66,6 @@ jobs:
lint:
name: Lint
runs-on: ubuntu-24.04-arm
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
steps:
- uses: actions/checkout@v4
- name: Run oxlint
@@ -107,8 +91,6 @@ jobs:
typecheck:
name: Typecheck
runs-on: ubuntu-24.04-arm
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
env:
NODE_OPTIONS: --max-old-space-size=14384
steps:
@@ -136,8 +118,6 @@ jobs:
lint-rust:
name: Lint Rust
runs-on: ubuntu-latest
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build-rust
@@ -151,15 +131,14 @@ jobs:
- name: Clippy
run: |
rustup component add clippy
cargo clippy --all-targets --all-features -- -D warnings
cargo clippy --workspace --exclude affine_server_native --all-targets --all-features -- -D warnings
cargo clippy -p affine_server_native --all-targets --all-features -- -D warnings
check-git-status:
name: Check Git Status
runs-on: ubuntu-latest
needs:
- optimize_ci
- build-server-native
if: needs.optimize_ci.outputs.skip == 'false'
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
@@ -195,8 +174,6 @@ jobs:
check-yarn-binary:
name: Check yarn binary
runs-on: ubuntu-latest
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
steps:
- uses: actions/checkout@v4
- name: Run check
@@ -207,8 +184,6 @@ jobs:
e2e-blocksuite-test:
name: E2E BlockSuite Test
runs-on: ubuntu-latest
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
strategy:
fail-fast: false
matrix:
@@ -240,8 +215,6 @@ jobs:
e2e-blocksuite-cross-browser-test:
name: E2E BlockSuite Cross Browser Test
runs-on: ubuntu-latest
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
strategy:
fail-fast: false
matrix:
@@ -276,8 +249,6 @@ jobs:
e2e-test:
name: E2E Test
runs-on: ubuntu-24.04-arm
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
env:
DISTRIBUTION: web
IN_CI_TEST: true
@@ -310,8 +281,6 @@ jobs:
e2e-mobile-test:
name: E2E Mobile Test
runs-on: ubuntu-latest
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
env:
DISTRIBUTION: mobile
IN_CI_TEST: true
@@ -343,9 +312,7 @@ jobs:
name: Unit Test
runs-on: ubuntu-latest
needs:
- optimize_ci
- build-native
if: needs.optimize_ci.outputs.skip == 'false'
env:
DISTRIBUTION: web
strategy:
@@ -382,8 +349,6 @@ jobs:
build-native:
name: Build AFFiNE native (${{ matrix.spec.target }})
runs-on: ${{ matrix.spec.os }}
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
env:
CARGO_PROFILE_RELEASE_DEBUG: '1'
strategy:
@@ -426,8 +391,6 @@ jobs:
build-windows-native:
name: Build AFFiNE native (${{ matrix.spec.target }})
runs-on: ${{ matrix.spec.os }}
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
env:
CARGO_PROFILE_RELEASE_DEBUG: '1'
strategy:
@@ -475,8 +438,6 @@ jobs:
build-server-native:
name: Build Server native
runs-on: ubuntu-latest
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
env:
CARGO_PROFILE_RELEASE_DEBUG: '1'
steps:
@@ -502,8 +463,6 @@ jobs:
build-electron-renderer:
name: Build @affine/electron renderer
runs-on: ubuntu-latest
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
@@ -529,9 +488,7 @@ jobs:
name: Native Unit Test
runs-on: ubuntu-latest
needs:
- optimize_ci
- build-native
if: needs.optimize_ci.outputs.skip == 'false'
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
@@ -551,9 +508,7 @@ jobs:
name: Server Test
runs-on: ubuntu-latest
needs:
- optimize_ci
- build-server-native
if: needs.optimize_ci.outputs.skip == 'false'
strategy:
fail-fast: false
matrix:
@@ -585,7 +540,7 @@ jobs:
- 1025:1025
- 8025:8025
indexer:
image: manticoresearch/manticore:9.3.2
image: manticoresearch/manticore:10.1.0
ports:
- 9308:9308
steps:
@@ -626,9 +581,7 @@ jobs:
name: Server Test with Elasticsearch
runs-on: ubuntu-latest
needs:
- optimize_ci
- build-server-native
if: needs.optimize_ci.outputs.skip == 'false'
strategy:
fail-fast: false
env:
@@ -711,9 +664,7 @@ jobs:
name: Server E2E Test
runs-on: ubuntu-latest
needs:
- optimize_ci
- build-server-native
if: needs.optimize_ci.outputs.skip == 'false'
env:
NODE_ENV: test
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine
@@ -735,7 +686,7 @@ jobs:
ports:
- 6379:6379
indexer:
image: manticoresearch/manticore:9.3.2
image: manticoresearch/manticore:10.1.0
ports:
- 9308:9308
steps:
@@ -771,9 +722,6 @@ jobs:
miri:
name: miri code check
runs-on: ubuntu-latest
needs:
- optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
env:
RUST_BACKTRACE: full
CARGO_TERM_COLOR: always
@@ -787,7 +735,9 @@ jobs:
toolchain: nightly
components: miri
- name: Install latest nextest release
uses: taiki-e/install-action@nextest
uses: taiki-e/install-action@v2
with:
tool: nextest@0.9.98
- name: Miri Code Check
continue-on-error: true
@@ -797,9 +747,6 @@ jobs:
loom:
name: loom thread test
runs-on: ubuntu-latest
needs:
- optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
env:
RUSTFLAGS: --cfg loom
RUST_BACKTRACE: full
@@ -812,7 +759,9 @@ jobs:
with:
toolchain: stable
- name: Install latest nextest release
uses: taiki-e/install-action@nextest
uses: taiki-e/install-action@v2
with:
tool: nextest@0.9.98
- name: Loom Thread Test
run: |
@@ -821,11 +770,7 @@ jobs:
fuzzing:
name: fuzzing
runs-on: ubuntu-latest
needs:
- optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
env:
RUSTFLAGS: -D warnings
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
@@ -871,9 +816,6 @@ jobs:
- { target: 'aarch64-apple-darwin', os: 'macos-latest' }
- { target: 'x86_64-pc-windows-msvc', os: 'windows-latest' }
- { target: 'aarch64-pc-windows-msvc', os: 'windows-11-arm' }
needs:
- optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
@@ -907,8 +849,6 @@ jobs:
rust-test:
name: Run native tests
runs-on: ubuntu-latest
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
env:
CARGO_TERM_COLOR: always
steps:
@@ -920,18 +860,18 @@ jobs:
no-build: 'true'
- name: Install latest nextest release
uses: taiki-e/install-action@nextest
uses: taiki-e/install-action@v2
with:
tool: nextest@0.9.98
- name: Run tests
run: cargo nextest run --release --no-fail-fast
run: cargo nextest run --workspace --exclude affine_server_native --features use-as-lib --release --no-fail-fast
copilot-api-test:
name: Server Copilot Api Test
runs-on: ubuntu-latest
needs:
- optimize_ci
- build-server-native
if: needs.optimize_ci.outputs.skip == 'false'
env:
NODE_ENV: test
DISTRIBUTION: web
@@ -959,7 +899,7 @@ jobs:
- 1025:1025
- 8025:8025
indexer:
image: manticoresearch/manticore:9.3.2
image: manticoresearch/manticore:10.1.0
ports:
- 9308:9308
steps:
@@ -1053,7 +993,7 @@ jobs:
ports:
- 6379:6379
indexer:
image: manticoresearch/manticore:9.3.2
image: manticoresearch/manticore:10.1.0
ports:
- 9308:9308
steps:
@@ -1113,10 +1053,8 @@ jobs:
name: ${{ matrix.tests.name }}
runs-on: ubuntu-latest
needs:
- optimize_ci
- build-server-native
- build-native
if: needs.optimize_ci.outputs.skip == 'false'
env:
DISTRIBUTION: web
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine
@@ -1175,7 +1113,7 @@ jobs:
- 1025:1025
- 8025:8025
indexer:
image: manticoresearch/manticore:9.3.2
image: manticoresearch/manticore:10.1.0
ports:
- 9308:9308
steps:
@@ -1220,10 +1158,8 @@ jobs:
name: Desktop Test (${{ matrix.spec.os }}, ${{ matrix.spec.platform }}, ${{ matrix.spec.arch }}, ${{ matrix.spec.target }}, ${{ matrix.spec.test }})
runs-on: ${{ matrix.spec.os }}
needs:
- optimize_ci
- build-electron-renderer
- build-native
if: needs.optimize_ci.outputs.skip == 'false'
strategy:
fail-fast: false
matrix:
@@ -1318,10 +1254,8 @@ jobs:
name: Desktop bundle check (${{ matrix.spec.os }}, ${{ matrix.spec.platform }}, ${{ matrix.spec.arch }}, ${{ matrix.spec.target }}, ${{ matrix.spec.test }})
runs-on: ${{ matrix.spec.os }}
needs:
- optimize_ci
- build-electron-renderer
- build-native
if: needs.optimize_ci.outputs.skip == 'false'
strategy:
fail-fast: false
matrix:
@@ -1425,17 +1359,6 @@ jobs:
run: |
yarn affine @affine/electron node ./scripts/macos-arm64-output-check.ts
test-build-mobile-app:
uses: ./.github/workflows/release-mobile.yml
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
with:
build-type: canary
build-target: development
secrets: inherit
permissions:
id-token: 'write'
test-done:
needs:
- analyze
@@ -1466,7 +1389,6 @@ jobs:
- desktop-test
- desktop-bundle-check
- cloud-e2e-test
- test-build-mobile-app
if: always()
runs-on: ubuntu-latest
name: 3, 2, 1 Launch

View File

@@ -60,7 +60,7 @@ jobs:
- 1025:1025
- 8025:8025
indexer:
image: manticoresearch/manticore:9.3.2
image: manticoresearch/manticore:10.1.0
ports:
- 9308:9308
steps:
@@ -130,7 +130,7 @@ jobs:
ports:
- 6379:6379
indexer:
image: manticoresearch/manticore:9.3.2
image: manticoresearch/manticore:10.1.0
ports:
- 9308:9308
steps:

View File

@@ -1,32 +0,0 @@
name: Deploy Automatically
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+-canary.[0-9]+'
schedule:
- cron: '0 9 * * *'
permissions:
contents: write
pull-requests: write
actions: write
jobs:
dispatch-deploy:
runs-on: ubuntu-latest
name: Setup Deploy
steps:
- name: dispatch deploy by tag
if: ${{ github.event_name == 'push' }}
uses: benc-uk/workflow-dispatch@v1
with:
workflow: deploy.yml
inputs: '{ "flavor": "canary" }'
- name: dispatch deploy by schedule
if: ${{ github.event_name == 'schedule' }}
uses: benc-uk/workflow-dispatch@v1
with:
workflow: deploy.yml
inputs: '{ "flavor": "canary" }'
ref: canary

View File

@@ -1,189 +0,0 @@
name: Deploy
on:
workflow_dispatch:
inputs:
flavor:
description: 'Select what enverionment to deploy to'
type: choice
default: canary
options:
- canary
- beta
- stable
- internal
permissions:
contents: 'write'
id-token: 'write'
packages: 'write'
jobs:
output-prev-version:
name: Output previous version
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.flavor }}
outputs:
prev: ${{ steps.print.outputs.version }}
namespace: ${{ steps.print.outputs.namespace }}
steps:
- uses: actions/checkout@v4
- name: Auth to Cluster
uses: './.github/actions/cluster-auth'
with:
gcp-project-number: ${{ secrets.GCP_PROJECT_NUMBER }}
gcp-project-id: ${{ secrets.GCP_PROJECT_ID }}
service-account: ${{ secrets.GCP_HELM_DEPLOY_SERVICE_ACCOUNT }}
cluster-name: ${{ secrets.GCP_CLUSTER_NAME }}
cluster-location: ${{ secrets.GCP_CLUSTER_LOCATION }}
- name: Output previous version
id: print
run: |
namespace=""
if [ "${{ github.event.inputs.flavor }}" = "canary" ]; then
namespace="dev"
elif [ "${{ github.event.inputs.flavor }}" = "beta" ]; then
namespace="beta"
elif [ "${{ github.event.inputs.flavor }}" = "stable" ]; then
namespace="production"
else
echo "Invalid flavor: ${{ github.event.inputs.flavor }}"
exit 1
fi
echo "Namespace set to: $namespace"
# Get the previous version from the deployment
prev_version=$(kubectl get deployment -n $namespace affine-graphql -o=jsonpath='{.spec.template.spec.containers[0].image}' | awk -F '-' '{print $3}')
echo "Previous version: $prev_version"
echo "version=$prev_version" >> $GITHUB_OUTPUT
echo "namesapce=$namespace" >> $GITHUB_OUTPUT
build-images:
name: Build Images
uses: ./.github/workflows/build-images.yml
secrets: inherit
with:
flavor: ${{ github.event.inputs.flavor }}
deploy:
name: Deploy to cluster
if: ${{ github.event_name == 'workflow_dispatch' }}
environment: ${{ github.event.inputs.flavor }}
needs:
- build-images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Version
id: version
uses: ./.github/actions/setup-version
- name: Deploy to ${{ github.event.inputs.flavor }}
uses: ./.github/actions/deploy
with:
build-type: ${{ github.event.inputs.flavor }}
gcp-project-number: ${{ secrets.GCP_PROJECT_NUMBER }}
gcp-project-id: ${{ secrets.GCP_PROJECT_ID }}
service-account: ${{ secrets.GCP_HELM_DEPLOY_SERVICE_ACCOUNT }}
cluster-name: ${{ secrets.GCP_CLUSTER_NAME }}
cluster-location: ${{ secrets.GCP_CLUSTER_LOCATION }}
env:
APP_VERSION: ${{ steps.version.outputs.APP_VERSION }}
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
CANARY_DEPLOY_HOST: ${{ secrets.CANARY_DEPLOY_HOST }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
DATABASE_USERNAME: ${{ secrets.DATABASE_USERNAME }}
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
DATABASE_NAME: ${{ secrets.DATABASE_NAME }}
GCLOUD_CONNECTION_NAME: ${{ secrets.GCLOUD_CONNECTION_NAME }}
REDIS_SERVER_HOST: ${{ secrets.REDIS_SERVER_HOST }}
REDIS_SERVER_PASSWORD: ${{ secrets.REDIS_SERVER_PASSWORD }}
CLOUD_SQL_IAM_ACCOUNT: ${{ secrets.CLOUD_SQL_IAM_ACCOUNT }}
APP_IAM_ACCOUNT: ${{ secrets.APP_IAM_ACCOUNT }}
STATIC_IP_NAME: ${{ secrets.STATIC_IP_NAME }}
AFFINE_INDEXER_SEARCH_PROVIDER: ${{ secrets.AFFINE_INDEXER_SEARCH_PROVIDER }}
AFFINE_INDEXER_SEARCH_ENDPOINT: ${{ secrets.AFFINE_INDEXER_SEARCH_ENDPOINT }}
AFFINE_INDEXER_SEARCH_API_KEY: ${{ secrets.AFFINE_INDEXER_SEARCH_API_KEY }}
deploy-done:
needs:
- output-prev-version
- build-images
- deploy
if: always()
runs-on: ubuntu-latest
name: Post deploy message
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/checkout@v4
with:
repository: toeverything/blocksuite
path: blocksuite
fetch-depth: 0
fetch-tags: true
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
extra-flags: 'workspaces focus @affine/changelog'
electron-install: false
- name: Output deployed info
if: ${{ always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
id: set_info
run: |
if [ "${{ github.event.inputs.flavor }}" = "canary" ]; then
echo "deployed_url=https://affine.fail" >> $GITHUB_OUTPUT
elif [ "${{ github.event.inputs.flavor }}" = "beta" ]; then
echo "deployed_url=https://insider.affine.pro" >> $GITHUB_OUTPUT
elif [ "${{ github.event.inputs.flavor }}" = "stable" ]; then
echo "deployed_url=https://app.affine.pro" >> $GITHUB_OUTPUT
else
exit 1
fi
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Post Success event to a Slack channel
if: ${{ always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
run: node ./tools/changelog/index.js
env:
CHANNEL_ID: ${{ secrets.RELEASE_SLACK_CHNNEL_ID }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
DEPLOYED_URL: ${{ steps.set_info.outputs.deployed_url }}
PREV_VERSION: ${{ needs.output-prev-version.outputs.prev }}
NAMESPACE: ${{ needs.output-prev-version.outputs.namespace }}
DEPLOYMENT: 'SERVER'
FLAVOR: ${{ github.event.inputs.flavor }}
BLOCKSUITE_REPO_PATH: ${{ github.workspace }}/blocksuite
- name: Post Failed event to a Slack channel
id: failed-slack
uses: slackapi/slack-github-action@v2.1.0
if: ${{ always() && contains(needs.*.result, 'failure') }}
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: ${{ secrets.RELEASE_SLACK_CHNNEL_ID }}
text: "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Backend deploy failed `${{ github.event.inputs.flavor }}`>"
blocks:
- type: section
text:
type: mrkdwn
text: "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Backend deploy failed `${{ github.event.inputs.flavor }}`>"
- name: Post Cancel event to a Slack channel
id: cancel-slack
uses: slackapi/slack-github-action@v2.1.0
if: ${{ always() && contains(needs.*.result, 'cancelled') && !contains(needs.*.result, 'failure') }}
with:
token: ${{ secrets.SLACK_BOT_TOKEN }}
method: chat.postMessage
payload: |
channel: ${{ secrets.RELEASE_SLACK_CHNNEL_ID }}
text: "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Backend deploy cancelled `${{ github.event.inputs.flavor }}`>"
blocks:
- type: section
text:
type: mrkdwn
text: "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Backend deploy cancelled `${{ github.event.inputs.flavor }}`>"

View File

@@ -1,66 +0,0 @@
name: Release Charts
on:
push:
branches: [canary]
paths:
- '.github/helm/**/Chart.yml'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout Helm chart repo
uses: actions/checkout@v4
with:
repository: toeverything/helm-charts
path: .helm-chart-repo
ref: gh-pages
token: ${{ secrets.HELM_RELEASER_TOKEN }}
- name: Install Helm
uses: azure/setup-helm@v4
- name: Install chart releaser
run: |
set -e
arch="$(dpkg --print-architecture)"
curl -s https://api.github.com/repos/helm/chart-releaser/releases/latest \
| yq --indent 0 --no-colors --input-format json --unwrapScalar \
".assets[] | select(.name | test("\""^chart-releaser_.+_linux_${arch}\.tar\.gz$"\"")) | .browser_download_url" \
| xargs curl -SsL \
| tar zxf - -C /usr/local/bin
- name: Package charts
working-directory: .helm-chart-repo
run: |
mkdir -p .cr-index
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
helm dependencies build ../.github/helm/affine
helm dependencies build ../.github/helm/affine-cloud
cr package ../.github/helm/affine
cr package ../.github/helm/affine-cloud
- name: Publish charts
working-directory: .helm-chart-repo
run: |
set -ex
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
owner=$(cut -d '/' -f 1 <<< '${{ github.repository }}')
repo=helm-charts
git_hash=$(git rev-parse HEAD)
cr upload --commit "$git_hash" \
--git-repo "$repo" --owner "$owner" \
--token '${{ secrets.HELM_RELEASER_TOKEN }}' \
--skip-existing
cr index --git-repo "$repo" --owner "$owner" \
--token '${{ secrets.HELM_RELEASER_TOKEN }}' \
--index-path .cr-index --push

View File

@@ -1,19 +0,0 @@
name: Label Checker
on:
pull_request:
types:
- opened
- labeled
- unlabeled
branches:
- canary
jobs:
check_labels:
name: PR should not have a blocked label
runs-on: ubuntu-latest
steps:
- uses: docker://agilepathway/pull-request-label-checker:latest
with:
none_of: blocked
repo_token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,12 +0,0 @@
name: Pull request auto assign
# on: pull_request
on:
pull_request:
types: [opened, ready_for_review]
jobs:
add-reviews:
runs-on: ubuntu-latest
steps:
- uses: kentaro-m/auto-assign-action@v2.0.0

View File

@@ -1,38 +0,0 @@
name: Release Desktop/Mobile Automatically
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+-canary.[0-9]+'
schedule:
- cron: '0 9 * * *'
permissions:
contents: write
pull-requests: write
actions: write
jobs:
dispatch-release-desktop:
runs-on: ubuntu-latest
name: Setup Release Desktop
steps:
- name: dispatch desktop release by tag
if: ${{ github.event_name == 'push' }}
uses: benc-uk/workflow-dispatch@v1
with:
workflow: release-desktop.yml
inputs: '{ "build-type": "canary", "is-draft": false, "is-pre-release": true }'
- name: dispatch desktop release by schedule
if: ${{ github.event_name == 'schedule' }}
uses: benc-uk/workflow-dispatch@v1
with:
workflow: release-desktop.yml
inputs: '{ "build-type": "canary", "is-draft": false, "is-pre-release": true }'
ref: canary
- name: dispatch desktop release by tag
uses: benc-uk/workflow-dispatch@v1
with:
workflow: release-mobile.yml
inputs: '{ "build-type": "canary", "build-target": "distribution" }'

66
.github/workflows/release-cloud.yml vendored Normal file
View File

@@ -0,0 +1,66 @@
name: Release Cloud
on:
workflow_call:
inputs:
build-type:
required: true
type: string
app-version:
required: true
type: string
git-short-hash:
required: true
type: string
permissions:
contents: 'write'
id-token: 'write'
packages: 'write'
jobs:
build-images:
name: Build Images
uses: ./.github/workflows/build-images.yml
secrets: inherit
with:
build-type: ${{ inputs.build-type }}
app-version: ${{ inputs.app-version }}
git-short-hash: ${{ inputs.git-short-hash }}
deploy:
name: Deploy to cluster
environment: ${{ inputs.build-type }}
needs:
- build-images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy to ${{ inputs.build-type }}
uses: ./.github/actions/deploy
with:
gcp-project-number: ${{ secrets.GCP_PROJECT_NUMBER }}
gcp-project-id: ${{ secrets.GCP_PROJECT_ID }}
service-account: ${{ secrets.GCP_HELM_DEPLOY_SERVICE_ACCOUNT }}
cluster-name: ${{ secrets.GCP_CLUSTER_NAME }}
cluster-location: ${{ secrets.GCP_CLUSTER_LOCATION }}
env:
BUILD_TYPE: ${{ inputs.build-type }}
APP_VERSION: ${{ inputs.app-version }}
GIT_SHORT_HASH: ${{ inputs.git-short-hash }}
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
CANARY_DEPLOY_HOST: ${{ secrets.CANARY_DEPLOY_HOST }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
DATABASE_USERNAME: ${{ secrets.DATABASE_USERNAME }}
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
DATABASE_NAME: ${{ secrets.DATABASE_NAME }}
GCLOUD_CONNECTION_NAME: ${{ secrets.GCLOUD_CONNECTION_NAME }}
REDIS_SERVER_HOST: ${{ secrets.REDIS_SERVER_HOST }}
REDIS_SERVER_PASSWORD: ${{ secrets.REDIS_SERVER_PASSWORD }}
CLOUD_SQL_IAM_ACCOUNT: ${{ secrets.CLOUD_SQL_IAM_ACCOUNT }}
APP_IAM_ACCOUNT: ${{ secrets.APP_IAM_ACCOUNT }}
STATIC_IP_NAME: ${{ secrets.STATIC_IP_NAME }}
AFFINE_INDEXER_SEARCH_PROVIDER: ${{ secrets.AFFINE_INDEXER_SEARCH_PROVIDER }}
AFFINE_INDEXER_SEARCH_ENDPOINT: ${{ secrets.AFFINE_INDEXER_SEARCH_ENDPOINT }}
AFFINE_INDEXER_SEARCH_API_KEY: ${{ secrets.AFFINE_INDEXER_SEARCH_API_KEY }}

View File

@@ -1,27 +1,17 @@
name: Release Desktop App
name: Release Desktop
on:
workflow_dispatch:
workflow_call:
inputs:
build-type:
description: 'Build Type'
type: choice
required: true
default: canary
options:
- canary
- beta
- stable
is-draft:
description: 'Draft Release?'
type: boolean
type: string
app-version:
required: true
default: true
is-pre-release:
description: 'Pre Release? (labeled as "PreRelease")'
type: boolean
type: string
git-short-hash:
required: true
default: true
type: string
permissions:
actions: write
@@ -31,7 +21,8 @@ permissions:
attestations: write
env:
BUILD_TYPE: ${{ github.event.inputs.build-type }}
BUILD_TYPE: ${{ inputs.build-type }}
RELEASE_VERSION: ${{ inputs.app-version }}
DEBUG: 'affine:*,napi:*'
APP_NAME: affine
MACOSX_DEPLOYMENT_TARGET: '10.13'
@@ -39,14 +30,13 @@ env:
jobs:
before-make:
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.build-type }}
outputs:
RELEASE_VERSION: ${{ steps.version.outputs.APP_VERSION }}
environment: ${{ inputs.build-type }}
steps:
- uses: actions/checkout@v4
- name: Setup Version
id: version
uses: ./.github/actions/setup-version
with:
app-version: ${{ inputs.app-version }}
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Setup @sentry/cli
@@ -58,14 +48,14 @@ jobs:
SENTRY_PROJECT: 'affine'
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_RELEASE: ${{ steps.version.outputs.APP_VERSION }}
RELEASE_VERSION: ${{ steps.version.outputs.APP_VERSION }}
SENTRY_RELEASE: ${{ inputs.app-version }}
RELEASE_VERSION: ${{ inputs.app-version }}
MIXPANEL_TOKEN: ${{ secrets.MIXPANEL_TOKEN }}
- name: Upload web artifact
uses: actions/upload-artifact@v4
with:
name: web
name: desktop-web
path: packages/frontend/apps/electron/resources/web-static
make-distribution:
@@ -87,7 +77,7 @@ jobs:
target: x86_64-unknown-linux-gnu
runs-on: ${{ matrix.spec.runner }}
needs: before-make
environment: ${{ github.event.inputs.build-type }}
environment: ${{ inputs.build-type }}
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
@@ -97,13 +87,14 @@ jobs:
SENTRY_PROJECT: 'affine'
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_RELEASE: ${{ needs.before-make.outputs.RELEASE_VERSION }}
SENTRY_RELEASE: ${{ inputs.app-version }}
MIXPANEL_TOKEN: ${{ secrets.MIXPANEL_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Setup Version
id: version
uses: ./.github/actions/setup-version
with:
app-version: ${{ inputs.app-version }}
- name: Setup Node.js
timeout-minutes: 10
uses: ./.github/actions/setup-node
@@ -119,7 +110,7 @@ jobs:
package: '@affine/native'
- uses: actions/download-artifact@v4
with:
name: web
name: desktop-web
path: packages/frontend/apps/electron/resources/web-static
- name: Build Desktop Layers
@@ -165,31 +156,31 @@ jobs:
if: ${{ matrix.spec.platform == 'darwin' }}
run: |
mkdir -p builds
mv packages/frontend/apps/electron/out/*/make/*.dmg ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.dmg
mv packages/frontend/apps/electron/out/*/make/zip/darwin/${{ matrix.spec.arch }}/*.zip ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.zip
mv packages/frontend/apps/electron/out/*/make/*.dmg ./builds/affine-${{ env.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.dmg
mv packages/frontend/apps/electron/out/*/make/zip/darwin/${{ matrix.spec.arch }}/*.zip ./builds/affine-${{ env.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.zip
- name: Save artifacts (linux)
if: ${{ matrix.spec.platform == 'linux' }}
run: |
mkdir -p builds
mv packages/frontend/apps/electron/out/*/make/zip/linux/${{ matrix.spec.arch }}/*.zip ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-${{ matrix.spec.arch }}.zip
mv packages/frontend/apps/electron/out/*/make/*.AppImage ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-${{ matrix.spec.arch }}.appimage
mv packages/frontend/apps/electron/out/*/make/deb/${{ matrix.spec.arch }}/*.deb ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-${{ matrix.spec.arch }}.deb
mv packages/frontend/apps/electron/out/*/make/flatpak/*/*.flatpak ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-${{ matrix.spec.arch }}.flatpak
mv packages/frontend/apps/electron/out/*/make/zip/linux/${{ matrix.spec.arch }}/*.zip ./builds/affine-${{ env.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-${{ matrix.spec.arch }}.zip
mv packages/frontend/apps/electron/out/*/make/*.AppImage ./builds/affine-${{ env.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-${{ matrix.spec.arch }}.appimage
mv packages/frontend/apps/electron/out/*/make/deb/${{ matrix.spec.arch }}/*.deb ./builds/affine-${{ env.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-${{ matrix.spec.arch }}.deb
mv packages/frontend/apps/electron/out/*/make/flatpak/*/*.flatpak ./builds/affine-${{ env.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-${{ matrix.spec.arch }}.flatpak
- uses: actions/attest-build-provenance@v2
if: ${{ matrix.spec.platform == 'darwin' }}
with:
subject-path: |
./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.zip
./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.dmg
./builds/affine-${{ env.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.zip
./builds/affine-${{ env.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.dmg
- uses: actions/attest-build-provenance@v2
if: ${{ matrix.spec.platform == 'linux' }}
with:
subject-path: |
./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-x64.zip
./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-x64.appimage
./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-x64.deb
./builds/affine-${{ env.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-x64.zip
./builds/affine-${{ env.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-x64.appimage
./builds/affine-${{ env.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-linux-x64.deb
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
@@ -197,7 +188,7 @@ jobs:
path: builds
package-distribution-windows:
environment: ${{ github.event.inputs.build-type }}
environment: ${{ inputs.build-type }}
strategy:
fail-fast: false
matrix:
@@ -221,13 +212,14 @@ jobs:
SENTRY_PROJECT: 'affine'
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_RELEASE: ${{ needs.before-make.outputs.RELEASE_VERSION }}
SENTRY_RELEASE: ${{ inputs.app-version }}
MIXPANEL_TOKEN: ${{ secrets.MIXPANEL_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Setup Version
id: version
uses: ./.github/actions/setup-version
with:
app-version: ${{ inputs.app-version }}
- name: Setup Node.js
timeout-minutes: 10
uses: ./.github/actions/setup-node
@@ -242,7 +234,7 @@ jobs:
package: '@affine/native'
- uses: actions/download-artifact@v4
with:
name: web
name: desktop-web
path: packages/frontend/apps/electron/resources/web-static
- name: Build Desktop Layers
@@ -314,8 +306,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Version
id: version
uses: ./.github/actions/setup-version
with:
app-version: ${{ inputs.app-version }}
- name: Setup Node.js
timeout-minutes: 10
uses: ./.github/actions/setup-node
@@ -399,16 +392,16 @@ jobs:
- name: Save artifacts
run: |
mkdir -p builds
mv packages/frontend/apps/electron/out/*/make/zip/win32/${{ matrix.spec.arch }}/AFFiNE*-win32-${{ matrix.spec.arch }}-*.zip ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-${{ matrix.spec.arch }}.zip
mv packages/frontend/apps/electron/out/*/make/squirrel.windows/${{ matrix.spec.arch }}/*.exe ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-${{ matrix.spec.arch }}.exe
mv packages/frontend/apps/electron/out/*/make/nsis.windows/${{ matrix.spec.arch }}/*.exe ./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-${{ matrix.spec.arch }}.nsis.exe
mv packages/frontend/apps/electron/out/*/make/zip/win32/${{ matrix.spec.arch }}/AFFiNE*-win32-${{ matrix.spec.arch }}-*.zip ./builds/affine-${{ env.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-${{ matrix.spec.arch }}.zip
mv packages/frontend/apps/electron/out/*/make/squirrel.windows/${{ matrix.spec.arch }}/*.exe ./builds/affine-${{ env.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-${{ matrix.spec.arch }}.exe
mv packages/frontend/apps/electron/out/*/make/nsis.windows/${{ matrix.spec.arch }}/*.exe ./builds/affine-${{ env.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-${{ matrix.spec.arch }}.nsis.exe
- uses: actions/attest-build-provenance@v2
with:
subject-path: |
./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-${{ matrix.spec.arch }}.zip
./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-${{ matrix.spec.arch }}.exe
./builds/affine-${{ needs.before-make.outputs.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-${{ matrix.spec.arch }}.nsis.exe
./builds/affine-${{ env.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-${{ matrix.spec.arch }}.zip
./builds/affine-${{ env.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-${{ matrix.spec.arch }}.exe
./builds/affine-${{ env.RELEASE_VERSION }}-${{ env.BUILD_TYPE }}-windows-${{ matrix.spec.arch }}.nsis.exe
- name: Upload Artifact
uses: actions/upload-artifact@v4
@@ -424,7 +417,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: web
name: desktop-web
path: web-static
- name: Zip web-static
run: zip -r web-static.zip web-static
@@ -465,32 +458,14 @@ jobs:
run: |
node ./scripts/generate-release-yml.mjs
env:
RELEASE_VERSION: ${{ needs.before-make.outputs.RELEASE_VERSION }}
- name: Create Release Draft
if: ${{ github.ref_type == 'tag' }}
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: ${{ needs.before-make.outputs.RELEASE_VERSION }}
body: ''
draft: ${{ github.event.inputs.is-draft }}
prerelease: ${{ github.event.inputs.is-pre-release }}
files: |
./release/*
./release/.env.example
- name: Create Nightly Release Draft
if: ${{ github.ref_type == 'branch' }}
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
# Temporarily, treat release from branch as nightly release, artifact saved to AFFiNE-Releases.
# Need to improve internal build and nightly release logic.
repository: 'toeverything/AFFiNE-Releases'
name: ${{ needs.before-make.outputs.RELEASE_VERSION }}
tag_name: ${{ needs.before-make.outputs.RELEASE_VERSION }}
body: ''
draft: false
prerelease: true
name: ${{ env.RELEASE_VERSION }}
draft: ${{ inputs.build-type == 'stable' }}
prerelease: ${{ inputs.build-type != 'stable' }}
tag_name: ${{ env.RELEASE_VERSION}}
files: |
./release/*
./release/.env.example

View File

@@ -1,68 +1,33 @@
name: Release Mobile App
name: Release Mobile
on:
workflow_call:
inputs:
build-target:
description: 'Build Target'
app-version:
type: string
required: true
git-short-hash:
type: string
required: true
build-type:
description: 'Build Type'
type: string
required: true
workflow_dispatch:
inputs:
build-target:
description: 'Build Target'
type: choice
required: true
default: distribution
options:
- development
- distribution
build-type:
description: 'Build Type'
type: choice
required: true
default: canary
options:
- canary
- beta
- stable
env:
BUILD_TYPE: ${{ inputs.build-type || github.event.inputs.build-type }}
BUILD_TARGET: ${{ inputs.build-target || github.event.inputs.build-target }}
BUILD_TYPE: ${{ inputs.build-type }}
DEBUG: napi:*
KEYCHAIN_NAME: ${{ github.workspace }}/signing_temp
jobs:
output-env:
runs-on: ubuntu-latest
outputs:
ENVIRONMENT: ${{ steps.env.outputs.ENVIRONMENT }}
steps:
- name: Output Environment
id: env
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "ENVIRONMENT=${{ github.event.inputs.build-type }}" >> $GITHUB_OUTPUT
else
echo "ENVIRONMENT=" >> $GITHUB_OUTPUT
fi
build-ios-web:
needs:
- output-env
runs-on: ubuntu-24.04-arm
environment: ${{ needs.output-env.outputs.ENVIRONMENT }}
outputs:
RELEASE_VERSION: ${{ steps.version.outputs.APP_VERSION }}
runs-on: ubuntu-latest
environment: ${{ inputs.build-type }}
steps:
- uses: actions/checkout@v4
- name: Setup Version
id: version
uses: ./.github/actions/setup-version
with:
app-version: ${{ inputs.app-version }}
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Setup @sentry/cli
@@ -76,8 +41,8 @@ jobs:
SENTRY_PROJECT: 'affine'
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_RELEASE: ${{ steps.version.outputs.APP_VERSION }}
RELEASE_VERSION: ${{ steps.version.outputs.APP_VERSION }}
SENTRY_RELEASE: ${{ inputs.app-version }}
RELEASE_VERSION: ${{ inputs.app-version }}
- name: Upload ios artifact
uses: actions/upload-artifact@v4
with:
@@ -85,17 +50,13 @@ jobs:
path: packages/frontend/apps/ios/dist
build-android-web:
runs-on: ubuntu-24.04-arm
needs:
- output-env
environment: ${{ needs.output-env.outputs.ENVIRONMENT }}
outputs:
RELEASE_VERSION: ${{ steps.version.outputs.APP_VERSION }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Version
id: version
uses: ./.github/actions/setup-version
with:
app-version: ${{ inputs.app-version }}
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Setup @sentry/cli
@@ -109,41 +70,26 @@ jobs:
SENTRY_PROJECT: 'affine'
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_RELEASE: ${{ steps.version.outputs.APP_VERSION }}
RELEASE_VERSION: ${{ steps.version.outputs.APP_VERSION }}
SENTRY_RELEASE: ${{ inputs.app-version }}
- name: Upload android artifact
uses: actions/upload-artifact@v4
with:
name: android
path: packages/frontend/apps/android/dist
determine-ios-runner:
runs-on: ubuntu-latest
ios:
runs-on: ${{ github.ref_name == 'canary' && 'macos-latest' || 'blaze/macos-14' }}
needs:
- build-ios-web
outputs:
RUNNER: ${{ steps.runner.outputs.RUNNER }}
steps:
- name: Determine Runner
id: runner
# Randomly pick runner with 80% chance for blaze/macos-14 and 20% chance for namespace-profile-macos
# blaze/macos-14 is free but has limited concurrency
run: |
RANDOM_NUMBER=$(( $RANDOM % 100 + 1 ))
if [ $RANDOM_NUMBER -le 20 ]; then
echo "Selected namespace-profile-macos (20% probability)"
echo "RUNNER=namespace-profile-macos" >> $GITHUB_OUTPUT
else
echo "Selected blaze/macos-14 (80% probability)"
echo "RUNNER=blaze/macos-14" >> $GITHUB_OUTPUT
fi
ios:
runs-on: ${{ github.ref_name == 'canary' && 'macos-latest' || needs.determine-ios-runner.outputs.RUNNER }}
needs:
- determine-ios-runner
steps:
- uses: actions/checkout@v4
- name: Setup Version
uses: ./.github/actions/setup-version
with:
app-version: ${{ inputs.app-version }}
- name: 'Update Code Sign Identity'
shell: bash
run: ./packages/frontend/apps/ios/update_code_sign_identity.sh
- name: Download mobile artifact
uses: actions/download-artifact@v4
with:
@@ -201,8 +147,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Version
id: version
uses: ./.github/actions/setup-version
with:
app-version: ${{ inputs.app-version }}
- name: Download mobile artifact
uses: actions/download-artifact@v4
with:
@@ -235,7 +182,6 @@ jobs:
- name: Auth gcloud
id: auth
uses: google-github-actions/auth@v2
if: ${{ env.BUILD_TARGET == 'distribution' }}
with:
workload_identity_provider: 'projects/${{ secrets.GCP_PROJECT_NUMBER }}/locations/global/workloadIdentityPools/github-actions/providers/github-actions-helm-deploy'
service_account: '${{ secrets.GCP_HELM_DEPLOY_SERVICE_ACCOUNT }}'
@@ -249,7 +195,6 @@ jobs:
cache: 'gradle'
- name: Auto increment version code
id: bump
if: ${{ env.BUILD_TARGET == 'distribution' }}
run: yarn affine @affine/playstore-auto-bump bump
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ steps.auth.outputs.credentials_file_path }}
@@ -261,14 +206,13 @@ jobs:
AFFINE_ANDROID_KEYSTORE_PASSWORD: ${{ secrets.AFFINE_ANDROID_KEYSTORE_PASSWORD }}
AFFINE_ANDROID_KEYSTORE_ALIAS_PASSWORD: ${{ secrets.AFFINE_ANDROID_KEYSTORE_ALIAS_PASSWORD }}
AFFINE_ANDROID_SIGN_KEYSTORE: ${{ secrets.AFFINE_ANDROID_SIGN_KEYSTORE }}
VERSION_NAME: ${{ steps.version.outputs.APP_VERSION }}
VERSION_NAME: ${{ inputs.app-version }}
- name: Upload to Google Play
uses: r0adkll/upload-google-play@v1
if: ${{ env.BUILD_TARGET == 'distribution' }}
with:
serviceAccountJson: ${{ steps.auth.outputs.credentials_file_path }}
packageName: app.affine.pro
releaseName: ${{ steps.version.outputs.APP_VERSION }}
releaseName: ${{ inputs.app-version }}
releaseFiles: packages/frontend/apps/android/App/app/build/outputs/bundle/${{ env.BUILD_TYPE }}Release/app-${{ env.BUILD_TYPE }}-release-signed.aab
track: internal
status: draft

119
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,119 @@
name: Release
on:
schedule:
- cron: '0 9 * * *'
workflow_dispatch:
inputs:
web:
description: 'Release Web?'
required: true
type: boolean
default: false
desktop:
description: 'Release Desktop?'
required: true
type: boolean
default: false
mobile:
description: 'Release Mobile?'
required: true
type: boolean
default: false
permissions:
contents: write
pull-requests: write
actions: write
id-token: write
packages: write
security-events: write
attestations: write
jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
outputs:
APP_VERSION: ${{ steps.prepare.outputs.APP_VERSION }}
GIT_SHORT_HASH: ${{ steps.prepare.outputs.GIT_SHORT_HASH }}
BUILD_TYPE: ${{ steps.prepare.outputs.BUILD_TYPE }}
steps:
- uses: actions/checkout@v4
- name: Prepare Release
id: prepare
uses: ./.github/actions/prepare-release
cloud:
name: Release Cloud
if: ${{ inputs.web || github.event_name != 'workflow_dispatch' }}
needs:
- prepare
uses: ./.github/workflows/release-cloud.yml
secrets: inherit
with:
build-type: ${{ needs.prepare.outputs.BUILD_TYPE }}
app-version: ${{ needs.prepare.outputs.APP_VERSION }}
git-short-hash: ${{ needs.prepare.outputs.GIT_SHORT_HASH }}
image:
name: Release Docker Image
runs-on: ubuntu-latest
needs:
- prepare
- cloud
steps:
- uses: trstringer/manual-approval@v1
if: ${{ needs.prepare.outputs.BUILD_TYPE == 'stable' }}
name: Wait for approval
with:
secret: ${{ secrets.GITHUB_TOKEN }}
approvers: forehalo,fengmk2
fail-on-denial: true
issue-title: Please confirm to release docker image
issue-body: |
Env: ${{ needs.prepare.outputs.BUILD_TYPE }}
Candidate: ghcr.io/toeverything/affine:${{ needs.prepare.outputs.BUILD_TYPE }}-${{ needs.prepare.outputs.GIT_SHORT_HASH }}
Tag: ghcr.io/toeverything/affine:${{ needs.prepare.outputs.BUILD_TYPE }}
> comment with "approve", "approved", "lgtm", "yes" to approve
> comment with "deny", "deny", "no" to deny
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
logout: false
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Tag Image
run: |
docker buildx imagetools create --tag ghcr.io/toeverything/affine:${{needs.prepare.outputs.BUILD_TYPE}} ghcr.io/toeverything/affine:${{needs.prepare.outputs.BUILD_TYPE}}-${{needs.prepare.outputs.GIT_SHORT_HASH}}
docker buildx imagetools create --tag ghcr.io/toeverything/affine:${{needs.prepare.outputs.APP_VERSION}} ghcr.io/toeverything/affine:${{needs.prepare.outputs.BUILD_TYPE}}-${{needs.prepare.outputs.GIT_SHORT_HASH}}
desktop:
name: Release Desktop
if: ${{ inputs.desktop || github.event_name != 'workflow_dispatch' }}
needs:
- prepare
uses: ./.github/workflows/release-desktop.yml
secrets: inherit
with:
build-type: ${{ needs.prepare.outputs.BUILD_TYPE }}
app-version: ${{ needs.prepare.outputs.APP_VERSION }}
git-short-hash: ${{ needs.prepare.outputs.GIT_SHORT_HASH }}
mobile:
name: Release Mobile
if: ${{ inputs.mobile }}
needs:
- prepare
uses: ./.github/workflows/release-mobile.yml
secrets: inherit
with:
build-type: ${{ needs.prepare.outputs.BUILD_TYPE }}
app-version: ${{ needs.prepare.outputs.APP_VERSION }}
git-short-hash: ${{ needs.prepare.outputs.GIT_SHORT_HASH }}

873
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -28,12 +28,14 @@ base64-simd = "0.8"
bitvec = "1.0"
block2 = "0.6"
byteorder = "1.5"
cpal = "0.15"
chrono = "0.4"
clap = { version = "4.4", features = ["derive"] }
core-foundation = "0.10"
coreaudio-rs = "0.12"
criterion = { version = "0.5", features = ["html_reports"] }
criterion2 = { version = "3", default-features = false }
crossbeam-channel = "0.5"
dispatch2 = "0.3"
docx-parser = { git = "https://github.com/toeverything/docx-parser" }
dotenvy = "0.15"
@@ -47,9 +49,9 @@ log = "0.4"
loom = { version = "0.7", features = ["checkpoint"] }
mimalloc = "0.1"
nanoid = "0.4"
napi = { version = "3.0.0-alpha.31", features = ["async", "chrono_date", "error_anyhow", "napi9", "serde"] }
napi = { version = "3.0.0-beta.3", features = ["async", "chrono_date", "error_anyhow", "napi9", "serde"] }
napi-build = { version = "2" }
napi-derive = { version = "3.0.0-alpha.28" }
napi-derive = { version = "3.0.0-beta.3" }
nom = "8"
notify = { version = "8", features = ["serde"] }
objc2 = "0.6"
@@ -77,12 +79,12 @@ smol_str = "0.3"
sqlx = { version = "0.8", default-features = false, features = ["chrono", "macros", "migrate", "runtime-tokio", "sqlite", "tls-rustls"] }
strum_macros = "0.27.0"
symphonia = { version = "0.5", features = ["all", "opt-simd"] }
text-splitter = "0.25"
text-splitter = "0.27"
thiserror = "2"
tiktoken-rs = "0.6"
tokio = "1.37"
tiktoken-rs = "0.7"
tokio = "1.45"
tree-sitter = { version = "0.25" }
tree-sitter-c = { version = "0.23" }
tree-sitter-c = { version = "0.24" }
tree-sitter-c-sharp = { version = "0.23" }
tree-sitter-cpp = { version = "0.23" }
tree-sitter-go = { version = "0.23" }
@@ -97,6 +99,19 @@ uniffi = "0.29"
url = { version = "2.5" }
uuid = "1.8"
v_htmlescape = "0.15"
windows = { version = "0.61", features = [
"Win32_Devices_FunctionDiscovery",
"Win32_UI_Shell_PropertiesSystem",
"Win32_Media_Audio",
"Win32_System_Variant",
"Win32_System_Com_StructuredStorage",
"Win32_System_Threading",
"Win32_System_ProcessStatus",
"Win32_Foundation",
"Win32_System_Com",
"Win32_System_Diagnostics_ToolHelp",
] }
windows-core = { version = "0.61" }
y-octo = { path = "./packages/common/y-octo/core" }
y-sync = { version = "0.4" }
yrs = "0.23.0"

View File

@@ -292,7 +292,7 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.21.0",
"version": "0.22.4",
"devDependencies": {
"@vanilla-extract/vite-plugin": "^5.0.0",
"msw": "^2.8.4",

View File

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

View File

@@ -17,11 +17,15 @@ import {
AttachmentBlockStyles,
} from '@blocksuite/affine-model';
import {
CitationProvider,
DocModeProvider,
FileSizeLimitProvider,
TelemetryProvider,
} from '@blocksuite/affine-shared/services';
import { formatSize } from '@blocksuite/affine-shared/utils';
import {
formatSize,
openSingleFileWith,
} from '@blocksuite/affine-shared/utils';
import {
AttachmentIcon,
ResetIcon,
@@ -30,17 +34,18 @@ import {
} from '@blocksuite/icons/lit';
import { BlockSelection } from '@blocksuite/std';
import { nanoid, Slice } from '@blocksuite/store';
import { computed, signal } from '@preact/signals-core';
import { batch, computed, signal } from '@preact/signals-core';
import { html, type TemplateResult } from 'lit';
import { choose } from 'lit/directives/choose.js';
import { type ClassInfo, classMap } from 'lit/directives/class-map.js';
import { guard } from 'lit/directives/guard.js';
import { styleMap } from 'lit/directives/style-map.js';
import { when } from 'lit/directives/when.js';
import { filter } from 'rxjs/operators';
import { AttachmentEmbedProvider } from './embed';
import { styles } from './styles';
import { downloadAttachmentBlob, refreshData } from './utils';
import { downloadAttachmentBlob, getFileType, refreshData } from './utils';
type AttachmentResolvedStateInfo = ResolvedStateInfo & {
kind?: TemplateResult;
@@ -79,8 +84,12 @@ export class AttachmentBlockComponent extends CaptionedBlockComponent<Attachment
return this.std.get(FileSizeLimitProvider).maxFileSize;
}
get citationService() {
return this.std.get(CitationProvider);
}
get isCitation() {
return !!this.model.props.footnoteIdentifier;
return this.citationService.isCitationModel(this.model);
}
convertTo = () => {
@@ -123,12 +132,50 @@ export class AttachmentBlockComponent extends CaptionedBlockComponent<Attachment
// Refreshes the embed component.
reload = () => {
if (this.model.props.embed) {
this._refreshKey$.value = nanoid();
return;
}
batch(() => {
if (this.model.props.embed$.value) {
this._refreshKey$.value = nanoid();
return;
}
this.refreshData();
this.refreshData();
});
};
// Replaces the current attachment.
replace = async () => {
const state = this.resourceController.state$.peek();
if (state.uploading) return;
const file = await openSingleFileWith();
if (!file) return;
const sourceId = await this.std.store.blobSync.set(file);
const type = await getFileType(file);
const { name, size } = file;
let embed = this.model.props.embed$.value ?? false;
this.std.store.captureSync();
this.std.store.transact(() => {
this.std.store.updateBlock(this.blockId, {
name,
size,
type,
sourceId,
embed: false,
});
const provider = this.std.get(AttachmentEmbedProvider);
embed &&= provider.embedded(this.model);
if (embed) {
provider.convertTo(this.model);
}
// Reloads
this.reload();
});
};
private _selectBlock() {
@@ -139,6 +186,34 @@ export class AttachmentBlockComponent extends CaptionedBlockComponent<Attachment
selectionManager.setGroup('note', [blockSelection]);
}
private readonly _trackCitationDeleteEvent = () => {
// Check citation delete event
this._disposables.add(
this.std.store.slots.blockUpdated
.pipe(
filter(payload => {
if (!payload.isLocal) return false;
const { flavour, id, type } = payload;
if (
type !== 'delete' ||
flavour !== this.model.flavour ||
id !== this.model.id
)
return false;
const { model } = payload;
if (!this.citationService.isCitationModel(model)) return false;
return true;
})
)
.subscribe(() => {
this.citationService.trackEvent('Delete');
})
);
};
override connectedCallback() {
super.connectedCallback();
@@ -162,6 +237,8 @@ export class AttachmentBlockComponent extends CaptionedBlockComponent<Attachment
});
});
}
this._trackCitationDeleteEvent();
}
override firstUpdated() {
@@ -367,7 +444,7 @@ export class AttachmentBlockComponent extends CaptionedBlockComponent<Attachment
protected renderEmbedView = () => {
const { model, blobUrl } = this;
if (!model.props.embed || !blobUrl) return null;
if (!model.props.embed$.value || !blobUrl) return null;
const { std, _maxFileSize } = this;
const provider = std.get(AttachmentEmbedProvider);

View File

@@ -1,6 +1,7 @@
import { ConfirmIcon } from '@blocksuite/affine-components/icons';
import { toast } from '@blocksuite/affine-components/toast';
import type { AttachmentBlockModel } from '@blocksuite/affine-model';
import { CitationProvider } from '@blocksuite/affine-shared/services';
import type { EditorHost } from '@blocksuite/std';
import { html } from 'lit';
import { createRef, ref } from 'lit/directives/ref.js';
@@ -33,6 +34,7 @@ export const RenameModal = ({
let fileName = includeExtension ? nameWithoutExtension : originalName;
const extension = includeExtension ? originalExtension : '';
const citationService = editorHost.std.get(CitationProvider);
const abort = () => abortController.abort();
const onConfirm = () => {
@@ -44,6 +46,9 @@ export const RenameModal = ({
model.store.updateBlock(model, {
name: newFileName,
});
if (citationService.isCitationModel(model)) {
citationService.trackEvent('Edit');
}
abort();
};
const onInput = (e: InputEvent) => {

View File

@@ -24,6 +24,7 @@ import {
DownloadIcon,
DuplicateIcon,
EditIcon,
ReplaceIcon,
ResetIcon,
} from '@blocksuite/icons/lit';
import { BlockFlavourIdentifier } from '@blocksuite/std';
@@ -139,27 +140,42 @@ export const attachmentViewDropdownMenu = {
});
};
return html`${keyed(
model,
html`<affine-view-dropdown-menu
@toggle=${onToggle}
.actions=${actions.value}
.context=${ctx}
.viewType$=${viewType$}
></affine-view-dropdown-menu>`
)}`;
return html`<affine-view-dropdown-menu
@toggle=${onToggle}
.actions=${actions.value}
.context=${ctx}
.viewType$=${viewType$}
></affine-view-dropdown-menu>`;
},
} as const satisfies ToolbarActionGroup<ToolbarAction>;
const replaceAction = {
id: 'c.replace',
tooltip: 'Replace attachment',
icon: ReplaceIcon(),
disabled(ctx) {
const block = ctx.getCurrentBlockByType(AttachmentBlockComponent);
if (!block) return true;
const { downloading = false, uploading = false } =
block.resourceController.state$.value;
return downloading || uploading;
},
run(ctx) {
const block = ctx.getCurrentBlockByType(AttachmentBlockComponent);
block?.replace().catch(console.error);
},
} as const satisfies ToolbarAction;
const downloadAction = {
id: 'c.download',
id: 'd.download',
tooltip: 'Download',
icon: DownloadIcon(),
run(ctx) {
const block = ctx.getCurrentBlockByType(AttachmentBlockComponent);
block?.download();
},
when: ctx => {
when(ctx) {
const model = ctx.getCurrentModelByType(AttachmentBlockModel);
if (!model) return false;
// Current citation attachment block does not support download
@@ -168,7 +184,7 @@ const downloadAction = {
} as const satisfies ToolbarAction;
const captionAction = {
id: 'd.caption',
id: 'e.caption',
tooltip: 'Caption',
icon: CaptionIcon(),
run(ctx) {
@@ -221,6 +237,7 @@ const builtinToolbarConfig = {
},
},
attachmentViewDropdownMenu,
replaceAction,
downloadAction,
captionAction,
{
@@ -354,13 +371,17 @@ const builtinSurfaceToolbarConfig = {
)}`;
},
} satisfies ToolbarActionGroup<ToolbarAction>,
{
...replaceAction,
id: 'd.replace',
},
{
...downloadAction,
id: 'd.download',
id: 'e.download',
},
{
...captionAction,
id: 'e.caption',
id: 'f.caption',
},
],
when: ctx => ctx.getSurfaceModelsByType(AttachmentBlockModel).length === 1,

View File

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

View File

@@ -8,6 +8,7 @@ import type {
} from '@blocksuite/affine-model';
import { ImageProxyService } from '@blocksuite/affine-shared/adapters';
import {
CitationProvider,
DocModeProvider,
LinkPreviewServiceIdentifier,
} from '@blocksuite/affine-shared/services';
@@ -18,6 +19,7 @@ import { html } from 'lit';
import { property, query } from 'lit/decorators.js';
import { type ClassInfo, classMap } from 'lit/directives/class-map.js';
import { type StyleInfo, styleMap } from 'lit/directives/style-map.js';
import { filter } from 'rxjs/operators';
import { refreshBookmarkUrlData } from './utils.js';
@@ -114,11 +116,12 @@ export class BookmarkBlockComponent extends CaptionedBlockComponent<BookmarkBloc
);
};
get citationService() {
return this.std.get(CitationProvider);
}
get isCitation() {
return (
!!this.model.props.footnoteIdentifier &&
this.model.props.style === 'citation'
);
return this.citationService.isCitationModel(this.model);
}
get imageProxyService() {
@@ -166,6 +169,31 @@ export class BookmarkBlockComponent extends CaptionedBlockComponent<BookmarkBloc
></bookmark-card>`;
};
private readonly _trackCitationDeleteEvent = () => {
// Check citation delete event
this._disposables.add(
this.std.store.slots.blockUpdated
.pipe(
filter(payload => {
if (!payload.isLocal) return false;
const { flavour, id, type } = payload;
if (
type !== 'delete' ||
flavour !== this.model.flavour ||
id !== this.model.id
)
return false;
const { model } = payload;
if (!this.citationService.isCitationModel(model)) return false;
return true;
})
)
.subscribe(() => {
this.citationService.trackEvent('Delete');
})
);
};
override connectedCallback() {
super.connectedCallback();
@@ -203,6 +231,8 @@ export class BookmarkBlockComponent extends CaptionedBlockComponent<BookmarkBloc
}
})
);
this._trackCitationDeleteEvent();
}
override disconnectedCallback(): void {

View File

@@ -1,4 +1,5 @@
import {
canEmbedAsEmbedBlock,
canEmbedAsIframe,
EMBED_IFRAME_DEFAULT_HEIGHT_IN_SURFACE,
EMBED_IFRAME_DEFAULT_WIDTH_IN_SURFACE,
@@ -149,13 +150,10 @@ const builtinToolbarConfig = {
if (!model) return true;
const url = model.props.url;
// check if the url can be embedded as iframe block or other embed blocks
const options = ctx.std
.get(EmbedOptionProvider)
.getEmbedBlockOptions(url);
return (
!canEmbedAsIframe(ctx.std, url) && options?.viewType !== 'embed'
!canEmbedAsIframe(ctx.std, url) &&
!canEmbedAsEmbedBlock(ctx.std, url)
);
},
run(ctx) {
@@ -169,15 +167,8 @@ const builtinToolbarConfig = {
let blockId: string | undefined;
// first try to embed as iframe block
if (canEmbedAsIframe(ctx.std, url)) {
const embedIframeService = ctx.std.get(EmbedIframeService);
blockId = embedIframeService.addEmbedIframeBlock(
{ url, caption, title, description },
parent.id,
index
);
} else {
// first try to embed as a custom embed block
if (canEmbedAsEmbedBlock(ctx.std, url)) {
const options = ctx.std
.get(EmbedOptionProvider)
.getEmbedBlockOptions(url);
@@ -202,6 +193,13 @@ const builtinToolbarConfig = {
parent,
index
);
} else if (canEmbedAsIframe(ctx.std, url)) {
const embedIframeService = ctx.std.get(EmbedIframeService);
blockId = embedIframeService.addEmbedIframeBlock(
{ url, caption, title, description },
parent.id,
index
);
}
if (!blockId) return;
@@ -379,27 +377,8 @@ const builtinSurfaceToolbarConfig = {
let newId: string | undefined;
// first try to embed as iframe block
if (canEmbedAsIframe(ctx.std, url)) {
const embedIframeService = ctx.std.get(EmbedIframeService);
const config = embedIframeService.getConfig(url);
if (!config) {
return;
}
const bound = Bound.deserialize(xywh);
const options = config.options;
const { widthInSurface, heightInSurface } = options ?? {};
bound.w = widthInSurface ?? EMBED_IFRAME_DEFAULT_WIDTH_IN_SURFACE;
bound.h =
heightInSurface ?? EMBED_IFRAME_DEFAULT_HEIGHT_IN_SURFACE;
newId = ctx.store.addBlock(
'affine:embed-iframe',
{ url, caption, title, description, xywh: bound.serialize() },
parent
);
} else {
// first try to embed as a custom embed block
if (canEmbedAsEmbedBlock(ctx.std, url)) {
const options = ctx.std
.get(EmbedOptionProvider)
.getEmbedBlockOptions(url);
@@ -407,7 +386,7 @@ const builtinSurfaceToolbarConfig = {
if (options?.viewType !== 'embed') return;
const { flavour, styles } = options;
let { style } = model.props;
let style: EmbedCardStyle = model.props.style;
if (!styles.includes(style)) {
style = styles[0];
@@ -429,8 +408,29 @@ const builtinSurfaceToolbarConfig = {
},
parent
);
} else if (canEmbedAsIframe(ctx.std, url)) {
const embedIframeService = ctx.std.get(EmbedIframeService);
const config = embedIframeService.getConfig(url);
if (!config) {
return;
}
const bound = Bound.deserialize(xywh);
const options = config.options;
const { widthInSurface, heightInSurface } = options ?? {};
bound.w = widthInSurface ?? EMBED_IFRAME_DEFAULT_WIDTH_IN_SURFACE;
bound.h =
heightInSurface ?? EMBED_IFRAME_DEFAULT_HEIGHT_IN_SURFACE;
newId = ctx.store.addBlock(
'affine:embed-iframe',
{ url, caption, title, description, xywh: bound.serialize() },
parent
);
}
if (!newId) return;
ctx.command.exec(reassociateConnectorsCommand, { oldId, newId });
ctx.store.deleteBlock(model);
@@ -449,13 +449,10 @@ const builtinSurfaceToolbarConfig = {
when(ctx) {
const model = ctx.getCurrentModelByType(BookmarkBlockModel);
if (!model) return false;
const { url } = model.props;
const options = ctx.std
.get(EmbedOptionProvider)
.getEmbedBlockOptions(url);
return canEmbedAsIframe(ctx.std, url) || options?.viewType === 'embed';
return (
canEmbedAsIframe(ctx.std, url) || canEmbedAsEmbedBlock(ctx.std, url)
);
},
content(ctx) {
const model = ctx.getCurrentModelByType(BookmarkBlockModel);
@@ -482,24 +479,26 @@ const builtinSurfaceToolbarConfig = {
} satisfies ToolbarActionGroup<ToolbarAction>,
{
id: 'b.style',
actions: [
{
id: 'horizontal',
label: 'Large horizontal style',
},
{
id: 'list',
label: 'Small horizontal style',
},
{
id: 'vertical',
label: 'Large vertical style',
},
{
id: 'cube',
label: 'Small vertical style',
},
].filter(action => BookmarkStyles.includes(action.id as EmbedCardStyle)),
actions: (
[
{
id: 'horizontal',
label: 'Large horizontal style',
},
{
id: 'list',
label: 'Small horizontal style',
},
{
id: 'vertical',
label: 'Large vertical style',
},
{
id: 'cube',
label: 'Small vertical style',
},
] as const
).filter(action => BookmarkStyles.includes(action.id)),
content(ctx) {
const model = ctx.getCurrentModelByType(BookmarkBlockModel);
if (!model) return null;

View File

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

View File

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

View File

@@ -40,6 +40,16 @@ export class CodeBlockComponent extends CaptionedBlockComponent<CodeBlockModel>
private _inlineRangeProvider: InlineRangeProvider | null = null;
private readonly _localPreview$ = signal<boolean | null>(null);
preview$: Signal<boolean> = computed(() => {
const modelPreview = !!this.model.props.preview$.value;
if (this.store.readonly) {
return this._localPreview$.value ?? modelPreview;
}
return modelPreview;
});
highlightTokens$: Signal<ThemedToken[][]> = signal([]);
languageName$: Signal<string> = computed(() => {
@@ -393,7 +403,7 @@ export class CodeBlockComponent extends CaptionedBlockComponent<CodeBlockModel>
true) &&
(this.model.props.lineNumber ?? true);
const preview = !!this.model.props.preview;
const preview = this.preview$.value;
const previewContext = this.std.getOptional(
CodeBlockPreviewIdentifier(this.model.props.language ?? '')
);
@@ -440,7 +450,7 @@ export class CodeBlockComponent extends CaptionedBlockComponent<CodeBlockModel>
contenteditable="false"
class="affine-code-block-preview"
>
${previewContext?.renderer(this.model)}
${shouldRenderPreview && previewContext?.renderer(this.model)}
</div>
${this.renderChildren(this.model)} ${Object.values(this.widgets)}
</div>
@@ -461,6 +471,14 @@ export class CodeBlockComponent extends CaptionedBlockComponent<CodeBlockModel>
override accessor useCaptionEditor = true;
override accessor useZeroWidth = true;
setPreviewState(preview: boolean) {
if (this.store.readonly) {
this._localPreview$.value = preview;
} else {
this.store.updateBlock(this.model, { preview });
}
}
}
declare global {

View File

@@ -58,11 +58,7 @@ export class PreviewButton extends WithDisposable(SignalWatcher(LitElement)) {
`;
private readonly _toggle = (value: boolean) => {
if (this.blockComponent.store.readonly) return;
this.blockComponent.store.updateBlock(this.blockComponent.model, {
preview: value,
});
this.blockComponent.setPreviewState(value);
const std = this.blockComponent.std;
const mode = std.getOptional(DocModeProvider)?.getEditorMode() ?? 'page';
@@ -77,7 +73,7 @@ export class PreviewButton extends WithDisposable(SignalWatcher(LitElement)) {
};
get preview() {
return !!this.blockComponent.model.props.preview$.value;
return this.blockComponent.preview$.value;
}
override render() {

View File

@@ -0,0 +1,61 @@
import {
type CodeBlockModel,
CodeBlockSchema,
ParagraphBlockModel,
} from '@blocksuite/affine-model';
import { focusTextModel } from '@blocksuite/affine-rich-text';
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
import { matchModels } from '@blocksuite/affine-shared/utils';
import type { BlockComponent } from '@blocksuite/std';
import { InlineMarkdownExtension } from '@blocksuite/std/inline';
export const CodeBlockMarkdownExtension =
InlineMarkdownExtension<AffineTextAttributes>({
name: 'code-block',
pattern: /^```([a-zA-Z0-9]*)\s$/,
action: ({ inlineEditor, inlineRange, prefixText, pattern }) => {
if (inlineEditor.yTextString.slice(0, inlineRange.index).includes('\n')) {
return;
}
const match = prefixText.match(pattern);
if (!match) return;
const language = match[1];
if (!inlineEditor.rootElement) return;
const blockComponent =
inlineEditor.rootElement.closest<BlockComponent>('[data-block-id]');
if (!blockComponent) return;
const { model, std, store } = blockComponent;
if (
matchModels(model, [ParagraphBlockModel]) &&
model.props.type === 'quote'
) {
return;
}
const parent = store.getParent(model);
if (!parent) return;
const index = parent.children.indexOf(model);
store.captureSync();
const codeId = store.addBlock<CodeBlockModel>(
CodeBlockSchema.model.flavour,
{ language },
parent,
index
);
if (model.text && model.text.length > prefixText.length) {
const text = model.text.clone();
store.addBlock('affine:paragraph', { text }, parent, index + 1);
text.delete(0, prefixText.length);
}
store.deleteBlock(model, { bringChildrenTo: parent });
focusTextModel(std, codeId);
},
});

View File

@@ -33,6 +33,10 @@ export const codeBlockStyles = css`
grid-template-columns: auto minmax(0, 1fr);
}
.affine-code-block-container.disable-line-numbers v-line {
grid-template-columns: unset;
}
.affine-code-block-container div:has(> v-line) {
display: grid;
}

View File

@@ -21,6 +21,7 @@ import { CodeKeymapExtension } from './code-keymap.js';
import { AFFINE_CODE_TOOLBAR_WIDGET } from './code-toolbar/index.js';
import { codeSlashMenuConfig } from './configs/slash-menu.js';
import { effects } from './effects.js';
import { CodeBlockMarkdownExtension } from './markdown.js';
const codeToolbarWidget = WidgetViewExtension(
'affine:code',
@@ -44,6 +45,7 @@ export class CodeBlockViewExtension extends ViewExtensionProvider {
BlockViewExtension('affine:code', literal`affine-code`),
SlashMenuConfigExtension('affine:code', codeSlashMenuConfig),
CodeKeymapExtension,
CodeBlockMarkdownExtension,
...getCodeClipboardExtensions(),
]);
context.register([

View File

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

View File

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

View File

@@ -331,7 +331,6 @@ export class RichTextCell extends BaseCellRenderer<Text, string> {
this.inlineEditor$.value?.selectAll();
}
};
this.addEventListener('keydown', selectAll);
this.disposables.addFromEvent(this, 'keydown', selectAll);
this.disposables.add(
effect(() => {

View File

@@ -209,10 +209,19 @@ export class HeaderAreaTextCell extends BaseCellRenderer<Text, string> {
}
};
this.addEventListener('keydown', selectAll);
this.disposables.addFromEvent(this, 'keydown', selectAll);
}
private readonly _handleKeyDown = (event: KeyboardEvent) => {
if (event.key !== 'Escape') {
if (event.key === 'Tab') {
event.preventDefault();
return;
}
event.stopPropagation();
}
};
override firstUpdated(props: Map<string, unknown>) {
super.firstUpdated(props);
this.richText.value?.updateComplete
@@ -233,6 +242,12 @@ export class HeaderAreaTextCell extends BaseCellRenderer<Text, string> {
'paste',
this._onPaste
);
const inlineEditor = this.inlineEditor;
if (inlineEditor) {
this.disposables.add(
inlineEditor.slots.keydown.subscribe(this._handleKeyDown)
);
}
}
})
.catch(console.error);

View File

@@ -13,6 +13,7 @@
"@blocksuite/affine-components": "workspace:*",
"@blocksuite/affine-ext-loader": "workspace:*",
"@blocksuite/affine-model": "workspace:*",
"@blocksuite/affine-rich-text": "workspace:*",
"@blocksuite/affine-shared": "workspace:*",
"@blocksuite/global": "workspace:*",
"@blocksuite/std": "workspace:*",
@@ -38,5 +39,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.21.0"
"version": "0.22.4"
}

View File

@@ -0,0 +1,63 @@
import {
type DividerBlockModel,
DividerBlockSchema,
ParagraphBlockModel,
ParagraphBlockSchema,
} from '@blocksuite/affine-model';
import { focusTextModel } from '@blocksuite/affine-rich-text';
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
import { matchModels } from '@blocksuite/affine-shared/utils';
import type { BlockComponent } from '@blocksuite/std';
import { InlineMarkdownExtension } from '@blocksuite/std/inline';
export const DividerMarkdownExtension =
InlineMarkdownExtension<AffineTextAttributes>({
name: 'divider',
pattern: /^(-{3,}|\*{3,}|_{3,})\s$/,
action: ({ inlineEditor, inlineRange }) => {
if (inlineEditor.yTextString.slice(0, inlineRange.index).includes('\n')) {
return;
}
if (!inlineEditor.rootElement) return;
const blockComponent =
inlineEditor.rootElement.closest<BlockComponent>('[data-block-id]');
if (!blockComponent) return;
const { model, std, store } = blockComponent;
if (
matchModels(model, [ParagraphBlockModel]) &&
model.props.type !== 'quote'
) {
const parent = store.getParent(model);
if (!parent) return;
const index = parent.children.indexOf(model);
store.captureSync();
inlineEditor.deleteText({
index: 0,
length: inlineRange.index,
});
store.addBlock<DividerBlockModel>(
DividerBlockSchema.model.flavour,
{
children: model.children,
},
parent,
index
);
const nextBlock = parent.children.at(index + 1);
let id = nextBlock?.id;
if (!id) {
id = store.addBlock<ParagraphBlockModel>(
ParagraphBlockSchema.model.flavour,
{},
parent
);
}
focusTextModel(std, id);
}
},
});

View File

@@ -6,6 +6,7 @@ import { BlockViewExtension } from '@blocksuite/std';
import { literal } from 'lit/static-html.js';
import { effects } from './effects';
import { DividerMarkdownExtension } from './markdown';
export class DividerViewExtension extends ViewExtensionProvider {
override name = 'affine-divider-block';
@@ -19,6 +20,7 @@ export class DividerViewExtension extends ViewExtensionProvider {
super.setup(context);
context.register([
BlockViewExtension('affine:divider', literal`affine-divider`),
DividerMarkdownExtension,
]);
}
}

View File

@@ -10,6 +10,7 @@
{ "path": "../../components" },
{ "path": "../../ext-loader" },
{ "path": "../../model" },
{ "path": "../../rich-text" },
{ "path": "../../shared" },
{ "path": "../../../framework/global" },
{ "path": "../../../framework/std" },

View File

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

View File

@@ -49,5 +49,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.21.0"
"version": "0.22.4"
}

View File

@@ -259,18 +259,18 @@ const builtinToolbarConfig = {
conversionsActionGroup,
{
id: 'c.style',
actions: [
{
id: 'horizontal',
label: 'Large horizontal style',
},
{
id: 'list',
label: 'Small horizontal style',
},
].filter(action =>
EmbedLinkedDocStyles.includes(action.id as EmbedCardStyle)
),
actions: (
[
{
id: 'horizontal',
label: 'Large horizontal style',
},
{
id: 'list',
label: 'Small horizontal style',
},
] as const
).filter(action => EmbedLinkedDocStyles.includes(action.id)),
content(ctx) {
const model = ctx.getCurrentModelByType(EmbedLinkedDocModel);
if (!model) return null;
@@ -368,26 +368,26 @@ const builtinSurfaceToolbarConfig = {
conversionsActionGroup,
{
id: 'c.style',
actions: [
{
id: 'horizontal',
label: 'Large horizontal style',
},
{
id: 'list',
label: 'Small horizontal style',
},
{
id: 'vertical',
label: 'Large vertical style',
},
{
id: 'cube',
label: 'Small vertical style',
},
].filter(action =>
EmbedLinkedDocStyles.includes(action.id as EmbedCardStyle)
),
actions: (
[
{
id: 'horizontal',
label: 'Large horizontal style',
},
{
id: 'list',
label: 'Small horizontal style',
},
{
id: 'vertical',
label: 'Large vertical style',
},
{
id: 'cube',
label: 'Small vertical style',
},
] as const
).filter(action => EmbedLinkedDocStyles.includes(action.id)),
content(ctx) {
const model = ctx.getCurrentModelByType(EmbedLinkedDocModel);
if (!model) return null;

View File

@@ -17,6 +17,7 @@ import {
REFERENCE_NODE,
} from '@blocksuite/affine-shared/consts';
import {
CitationProvider,
DocDisplayMetaProvider,
DocModeProvider,
OpenDocExtensionIdentifier,
@@ -43,6 +44,7 @@ import { repeat } from 'lit/directives/repeat.js';
import { styleMap } from 'lit/directives/style-map.js';
import { when } from 'lit/directives/when.js';
import throttle from 'lodash-es/throttle';
import { filter } from 'rxjs/operators';
import * as Y from 'yjs';
import { renderLinkedDocInCard } from '../common/render-linked-doc';
@@ -254,11 +256,12 @@ export class EmbedLinkedDocBlockComponent extends EmbedBlockComponent<EmbedLinke
return this.store.readonly;
}
get citationService() {
return this.std.get(CitationProvider);
}
get isCitation() {
return (
!!this.model.props.footnoteIdentifier &&
this.model.props.style === 'citation'
);
return this.citationService.isCitationModel(this.model);
}
private readonly _handleDoubleClick = (event: MouseEvent) => {
@@ -454,6 +457,31 @@ export class EmbedLinkedDocBlockComponent extends EmbedBlockComponent<EmbedLinke
);
};
private readonly _trackCitationDeleteEvent = () => {
// Check citation delete event
this._disposables.add(
this.std.store.slots.blockUpdated
.pipe(
filter(payload => {
if (!payload.isLocal) return false;
const { flavour, id, type } = payload;
if (
type !== 'delete' ||
flavour !== this.model.flavour ||
id !== this.model.id
)
return false;
const { model } = payload;
if (!this.citationService.isCitationModel(model)) return false;
return true;
})
)
.subscribe(() => {
this.citationService.trackEvent('Delete');
})
);
};
override connectedCallback() {
super.connectedCallback();
@@ -467,14 +495,6 @@ export class EmbedLinkedDocBlockComponent extends EmbedBlockComponent<EmbedLinke
const linkedDoc = this.linkedDoc;
if (linkedDoc) {
this.disposables.add(
linkedDoc.workspace.slots.docListUpdated.subscribe(() => {
this._load().catch(e => {
console.error(e);
this.isError = true;
});
})
);
// Should throttle the blockUpdated event to avoid too many re-renders
// Because the blockUpdated event is triggered too frequently at some cases
this.disposables.add(
@@ -532,6 +552,8 @@ export class EmbedLinkedDocBlockComponent extends EmbedBlockComponent<EmbedLinke
}
})
);
this._trackCitationDeleteEvent();
}
getInitialState(): {

View File

@@ -49,5 +49,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.21.0"
"version": "0.22.4"
}

View File

@@ -11,6 +11,8 @@ import {
EmbedCardLightVerticalIcon,
} from '@blocksuite/affine-components/icons';
import { ColorScheme } from '@blocksuite/affine-model';
import { EmbedOptionProvider } from '@blocksuite/affine-shared/services';
import type { BlockStdScope } from '@blocksuite/std';
import type { TemplateResult } from 'lit';
type EmbedCardIcons = {
@@ -40,3 +42,8 @@ export function getEmbedCardIcons(theme: ColorScheme): EmbedCardIcons {
};
}
}
export function canEmbedAsEmbedBlock(std: BlockStdScope, url: string) {
const options = std.get(EmbedOptionProvider).getEmbedBlockOptions(url);
return options?.viewType === 'embed';
}

View File

@@ -153,7 +153,7 @@ function createBuiltinToolbarConfigForExternal(
.get(EmbedOptionProvider)
.getEmbedBlockOptions(url);
let { style } = model.props;
let style: EmbedCardStyle = model.props.style;
let flavour = 'affine:bookmark';
if (options?.viewType === 'card') {
@@ -227,7 +227,7 @@ function createBuiltinToolbarConfigForExternal(
if (options?.viewType !== 'embed') return;
const { flavour, styles } = options;
let { style } = model.props;
let style: EmbedCardStyle = model.props.style;
if (!styles.includes(style)) {
style =
@@ -441,7 +441,11 @@ const createBuiltinSurfaceToolbarConfigForExternal = (
let { style } = model.props;
let flavour = 'affine:bookmark';
if (!BookmarkStyles.includes(style)) {
if (
!BookmarkStyles.includes(
style as (typeof BookmarkStyles)[number]
)
) {
style = BookmarkStyles[0];
}
@@ -517,26 +521,26 @@ const createBuiltinSurfaceToolbarConfigForExternal = (
} satisfies ToolbarActionGroup<ToolbarAction>,
{
id: 'c.style',
actions: [
{
id: 'horizontal',
label: 'Large horizontal style',
},
{
id: 'list',
label: 'Small horizontal style',
},
{
id: 'vertical',
label: 'Large vertical style',
},
{
id: 'cube',
label: 'Small vertical style',
},
].filter(action =>
EmbedGithubStyles.includes(action.id as EmbedCardStyle)
),
actions: (
[
{
id: 'horizontal',
label: 'Large horizontal style',
},
{
id: 'list',
label: 'Small horizontal style',
},
{
id: 'vertical',
label: 'Large vertical style',
},
{
id: 'cube',
label: 'Small vertical style',
},
] as const
).filter(action => EmbedGithubStyles.includes(action.id)),
when(ctx) {
return Boolean(ctx.getCurrentModelByType(EmbedGithubModel));
},

View File

@@ -107,10 +107,10 @@ export class EmbedHtmlFullscreenToolbar extends LitElement {
if (this._copied) return;
this.embedHtml.std.clipboard
.writeToClipboard(items => {
items['text/plain'] = this.embedHtml.model.props.html ?? '';
return items;
})
.writeToClipboard(items => ({
...items,
'text/plain': this.embedHtml.model.props.html ?? '',
}))
.then(() => {
this._copied = true;
setTimeout(() => (this._copied = false), 1500);

View File

@@ -0,0 +1,75 @@
import { EmbedIframeConfigExtension } from '@blocksuite/affine-shared/services';
const GENERIC_DEFAULT_WIDTH_IN_SURFACE = 800;
const GENERIC_DEFAULT_HEIGHT_IN_SURFACE = 600;
const GENERIC_DEFAULT_WIDTH_PERCENT = 100;
const GENERIC_DEFAULT_HEIGHT_IN_NOTE = 400;
/**
* AFFiNE domains that should be excluded from generic embedding
* These are based on the centralized cloud constants and known AFFiNE domains
*/
const AFFINE_DOMAINS = [
'affine.pro', // Main AFFiNE domain
'app.affine.pro', // Stable cloud domain
'insider.affine.pro', // Beta/internal cloud domain
'affine.fail', // Canary cloud domain
'toeverything.app', // Safety measure for potential future use
'apple.getaffineapp.com', // Cloud domain for Apple app
];
/**
* Validates if a URL is suitable for generic iframe embedding
* Allows HTTPS URLs but excludes AFFiNE domains
* @param url The URL to validate
* @returns Boolean indicating if the URL can be generically embedded
*/
function isValidGenericEmbedUrl(url: string): boolean {
try {
const parsedUrl = new URL(url);
// Only allow HTTPS for security
if (parsedUrl.protocol !== 'https:') {
return false;
}
// Exclude AFFiNE domains
const hostname = parsedUrl.hostname.toLowerCase();
if (
AFFINE_DOMAINS.some(
domain => hostname === domain || hostname.endsWith(`.${domain}`)
)
) {
return false;
}
return true;
} catch {
// Invalid URL
return false;
}
}
const genericConfig = {
name: 'generic',
match: (url: string) => isValidGenericEmbedUrl(url),
buildOEmbedUrl: (url: string) => {
if (!isValidGenericEmbedUrl(url)) {
return undefined;
}
return url;
},
useOEmbedUrlDirectly: true,
options: {
widthInSurface: GENERIC_DEFAULT_WIDTH_IN_SURFACE,
heightInSurface: GENERIC_DEFAULT_HEIGHT_IN_SURFACE,
widthPercent: GENERIC_DEFAULT_WIDTH_PERCENT,
heightInNote: GENERIC_DEFAULT_HEIGHT_IN_NOTE,
allowFullscreen: true,
style: 'border: none; border-radius: 8px;',
allow: 'clipboard-read; clipboard-write; picture-in-picture;',
referrerpolicy: 'no-referrer-when-downgrade',
},
};
export const GenericEmbedConfig = EmbedIframeConfigExtension(genericConfig);

View File

@@ -1,4 +1,5 @@
import { ExcalidrawEmbedConfig } from './excalidraw';
import { GenericEmbedConfig } from './generic';
import { GoogleDocsEmbedConfig } from './google-docs';
import { GoogleDriveEmbedConfig } from './google-drive';
import { MiroEmbedConfig } from './miro';
@@ -10,4 +11,5 @@ export const EmbedIframeConfigExtensions = [
MiroEmbedConfig,
ExcalidrawEmbedConfig,
GoogleDocsEmbedConfig,
GenericEmbedConfig,
];

View File

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

View File

@@ -16,6 +16,7 @@ import {
import { cssVarV2 } from '@toeverything/theme/v2';
import { html } from 'lit';
import { state } from 'lit/decorators.js';
import { repeat } from 'lit/directives/repeat.js';
import { styleMap } from 'lit/directives/style-map.js';
import {
@@ -87,6 +88,12 @@ export class FrameBlockComponent extends GfxBlockComponent<FrameBlockModel> {
this.gfx.tool.currentToolName$.value === 'frameNavigator';
const frameIndex = this.gfx.layer.getZIndex(model);
const widgets = html`${repeat(
Object.entries(this.widgets),
([id]) => id,
([_, widget]) => widget
)}`;
return html`
<div
class="affine-frame-container"
@@ -102,6 +109,7 @@ export class FrameBlockComponent extends GfxBlockComponent<FrameBlockModel> {
: `1px solid ${cssVarV2('edgeless/frame/border/default')}`,
})}
></div>
${widgets}
`;
}
@@ -178,11 +186,22 @@ export const FrameBlockInteraction =
selectable(context) {
const { model } = context;
const onTitle =
model.externalBound?.containsPoint([
context.position.x,
context.position.y,
]) ?? false;
return (
context.default(context) &&
(model.isLocked() || !isTransparent(model.props.background))
(model.isLocked() ||
!isTransparent(model.props.background) ||
onTitle)
);
},
onSelect(context) {
return context.default(context);
},
};
},
}

View File

@@ -241,20 +241,35 @@ export class EdgelessFrameManager extends GfxExtension {
surfaceModel.elementAdded.subscribe(({ id, local }) => {
const element = surfaceModel.getElementById(id);
if (element && local) {
const frame = this.getFrameFromPoint(element.elementBound.center);
// if the container created with a frame, skip it.
if (
isGfxGroupCompatibleModel(element) &&
frame &&
element.hasChild(frame)
) {
return;
}
// new element may intended to be added to other group
// so we need to wait for the next microtask to check if the element can be added to the frame
// The entire frame detection logic must be in microtask for timing reasons:
//
// 1. For connectors: When elementAdded fires, connectors have invalid bounds [0,0,0,0]
// because their path/bounds are calculated in a separate microtask of updateConnectorPath by connector-watcher.
// We need to wait for that calculation to complete before frame detection.
//
// 2. For shapes: Although they have valid bounds immediately, processing them in microtask
// ensures consistent timing and allows other initialization to complete first.
//
// 3. Group compatibility: Some elements may need to establish their group relationships
// before being considered for frame membership.
//
// By embedding the entire logic in microtask, we ensure:
// - Connectors have proper bounds calculated (not [0,0,0,0])
// - getFrameFromPoint() works correctly with valid element centers
// - All element initialization is complete before frame detection
queueMicrotask(() => {
const frame = this.getFrameFromPoint(element.elementBound.center);
// if the container created with a frame, skip it.
if (
isGfxGroupCompatibleModel(element) &&
frame &&
element.hasChild(frame)
) {
return;
}
// Only add elements that aren't already grouped and have a valid frame
if (!element.group && frame) {
this.addElementsToFrame(frame, [element]);
}

View File

@@ -62,13 +62,11 @@ const builtinSurfaceToolbarConfig = {
if (!rootModel) return;
const { id: frameId, xywh } = model;
let lastNoteId = rootModel.children
.filter(
note =>
matchModels(note, [NoteBlockModel]) &&
note.props.displayMode !== NoteDisplayMode.EdgelessOnly
)
.pop()?.id;
let lastNoteId = rootModel.children.findLast(
note =>
matchModels(note, [NoteBlockModel]) &&
note.props.displayMode !== NoteDisplayMode.EdgelessOnly
)?.id;
if (!lastNoteId) {
const bounds = Bound.deserialize(xywh);

View File

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

View File

@@ -11,6 +11,7 @@ import {
NativeClipboardProvider,
} from '@blocksuite/affine-shared/services';
import {
convertToPng,
formatSize,
getBlockProps,
isInsidePageEditor,
@@ -111,28 +112,6 @@ export async function resetImageSize(
block.store.updateBlock(model, props);
}
function convertToPng(blob: Blob): Promise<Blob | null> {
return new Promise(resolve => {
const reader = new FileReader();
reader.addEventListener('load', _ => {
const img = new Image();
img.onload = () => {
const c = document.createElement('canvas');
c.width = img.width;
c.height = img.height;
const ctx = c.getContext('2d');
if (!ctx) return;
ctx.drawImage(img, 0, 0);
c.toBlob(resolve, 'image/png');
};
img.onerror = () => resolve(null);
img.src = reader.result as string;
});
reader.addEventListener('error', () => resolve(null));
reader.readAsDataURL(blob);
});
}
export async function copyImageBlob(
block: ImageBlockComponent | ImageEdgelessBlockComponent
) {

View File

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

View File

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

View File

@@ -1,6 +1,5 @@
import { textKeymap } from '@blocksuite/affine-inline-preset';
import { ListBlockSchema } from '@blocksuite/affine-model';
import { markdownInput } from '@blocksuite/affine-rich-text';
import { getSelectedModelsCommand } from '@blocksuite/affine-shared/commands';
import { IS_MAC } from '@blocksuite/global/env';
import { KeymapExtension, TextSelection } from '@blocksuite/std';
@@ -125,20 +124,6 @@ export const ListKeymapExtension = KeymapExtension(
ctx.get('keyboardState').raw.preventDefault();
return true;
},
Space: ctx => {
if (!markdownInput(std)) {
return;
}
ctx.get('keyboardState').raw.preventDefault();
return true;
},
'Shift-Space': ctx => {
if (!markdownInput(std)) {
return;
}
ctx.get('keyboardState').raw.preventDefault();
return true;
},
};
},
{

View File

@@ -0,0 +1,91 @@
import {
type ListBlockModel,
ListBlockSchema,
type ListType,
ParagraphBlockModel,
} from '@blocksuite/affine-model';
import { focusTextModel } from '@blocksuite/affine-rich-text';
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
import { matchModels, toNumberedList } from '@blocksuite/affine-shared/utils';
import type { BlockComponent } from '@blocksuite/std';
import { InlineMarkdownExtension } from '@blocksuite/std/inline';
export const ListMarkdownExtension =
InlineMarkdownExtension<AffineTextAttributes>({
name: 'list',
// group 2: number
// group 3: bullet
// group 4: bullet
// group 5: todo
// group 6: todo checked
pattern: /^((\d+\.)|(-)|(\*)|(\[ ?\])|(\[x\]))\s$/,
action: ({ inlineEditor, pattern, inlineRange, prefixText }) => {
if (inlineEditor.yTextString.slice(0, inlineRange.index).includes('\n')) {
return;
}
const match = prefixText.match(pattern);
if (!match) return;
let type: ListType;
if (match[2]) {
type = 'numbered';
} else if (match[3] || match[4]) {
type = 'bulleted';
} else if (match[5] || match[6]) {
type = 'todo';
} else {
return;
}
const checked = match[6] !== undefined;
if (!inlineEditor.rootElement) return;
const blockComponent =
inlineEditor.rootElement.closest<BlockComponent>('[data-block-id]');
if (!blockComponent) return;
const { model, std, store } = blockComponent;
if (!matchModels(model, [ParagraphBlockModel])) return;
if (type !== 'numbered') {
const parent = store.getParent(model);
if (!parent) return;
const index = parent.children.indexOf(model);
store.captureSync();
inlineEditor.deleteText({
index: 0,
length: inlineRange.index,
});
const id = store.addBlock<ListBlockModel>(
ListBlockSchema.model.flavour,
{
type: type,
text: model.text?.clone(),
children: model.children,
...(type === 'todo' ? { checked } : {}),
},
parent,
index
);
store.deleteBlock(model, { deleteChildren: false });
focusTextModel(std, id);
} else {
let order = parseInt(match[2]);
if (!Number.isInteger(order)) order = 1;
store.captureSync();
inlineEditor.deleteText({
index: 0,
length: inlineRange.index,
});
const id = toNumberedList(std, model, order);
if (!id) return;
focusTextModel(std, id);
}
},
});

View File

@@ -7,6 +7,7 @@ import { literal } from 'lit/static-html.js';
import { effects } from './effects.js';
import { ListKeymapExtension, ListTextKeymapExtension } from './list-keymap.js';
import { ListMarkdownExtension } from './markdown.js';
export class ListViewExtension extends ViewExtensionProvider {
override name = 'affine-list-block';
@@ -23,6 +24,7 @@ export class ListViewExtension extends ViewExtensionProvider {
BlockViewExtension('affine:list', literal`affine-list`),
ListKeymapExtension,
ListTextKeymapExtension,
ListMarkdownExtension,
]);
}
}

View File

@@ -49,5 +49,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.21.0"
"version": "0.22.4"
}

View File

@@ -14,6 +14,7 @@ export class EdgelessNoteMask extends SignalWatcher(
protected override firstUpdated() {
const maskDOM = this.renderRoot!.querySelector('.affine-note-mask');
const observer = new ResizeObserver(entries => {
if (this.model.store.readonly) return;
for (const entry of entries) {
if (!this.model.props.edgeless.collapse) {
const bound = Bound.deserialize(this.model.xywh);

View File

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

View File

@@ -0,0 +1,74 @@
import {
ListBlockModel,
ParagraphBlockModel,
ParagraphBlockSchema,
type ParagraphType,
} from '@blocksuite/affine-model';
import { focusTextModel } from '@blocksuite/affine-rich-text';
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
import { matchModels } from '@blocksuite/affine-shared/utils';
import type { BlockComponent } from '@blocksuite/std';
import { InlineMarkdownExtension } from '@blocksuite/std/inline';
export const ParagraphMarkdownExtension =
InlineMarkdownExtension<AffineTextAttributes>({
name: 'heading',
pattern: /^((#{1,6})|(>))\s$/,
action: ({ inlineEditor, pattern, inlineRange, prefixText }) => {
if (inlineEditor.yTextString.slice(0, inlineRange.index).includes('\n')) {
return;
}
const match = prefixText.match(pattern);
if (!match) return;
const type = (
match[2] ? `h${match[2].length}` : 'quote'
) as ParagraphType;
if (!inlineEditor.rootElement) return;
const blockComponent =
inlineEditor.rootElement.closest<BlockComponent>('[data-block-id]');
if (!blockComponent) return;
const { model, std, store } = blockComponent;
if (
!matchModels(model, [ParagraphBlockModel]) &&
matchModels(model, [ListBlockModel])
) {
const parent = store.getParent(model);
if (!parent) return;
const index = parent.children.indexOf(model);
store.captureSync();
inlineEditor.deleteText({
index: 0,
length: inlineRange.index,
});
store.deleteBlock(model, { deleteChildren: false });
const id = store.addBlock<ParagraphBlockModel>(
ParagraphBlockSchema.model.flavour,
{
type: type,
text: model.text?.clone(),
children: model.children,
},
parent,
index
);
focusTextModel(std, id);
} else if (
matchModels(model, [ParagraphBlockModel]) &&
model.props.type !== type
) {
store.captureSync();
inlineEditor.deleteText({
index: 0,
length: inlineRange.index,
});
store.updateBlock(model, { type });
focusTextModel(std, model.id);
}
},
});

View File

@@ -7,7 +7,10 @@ import {
BLOCK_CHILDREN_CONTAINER_PADDING_LEFT,
EDGELESS_TOP_CONTENTEDITABLE_SELECTOR,
} from '@blocksuite/affine-shared/consts';
import { DocModeProvider } from '@blocksuite/affine-shared/services';
import {
CitationProvider,
DocModeProvider,
} from '@blocksuite/affine-shared/services';
import {
calculateCollapsedSiblings,
getNearestHeadingBefore,
@@ -63,6 +66,10 @@ export class ParagraphBlockComponent extends CaptionedBlockComponent<ParagraphBl
?.getPlaceholder(this.model);
}
get citationService() {
return this.std.get(CitationProvider);
}
get attributeRenderer() {
return this.inlineManager.getRenderer();
}
@@ -94,6 +101,12 @@ export class ParagraphBlockComponent extends CaptionedBlockComponent<ParagraphBl
return this.std.get(DefaultInlineManagerExtension.identifier);
}
get hasCitationSiblings() {
return this.collapsedSiblings.some(sibling =>
this.citationService.isCitationModel(sibling)
);
}
override get topContenteditableElement() {
if (this.std.get(DocModeProvider).getEditorMode() === 'edgeless') {
return this.closest<BlockComponent>(
@@ -286,6 +299,13 @@ export class ParagraphBlockComponent extends CaptionedBlockComponent<ParagraphBl
collapsed: value,
});
}
if (this.hasCitationSiblings) {
this.citationService.trackEvent('Expand', {
control: 'Source Button',
type: value ? 'Hide' : 'Show',
});
}
}}
></blocksuite-toggle-button>
`

View File

@@ -7,7 +7,6 @@ import {
import {
focusTextModel,
getInlineEditorByModel,
markdownInput,
} from '@blocksuite/affine-rich-text';
import {
calculateCollapsedSiblings,
@@ -148,10 +147,6 @@ export const ParagraphKeymapExtension = KeymapExtension(
raw.preventDefault();
if (markdownInput(std, model.id)) {
return true;
}
if (model.props.type.startsWith('h') && model.props.collapsed) {
const parent = store.getParent(model);
if (!parent) return true;
@@ -199,20 +194,6 @@ export const ParagraphKeymapExtension = KeymapExtension(
event.preventDefault();
return true;
},
Space: ctx => {
if (!markdownInput(std)) {
return;
}
ctx.get('keyboardState').raw.preventDefault();
return true;
},
'Shift-Space': ctx => {
if (!markdownInput(std)) {
return;
}
ctx.get('keyboardState').raw.preventDefault();
return true;
},
Tab: ctx => {
const [success] = std.command
.chain()

View File

@@ -20,6 +20,7 @@ import { EMBED_BLOCK_MODEL_LIST } from '@blocksuite/affine-shared/consts';
import type { ExtendedModel } from '@blocksuite/affine-shared/types';
import {
focusTitle,
getDocTitleInlineEditor,
getPrevContentBlock,
matchModels,
} from '@blocksuite/affine-shared/utils';
@@ -45,10 +46,6 @@ export function mergeWithPrev(editorHost: EditorHost, model: BlockModel) {
const parent = doc.getParent(model);
if (!parent) return false;
if (matchModels(parent, [EdgelessTextBlockModel])) {
return true;
}
const prevBlock = getPrevContentBlock(editorHost, model);
if (!prevBlock) {
return handleNoPreviousSibling(editorHost, model);
@@ -123,36 +120,63 @@ function handleNoPreviousSibling(editorHost: EditorHost, model: ExtendedModel) {
const parent = doc.getParent(model);
if (!parent) return false;
if (matchModels(parent, [NoteBlockModel]) && parent.isPageBlock()) {
const focusFirstBlockStart = () => {
const firstBlock = parent.firstChild();
if (firstBlock) {
focusTextModel(editorHost.std, firstBlock.id, 0);
}
};
if (matchModels(parent, [NoteBlockModel])) {
const hasTitleEditor = getDocTitleInlineEditor(editorHost);
const rootModel = model.store.root as RootBlockModel;
const title = rootModel.props.title;
const shouldHandleTitle = parent.isPageBlock() && hasTitleEditor;
doc.captureSync();
let textLength = 0;
if (text) {
textLength = text.length;
title.join(text);
if (shouldHandleTitle) {
let textLength = 0;
if (text) {
textLength = text.length;
title.join(text);
}
if (model.children.length > 0 || doc.getNext(model)) {
doc.deleteBlock(model, {
bringChildrenTo: parent,
});
}
// no other blocks, preserve a empty line
else {
text?.clear();
}
focusTitle(editorHost, title.length - textLength);
return true;
}
// Preserve at least one block to be able to focus on container click
if (doc.getNext(model) || model.children.length > 0) {
if (
text?.length === 0 &&
(model.children.length > 0 || doc.getNext(model))
) {
doc.deleteBlock(model, {
bringChildrenTo: parent,
});
} else {
text?.clear();
focusFirstBlockStart();
return true;
}
focusTitle(editorHost, title.length - textLength);
return true;
}
if (
matchModels(parent, [EdgelessTextBlockModel]) ||
model.children.length > 0
matchModels(parent, [EdgelessTextBlockModel]) &&
text?.length === 0 &&
(model.children.length > 0 || doc.getNext(model))
) {
doc.deleteBlock(model, {
bringChildrenTo: parent,
});
focusFirstBlockStart();
return true;
}

View File

@@ -2,9 +2,13 @@ import {
type ViewExtensionContext,
ViewExtensionProvider,
} from '@blocksuite/affine-ext-loader';
import { ParagraphBlockModel } from '@blocksuite/affine-model';
import { BlockViewExtension, FlavourExtension } from '@blocksuite/std';
import { literal } from 'lit/static-html.js';
import { z } from 'zod';
import { effects } from './effects';
import { ParagraphMarkdownExtension } from './markdown.js';
import { ParagraphBlockConfigExtension } from './paragraph-block-config.js';
import {
ParagraphKeymapExtension,
@@ -22,11 +26,6 @@ const placeholders = {
quote: '',
};
import { ParagraphBlockModel } from '@blocksuite/affine-model';
import { z } from 'zod';
import { effects } from './effects';
const optionsSchema = z.object({
getPlaceholder: z.optional(
z.function().args(z.instanceof(ParagraphBlockModel)).returns(z.string())
@@ -61,6 +60,7 @@ export class ParagraphViewExtension extends ViewExtensionProvider<
ParagraphBlockConfigExtension({
getPlaceholder,
}),
ParagraphMarkdownExtension,
]);
}
}

View File

@@ -67,5 +67,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.21.0"
"version": "0.22.4"
}

View File

@@ -9,7 +9,10 @@ import {
getSurfaceComponent,
} from '@blocksuite/affine-block-surface';
import { splitIntoLines } from '@blocksuite/affine-gfx-text';
import type { ShapeElementModel } from '@blocksuite/affine-model';
import type {
EmbedCardStyle,
ShapeElementModel,
} from '@blocksuite/affine-model';
import {
BookmarkStyles,
DEFAULT_NOTE_HEIGHT,
@@ -32,6 +35,7 @@ import {
TelemetryProvider,
} from '@blocksuite/affine-shared/services';
import {
convertToPng,
isInsidePageEditor,
isTopLevelBlock,
isUrlInClipboard,
@@ -64,7 +68,7 @@ import * as Y from 'yjs';
import { PageClipboard } from '../../clipboard/index.js';
import { getSortedCloneElements } from '../utils/clone-utils.js';
import { isCanvasElementWithText } from '../utils/query.js';
import { isCanvasElementWithText, isImageBlock } from '../utils/query.js';
import { createElementsFromClipboardDataCommand } from './command.js';
import {
isPureFileInClipboard,
@@ -123,6 +127,49 @@ export class EdgelessClipboardController extends PageClipboard {
return;
}
// Only when an image is selected, it can be pasted normally to page mode.
if (elements.length === 1 && isImageBlock(elements[0])) {
const element = elements[0];
const sourceId = element.props.sourceId$.peek();
if (!sourceId) return;
await this.std.clipboard.writeToClipboard(async items => {
const job = this.std.store.getTransformer();
await job.assetsManager.readFromBlob(sourceId);
let blob = job.assetsManager.getAssets().get(sourceId) ?? null;
if (!blob) {
return items;
}
let type = blob.type;
let supported = false;
try {
supported = ClipboardItem?.supports(type) ?? false;
} catch (err) {
console.error(err);
}
// TODO(@fundon): when converting jpeg to png, image may become larger and exceed the limit.
if (!supported) {
type = 'image/png';
blob = await convertToPng(blob);
}
if (blob) {
return {
...items,
[`${type}`]: blob,
};
}
return items;
});
return;
}
await this.std.clipboard.writeToClipboard(async _items => {
const data = await prepareClipboardData(elements, this.std);
return {
@@ -236,7 +283,7 @@ export class EdgelessClipboardController extends PageClipboard {
const options: Record<string, unknown> = {};
let flavour = 'affine:bookmark';
let style = BookmarkStyles[0];
let style: EmbedCardStyle = BookmarkStyles[0];
let isInternalLink = false;
let isLinkedBlock = false;
@@ -559,6 +606,10 @@ export class EdgelessClipboardController extends PageClipboard {
}
private async _pasteTextContentAsNote(content: BlockSnapshot[] | string) {
if (content === '') {
return;
}
const { x, y } = this.toolManager.lastMousePos$.peek();
const noteProps = {

View File

@@ -69,37 +69,39 @@ export async function prepareClipboardData(
export function isPureFileInClipboard(clipboardData: DataTransfer) {
const types = clipboardData.types;
return (
(types.length === 1 && types[0] === 'Files') ||
(types.length === 2 &&
(types.includes('text/plain') || types.includes('text/html')) &&
types.includes('Files'))
);
const allowedTypes = new Set([
'Files',
'text/plain',
'text/html',
'application/x-moz-file',
]);
return types.includes('Files') && types.every(type => allowedTypes.has(type));
}
export function tryGetSvgFromClipboard(clipboardData: DataTransfer) {
const types = clipboardData.types;
try {
const parser = new DOMParser();
const svgDoc = parser.parseFromString(
clipboardData.getData('text/plain'),
'image/svg+xml'
);
const svg = svgDoc.documentElement;
if (types.length === 1 && types[0] !== 'text/plain') {
if (svg.tagName !== 'svg' || !svg.hasAttribute('xmlns')) {
return null;
}
const svgContent = DOMPurify.sanitize(svgDoc.documentElement, {
USE_PROFILES: { svg: true },
});
const blob = new Blob([svgContent], { type: 'image/svg+xml' });
const file = new File([blob], 'pasted-image.svg', {
type: 'image/svg+xml',
});
return file;
} catch {
return null;
}
const parser = new DOMParser();
const svgDoc = parser.parseFromString(
clipboardData.getData('text/plain'),
'image/svg+xml'
);
const svg = svgDoc.documentElement;
if (svg.tagName !== 'svg' || !svg.hasAttribute('xmlns')) {
return null;
}
const svgContent = DOMPurify.sanitize(svgDoc.documentElement, {
USE_PROFILES: { svg: true },
});
const blob = new Blob([svgContent], { type: 'image/svg+xml' });
const file = new File([blob], 'pasted-image.svg', { type: 'image/svg+xml' });
return file;
}
export function edgelessElementsBoundFromRawData(

View File

@@ -129,7 +129,7 @@ export class EdgelessRootBlockComponent extends BlockComponent<
) as SurfaceBlockModel;
}
private get _viewportElement(): HTMLElement {
get viewportElement(): HTMLElement {
return this.std.get(ViewportElementProvider).viewportElement;
}
@@ -267,7 +267,7 @@ export class EdgelessRootBlockComponent extends BlockComponent<
this.gfx.viewport.onResize();
});
resizeObserver.observe(this._viewportElement);
resizeObserver.observe(this.viewportElement);
this._resizeObserver = resizeObserver;
}

View File

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

View File

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

View File

@@ -43,6 +43,25 @@ type RendererOptions = {
surfaceModel: SurfaceBlockModel;
};
const UpdateType = {
ELEMENT_ADDED: 'element-added',
ELEMENT_REMOVED: 'element-removed',
ELEMENT_UPDATED: 'element-updated',
VIEWPORT_CHANGED: 'viewport-changed',
SIZE_CHANGED: 'size-changed',
ZOOM_STATE_CHANGED: 'zoom-state-changed',
} as const;
type UpdateType = (typeof UpdateType)[keyof typeof UpdateType];
interface IncrementalUpdateState {
dirtyElementIds: Set<string>;
viewportDirty: boolean;
sizeDirty: boolean;
usePlaceholderDirty: boolean;
pendingUpdates: Map<string, UpdateType[]>;
}
const PLACEHOLDER_RESET_STYLES = {
border: 'none',
borderRadius: '0',
@@ -141,6 +160,18 @@ export class DomRenderer {
private _sizeUpdatedRafId: number | null = null;
private readonly _updateState: IncrementalUpdateState = {
dirtyElementIds: new Set(),
viewportDirty: false,
sizeDirty: false,
usePlaceholderDirty: false,
pendingUpdates: new Map(),
};
private _lastViewportBounds: Bound | null = null;
private _lastZoom: number | null = null;
private _lastUsePlaceholder: boolean = false;
rootElement: HTMLElement;
private readonly _elementsMap = new Map<string, HTMLElement>();
@@ -186,6 +217,7 @@ export class DomRenderer {
private _initViewport() {
this._disposables.add(
this.viewport.viewportUpdated.subscribe(() => {
this._markViewportDirty();
this.refresh();
})
);
@@ -195,6 +227,7 @@ export class DomRenderer {
if (this._sizeUpdatedRafId) return;
this._sizeUpdatedRafId = requestConnectedFrame(() => {
this._sizeUpdatedRafId = null;
this._markSizeDirty();
this._resetSize();
this._render();
this.refresh();
@@ -208,6 +241,7 @@ export class DomRenderer {
if (this.usePlaceholder !== shouldRenderPlaceholders) {
this.usePlaceholder = shouldRenderPlaceholders;
this._markUsePlaceholderDirty();
this.refresh();
}
})
@@ -307,6 +341,292 @@ export class DomRenderer {
}
private _render() {
this._renderIncremental();
}
private _watchSurface(surfaceModel: SurfaceBlockModel) {
this._disposables.add(
surfaceModel.elementAdded.subscribe(payload => {
this._markElementDirty(payload.id, UpdateType.ELEMENT_ADDED);
this.refresh();
})
);
this._disposables.add(
surfaceModel.elementRemoved.subscribe(payload => {
this._markElementDirty(payload.id, UpdateType.ELEMENT_REMOVED);
this.refresh();
})
);
this._disposables.add(
surfaceModel.localElementAdded.subscribe(payload => {
this._markElementDirty(payload.id, UpdateType.ELEMENT_ADDED);
this.refresh();
})
);
this._disposables.add(
surfaceModel.localElementDeleted.subscribe(payload => {
this._markElementDirty(payload.id, UpdateType.ELEMENT_REMOVED);
this.refresh();
})
);
this._disposables.add(
surfaceModel.localElementUpdated.subscribe(payload => {
this._markElementDirty(payload.model.id, UpdateType.ELEMENT_UPDATED);
this.refresh();
})
);
this._disposables.add(
surfaceModel.elementUpdated.subscribe(payload => {
// ignore externalXYWH update cause it's updated by the renderer
if (payload.props['externalXYWH']) return;
this._markElementDirty(payload.id, UpdateType.ELEMENT_UPDATED);
this.refresh();
})
);
}
addOverlay = (overlay: Overlay) => {
overlay.setRenderer(null);
this._overlays.add(overlay);
this.refresh();
};
attach = (container: HTMLElement) => {
this._container = container;
container.append(this.rootElement);
this._resetSize();
this.refresh();
};
dispose = () => {
this._overlays.forEach(overlay => overlay.dispose());
this._overlays.clear();
this._disposables.dispose();
if (this._refreshRafId) {
cancelAnimationFrame(this._refreshRafId);
this._refreshRafId = null;
}
if (this._sizeUpdatedRafId) {
cancelAnimationFrame(this._sizeUpdatedRafId);
this._sizeUpdatedRafId = null;
}
this.rootElement.remove();
this._elementsMap.clear();
};
generateColorProperty = (color: Color, fallback?: Color) => {
return (
this.provider.generateColorProperty?.(color, fallback) ?? 'transparent'
);
};
getColorScheme = () => {
return this.provider.getColorScheme?.() ?? ColorScheme.Light;
};
getColorValue = (color: Color, fallback?: Color, real?: boolean) => {
return (
this.provider.getColorValue?.(color, fallback, real) ?? 'transparent'
);
};
getPropertyValue = (property: string) => {
return this.provider.getPropertyValue?.(property) ?? '';
};
refresh = () => {
if (this._refreshRafId !== null) return;
this._refreshRafId = requestConnectedFrame(() => {
this._refreshRafId = null;
this._render();
}, this._container);
};
removeOverlay = (overlay: Overlay) => {
if (!this._overlays.has(overlay)) {
return;
}
this._overlays.delete(overlay);
this.refresh();
};
/**
* Mark a specific element as dirty for incremental updates
* @param elementId - The ID of the element to mark as dirty
* @param updateType - The type of update (optional, defaults to ELEMENT_UPDATED)
*/
markElementDirty = (
elementId: string,
updateType: UpdateType = UpdateType.ELEMENT_UPDATED
) => {
this._markElementDirty(elementId, updateType);
};
/**
* Force a full re-render of all elements
*/
forceFullRender = () => {
this._updateState.viewportDirty = true;
this.refresh();
};
private _markElementDirty(elementId: string, updateType: UpdateType) {
this._updateState.dirtyElementIds.add(elementId);
const currentUpdates =
this._updateState.pendingUpdates.get(elementId) || [];
if (!currentUpdates.includes(updateType)) {
currentUpdates.push(updateType);
this._updateState.pendingUpdates.set(elementId, currentUpdates);
}
}
private _markViewportDirty() {
this._updateState.viewportDirty = true;
}
private _markSizeDirty() {
this._updateState.sizeDirty = true;
}
private _markUsePlaceholderDirty() {
this._updateState.usePlaceholderDirty = true;
}
private _clearUpdateState() {
this._updateState.dirtyElementIds.clear();
this._updateState.viewportDirty = false;
this._updateState.sizeDirty = false;
this._updateState.usePlaceholderDirty = false;
this._updateState.pendingUpdates.clear();
}
private _isViewportChanged(): boolean {
const { viewportBounds, zoom } = this.viewport;
if (!this._lastViewportBounds || !this._lastZoom) {
return true;
}
return (
this._lastViewportBounds.x !== viewportBounds.x ||
this._lastViewportBounds.y !== viewportBounds.y ||
this._lastViewportBounds.w !== viewportBounds.w ||
this._lastViewportBounds.h !== viewportBounds.h ||
this._lastZoom !== zoom
);
}
private _isUsePlaceholderChanged(): boolean {
return this._lastUsePlaceholder !== this.usePlaceholder;
}
private _updateLastState() {
const { viewportBounds, zoom } = this.viewport;
this._lastViewportBounds = {
x: viewportBounds.x,
y: viewportBounds.y,
w: viewportBounds.w,
h: viewportBounds.h,
} as Bound;
this._lastZoom = zoom;
this._lastUsePlaceholder = this.usePlaceholder;
}
private _renderIncremental() {
const { viewportBounds, zoom } = this.viewport;
const addedElements: HTMLElement[] = [];
const elementsToRemove: HTMLElement[] = [];
const needsFullRender =
this._isViewportChanged() ||
this._isUsePlaceholderChanged() ||
this._updateState.sizeDirty ||
this._updateState.viewportDirty ||
this._updateState.usePlaceholderDirty;
if (needsFullRender) {
this._renderFull();
this._updateLastState();
this._clearUpdateState();
return;
}
// Only update dirty elements
const elementsFromGrid = this.grid.search(viewportBounds, {
filter: ['canvas', 'local'],
}) as SurfaceElementModel[];
const visibleElementIds = new Set<string>();
// 1. Update dirty elements
for (const elementModel of elementsFromGrid) {
const display = (elementModel.display ?? true) && !elementModel.hidden;
if (
display &&
intersects(getBoundWithRotation(elementModel), viewportBounds)
) {
visibleElementIds.add(elementModel.id);
// Only update dirty elements
if (this._updateState.dirtyElementIds.has(elementModel.id)) {
if (
this.usePlaceholder &&
!(elementModel as GfxCompatibleInterface).forceFullRender
) {
this._renderOrUpdatePlaceholder(
elementModel,
viewportBounds,
zoom,
addedElements
);
} else {
this._renderOrUpdateFullElement(
elementModel,
viewportBounds,
zoom,
addedElements
);
}
}
}
}
// 2. Remove elements that are no longer in the grid
for (const elementId of this._updateState.dirtyElementIds) {
const updateTypes = this._updateState.pendingUpdates.get(elementId) || [];
if (
updateTypes.includes(UpdateType.ELEMENT_REMOVED) ||
!visibleElementIds.has(elementId)
) {
const domElem = this._elementsMap.get(elementId);
if (domElem) {
domElem.remove();
this._elementsMap.delete(elementId);
elementsToRemove.push(domElem);
}
}
}
// 3. Notify changes
if (addedElements.length > 0 || elementsToRemove.length > 0) {
this.elementsUpdated.next({
elements: Array.from(this._elementsMap.values()),
added: addedElements,
removed: elementsToRemove,
});
}
this._updateLastState();
this._clearUpdateState();
}
private _renderFull() {
const { viewportBounds, zoom } = this.viewport;
const addedElements: HTMLElement[] = [];
const elementsToRemove: HTMLElement[] = [];
@@ -387,100 +707,4 @@ export class DomRenderer {
});
}
}
private _watchSurface(surfaceModel: SurfaceBlockModel) {
this._disposables.add(
surfaceModel.elementAdded.subscribe(() => this.refresh())
);
this._disposables.add(
surfaceModel.elementRemoved.subscribe(() => this.refresh())
);
this._disposables.add(
surfaceModel.localElementAdded.subscribe(() => this.refresh())
);
this._disposables.add(
surfaceModel.localElementDeleted.subscribe(() => this.refresh())
);
this._disposables.add(
surfaceModel.localElementUpdated.subscribe(() => this.refresh())
);
this._disposables.add(
surfaceModel.elementUpdated.subscribe(payload => {
// ignore externalXYWH update cause it's updated by the renderer
if (payload.props['externalXYWH']) return;
this.refresh();
})
);
}
addOverlay(overlay: Overlay) {
overlay.setRenderer(null);
this._overlays.add(overlay);
this.refresh();
}
attach(container: HTMLElement) {
this._container = container;
container.append(this.rootElement);
this._resetSize();
this.refresh();
}
dispose(): void {
this._overlays.forEach(overlay => overlay.dispose());
this._overlays.clear();
this._disposables.dispose();
if (this._refreshRafId) {
cancelAnimationFrame(this._refreshRafId);
this._refreshRafId = null;
}
if (this._sizeUpdatedRafId) {
cancelAnimationFrame(this._sizeUpdatedRafId);
this._sizeUpdatedRafId = null;
}
this.rootElement.remove();
this._elementsMap.clear();
}
generateColorProperty(color: Color, fallback?: Color) {
return (
this.provider.generateColorProperty?.(color, fallback) ?? 'transparent'
);
}
getColorScheme() {
return this.provider.getColorScheme?.() ?? ColorScheme.Light;
}
getColorValue(color: Color, fallback?: Color, real?: boolean) {
return (
this.provider.getColorValue?.(color, fallback, real) ?? 'transparent'
);
}
getPropertyValue(property: string) {
return this.provider.getPropertyValue?.(property) ?? '';
}
refresh() {
if (this._refreshRafId !== null) return;
this._refreshRafId = requestConnectedFrame(() => {
this._refreshRafId = null;
this._render();
}, this._container);
}
removeOverlay(overlay: Overlay) {
if (!this._overlays.has(overlay)) {
return;
}
this._overlays.delete(overlay);
this.refresh();
}
}

View File

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

View File

@@ -647,6 +647,16 @@ export class TableCell extends SignalWatcher(
return this.richText$.value?.inlineEditor;
}
private readonly _handleKeyDown = (e: KeyboardEvent) => {
if (e.key !== 'Escape') {
if (e.key === 'Tab') {
e.preventDefault();
return;
}
e.stopPropagation();
}
};
override connectedCallback() {
super.connectedCallback();
if (this.readonly) {
@@ -659,10 +669,7 @@ export class TableCell extends SignalWatcher(
this.inlineEditor?.selectAll();
}
};
this.addEventListener('keydown', selectAll);
this.disposables.add(() => {
this.removeEventListener('keydown', selectAll);
});
this.disposables.addFromEvent(this, 'keydown', selectAll);
this.disposables.addFromEvent(this, 'click', (e: MouseEvent) => {
e.stopPropagation();
requestAnimationFrame(() => {
@@ -679,6 +686,13 @@ export class TableCell extends SignalWatcher(
}
this.richText$.value?.updateComplete
.then(() => {
const inlineEditor = this.inlineEditor;
if (inlineEditor) {
this.disposables.add(
inlineEditor.slots.keydown.subscribe(this._handleKeyDown)
);
}
this.disposables.add(
effect(() => {
const richText = this.richText$.value;

View File

@@ -81,5 +81,5 @@
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.21.0"
"version": "0.22.4"
}

View File

@@ -11,6 +11,7 @@ import { property } from 'lit/decorators.js';
import { classMap } from 'lit/directives/class-map.js';
import { keyed } from 'lit/directives/keyed.js';
import type { ClassInfo } from 'lit-html/directives/class-map.js';
import { ifDefined } from 'lit-html/directives/if-defined.js';
import { MenuFocusable } from './focusable.js';
import type { Menu } from './menu.js';
@@ -21,6 +22,7 @@ export type MenuButtonData = {
class: ClassInfo;
select: (ele: HTMLElement) => void | false;
onHover?: (hover: boolean) => void;
testId?: string;
};
export class MenuButton extends MenuFocusable {
@@ -97,7 +99,12 @@ export class MenuButton extends MenuFocusable {
focused: this.isFocused$.value,
...this.data.class,
});
return html` <div class="${classString}">${this.data.content()}</div>`;
return html` <div
class="${classString}"
data-testid=${ifDefined(this.data.testId)}
>
${this.data.content()}
</div>`;
}
@property({ attribute: false })
@@ -157,7 +164,12 @@ export class MobileMenuButton extends MenuFocusable {
focused: this.isFocused$.value,
...this.data.class,
});
return html` <div class="${classString}">${this.data.content()}</div>`;
return html` <div
class="${classString}"
data-testid=${ifDefined(this.data.testId)}
>
${this.data.content()}
</div>`;
}
@property({ attribute: false })
@@ -188,6 +200,7 @@ export const menuButtonItems = {
onHover?: (hover: boolean) => void;
class?: MenuClass;
hide?: () => boolean;
testId?: string;
}) =>
menu => {
if (config.hide?.() || !menu.search(config.name)) {
@@ -209,6 +222,7 @@ export const menuButtonItems = {
'selected-item': config.isSelected ?? false,
...config.class,
},
testId: config.testId,
};
return renderButton(data, menu);
},
@@ -220,6 +234,7 @@ export const menuButtonItems = {
label?: () => TemplateResult;
select: (checked: boolean) => boolean;
class?: ClassInfo;
testId?: string;
}) =>
menu => {
if (!menu.search(config.name)) {
@@ -240,6 +255,7 @@ export const menuButtonItems = {
return false;
},
class: config.class ?? {},
testId: config.testId,
};
return html`${keyed(config.name, renderButton(data, menu))}`;
},
@@ -247,10 +263,12 @@ export const menuButtonItems = {
(config: {
name: string;
on: boolean;
prefix?: TemplateResult;
postfix?: TemplateResult;
label?: () => TemplateResult;
onChange: (on: boolean) => void;
class?: ClassInfo;
testId?: string;
}) =>
menu => {
if (!menu.search(config.name)) {
@@ -262,6 +280,7 @@ export const menuButtonItems = {
const data: MenuButtonData = {
content: () => html`
${config.prefix}
<div class="affine-menu-action-text">
${config.label?.() ?? config.name}
</div>
@@ -276,6 +295,7 @@ export const menuButtonItems = {
return false;
},
class: config.class ?? {},
testId: config.testId,
};
return html`${keyed(config.name, renderButton(data, menu))}`;
},

View File

@@ -23,6 +23,7 @@ export type MenuOptions = {
placeholder?: string;
};
items: MenuConfig[];
testId?: string;
};
// Global menu open listener type
@@ -72,6 +73,9 @@ export class Menu {
? document.createElement('mobile-menu')
: document.createElement('affine-menu');
this.menuElement.menu = this;
if (this.options.testId) {
this.menuElement.dataset.testid = this.options.testId;
}
// Call global menu open listeners
menuOpenListeners.forEach(listener => {

View File

@@ -195,8 +195,7 @@ export class EmbedCardEditModal extends SignalWatcher(
const description = this.description$.value.trim();
const props: AliasInfo = { title };
if (description) props.description = description;
const props: AliasInfo = { title, description };
this.onSave?.(std, blockComponent, props);

View File

@@ -111,6 +111,7 @@ export class FilterableListComponent<Props = unknown> extends WithDisposable(
if (ev.isComposing) break;
ev.preventDefault();
const item = filteredItems[this._curFocusIndex];
if (!item) return;
this._select(item);
break;
}

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