mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-03 02:30:36 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ba78a6bd45 |
@@ -25,7 +25,7 @@ services:
|
||||
image: redis
|
||||
|
||||
indexer:
|
||||
image: manticoresearch/manticore:${MANTICORE_VERSION:-10.1.0}
|
||||
image: manticoresearch/manticore:${MANTICORE_VERSION:-9.3.2}
|
||||
ulimits:
|
||||
nproc: 65535
|
||||
nofile:
|
||||
|
||||
@@ -12,4 +12,4 @@ DB_DATABASE_NAME=affine
|
||||
# ELASTIC_PLATFORM=linux/arm64
|
||||
|
||||
# manticoresearch
|
||||
MANTICORE_VERSION=10.1.0
|
||||
MANTICORE_VERSION=9.3.2
|
||||
|
||||
@@ -15,7 +15,13 @@ yarn affine cert --install
|
||||
|
||||
```bash
|
||||
# certificates will be located at `./.docker/dev/certs/${domain}`
|
||||
yarn affine cert --domain affine.localhost
|
||||
yarn affine cert --domain dev.affine.fail
|
||||
```
|
||||
|
||||
### 3. Enable nginx service in compose.yml
|
||||
### 3. Enable dns and nginx service in compose.yml
|
||||
|
||||
### 4. Add custom dns server
|
||||
|
||||
```bash
|
||||
echo "nameserver 127.0.0.1" | sudo tee /etc/resolver/dev.affine.fail
|
||||
```
|
||||
|
||||
@@ -26,7 +26,7 @@ services:
|
||||
|
||||
# https://manual.manticoresearch.com/Starting_the_server/Docker
|
||||
manticoresearch:
|
||||
image: manticoresearch/manticore:${MANTICORE_VERSION:-10.1.0}
|
||||
image: manticoresearch/manticore:${MANTICORE_VERSION:-9.3.2}
|
||||
ports:
|
||||
- 9308:9308
|
||||
ulimits:
|
||||
@@ -73,6 +73,17 @@ services:
|
||||
# timeout: 10s
|
||||
# retries: 120
|
||||
|
||||
# dns:
|
||||
# image: strm/dnsmasq
|
||||
# volumes:
|
||||
# - ./dnsmasq.conf:/etc/dnsmasq.d/local.conf
|
||||
# ports:
|
||||
# - "53:53/udp"
|
||||
# cap_add:
|
||||
# - NET_ADMIN
|
||||
# depends_on:
|
||||
# - nginx
|
||||
|
||||
# nginx:
|
||||
# image: nginx:alpine
|
||||
# volumes:
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
log-queries
|
||||
address=/dev.affine.fail/127.0.0.1
|
||||
@@ -540,11 +540,6 @@
|
||||
"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`",
|
||||
@@ -565,11 +560,6 @@
|
||||
"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
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -737,11 +727,6 @@
|
||||
},
|
||||
"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\":\"\"}",
|
||||
|
||||
@@ -126,10 +126,7 @@ const createHelmCommand = ({ isDryRun }) => {
|
||||
? 'internal'
|
||||
: 'dev';
|
||||
|
||||
const hosts = (DEPLOY_HOST || CANARY_DEPLOY_HOST)
|
||||
.split(',')
|
||||
.map(host => host.trim())
|
||||
.filter(host => host);
|
||||
const host = DEPLOY_HOST || CANARY_DEPLOY_HOST;
|
||||
const deployCommand = [
|
||||
`helm upgrade --install affine .github/helm/affine`,
|
||||
`--namespace ${namespace}`,
|
||||
@@ -138,9 +135,7 @@ 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}\\" }"`,
|
||||
...hosts.map(
|
||||
(host, index) => `--set global.ingress.hosts[${index}]=${host}`
|
||||
),
|
||||
`--set-string global.ingress.host="${host}"`,
|
||||
`--set-string global.version="${APP_VERSION}"`,
|
||||
...redisAndPostgres,
|
||||
...indexerOptions,
|
||||
@@ -148,14 +143,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=${hosts[0]}`,
|
||||
`--set graphql.app.host=${host}`,
|
||||
`--set sync.replicaCount=${replica.sync}`,
|
||||
`--set-string sync.image.tag="${imageTag}"`,
|
||||
`--set-string renderer.image.tag="${imageTag}"`,
|
||||
`--set renderer.app.host=${hosts[0]}`,
|
||||
`--set renderer.app.host=${host}`,
|
||||
`--set renderer.replicaCount=${replica.renderer}`,
|
||||
`--set-string doc.image.tag="${imageTag}"`,
|
||||
`--set doc.app.host=${hosts[0]}`,
|
||||
`--set doc.app.host=${host}`,
|
||||
`--set doc.replicaCount=${replica.doc}`,
|
||||
...serviceAnnotations,
|
||||
...resources,
|
||||
|
||||
@@ -21,7 +21,7 @@ runs:
|
||||
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')
|
||||
APP_VERSION=$(date '+%Y.%-m.%-d-canary.%-H%-M')
|
||||
fi
|
||||
if [[ "$APP_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
BUILD_TYPE=stable
|
||||
|
||||
@@ -7,10 +7,7 @@ COPY ./packages/frontend/apps/mobile/dist /app/static/mobile
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends openssl libjemalloc2 && \
|
||||
apt-get install -y --no-install-recommends openssl && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Enable jemalloc by preloading the library
|
||||
ENV LD_PRELOAD=libjemalloc.so.2
|
||||
|
||||
CMD ["node", "./dist/main.js"]
|
||||
|
||||
@@ -36,8 +36,7 @@ spec:
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.global.ingress.hosts }}
|
||||
- host: {{ . | quote }}
|
||||
- host: "{{ .Values.global.ingress.host }}"
|
||||
http:
|
||||
paths:
|
||||
- path: /socket.io
|
||||
@@ -46,34 +45,33 @@ 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 }}
|
||||
{{- end }}
|
||||
number: {{ .Values.web.service.port }}
|
||||
{{- end }}
|
||||
|
||||
@@ -4,13 +4,7 @@ global:
|
||||
ingress:
|
||||
enabled: false
|
||||
className: ''
|
||||
# hosts for ingress rules
|
||||
# e.g.
|
||||
# hosts:
|
||||
# - affine.pro
|
||||
# - www.affine.pro
|
||||
hosts:
|
||||
- affine.pro
|
||||
host: affine.pro
|
||||
tls: []
|
||||
secret:
|
||||
secretName: 'server-private-key'
|
||||
|
||||
@@ -972,8 +972,8 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||
shardTotal: [10]
|
||||
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8]
|
||||
shardTotal: [8]
|
||||
needs:
|
||||
- build-server-native
|
||||
services:
|
||||
@@ -1064,36 +1064,24 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
tests:
|
||||
- name: 'Cloud E2E Test 1/10'
|
||||
- name: 'Cloud E2E Test 1/6'
|
||||
shard: 1
|
||||
script: yarn affine @affine-test/affine-cloud e2e --forbid-only --shard=1/10
|
||||
- name: 'Cloud E2E Test 2/10'
|
||||
script: yarn affine @affine-test/affine-cloud e2e --forbid-only --shard=1/6
|
||||
- name: 'Cloud E2E Test 2/6'
|
||||
shard: 2
|
||||
script: yarn affine @affine-test/affine-cloud e2e --forbid-only --shard=2/10
|
||||
- name: 'Cloud E2E Test 3/10'
|
||||
script: yarn affine @affine-test/affine-cloud e2e --forbid-only --shard=2/6
|
||||
- name: 'Cloud E2E Test 3/6'
|
||||
shard: 3
|
||||
script: yarn affine @affine-test/affine-cloud e2e --forbid-only --shard=3/10
|
||||
- name: 'Cloud E2E Test 4/10'
|
||||
script: yarn affine @affine-test/affine-cloud e2e --forbid-only --shard=3/6
|
||||
- name: 'Cloud E2E Test 4/6'
|
||||
shard: 4
|
||||
script: yarn affine @affine-test/affine-cloud e2e --forbid-only --shard=4/10
|
||||
- name: 'Cloud E2E Test 5/10'
|
||||
script: yarn affine @affine-test/affine-cloud e2e --forbid-only --shard=4/6
|
||||
- name: 'Cloud E2E Test 5/6'
|
||||
shard: 5
|
||||
script: yarn affine @affine-test/affine-cloud e2e --forbid-only --shard=5/10
|
||||
- name: 'Cloud E2E Test 6/10'
|
||||
script: yarn affine @affine-test/affine-cloud e2e --forbid-only --shard=5/6
|
||||
- name: 'Cloud E2E Test 6/6'
|
||||
shard: 6
|
||||
script: yarn affine @affine-test/affine-cloud e2e --forbid-only --shard=6/10
|
||||
- name: 'Cloud E2E Test 7/10'
|
||||
shard: 7
|
||||
script: yarn affine @affine-test/affine-cloud e2e --forbid-only --shard=7/10
|
||||
- name: 'Cloud E2E Test 8/10'
|
||||
shard: 8
|
||||
script: yarn affine @affine-test/affine-cloud e2e --forbid-only --shard=8/10
|
||||
- name: 'Cloud E2E Test 9/10'
|
||||
shard: 9
|
||||
script: yarn affine @affine-test/affine-cloud e2e --forbid-only --shard=9/10
|
||||
- name: 'Cloud E2E Test 10/10'
|
||||
shard: 10
|
||||
script: yarn affine @affine-test/affine-cloud e2e --forbid-only --shard=10/10
|
||||
script: yarn affine @affine-test/affine-cloud e2e --forbid-only --shard=6/6
|
||||
- name: 'Cloud Desktop E2E Test'
|
||||
shard: desktop
|
||||
script: |
|
||||
|
||||
@@ -109,8 +109,8 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||
shardTotal: [10]
|
||||
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8]
|
||||
shardTotal: [8]
|
||||
needs:
|
||||
- build-server-native
|
||||
services:
|
||||
|
||||
@@ -124,6 +124,7 @@ jobs:
|
||||
package: 'affine_mobile_native'
|
||||
no-build: 'true'
|
||||
- name: Testflight
|
||||
if: ${{ env.BUILD_TYPE != 'stable' }}
|
||||
working-directory: packages/frontend/apps/ios/App
|
||||
run: |
|
||||
echo -n "${{ env.BUILD_PROVISION_PROFILE }}" | base64 --decode -o $PP_PATH
|
||||
@@ -131,7 +132,6 @@ jobs:
|
||||
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
|
||||
fastlane beta
|
||||
env:
|
||||
BUILD_TARGET: distribution
|
||||
BUILD_PROVISION_PROFILE: ${{ secrets.BUILD_PROVISION_PROFILE }}
|
||||
PP_PATH: ${{ runner.temp }}/build_pp.mobileprovision
|
||||
APPLE_STORE_CONNECT_API_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_API_KEY_ID }}
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
"@blocksuite/affine-gfx-template": "workspace:*",
|
||||
"@blocksuite/affine-gfx-text": "workspace:*",
|
||||
"@blocksuite/affine-gfx-turbo-renderer": "workspace:*",
|
||||
"@blocksuite/affine-inline-comment": "workspace:*",
|
||||
"@blocksuite/affine-inline-footnote": "workspace:*",
|
||||
"@blocksuite/affine-inline-latex": "workspace:*",
|
||||
"@blocksuite/affine-inline-link": "workspace:*",
|
||||
@@ -174,7 +173,6 @@
|
||||
"./inlines/footnote": "./src/inlines/footnote/index.ts",
|
||||
"./inlines/footnote/view": "./src/inlines/footnote/view.ts",
|
||||
"./inlines/footnote/store": "./src/inlines/footnote/store.ts",
|
||||
"./inlines/comment": "./src/inlines/comment/index.ts",
|
||||
"./inlines/latex": "./src/inlines/latex/index.ts",
|
||||
"./inlines/latex/store": "./src/inlines/latex/store.ts",
|
||||
"./inlines/latex/view": "./src/inlines/latex/view.ts",
|
||||
@@ -285,7 +283,6 @@
|
||||
"./sync": "./src/sync/index.ts",
|
||||
"./extensions/store": "./src/extensions/store.ts",
|
||||
"./extensions/view": "./src/extensions/view.ts",
|
||||
"./foundation/clipboard": "./src/foundation/clipboard.ts",
|
||||
"./foundation/store": "./src/foundation/store.ts",
|
||||
"./foundation/view": "./src/foundation/view.ts"
|
||||
},
|
||||
|
||||
@@ -33,7 +33,6 @@ import { PointerViewExtension } from '@blocksuite/affine-gfx-pointer/view';
|
||||
import { ShapeViewExtension } from '@blocksuite/affine-gfx-shape/view';
|
||||
import { TemplateViewExtension } from '@blocksuite/affine-gfx-template/view';
|
||||
import { TextViewExtension } from '@blocksuite/affine-gfx-text/view';
|
||||
import { InlineCommentViewExtension } from '@blocksuite/affine-inline-comment/view';
|
||||
import { FootnoteViewExtension } from '@blocksuite/affine-inline-footnote/view';
|
||||
import { LatexViewExtension as InlineLatexViewExtension } from '@blocksuite/affine-inline-latex/view';
|
||||
import { LinkViewExtension } from '@blocksuite/affine-inline-link/view';
|
||||
@@ -96,7 +95,6 @@ export function getInternalViewExtensions() {
|
||||
RootViewExtension,
|
||||
|
||||
// Inline
|
||||
InlineCommentViewExtension,
|
||||
FootnoteViewExtension,
|
||||
LinkViewExtension,
|
||||
ReferenceViewExtension,
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export * from '@blocksuite/affine-foundation/clipboard';
|
||||
@@ -1 +0,0 @@
|
||||
export * from '@blocksuite/affine-inline-comment';
|
||||
@@ -45,7 +45,6 @@
|
||||
{ "path": "../gfx/template" },
|
||||
{ "path": "../gfx/text" },
|
||||
{ "path": "../gfx/turbo-renderer" },
|
||||
{ "path": "../inlines/comment" },
|
||||
{ "path": "../inlines/footnote" },
|
||||
{ "path": "../inlines/latex" },
|
||||
{ "path": "../inlines/link" },
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"file-type": "^21.0.0",
|
||||
"lit": "^3.2.0",
|
||||
"minimatch": "^10.0.1",
|
||||
|
||||
@@ -17,7 +17,6 @@ import {
|
||||
AttachmentBlockStyles,
|
||||
} from '@blocksuite/affine-model';
|
||||
import {
|
||||
BlockElementCommentManager,
|
||||
CitationProvider,
|
||||
DocModeProvider,
|
||||
FileSizeLimitProvider,
|
||||
@@ -93,14 +92,6 @@ export class AttachmentBlockComponent extends CaptionedBlockComponent<Attachment
|
||||
return this.citationService.isCitationModel(this.model);
|
||||
}
|
||||
|
||||
get isCommentHighlighted() {
|
||||
return (
|
||||
this.std
|
||||
.getOptional(BlockElementCommentManager)
|
||||
?.isBlockCommentHighlighted(this.model) ?? false
|
||||
);
|
||||
}
|
||||
|
||||
convertTo = () => {
|
||||
return this.std
|
||||
.get(AttachmentEmbedProvider)
|
||||
@@ -508,7 +499,6 @@ export class AttachmentBlockComponent extends CaptionedBlockComponent<Attachment
|
||||
class=${classMap({
|
||||
'affine-attachment-container': true,
|
||||
focused: this.selected$.value,
|
||||
'comment-highlighted': this.isCommentHighlighted,
|
||||
})}
|
||||
style=${this.containerStyleMap}
|
||||
>
|
||||
|
||||
@@ -15,10 +15,6 @@ export const styles = css`
|
||||
}
|
||||
}
|
||||
|
||||
.affine-attachment-container.comment-highlighted {
|
||||
outline: 2px solid ${unsafeCSSVarV2('block/comment/highlightUnderline')};
|
||||
}
|
||||
|
||||
.affine-attachment-card {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"@blocksuite/store": "workspace:*",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"lit": "^3.2.0",
|
||||
"minimatch": "^10.0.1",
|
||||
"rxjs": "^7.8.1",
|
||||
|
||||
@@ -8,7 +8,6 @@ import type {
|
||||
} from '@blocksuite/affine-model';
|
||||
import { ImageProxyService } from '@blocksuite/affine-shared/adapters';
|
||||
import {
|
||||
BlockElementCommentManager,
|
||||
CitationProvider,
|
||||
DocModeProvider,
|
||||
LinkPreviewServiceIdentifier,
|
||||
@@ -129,14 +128,6 @@ export class BookmarkBlockComponent extends CaptionedBlockComponent<BookmarkBloc
|
||||
return this.std.get(ImageProxyService);
|
||||
}
|
||||
|
||||
get isCommentHighlighted() {
|
||||
return (
|
||||
this.std
|
||||
.getOptional(BlockElementCommentManager)
|
||||
?.isBlockCommentHighlighted(this.model) ?? false
|
||||
);
|
||||
}
|
||||
|
||||
handleClick = (event: MouseEvent) => {
|
||||
event.stopPropagation();
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ export class BookmarkCard extends SignalWatcher(
|
||||
[style]: true,
|
||||
selected: this.bookmark.selected$.value,
|
||||
edgeless: isGfxBlockComponent(this.bookmark),
|
||||
'comment-highlighted': this.bookmark.isCommentHighlighted,
|
||||
});
|
||||
|
||||
const domainName = url.match(
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
canEmbedAsEmbedBlock,
|
||||
canEmbedAsIframe,
|
||||
EMBED_IFRAME_DEFAULT_HEIGHT_IN_SURFACE,
|
||||
EMBED_IFRAME_DEFAULT_WIDTH_IN_SURFACE,
|
||||
@@ -150,10 +149,13 @@ 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) &&
|
||||
!canEmbedAsEmbedBlock(ctx.std, url)
|
||||
!canEmbedAsIframe(ctx.std, url) && options?.viewType !== 'embed'
|
||||
);
|
||||
},
|
||||
run(ctx) {
|
||||
@@ -167,8 +169,15 @@ const builtinToolbarConfig = {
|
||||
|
||||
let blockId: string | undefined;
|
||||
|
||||
// first try to embed as a custom embed block
|
||||
if (canEmbedAsEmbedBlock(ctx.std, url)) {
|
||||
// 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 {
|
||||
const options = ctx.std
|
||||
.get(EmbedOptionProvider)
|
||||
.getEmbedBlockOptions(url);
|
||||
@@ -193,13 +202,6 @@ 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;
|
||||
@@ -377,8 +379,27 @@ const builtinSurfaceToolbarConfig = {
|
||||
|
||||
let newId: string | undefined;
|
||||
|
||||
// first try to embed as a custom embed block
|
||||
if (canEmbedAsEmbedBlock(ctx.std, url)) {
|
||||
// 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 {
|
||||
const options = ctx.std
|
||||
.get(EmbedOptionProvider)
|
||||
.getEmbedBlockOptions(url);
|
||||
@@ -408,29 +429,8 @@ 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,10 +449,13 @@ const builtinSurfaceToolbarConfig = {
|
||||
when(ctx) {
|
||||
const model = ctx.getCurrentModelByType(BookmarkBlockModel);
|
||||
if (!model) return false;
|
||||
|
||||
const { url } = model.props;
|
||||
return (
|
||||
canEmbedAsIframe(ctx.std, url) || canEmbedAsEmbedBlock(ctx.std, url)
|
||||
);
|
||||
const options = ctx.std
|
||||
.get(EmbedOptionProvider)
|
||||
.getEmbedBlockOptions(url);
|
||||
|
||||
return canEmbedAsIframe(ctx.std, url) || options?.viewType === 'embed';
|
||||
},
|
||||
content(ctx) {
|
||||
const model = ctx.getCurrentModelByType(BookmarkBlockModel);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { unsafeCSSVar, unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';
|
||||
import { unsafeCSSVar } from '@blocksuite/affine-shared/theme';
|
||||
import { baseTheme } from '@toeverything/theme';
|
||||
import { css, unsafeCSS } from 'lit';
|
||||
|
||||
@@ -17,9 +17,9 @@ export const styles = css`
|
||||
width: 100%;
|
||||
|
||||
border-radius: 8px;
|
||||
border: 1px solid ${unsafeCSSVarV2('layer/background/tertiary')};
|
||||
border: 1px solid var(--affine-background-tertiary-color);
|
||||
|
||||
background: ${unsafeCSSVarV2('layer/background/primary')};
|
||||
background: var(--affine-background-primary-color);
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@@ -158,10 +158,6 @@ export const styles = css`
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.affine-bookmark-card.comment-highlighted {
|
||||
outline: 2px solid ${unsafeCSSVarV2('block/comment/highlightUnderline')};
|
||||
}
|
||||
|
||||
.affine-bookmark-card.loading {
|
||||
.affine-bookmark-content-title-text {
|
||||
color: var(--affine-placeholder-color);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"@floating-ui/dom": "^1.6.10",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/mdast": "^4.0.4",
|
||||
"emoji-mart": "^5.6.0",
|
||||
"lit": "^3.2.0",
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
"@blocksuite/affine-components": "workspace:*",
|
||||
"@blocksuite/affine-ext-loader": "workspace:*",
|
||||
"@blocksuite/affine-gfx-turbo-renderer": "workspace:*",
|
||||
"@blocksuite/affine-inline-comment": "workspace:*",
|
||||
"@blocksuite/affine-inline-latex": "workspace:*",
|
||||
"@blocksuite/affine-inline-link": "workspace:*",
|
||||
"@blocksuite/affine-inline-preset": "workspace:*",
|
||||
@@ -28,7 +27,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/mdast": "^4.0.4",
|
||||
"lit": "^3.2.0",
|
||||
"minimatch": "^10.0.1",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { CommentInlineSpecExtension } from '@blocksuite/affine-inline-comment';
|
||||
import { LatexInlineSpecExtension } from '@blocksuite/affine-inline-latex';
|
||||
import { LinkInlineSpecExtension } from '@blocksuite/affine-inline-link';
|
||||
import {
|
||||
@@ -21,9 +20,7 @@ import { z } from 'zod';
|
||||
export const CodeBlockUnitSpecExtension =
|
||||
InlineSpecExtension<AffineTextAttributes>({
|
||||
name: 'code-block-unit',
|
||||
schema: z.object({
|
||||
'code-block-uint': z.undefined(),
|
||||
}),
|
||||
schema: z.undefined(),
|
||||
match: () => true,
|
||||
renderer: ({ delta }) => {
|
||||
return html`<affine-code-unit .delta=${delta}></affine-code-unit>`;
|
||||
@@ -45,6 +42,5 @@ export const CodeBlockInlineManagerExtension =
|
||||
LatexInlineSpecExtension.identifier,
|
||||
LinkInlineSpecExtension.identifier,
|
||||
CodeBlockUnitSpecExtension.identifier,
|
||||
CommentInlineSpecExtension.identifier,
|
||||
],
|
||||
});
|
||||
|
||||
@@ -19,12 +19,8 @@ import {
|
||||
export class CodeBlockHighlighter extends LifeCycleWatcher {
|
||||
static override key = 'code-block-highlighter';
|
||||
|
||||
// Singleton highlighter instance
|
||||
private static _sharedHighlighter: HighlighterCore | null = null;
|
||||
private static _highlighterPromise: Promise<HighlighterCore> | null = null;
|
||||
private static _refCount = 0;
|
||||
|
||||
private _darkThemeKey: string | undefined;
|
||||
|
||||
private _lightThemeKey: string | undefined;
|
||||
|
||||
highlighter$: Signal<HighlighterCore | null> = signal(null);
|
||||
@@ -48,45 +44,18 @@ export class CodeBlockHighlighter extends LifeCycleWatcher {
|
||||
this.highlighter$.value = highlighter;
|
||||
};
|
||||
|
||||
private static async _getOrCreateHighlighter(): Promise<HighlighterCore> {
|
||||
if (CodeBlockHighlighter._sharedHighlighter) {
|
||||
return CodeBlockHighlighter._sharedHighlighter;
|
||||
}
|
||||
|
||||
if (!CodeBlockHighlighter._highlighterPromise) {
|
||||
CodeBlockHighlighter._highlighterPromise = createHighlighterCore({
|
||||
engine: createOnigurumaEngine(() => getWasm),
|
||||
}).then(highlighter => {
|
||||
CodeBlockHighlighter._sharedHighlighter = highlighter;
|
||||
return highlighter;
|
||||
});
|
||||
}
|
||||
|
||||
return CodeBlockHighlighter._highlighterPromise;
|
||||
}
|
||||
|
||||
override mounted(): void {
|
||||
super.mounted();
|
||||
|
||||
CodeBlockHighlighter._refCount++;
|
||||
|
||||
CodeBlockHighlighter._getOrCreateHighlighter()
|
||||
createHighlighterCore({
|
||||
engine: createOnigurumaEngine(() => getWasm),
|
||||
})
|
||||
.then(this._loadTheme)
|
||||
.catch(console.error);
|
||||
}
|
||||
|
||||
override unmounted(): void {
|
||||
CodeBlockHighlighter._refCount--;
|
||||
|
||||
// Only dispose the shared highlighter when no instances are using it
|
||||
if (
|
||||
CodeBlockHighlighter._refCount === 0 &&
|
||||
CodeBlockHighlighter._sharedHighlighter
|
||||
) {
|
||||
CodeBlockHighlighter._sharedHighlighter.dispose();
|
||||
CodeBlockHighlighter._sharedHighlighter = null;
|
||||
CodeBlockHighlighter._highlighterPromise = null;
|
||||
}
|
||||
this.highlighter$.value?.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
EDGELESS_TOP_CONTENTEDITABLE_SELECTOR,
|
||||
} from '@blocksuite/affine-shared/consts';
|
||||
import {
|
||||
BlockElementCommentManager,
|
||||
DocModeProvider,
|
||||
NotificationProvider,
|
||||
} from '@blocksuite/affine-shared/services';
|
||||
@@ -391,14 +390,6 @@ export class CodeBlockComponent extends CaptionedBlockComponent<CodeBlockModel>
|
||||
});
|
||||
}
|
||||
|
||||
get isCommentHighlighted() {
|
||||
return (
|
||||
this.std
|
||||
.getOptional(BlockElementCommentManager)
|
||||
?.isBlockCommentHighlighted(this.model) ?? false
|
||||
);
|
||||
}
|
||||
|
||||
override async getUpdateComplete() {
|
||||
const result = await super.getUpdateComplete();
|
||||
await this._richTextElement?.updateComplete;
|
||||
@@ -422,7 +413,6 @@ export class CodeBlockComponent extends CaptionedBlockComponent<CodeBlockModel>
|
||||
<div
|
||||
class=${classMap({
|
||||
'affine-code-block-container': true,
|
||||
'highlight-comment': this.isCommentHighlighted,
|
||||
mobile: IS_MOBILE,
|
||||
wrap: this.model.props.wrap,
|
||||
'disable-line-numbers': !showLineNumbers,
|
||||
|
||||
@@ -7,10 +7,9 @@ import {
|
||||
WrapIcon,
|
||||
} from '@blocksuite/affine-components/icons';
|
||||
import type { MenuItemGroup } from '@blocksuite/affine-components/toolbar';
|
||||
import { CommentProviderIdentifier } from '@blocksuite/affine-shared/services';
|
||||
import { isInsidePageEditor } from '@blocksuite/affine-shared/utils';
|
||||
import { noop, sleep } from '@blocksuite/global/utils';
|
||||
import { CommentIcon, NumberedListIcon } from '@blocksuite/icons/lit';
|
||||
import { NumberedListIcon } from '@blocksuite/icons/lit';
|
||||
import { BlockSelection } from '@blocksuite/std';
|
||||
import { html } from 'lit';
|
||||
import { ifDefined } from 'lit/directives/if-defined.js';
|
||||
@@ -114,47 +113,6 @@ export const PRIMARY_GROUPS: MenuItemGroup<CodeBlockToolbarContext>[] = [
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'comment',
|
||||
label: 'Comment',
|
||||
tooltip: 'Comment',
|
||||
icon: CommentIcon({
|
||||
width: '20',
|
||||
height: '20',
|
||||
}),
|
||||
when: ({ std }) => !!std.getOptional(CommentProviderIdentifier),
|
||||
generate: ({ blockComponent }) => {
|
||||
return {
|
||||
action: () => {
|
||||
const commentProvider = blockComponent.std.getOptional(
|
||||
CommentProviderIdentifier
|
||||
);
|
||||
if (!commentProvider) return;
|
||||
|
||||
commentProvider.addComment([
|
||||
new BlockSelection({
|
||||
blockId: blockComponent.model.id,
|
||||
}),
|
||||
]);
|
||||
},
|
||||
render: item =>
|
||||
html`<editor-icon-button
|
||||
class="code-toolbar-button comment"
|
||||
aria-label=${ifDefined(item.label)}
|
||||
.tooltip=${item.label}
|
||||
.tooltipOffset=${4}
|
||||
.iconSize=${'16px'}
|
||||
.iconContainerPadding=${4}
|
||||
@click=${(e: MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
item.action();
|
||||
}}
|
||||
>
|
||||
${item.icon}
|
||||
</editor-icon-button>`,
|
||||
};
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -2,9 +2,7 @@ export * from './adapters';
|
||||
export * from './clipboard';
|
||||
export * from './code-block';
|
||||
export * from './code-block-config';
|
||||
export * from './code-block-service';
|
||||
export * from './code-preview-extension';
|
||||
export * from './code-toolbar';
|
||||
export * from './highlight/const';
|
||||
export * from './turbo/code-layout-handler';
|
||||
export * from './turbo/code-painter.worker';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { scrollbarStyle } from '@blocksuite/affine-shared/styles';
|
||||
import { unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';
|
||||
import { css } from 'lit';
|
||||
|
||||
export const codeBlockStyles = css`
|
||||
@@ -21,10 +20,6 @@ export const codeBlockStyles = css`
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.affine-code-block-container.highlight-comment {
|
||||
outline: 2px solid ${unsafeCSSVarV2('block/comment/highlightUnderline')};
|
||||
}
|
||||
|
||||
${scrollbarStyle('.affine-code-block-container rich-text')}
|
||||
|
||||
.affine-code-block-container .inline-editor {
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
{ "path": "../../components" },
|
||||
{ "path": "../../ext-loader" },
|
||||
{ "path": "../../gfx/turbo-renderer" },
|
||||
{ "path": "../../inlines/comment" },
|
||||
{ "path": "../../inlines/latex" },
|
||||
{ "path": "../../inlines/link" },
|
||||
{ "path": "../../inlines/preset" },
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/mdast": "^4.0.4",
|
||||
"lit": "^3.2.0",
|
||||
"minimatch": "^10.0.1",
|
||||
|
||||
@@ -40,7 +40,6 @@ import { RANGE_SYNC_EXCLUDE_ATTR } from '@blocksuite/std/inline';
|
||||
import { Slice } from '@blocksuite/store';
|
||||
import { computed, signal } from '@preact/signals-core';
|
||||
import { css, nothing, unsafeCSS } from 'lit';
|
||||
import { repeat } from 'lit/directives/repeat.js';
|
||||
import { html } from 'lit/static-html.js';
|
||||
|
||||
import { BlockQueryDataSource } from './data-source.js';
|
||||
@@ -304,15 +303,9 @@ export class DataViewBlockComponent extends CaptionedBlockComponent<DataViewBloc
|
||||
},
|
||||
});
|
||||
override renderBlock() {
|
||||
const widgets = html`${repeat(
|
||||
Object.entries(this.widgets),
|
||||
([id]) => id,
|
||||
([_, widget]) => widget
|
||||
)}`;
|
||||
|
||||
return html`
|
||||
<div contenteditable="false" style="position: relative">
|
||||
${this.dataViewRootLogic.render()} ${widgets}
|
||||
${this.dataViewRootLogic.render()}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/mdast": "^4.0.4",
|
||||
"date-fns": "^4.0.0",
|
||||
"lit": "^3.2.0",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';
|
||||
import { stopPropagation } from '@blocksuite/affine-shared/utils';
|
||||
import type { DataViewUILogicBase } from '@blocksuite/data-view';
|
||||
import { SignalWatcher, WithDisposable } from '@blocksuite/global/lit';
|
||||
@@ -73,12 +72,6 @@ export class DatabaseTitle extends SignalWatcher(
|
||||
.affine-database-title [data-title-focus='true']::before {
|
||||
color: var(--affine-placeholder-color);
|
||||
}
|
||||
|
||||
.affine-database-title.comment-highlighted {
|
||||
border-bottom: 2px solid
|
||||
${unsafeCSSVarV2('block/comment/highlightUnderline')};
|
||||
background-color: ${unsafeCSSVarV2('block/comment/highlightActive')};
|
||||
}
|
||||
`;
|
||||
|
||||
private readonly compositionEnd = () => {
|
||||
@@ -141,7 +134,6 @@ export class DatabaseTitle extends SignalWatcher(
|
||||
const classList = classMap({
|
||||
'affine-database-title': true,
|
||||
ellipsis: !this.isFocus$.value,
|
||||
'comment-highlighted': this.database?.isCommentHighlighted ?? false,
|
||||
});
|
||||
const untitledStyle = styleMap({
|
||||
height: isEmpty ? 'auto' : 0,
|
||||
|
||||
@@ -10,8 +10,6 @@ import { toast } from '@blocksuite/affine-components/toast';
|
||||
import type { DatabaseBlockModel } from '@blocksuite/affine-model';
|
||||
import { EDGELESS_TOP_CONTENTEDITABLE_SELECTOR } from '@blocksuite/affine-shared/consts';
|
||||
import {
|
||||
BlockElementCommentManager,
|
||||
CommentProviderIdentifier,
|
||||
DocModeProvider,
|
||||
NotificationProvider,
|
||||
type TelemetryEventMap,
|
||||
@@ -36,18 +34,16 @@ import {
|
||||
import { widgetPresets } from '@blocksuite/data-view/widget-presets';
|
||||
import { Rect } from '@blocksuite/global/gfx';
|
||||
import {
|
||||
CommentIcon,
|
||||
CopyIcon,
|
||||
DeleteIcon,
|
||||
MoreHorizontalIcon,
|
||||
} from '@blocksuite/icons/lit';
|
||||
import { type BlockComponent, BlockSelection } from '@blocksuite/std';
|
||||
import { type BlockComponent } from '@blocksuite/std';
|
||||
import { RANGE_SYNC_EXCLUDE_ATTR } from '@blocksuite/std/inline';
|
||||
import { Slice } from '@blocksuite/store';
|
||||
import { autoUpdate } from '@floating-ui/dom';
|
||||
import { computed, signal } from '@preact/signals-core';
|
||||
import { html, nothing } from 'lit';
|
||||
import { repeat } from 'lit/directives/repeat.js';
|
||||
|
||||
import { popSideDetail } from './components/layout.js';
|
||||
import { DatabaseConfigExtension } from './config.js';
|
||||
@@ -86,18 +82,6 @@ export class DatabaseBlockComponent extends CaptionedBlockComponent<DatabaseBloc
|
||||
);
|
||||
},
|
||||
}),
|
||||
menu.action({
|
||||
prefix: CommentIcon(),
|
||||
name: 'Comment',
|
||||
hide: () => !this.std.getOptional(CommentProviderIdentifier),
|
||||
select: () => {
|
||||
this.std.getOptional(CommentProviderIdentifier)?.addComment([
|
||||
new BlockSelection({
|
||||
blockId: this.blockId,
|
||||
}),
|
||||
]);
|
||||
},
|
||||
}),
|
||||
menu.action({
|
||||
prefix: CopyIcon(),
|
||||
name: 'Copy',
|
||||
@@ -313,14 +297,6 @@ export class DatabaseBlockComponent extends CaptionedBlockComponent<DatabaseBloc
|
||||
};
|
||||
}
|
||||
|
||||
get isCommentHighlighted() {
|
||||
return (
|
||||
this.std
|
||||
.getOptional(BlockElementCommentManager)
|
||||
?.isBlockCommentHighlighted(this.model) ?? false
|
||||
);
|
||||
}
|
||||
|
||||
override get topContenteditableElement() {
|
||||
if (this.std.get(DocModeProvider).getEditorMode() === 'edgeless') {
|
||||
return this.closest<BlockComponent>(
|
||||
@@ -452,15 +428,9 @@ export class DatabaseBlockComponent extends CaptionedBlockComponent<DatabaseBloc
|
||||
})
|
||||
);
|
||||
override renderBlock() {
|
||||
const widgets = html`${repeat(
|
||||
Object.entries(this.widgets),
|
||||
([id]) => id,
|
||||
([_, widget]) => widget
|
||||
)}`;
|
||||
|
||||
return html`
|
||||
<div contenteditable="false" class="${databaseContentStyles}">
|
||||
${this.dataViewRootLogic.value.render()} ${widgets}
|
||||
${this.dataViewRootLogic.value.render()}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ function toggleStyle(
|
||||
return [k, v];
|
||||
}
|
||||
})
|
||||
) as AffineTextAttributes;
|
||||
);
|
||||
|
||||
inlineEditor.formatText(inlineRange, newAttributes, {
|
||||
mode: 'merge',
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/mdast": "^4.0.4",
|
||||
"lit": "^3.2.0",
|
||||
"minimatch": "^10.0.1",
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"lit": "^3.2.0",
|
||||
"minimatch": "^10.0.1",
|
||||
"rxjs": "^7.8.1",
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"lit": "^3.2.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
|
||||
-1
@@ -338,7 +338,6 @@ export class EmbedLinkedDocBlockComponent extends EmbedBlockComponent<EmbedLinke
|
||||
'note-empty': this.isNoteContentEmpty,
|
||||
'in-canvas': inCanvas,
|
||||
[this._cardStyle]: true,
|
||||
'comment-highlighted': this.isCommentHighlighted,
|
||||
});
|
||||
|
||||
const theme = this.std.get(ThemeProvider).theme;
|
||||
|
||||
@@ -5,4 +5,3 @@ export * from './edgeless-clipboard-config';
|
||||
export * from './embed-edgeless-linked-doc-block';
|
||||
export * from './embed-linked-doc-block';
|
||||
export * from './embed-linked-doc-spec';
|
||||
export { getEmbedLinkedDocIcons } from './utils';
|
||||
|
||||
@@ -9,16 +9,12 @@ export const styles = css`
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 8px;
|
||||
border: 1px solid ${unsafeCSSVarV2('layer/background/tertiary')};
|
||||
border: 1px solid var(--affine-background-tertiary-color);
|
||||
background: ${unsafeCSSVarV2('layer/background/primary')};
|
||||
user-select: none;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.affine-embed-linked-doc-block.comment-highlighted {
|
||||
outline: 2px solid ${unsafeCSSVarV2('block/comment/highlightUnderline')};
|
||||
}
|
||||
|
||||
.affine-embed-linked-doc-block.in-canvas {
|
||||
border: 1px solid ${unsafeCSSVarV2('layer/insideBorder/border')};
|
||||
background: ${unsafeCSSVarV2('layer/background/linkedDocOnEdgeless')};
|
||||
@@ -168,7 +164,6 @@ export const styles = css`
|
||||
.affine-embed-linked-doc-banner {
|
||||
margin: 12px 12px 0px 0px;
|
||||
width: 204px;
|
||||
min-width: 204px;
|
||||
max-width: 100%;
|
||||
height: 102px;
|
||||
pointer-events: none;
|
||||
|
||||
-1
@@ -232,7 +232,6 @@ export class EmbedSyncedDocBlockComponent extends EmbedBlockComponent<EmbedSynce
|
||||
surface: false,
|
||||
selected: this.selected$.value,
|
||||
'show-hover-border': true,
|
||||
'comment-highlighted': this.isCommentHighlighted,
|
||||
})}
|
||||
@click=${this._handleClick}
|
||||
style=${containerStyleMap}
|
||||
|
||||
@@ -57,9 +57,6 @@ export const blockStyles = css`
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.affine-embed-synced-doc-container.comment-highlighted {
|
||||
outline: 2px solid ${unsafeCSSVarV2('block/comment/highlightUnderline')};
|
||||
}
|
||||
.affine-embed-synced-doc-container.show-hover-border:hover {
|
||||
border-color: var(--affine-border-color);
|
||||
}
|
||||
@@ -197,8 +194,8 @@ export const cardStyles = css`
|
||||
width: 100%;
|
||||
height: ${EMBED_CARD_HEIGHT.horizontal}px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid ${unsafeCSSVarV2('layer/background/tertiary')};
|
||||
background: ${unsafeCSSVarV2('layer/background/primary')};
|
||||
border: 1px solid var(--affine-background-tertiary-color);
|
||||
background: var(--affine-background-primary-color);
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"lit": "^3.2.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
|
||||
@@ -2,20 +2,17 @@ import {
|
||||
CaptionedBlockComponent,
|
||||
SelectedStyle,
|
||||
} from '@blocksuite/affine-components/caption';
|
||||
import type { EmbedCardStyle, EmbedProps } from '@blocksuite/affine-model';
|
||||
import type { EmbedCardStyle } from '@blocksuite/affine-model';
|
||||
import {
|
||||
EMBED_CARD_HEIGHT,
|
||||
EMBED_CARD_MIN_WIDTH,
|
||||
EMBED_CARD_WIDTH,
|
||||
} from '@blocksuite/affine-shared/consts';
|
||||
import {
|
||||
BlockElementCommentManager,
|
||||
DocModeProvider,
|
||||
} from '@blocksuite/affine-shared/services';
|
||||
import { unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';
|
||||
import { DocModeProvider } from '@blocksuite/affine-shared/services';
|
||||
import { findAncestorModel } from '@blocksuite/affine-shared/utils';
|
||||
import type { BlockService } from '@blocksuite/std';
|
||||
import {
|
||||
type GfxCompatibleProps,
|
||||
GfxViewInteractionExtension,
|
||||
type ResizeConstraint,
|
||||
} from '@blocksuite/std/gfx';
|
||||
@@ -28,7 +25,7 @@ import { type ClassInfo, classMap } from 'lit/directives/class-map.js';
|
||||
import { type StyleInfo, styleMap } from 'lit/directives/style-map.js';
|
||||
|
||||
export class EmbedBlockComponent<
|
||||
Model extends BlockModel<EmbedProps> = BlockModel<EmbedProps>,
|
||||
Model extends BlockModel<GfxCompatibleProps> = BlockModel<GfxCompatibleProps>,
|
||||
Service extends BlockService = BlockService,
|
||||
WidgetName extends string = string,
|
||||
> extends CaptionedBlockComponent<Model, Service, WidgetName> {
|
||||
@@ -62,14 +59,6 @@ export class EmbedBlockComponent<
|
||||
*/
|
||||
protected embedContainerStyle: StyleInfo = {};
|
||||
|
||||
get isCommentHighlighted() {
|
||||
return (
|
||||
this.std
|
||||
.getOptional(BlockElementCommentManager)
|
||||
?.isBlockCommentHighlighted(this.model) ?? false
|
||||
);
|
||||
}
|
||||
|
||||
renderEmbed = (content: () => TemplateResult) => {
|
||||
if (
|
||||
this._cardStyle === 'horizontal' ||
|
||||
@@ -101,11 +90,6 @@ export class EmbedBlockComponent<
|
||||
style=${styleMap({
|
||||
height: `${this._cardHeight}px`,
|
||||
width: '100%',
|
||||
...(this.isCommentHighlighted
|
||||
? {
|
||||
border: `2px solid ${unsafeCSSVarV2('block/comment/highlightUnderline')}`,
|
||||
}
|
||||
: {}),
|
||||
...this.embedContainerStyle,
|
||||
})}
|
||||
>
|
||||
|
||||
@@ -57,11 +57,6 @@ export const embedNoteContentStyles = css`
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.affine-embed-doc-content-note-blocks inline-comment {
|
||||
background-color: unset !important;
|
||||
border-bottom: unset !important;
|
||||
}
|
||||
|
||||
.affine-embed-linked-doc-block.horizontal {
|
||||
affine-paragraph,
|
||||
affine-list {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { EdgelessLegacySlotIdentifier } from '@blocksuite/affine-block-surface';
|
||||
import type { EmbedProps } from '@blocksuite/affine-model';
|
||||
import { Bound } from '@blocksuite/global/gfx';
|
||||
import {
|
||||
blockComponentSymbol,
|
||||
@@ -8,13 +7,16 @@ import {
|
||||
GfxElementSymbol,
|
||||
toGfxBlockComponent,
|
||||
} from '@blocksuite/std';
|
||||
import type { GfxBlockElementModel } from '@blocksuite/std/gfx';
|
||||
import type {
|
||||
GfxBlockElementModel,
|
||||
GfxCompatibleProps,
|
||||
} from '@blocksuite/std/gfx';
|
||||
import type { StyleInfo } from 'lit/directives/style-map.js';
|
||||
|
||||
import type { EmbedBlockComponent } from './embed-block-element.js';
|
||||
|
||||
export function toEdgelessEmbedBlock<
|
||||
Model extends GfxBlockElementModel<EmbedProps>,
|
||||
Model extends GfxBlockElementModel<GfxCompatibleProps>,
|
||||
Service extends BlockService,
|
||||
WidgetName extends string,
|
||||
B extends typeof EmbedBlockComponent<Model, Service, WidgetName>,
|
||||
|
||||
@@ -11,8 +11,6 @@ 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 = {
|
||||
@@ -42,8 +40,3 @@ export function getEmbedCardIcons(theme: ColorScheme): EmbedCardIcons {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export function canEmbedAsEmbedBlock(std: BlockStdScope, url: string) {
|
||||
const options = std.get(EmbedOptionProvider).getEmbedBlockOptions(url);
|
||||
return options?.viewType === 'embed';
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ export const styles = css`
|
||||
height: 100%;
|
||||
|
||||
border-radius: 8px;
|
||||
border: 1px solid ${unsafeCSSVarV2('layer/background/tertiary')};
|
||||
border: 1px solid var(--affine-background-tertiary-color);
|
||||
|
||||
background: ${unsafeCSSVarV2('layer/background/primary')};
|
||||
background: var(--affine-background-primary-color);
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';
|
||||
import { css, html } from 'lit';
|
||||
|
||||
export const styles = css`
|
||||
@@ -10,9 +9,9 @@ export const styles = css`
|
||||
height: 100%;
|
||||
|
||||
border-radius: 8px;
|
||||
border: 1px solid ${unsafeCSSVarV2('layer/background/tertiary')};
|
||||
border: 1px solid var(--affine-background-tertiary-color);
|
||||
|
||||
background: ${unsafeCSSVarV2('layer/background/primary')};
|
||||
background: var(--affine-background-primary-color);
|
||||
user-select: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';
|
||||
import { css, html } from 'lit';
|
||||
|
||||
export const EMBED_HTML_MIN_WIDTH = 370;
|
||||
@@ -16,9 +15,9 @@ export const styles = css`
|
||||
gap: 20px;
|
||||
|
||||
border-radius: 12px;
|
||||
border: 1px solid ${unsafeCSSVarV2('layer/background/tertiary')};
|
||||
border: 1px solid var(--affine-background-tertiary-color);
|
||||
|
||||
background: ${unsafeCSSVarV2('layer/background/primary')};
|
||||
background: var(--affine-background-primary-color);
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
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);
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ExcalidrawEmbedConfig } from './excalidraw';
|
||||
import { GenericEmbedConfig } from './generic';
|
||||
import { GoogleDocsEmbedConfig } from './google-docs';
|
||||
import { GoogleDriveEmbedConfig } from './google-drive';
|
||||
import { MiroEmbedConfig } from './miro';
|
||||
@@ -11,5 +10,4 @@ export const EmbedIframeConfigExtensions = [
|
||||
MiroEmbedConfig,
|
||||
ExcalidrawEmbedConfig,
|
||||
GoogleDocsEmbedConfig,
|
||||
GenericEmbedConfig,
|
||||
];
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
type IframeOptions,
|
||||
LinkPreviewServiceIdentifier,
|
||||
NotificationProvider,
|
||||
VirtualKeyboardProvider,
|
||||
} from '@blocksuite/affine-shared/services';
|
||||
import { matchModels } from '@blocksuite/affine-shared/utils';
|
||||
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
||||
@@ -214,33 +213,9 @@ export class EmbedIframeBlockComponent extends CaptionedBlockComponent<EmbedIfra
|
||||
this._linkInputAbortController.abort();
|
||||
}
|
||||
|
||||
const keyboard = this.host.std.getOptional(VirtualKeyboardProvider);
|
||||
const computePosition = keyboard
|
||||
? {
|
||||
referenceElement: document.body,
|
||||
placement: 'top' as const,
|
||||
middleware: [
|
||||
offset(({ rects }) => ({
|
||||
mainAxis:
|
||||
-rects.floating.height -
|
||||
(window.innerHeight -
|
||||
rects.floating.height -
|
||||
keyboard.height$.value) /
|
||||
2,
|
||||
})),
|
||||
],
|
||||
autoUpdate: { animationFrame: true },
|
||||
}
|
||||
: {
|
||||
referenceElement: this._blockContainer,
|
||||
placement: 'bottom' as const,
|
||||
middleware: [flip(), offset(LINK_CREATE_POPUP_OFFSET), shift()],
|
||||
autoUpdate: { animationFrame: true },
|
||||
};
|
||||
|
||||
this._linkInputAbortController = new AbortController();
|
||||
|
||||
const { update } = createLitPortal({
|
||||
createLitPortal({
|
||||
template: html`<embed-iframe-link-input-popup
|
||||
.model=${this.model}
|
||||
.abortController=${this._linkInputAbortController}
|
||||
@@ -249,19 +224,15 @@ export class EmbedIframeBlockComponent extends CaptionedBlockComponent<EmbedIfra
|
||||
.options=${options}
|
||||
></embed-iframe-link-input-popup>`,
|
||||
container: document.body,
|
||||
computePosition,
|
||||
computePosition: {
|
||||
referenceElement: this._blockContainer,
|
||||
placement: 'bottom',
|
||||
middleware: [flip(), offset(LINK_CREATE_POPUP_OFFSET), shift()],
|
||||
autoUpdate: { animationFrame: true },
|
||||
},
|
||||
abortController: this._linkInputAbortController,
|
||||
closeOnClickAway: true,
|
||||
});
|
||||
|
||||
if (keyboard) {
|
||||
this._linkInputAbortController.signal.addEventListener(
|
||||
'abort',
|
||||
keyboard.height$.subscribe(() => {
|
||||
update();
|
||||
})
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';
|
||||
import { css, html } from 'lit';
|
||||
|
||||
export const styles = css`
|
||||
@@ -13,9 +12,9 @@ export const styles = css`
|
||||
height: 100%;
|
||||
|
||||
border-radius: 8px;
|
||||
border: 1px solid ${unsafeCSSVarV2('layer/background/tertiary')};
|
||||
border: 1px solid var(--affine-background-tertiary-color);
|
||||
|
||||
background: ${unsafeCSSVarV2('layer/background/primary')};
|
||||
background: var(--affine-background-primary-color);
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ export const styles = css`
|
||||
padding: 12px;
|
||||
|
||||
border-radius: 8px;
|
||||
border: 1px solid ${unsafeCSSVarV2('layer/background/tertiary')};
|
||||
border: 1px solid var(--affine-background-tertiary-color);
|
||||
|
||||
background: ${unsafeCSSVarV2('layer/background/primary')};
|
||||
background: var(--affine-background-primary-color);
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/mdast": "^4.0.4",
|
||||
"lit": "^3.2.0",
|
||||
"minimatch": "^10.0.1",
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"file-type": "^21.0.0",
|
||||
"lit": "^3.2.0",
|
||||
"minimatch": "^10.0.1",
|
||||
|
||||
@@ -18,7 +18,6 @@ import type { BaseSelection } from '@blocksuite/store';
|
||||
import { computed } from '@preact/signals-core';
|
||||
import { css, html, type PropertyValues } from 'lit';
|
||||
import { property, query } from 'lit/decorators.js';
|
||||
import { classMap } from 'lit/directives/class-map.js';
|
||||
import { styleMap } from 'lit/directives/style-map.js';
|
||||
import { when } from 'lit/directives/when.js';
|
||||
|
||||
@@ -77,10 +76,6 @@ export class ImageBlockPageComponent extends SignalWatcher(
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
affine-page-image .comment-highlighted {
|
||||
outline: 2px solid ${unsafeCSSVarV2('block/comment/highlightUnderline')};
|
||||
}
|
||||
`;
|
||||
|
||||
resizeable$ = computed(() => this.block.resizeable$.value);
|
||||
@@ -369,13 +364,7 @@ export class ImageBlockPageComponent extends SignalWatcher(
|
||||
const { loading, error, icon, description, needUpload } = this.state;
|
||||
|
||||
return html`
|
||||
<div
|
||||
class=${classMap({
|
||||
'resizable-img': true,
|
||||
'comment-highlighted': this.block.isCommentHighlighted,
|
||||
})}
|
||||
style=${styleMap(imageSize)}
|
||||
>
|
||||
<div class="resizable-img" style=${styleMap(imageSize)}>
|
||||
<img
|
||||
class="drag-target"
|
||||
draggable="false"
|
||||
|
||||
@@ -5,10 +5,7 @@ import { Peekable } from '@blocksuite/affine-components/peek';
|
||||
import { ResourceController } from '@blocksuite/affine-components/resource';
|
||||
import type { ImageBlockModel } from '@blocksuite/affine-model';
|
||||
import { ImageSelection } from '@blocksuite/affine-shared/selection';
|
||||
import {
|
||||
BlockElementCommentManager,
|
||||
ToolbarRegistryIdentifier,
|
||||
} from '@blocksuite/affine-shared/services';
|
||||
import { ToolbarRegistryIdentifier } from '@blocksuite/affine-shared/services';
|
||||
import { formatSize } from '@blocksuite/affine-shared/utils';
|
||||
import { IS_MOBILE } from '@blocksuite/global/env';
|
||||
import { BrokenImageIcon, ImageIcon } from '@blocksuite/icons/lit';
|
||||
@@ -68,14 +65,6 @@ export class ImageBlockComponent extends CaptionedBlockComponent<ImageBlockModel
|
||||
return this.pageImage?.resizeImg;
|
||||
}
|
||||
|
||||
get isCommentHighlighted() {
|
||||
return (
|
||||
this.std
|
||||
.getOptional(BlockElementCommentManager)
|
||||
?.isBlockCommentHighlighted(this.model) ?? false
|
||||
);
|
||||
}
|
||||
|
||||
private _handleClick(event: MouseEvent) {
|
||||
// the peek view need handle shift + click
|
||||
if (event.defaultPrevented) return;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';
|
||||
import { toGfxBlockComponent } from '@blocksuite/std';
|
||||
import { css } from 'lit';
|
||||
|
||||
@@ -10,7 +9,7 @@ export class ImageEdgelessPlaceholderBlockComponent extends toGfxBlockComponent(
|
||||
static override styles = css`
|
||||
affine-edgeless-placeholder-preview-image
|
||||
.affine-placeholder-preview-container {
|
||||
border: 1px solid ${unsafeCSSVarV2('layer/background/tertiary')};
|
||||
border: 1px solid var(--affine-background-tertiary-color);
|
||||
}
|
||||
`;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/katex": "^0.16.7",
|
||||
"@types/mdast": "^4.0.4",
|
||||
"katex": "^0.16.11",
|
||||
|
||||
@@ -116,7 +116,7 @@ export class LatexBlockComponent extends CaptionedBlockComponent<LatexBlockModel
|
||||
|
||||
this.selection.setGroup('note', []);
|
||||
|
||||
const { portal } = createLitPortal({
|
||||
const portal = createLitPortal({
|
||||
template: html`<latex-editor-menu
|
||||
.std=${this.std}
|
||||
.latexSignal=${this.model.props.latex$}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/mdast": "^4.0.4",
|
||||
"lit": "^3.2.0",
|
||||
"minimatch": "^10.0.1",
|
||||
|
||||
@@ -23,7 +23,6 @@ import { effect } from '@preact/signals-core';
|
||||
import { html, nothing, type TemplateResult } from 'lit';
|
||||
import { query, state } from 'lit/decorators.js';
|
||||
import { classMap } from 'lit/directives/class-map.js';
|
||||
import { repeat } from 'lit/directives/repeat.js';
|
||||
import { styleMap } from 'lit/directives/style-map.js';
|
||||
|
||||
import { correctNumberedListsOrderToPrev } from './commands/utils.js';
|
||||
@@ -139,11 +138,6 @@ export class ListBlockComponent extends CaptionedBlockComponent<ListBlockModel>
|
||||
|
||||
override renderBlock(): TemplateResult<1> {
|
||||
const { model, _onClickIcon } = this;
|
||||
const widgets = html`${repeat(
|
||||
Object.entries(this.widgets),
|
||||
([id]) => id,
|
||||
([_, widget]) => widget
|
||||
)}`;
|
||||
const collapsed = this.store.readonly
|
||||
? this._readonlyCollapsed
|
||||
: model.props.collapsed;
|
||||
@@ -205,7 +199,7 @@ export class ListBlockComponent extends CaptionedBlockComponent<ListBlockModel>
|
||||
></rich-text>
|
||||
</div>
|
||||
|
||||
${children} ${widgets}
|
||||
${children}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
"@blocksuite/store": "workspace:*",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/mdast": "^4.0.4",
|
||||
"@vanilla-extract/css": "^1.17.0",
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/mdast": "^4.0.4",
|
||||
"lit": "^3.2.0",
|
||||
"minimatch": "^10.0.1",
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
EDGELESS_TOP_CONTENTEDITABLE_SELECTOR,
|
||||
} from '@blocksuite/affine-shared/consts';
|
||||
import {
|
||||
BlockElementCommentManager,
|
||||
CitationProvider,
|
||||
DocModeProvider,
|
||||
} from '@blocksuite/affine-shared/services';
|
||||
@@ -27,7 +26,6 @@ import { computed, effect, signal } from '@preact/signals-core';
|
||||
import { html, nothing, type TemplateResult } from 'lit';
|
||||
import { query, state } from 'lit/decorators.js';
|
||||
import { classMap } from 'lit/directives/class-map.js';
|
||||
import { repeat } from 'lit/directives/repeat.js';
|
||||
import { styleMap } from 'lit/directives/style-map.js';
|
||||
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
||||
|
||||
@@ -109,14 +107,6 @@ export class ParagraphBlockComponent extends CaptionedBlockComponent<ParagraphBl
|
||||
);
|
||||
}
|
||||
|
||||
get isCommentHighlighted() {
|
||||
return (
|
||||
this.std
|
||||
.getOptional(BlockElementCommentManager)
|
||||
?.isBlockCommentHighlighted(this.model) ?? false
|
||||
);
|
||||
}
|
||||
|
||||
override get topContenteditableElement() {
|
||||
if (this.std.get(DocModeProvider).getEditorMode() === 'edgeless') {
|
||||
return this.closest<BlockComponent>(
|
||||
@@ -237,12 +227,6 @@ export class ParagraphBlockComponent extends CaptionedBlockComponent<ParagraphBl
|
||||
}
|
||||
|
||||
override renderBlock(): TemplateResult<1> {
|
||||
const widgets = html`${repeat(
|
||||
Object.entries(this.widgets),
|
||||
([id]) => id,
|
||||
([_, widget]) => widget
|
||||
)}`;
|
||||
|
||||
const { type$ } = this.model.props;
|
||||
const collapsed = this.store.readonly
|
||||
? this._readonlyCollapsed
|
||||
@@ -284,10 +268,7 @@ export class ParagraphBlockComponent extends CaptionedBlockComponent<ParagraphBl
|
||||
}
|
||||
</style>
|
||||
<div
|
||||
class=${classMap({
|
||||
'affine-paragraph-block-container': true,
|
||||
'highlight-comment': this.isCommentHighlighted,
|
||||
})}
|
||||
class="affine-paragraph-block-container"
|
||||
data-has-collapsed-siblings="${collapsedSiblings.length > 0}"
|
||||
>
|
||||
<div
|
||||
@@ -359,7 +340,7 @@ export class ParagraphBlockComponent extends CaptionedBlockComponent<ParagraphBl
|
||||
`}
|
||||
</div>
|
||||
|
||||
${children} ${widgets}
|
||||
${children}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';
|
||||
import { css } from 'lit';
|
||||
|
||||
export const paragraphBlockStyles = css`
|
||||
@@ -16,11 +15,6 @@ export const paragraphBlockStyles = css`
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.affine-paragraph-block-container.highlight-comment {
|
||||
background-color: ${unsafeCSSVarV2('block/comment/highlightActive')};
|
||||
outline: 2px solid ${unsafeCSSVarV2('block/comment/highlightUnderline')};
|
||||
}
|
||||
|
||||
affine-paragraph code {
|
||||
font-size: calc(var(--affine-font-base) - 3px);
|
||||
padding: 0px 4px 2px;
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"dompurify": "^3.2.4",
|
||||
"html2canvas": "^1.4.1",
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
promptDocTitle,
|
||||
} from '@blocksuite/affine-block-embed';
|
||||
import { updateBlockType } from '@blocksuite/affine-block-note';
|
||||
import type { HighlightType } from '@blocksuite/affine-components/highlight-dropdown-menu';
|
||||
import { toast } from '@blocksuite/affine-components/toast';
|
||||
import { EditorChevronDown } from '@blocksuite/affine-components/toolbar';
|
||||
import {
|
||||
@@ -20,10 +19,6 @@ import {
|
||||
isFormatSupported,
|
||||
textFormatConfigs,
|
||||
} from '@blocksuite/affine-inline-preset';
|
||||
import {
|
||||
EmbedLinkedDocBlockSchema,
|
||||
EmbedSyncedDocBlockSchema,
|
||||
} from '@blocksuite/affine-model';
|
||||
import { textConversionConfigs } from '@blocksuite/affine-rich-text';
|
||||
import {
|
||||
copySelectedModelsCommand,
|
||||
@@ -42,10 +37,8 @@ import type {
|
||||
ToolbarActionGroup,
|
||||
ToolbarModuleConfig,
|
||||
} from '@blocksuite/affine-shared/services';
|
||||
import {
|
||||
ActionPlacement,
|
||||
blockCommentToolbarButton,
|
||||
} from '@blocksuite/affine-shared/services';
|
||||
import { ActionPlacement } from '@blocksuite/affine-shared/services';
|
||||
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
|
||||
import { tableViewMeta } from '@blocksuite/data-view/view-presets';
|
||||
import {
|
||||
CopyIcon,
|
||||
@@ -54,11 +47,7 @@ import {
|
||||
DuplicateIcon,
|
||||
LinkedPageIcon,
|
||||
} from '@blocksuite/icons/lit';
|
||||
import {
|
||||
type BlockComponent,
|
||||
BlockSelection,
|
||||
BlockViewIdentifier,
|
||||
} from '@blocksuite/std';
|
||||
import { type BlockComponent, BlockSelection } from '@blocksuite/std';
|
||||
import { toDraftModel } from '@blocksuite/store';
|
||||
import { html } from 'lit';
|
||||
import { repeat } from 'lit/directives/repeat.js';
|
||||
@@ -151,7 +140,7 @@ const highlightActionGroup = {
|
||||
id: 'c.highlight',
|
||||
when: ({ chain }) => isFormatSupported(chain).run()[0],
|
||||
content({ chain }) {
|
||||
const updateHighlight = (styles: HighlightType) => {
|
||||
const updateHighlight = (styles: AffineTextAttributes) => {
|
||||
const payload = { styles };
|
||||
chain
|
||||
.try(chain => [
|
||||
@@ -172,7 +161,7 @@ const highlightActionGroup = {
|
||||
} as const satisfies ToolbarAction;
|
||||
|
||||
const turnIntoDatabase = {
|
||||
id: 'e.convert-to-database',
|
||||
id: 'd.convert-to-database',
|
||||
tooltip: 'Create Table',
|
||||
icon: DatabaseTableViewIcon(),
|
||||
when({ chain }) {
|
||||
@@ -219,21 +208,10 @@ const turnIntoDatabase = {
|
||||
} as const satisfies ToolbarAction;
|
||||
|
||||
const turnIntoLinkedDoc = {
|
||||
id: 'f.convert-to-linked-doc',
|
||||
id: 'e.convert-to-linked-doc',
|
||||
tooltip: 'Create Linked Doc',
|
||||
icon: LinkedPageIcon(),
|
||||
when({ chain, std }) {
|
||||
const supportFlavours = [
|
||||
EmbedLinkedDocBlockSchema,
|
||||
EmbedSyncedDocBlockSchema,
|
||||
].map(schema => schema.model.flavour);
|
||||
if (
|
||||
supportFlavours.some(
|
||||
flavour => !std.getOptional(BlockViewIdentifier(flavour))
|
||||
)
|
||||
)
|
||||
return false;
|
||||
|
||||
when({ chain }) {
|
||||
const [ok, { selectedModels }] = chain
|
||||
.pipe(getSelectedModelsCommand, {
|
||||
types: ['block', 'text'],
|
||||
@@ -295,10 +273,6 @@ export const builtinToolbarConfig = {
|
||||
highlightActionGroup,
|
||||
turnIntoDatabase,
|
||||
turnIntoLinkedDoc,
|
||||
{
|
||||
id: 'g.comment',
|
||||
...blockCommentToolbarButton,
|
||||
},
|
||||
{
|
||||
placement: ActionPlacement.More,
|
||||
id: 'a.clipboard',
|
||||
|
||||
@@ -17,7 +17,6 @@ import {
|
||||
} from '@blocksuite/affine-model';
|
||||
import {
|
||||
ActionPlacement,
|
||||
blockCommentToolbarButton,
|
||||
type ElementLockEvent,
|
||||
type ToolbarAction,
|
||||
type ToolbarContext,
|
||||
@@ -306,12 +305,6 @@ export const builtinMiscToolbarConfig = {
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
placement: ActionPlacement.End,
|
||||
id: 'c.comment',
|
||||
...blockCommentToolbarButton,
|
||||
},
|
||||
|
||||
// More actions
|
||||
...moreActions.map(action => ({
|
||||
...action,
|
||||
|
||||
@@ -305,10 +305,7 @@ export class PageRootBlockComponent extends BlockComponent<RootBlockModel> {
|
||||
);
|
||||
|
||||
// make sure there is a block can be focused
|
||||
if (
|
||||
!this.store.readonly$.value &&
|
||||
(notes.length === 0 || notes[notes.length - 1].children.length === 0)
|
||||
) {
|
||||
if (notes.length === 0 || notes[notes.length - 1].children.length === 0) {
|
||||
this.std.command.exec(appendParagraphCommand);
|
||||
return;
|
||||
}
|
||||
@@ -325,7 +322,7 @@ export class PageRootBlockComponent extends BlockComponent<RootBlockModel> {
|
||||
parseFloat(paddingLeft),
|
||||
parseFloat(paddingRight)
|
||||
);
|
||||
if (!isClickOnBlankArea && !this.store.readonly$.value) {
|
||||
if (!isClickOnBlankArea) {
|
||||
const lastBlock = notes[notes.length - 1].lastChild();
|
||||
if (
|
||||
!lastBlock ||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"fractional-indexing": "^3.2.0",
|
||||
"lit": "^3.2.0",
|
||||
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
type SurfaceRefBlockModel,
|
||||
} from '@blocksuite/affine-model';
|
||||
import {
|
||||
BlockElementCommentManager,
|
||||
DocModeProvider,
|
||||
EditPropsStore,
|
||||
type OpenDocMode,
|
||||
@@ -77,10 +76,6 @@ export class SurfaceRefBlockComponent extends BlockComponent<SurfaceRefBlockMode
|
||||
border-color: ${unsafeCSSVarV2('edgeless/frame/border/active')};
|
||||
}
|
||||
|
||||
.affine-surface-ref.comment-highlighted {
|
||||
outline: 2px solid ${unsafeCSSVarV2('block/comment/highlightUnderline')};
|
||||
}
|
||||
|
||||
@media print {
|
||||
.affine-surface-ref {
|
||||
outline: none !important;
|
||||
@@ -142,14 +137,6 @@ export class SurfaceRefBlockComponent extends BlockComponent<SurfaceRefBlockMode
|
||||
return this._referencedModel;
|
||||
}
|
||||
|
||||
get isCommentHighlighted() {
|
||||
return (
|
||||
this.std
|
||||
.getOptional(BlockElementCommentManager)
|
||||
?.isBlockCommentHighlighted(this.model) ?? false
|
||||
);
|
||||
}
|
||||
|
||||
private readonly _handleClick = () => {
|
||||
this.selection.update(() => {
|
||||
return [this.selection.create(BlockSelection, { blockId: this.blockId })];
|
||||
@@ -469,7 +456,6 @@ export class SurfaceRefBlockComponent extends BlockComponent<SurfaceRefBlockMode
|
||||
class=${classMap({
|
||||
'affine-surface-ref': true,
|
||||
focused: this.selected$.value,
|
||||
'comment-highlighted': this.isCommentHighlighted,
|
||||
})}
|
||||
@click=${this._handleClick}
|
||||
>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
"@blocksuite/store": "workspace:*",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"fractional-indexing": "^3.2.0",
|
||||
"html2canvas": "^1.4.1",
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"@lit/context": "^1.1.2",
|
||||
"@lottiefiles/dotlottie-wc": "^0.5.0",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/hast": "^3.0.4",
|
||||
"@types/katex": "^0.16.7",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { AffineTextStyleAttributes } from '@blocksuite/affine-shared/types';
|
||||
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
|
||||
import { PropTypes, requiredProperties } from '@blocksuite/std';
|
||||
import { LitElement } from 'lit';
|
||||
import { property } from 'lit/decorators.js';
|
||||
@@ -20,10 +20,7 @@ const colors = [
|
||||
'grey',
|
||||
] as const;
|
||||
|
||||
export type HighlightType = Pick<
|
||||
AffineTextStyleAttributes,
|
||||
'color' | 'background'
|
||||
>;
|
||||
type HighlightType = 'color' | 'background';
|
||||
|
||||
// TODO(@fundon): these recent settings should be added to the dropdown menu
|
||||
// tests/blocksutie/e2e/format-bar.spec.ts#253
|
||||
@@ -36,13 +33,13 @@ export type HighlightType = Pick<
|
||||
})
|
||||
export class HighlightDropdownMenu extends LitElement {
|
||||
@property({ attribute: false })
|
||||
accessor updateHighlight!: (styles: HighlightType) => void;
|
||||
accessor updateHighlight!: (styles: AffineTextAttributes) => void;
|
||||
|
||||
private readonly _update = (style: HighlightType) => {
|
||||
private readonly _update = (value: string | null, type: HighlightType) => {
|
||||
// latestHighlightColor = value;
|
||||
// latestHighlightType = type;
|
||||
|
||||
this.updateHighlight(style);
|
||||
this.updateHighlight({ [`${type}`]: value });
|
||||
};
|
||||
|
||||
override render() {
|
||||
@@ -74,7 +71,7 @@ export class HighlightDropdownMenu extends LitElement {
|
||||
return html`
|
||||
<editor-menu-action
|
||||
data-testid="foreground-${color}"
|
||||
@click=${() => this._update({ color: value })}
|
||||
@click=${() => this._update(value, 'color')}
|
||||
>
|
||||
<affine-text-duotone-icon
|
||||
style=${styleMap({
|
||||
@@ -95,7 +92,7 @@ export class HighlightDropdownMenu extends LitElement {
|
||||
return html`
|
||||
<editor-menu-action
|
||||
data-testid="background-${color}"
|
||||
@click=${() => this._update({ background: value })}
|
||||
@click=${() => this._update(value, 'background')}
|
||||
>
|
||||
<affine-text-duotone-icon
|
||||
style=${styleMap({
|
||||
|
||||
@@ -179,7 +179,7 @@ export class HoverController implements ReactiveController {
|
||||
this._portal = createLitPortal({
|
||||
...portalOptions,
|
||||
abortController: this._abortController,
|
||||
}).portal;
|
||||
});
|
||||
|
||||
const transition = this._hoverOptions.transition;
|
||||
if (transition) {
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
import { NoteBlockModel } from '@blocksuite/affine-model';
|
||||
import { DocModeProvider } from '@blocksuite/affine-shared/services';
|
||||
import {
|
||||
isInsideEdgelessEditor,
|
||||
matchModels,
|
||||
} from '@blocksuite/affine-shared/utils';
|
||||
import { isInsideEdgelessEditor } from '@blocksuite/affine-shared/utils';
|
||||
import type { Constructor } from '@blocksuite/global/utils';
|
||||
import {
|
||||
GfxBlockElementModel,
|
||||
GfxControllerIdentifier,
|
||||
} from '@blocksuite/std/gfx';
|
||||
import { GfxControllerIdentifier } from '@blocksuite/std/gfx';
|
||||
import type { BlockModel } from '@blocksuite/store';
|
||||
import type { LitElement, TemplateResult } from 'lit';
|
||||
|
||||
@@ -79,20 +72,6 @@ export const Peekable =
|
||||
);
|
||||
|
||||
if (hitTarget && hitTarget !== model) {
|
||||
// Check if hitTarget is a GfxBlockElementModel (which extends BlockModel)
|
||||
// and if it's a NoteBlockModel, then check if current model is inside it
|
||||
if (
|
||||
hitTarget instanceof GfxBlockElementModel &&
|
||||
matchModels(hitTarget, [NoteBlockModel])
|
||||
) {
|
||||
let curModel: BlockModel | null = model;
|
||||
while (curModel) {
|
||||
if (curModel === hitTarget) {
|
||||
return true; // Model is inside the NoteBlockModel, allow peek
|
||||
}
|
||||
curModel = curModel.parent;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ export function createLitPortal({
|
||||
}
|
||||
|
||||
if (!positionConfigOrFn) {
|
||||
return { portal: portalRoot, update: () => {} };
|
||||
return portalRoot;
|
||||
}
|
||||
|
||||
const visibility = portalRoot.style.visibility;
|
||||
@@ -221,5 +221,5 @@ export function createLitPortal({
|
||||
});
|
||||
}
|
||||
|
||||
return { portal: portalRoot, update };
|
||||
return portalRoot;
|
||||
}
|
||||
|
||||
@@ -190,10 +190,7 @@ export class Tooltip extends LitElement {
|
||||
middleware: [
|
||||
this.autoFlip && flip({ padding: AUTO_FLIP_PADDING }),
|
||||
this.autoShift && shift({ padding: AUTO_SHIFT_PADDING }),
|
||||
offset({
|
||||
mainAxis: (this.arrow ? TRIANGLE_HEIGHT : 0) + this.offsetY,
|
||||
crossAxis: this.offsetX,
|
||||
}),
|
||||
offset((this.arrow ? TRIANGLE_HEIGHT : 0) + this.offset),
|
||||
arrow({
|
||||
element: portalRoot.shadowRoot!.querySelector('.arrow')!,
|
||||
}),
|
||||
@@ -267,7 +264,7 @@ export class Tooltip extends LitElement {
|
||||
* Show a triangle arrow pointing to the reference element.
|
||||
*/
|
||||
@property({ attribute: false })
|
||||
accessor arrow = false;
|
||||
accessor arrow = true;
|
||||
|
||||
/**
|
||||
* changes the placement of the floating element in order to keep it in view,
|
||||
@@ -306,10 +303,7 @@ export class Tooltip extends LitElement {
|
||||
* See https://floating-ui.com/docs/offset
|
||||
*/
|
||||
@property({ attribute: false })
|
||||
accessor offsetY = 6;
|
||||
|
||||
@property({ attribute: false })
|
||||
accessor offsetX = 0;
|
||||
accessor offset = 4;
|
||||
|
||||
@property({ attribute: 'tip-position' })
|
||||
accessor placement: Placement = 'top';
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"clsx": "^2.1.1",
|
||||
"date-fns": "^4.0.0",
|
||||
|
||||
@@ -78,7 +78,7 @@ export class DateCell extends BaseCellRenderer<number, number> {
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const { portal } = createLitPortal({
|
||||
const root = createLitPortal({
|
||||
abortController,
|
||||
closeOnClickAway: true,
|
||||
computePosition: {
|
||||
@@ -107,7 +107,7 @@ export class DateCell extends BaseCellRenderer<number, number> {
|
||||
// for now the slide-layout-modal's z-index is `1001`
|
||||
// the z-index of popover should be higher than it
|
||||
// root.style.zIndex = 'var(--affine-z-index-popover)';
|
||||
portal.style.zIndex = '1002';
|
||||
root.style.zIndex = '1002';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"lit": "^3.2.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
@@ -32,7 +32,6 @@
|
||||
},
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./clipboard": "./src/clipboard.ts",
|
||||
"./store": "./src/store.ts",
|
||||
"./view": "./src/view.ts"
|
||||
},
|
||||
|
||||
@@ -43,7 +43,7 @@ const imageClipboardConfigs = [
|
||||
});
|
||||
});
|
||||
|
||||
export const PlainTextClipboardConfig = ClipboardAdapterConfigExtension({
|
||||
const PlainTextClipboardConfig = ClipboardAdapterConfigExtension({
|
||||
mimeType: 'text/plain',
|
||||
adapter: MixTextAdapter,
|
||||
priority: 70,
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
} from '@blocksuite/affine-ext-loader';
|
||||
import {
|
||||
AutoClearSelectionService,
|
||||
BlockElementCommentManager,
|
||||
CitationService,
|
||||
DefaultOpenDocExtension,
|
||||
DNDAPIExtension,
|
||||
@@ -79,7 +78,6 @@ export class FoundationViewExtension extends ViewExtensionProvider<FoundationVie
|
||||
LinkPreviewCache,
|
||||
LinkPreviewService,
|
||||
CitationService,
|
||||
BlockElementCommentManager,
|
||||
]);
|
||||
context.register(clipboardConfigs);
|
||||
if (this.isEdgeless(context.scope)) {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"lit": "^3.2.0",
|
||||
"rxjs": "^7.8.1"
|
||||
},
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"lit": "^3.2.0",
|
||||
"minimatch": "^10.0.1",
|
||||
"rxjs": "^7.8.1",
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"lit": "^3.2.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@vanilla-extract/css": "^1.17.0",
|
||||
"lit": "^3.2.0",
|
||||
"minimatch": "^10.0.1",
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
"@blocksuite/store": "workspace:*",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"lit": "^3.2.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"@blocksuite/store": "workspace:*",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@toeverything/theme": "^1.1.16",
|
||||
"@toeverything/theme": "^1.1.15",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"lit": "^3.2.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user