Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: rebase glitch

DarkSkyd7a580986163
diff --git a/Dockerfile-keck b/Dockerfile-keck
index d464e16da0..598fded0ab 100644
--- a/Dockerfile-keck
+++ b/Dockerfile-keck
@@ -23,7 +23,7 @@ ENV FIREBASE_PROJECT=
ENV HOST=0.0.0.0
ENV PORT=3000
-# 编码相关
+# coding
ENV TZ 'Asia/Shanghai'
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
diff --git a/README.md b/README.md
index 7d894c9fb2..147ed616eb 100644
--- a/README.md
+++ b/README.md
@@ -67,7 +67,6 @@ Have a look at [the examples to see AFFiNE in action](https://app.affine.pro/).
- [how-to-customize-rollup-config.md](docs/how-to-customize-rollup-config.md)
- [how-to-auto-download-figma-assets-in-affine.md](docs/how-to-auto-download-figma-assets-in-affine.md)
- [affine-icons-user-guide.md](docs/affine-icons-user-guide.md)
-- [How to develop api server in virgo](./apps/keck/README.md)
## Community
diff --git a/libs/components/editor-core/src/RenderRoot.tsx b/libs/components/editor-core/src/RenderRoot.tsx
index 6d836ae1e8..06e0f22804 100644
--- a/libs/components/editor-core/src/RenderRoot.tsx
+++ b/libs/components/editor-core/src/RenderRoot.tsx
@@ -11,6 +11,7 @@ import {
type ReturnUnobserve,
} from '@toeverything/datasource/db-service';
import { addNewGroup } from './recast-block';
+import { useIsOnDrag } from './hooks';
interface RenderRootProps {
editor: BlockEditor;
@@ -133,6 +134,8 @@ export const RenderRoot: FC<PropsWithChildren<RenderRootProps>> = ({
};
const onDragOver = (event: React.DragEvent<Element>) => {
+ event.dataTransfer.dropEffect = 'move';
+ event.preventDefault();
editor.dragDropManager.handlerEditorDragOver(event);
if (editor.dragDropManager.isEnabled()) {
editor.getHooks().onRootNodeDragOver(event);
@@ -140,6 +143,7 @@ export const RenderRoot: FC<PropsWithChildren<RenderRootProps>> = ({
};
const onDragOverCapture = (event: React.DragEvent<Element>) => {
+ event.preventDefault();
if (editor.dragDropManager.isEnabled()) {
editor.getHooks().onRootNodeDragOver(event);
}
@@ -177,6 +181,7 @@ export const RenderRoot: FC<PropsWithChildren<RenderRootProps>> = ({
onDragOverCapture={onDragOverCapture}
onDragEnd={onDragEnd}
onDrop={onDrop}
+ isOnDrag={isOnDrag}
>
<Content style={{ maxWidth: pageWidth + 'px' }}>
{children}
diff --git a/libs/components/editor-core/src/drag-drop-wrapper/DragDropWrapper.tsx b/libs/components/editor-core/src/drag-drop-wrapper/DragDropWrapper.tsx
index 859fea03de..030c2b5c20 100644
--- a/libs/components/editor-core/src/drag-drop-wrapper/DragDropWrapper.tsx
+++ b/libs/components/editor-core/src/drag-drop-wrapper/DragDropWrapper.tsx
@@ -13,6 +13,7 @@ export function DragDropWrapper({
block,
}: DragDropWrapperProps) {
const handlerDragOver: React.DragEventHandler<HTMLDivElement> = event => {
+ event.preventDefault();
if (block.dom) {
editor.getHooks().afterOnNodeDragOver(event, {
blockId: block.id,
diff --git a/libs/components/editor-core/src/editor/scroll/scroll.ts b/libs/components/editor-core/src/editor/scroll/scroll.ts
index 81d50eb422..efe65e50c0 100644
--- a/libs/components/editor-core/src/editor/scroll/scroll.ts
+++ b/libs/components/editor-core/src/editor/scroll/scroll.ts
@@ -15,7 +15,7 @@ type ScrollController = {
};
export class ScrollManager {
- private _editor: Block_editor;
+ private _editor: BlockEditor;
private _scrollContainer: HTMLElement;
private _animationFrame: null | number = null;
private _eventName = 'scrolling';
diff --git a/libs/components/editor-core/src/recast-block/view.ts b/libs/components/editor-core/src/recast-block/view.ts
index c14ef93267..c41d09809e 100644
--- a/libs/components/editor-core/src/recast-block/view.ts
+++ b/libs/components/editor-core/src/recast-block/view.ts
@@ -143,7 +143,7 @@ export const useRecastView = () => {
updateView,
renameView,
removeView,
- // TODO reorder API
+ // TODO: reorder API
withKanbanView,
};
diff --git a/libs/components/editor-plugins/src/menu/command-menu/Container.tsx b/libs/components/editor-plugins/src/menu/command-menu/Container.tsx
index cb56362892..70522d9b9c 100644
--- a/libs/components/editor-plugins/src/menu/command-menu/Container.tsx
+++ b/libs/components/editor-plugins/src/menu/command-menu/Container.tsx
@@ -192,7 +192,7 @@ export const CommandMenuContainer = ({
useEffect(() => {
const sub = hooks
.get(HookType.ON_ROOT_NODE_KEYDOWN_CAPTURE)
- .subscribe(handle_key_down);
+ .subscribe(handleKeyDown);
return () => {
sub.unsubscribe();
diff --git a/libs/components/editor-plugins/src/menu/inline-menu/Container.tsx b/libs/components/editor-plugins/src/menu/inline-menu/Container.tsx
index 99dfa797f3..3959d1c60b 100644
--- a/libs/components/editor-plugins/src/menu/inline-menu/Container.tsx
+++ b/libs/components/editor-plugins/src/menu/inline-menu/Container.tsx
@@ -34,6 +34,7 @@ export const InlineMenuContainer = ({ editor }: InlineMenuContainerProps) => {
!editor.blockHelper.getCurrentSelection(anchorNode.id) ||
editor.blockHelper.isSelectionCollapsed(anchorNode.id)
) {
+ setShowMenu(false);
return;
}
@@ -43,46 +44,34 @@ export const InlineMenuContainer = ({ editor }: InlineMenuContainerProps) => {
setSelectionInfo(info);
setShowMenu(true);
setContainerStyle({
- left: rect.left - editor.container.getBoundingClientRect().left,
- top: anchorNode.dom.offsetTop - 64,
+ left: rect.left - left,
+ top: rect.top - top - 64,
});
});
return unsubscribe;
}, [editor]);
- useEffect(() => {
- const hideInlineMenu = () => {
- setShowMenu(false);
- };
- editor.plugins.observe('hide-inline-menu', hideInlineMenu);
-
- return () =>
- editor.plugins.unobserve('hide-inline-menu', hideInlineMenu);
- }, [editor.plugins]);
-
return showMenu && containerStyle ? (
- <ClickAwayListener onClickAway={() => setShowMenu(false)}>
- <Grow
- in={showMenu}
- style={{ transformOrigin: '0 0 0' }}
- {...{ timeout: 'auto' }}
+ <Grow
+ in={showMenu}
+ style={{ transformOrigin: '0 0 0' }}
+ {...{ timeout: 'auto' }}
+ >
+ <ToolbarContainer
+ style={containerStyle}
+ onMouseDown={e => {
+ // prevent toolbar from taking focus away from editor
+ e.preventDefault();
+ e.stopPropagation();
+ }}
>
- <ToolbarContainer
- style={containerStyle}
- onMouseDown={e => {
- // prevent toolbar from taking focus away from editor
- e.preventDefault();
- e.stopPropagation();
- }}
- >
- <InlineMenuToolbar
- editor={editor}
- selectionInfo={selectionInfo}
- setShow={setShowMenu}
- />
- </ToolbarContainer>
- </Grow>
- </ClickAwayListener>
+ <InlineMenuToolbar
+ editor={editor}
+ selectionInfo={selectionInfo}
+ setShow={setShowMenu}
+ />
+ </ToolbarContainer>
+ </Grow>
) : null;
};
diff --git a/libs/components/ui/src/tooltip/Tooltip.tsx b/libs/components/ui/src/tooltip/Tooltip.tsx
index 0ae501dfba..2c896e5c0d 100644
--- a/libs/components/ui/src/tooltip/Tooltip.tsx
+++ b/libs/components/ui/src/tooltip/Tooltip.tsx
@@ -20,7 +20,7 @@ export const Tooltip = forwardRef<
>((props, ref) => {
const { content, placement = 'top-start' } = props;
const style = useTooltipStyle();
- // 如果没有内容,则永远隐藏
+ // If there is no content, hide forever
const visibleProp = content ? {} : { visible: false };
return (
<Popper
diff --git a/libs/datasource/feature-flags/src/config.ts b/libs/datasource/feature-flags/src/config.ts
index 864c79765c..7f3360d6db 100644
--- a/libs/datasource/feature-flags/src/config.ts
+++ b/libs/datasource/feature-flags/src/config.ts
@@ -1,7 +1,7 @@
import type { IOption } from 'ffc-js-client-side-sdk/esm/types';
export const config: IOption = {
- secret: process.env['AFFINE_FEATURE_FLAG_TOKEN'],
+ secret: process.env['AFFINE_FEATURE_FLAG_TOKEN'] || '',
anonymous: true,
// user: {
// userName: 'the user's user name',