fix: rebase glitch

This commit is contained in:
DarkSky
2022-08-01 02:15:25 +08:00
parent 36d8c0493d
commit d7a5809861
10 changed files with 34 additions and 40 deletions

View File

@@ -23,7 +23,7 @@ ENV FIREBASE_PROJECT=
ENV HOST=0.0.0.0 ENV HOST=0.0.0.0
ENV PORT=3000 ENV PORT=3000
# 编码相关 # coding
ENV TZ 'Asia/Shanghai' ENV TZ 'Asia/Shanghai'
ENV LANG en_US.UTF-8 ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en ENV LANGUAGE en_US:en

View File

@@ -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-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) - [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) - [affine-icons-user-guide.md](docs/affine-icons-user-guide.md)
- [How to develop api server in virgo](./apps/keck/README.md)
## Community ## Community

View File

@@ -11,6 +11,7 @@ import {
type ReturnUnobserve, type ReturnUnobserve,
} from '@toeverything/datasource/db-service'; } from '@toeverything/datasource/db-service';
import { addNewGroup } from './recast-block'; import { addNewGroup } from './recast-block';
import { useIsOnDrag } from './hooks';
interface RenderRootProps { interface RenderRootProps {
editor: BlockEditor; editor: BlockEditor;
@@ -133,6 +134,8 @@ export const RenderRoot: FC<PropsWithChildren<RenderRootProps>> = ({
}; };
const onDragOver = (event: React.DragEvent<Element>) => { const onDragOver = (event: React.DragEvent<Element>) => {
event.dataTransfer.dropEffect = 'move';
event.preventDefault();
editor.dragDropManager.handlerEditorDragOver(event); editor.dragDropManager.handlerEditorDragOver(event);
if (editor.dragDropManager.isEnabled()) { if (editor.dragDropManager.isEnabled()) {
editor.getHooks().onRootNodeDragOver(event); editor.getHooks().onRootNodeDragOver(event);
@@ -140,6 +143,7 @@ export const RenderRoot: FC<PropsWithChildren<RenderRootProps>> = ({
}; };
const onDragOverCapture = (event: React.DragEvent<Element>) => { const onDragOverCapture = (event: React.DragEvent<Element>) => {
event.preventDefault();
if (editor.dragDropManager.isEnabled()) { if (editor.dragDropManager.isEnabled()) {
editor.getHooks().onRootNodeDragOver(event); editor.getHooks().onRootNodeDragOver(event);
} }
@@ -177,6 +181,7 @@ export const RenderRoot: FC<PropsWithChildren<RenderRootProps>> = ({
onDragOverCapture={onDragOverCapture} onDragOverCapture={onDragOverCapture}
onDragEnd={onDragEnd} onDragEnd={onDragEnd}
onDrop={onDrop} onDrop={onDrop}
isOnDrag={isOnDrag}
> >
<Content style={{ maxWidth: pageWidth + 'px' }}> <Content style={{ maxWidth: pageWidth + 'px' }}>
{children} {children}

View File

@@ -13,6 +13,7 @@ export function DragDropWrapper({
block, block,
}: DragDropWrapperProps) { }: DragDropWrapperProps) {
const handlerDragOver: React.DragEventHandler<HTMLDivElement> = event => { const handlerDragOver: React.DragEventHandler<HTMLDivElement> = event => {
event.preventDefault();
if (block.dom) { if (block.dom) {
editor.getHooks().afterOnNodeDragOver(event, { editor.getHooks().afterOnNodeDragOver(event, {
blockId: block.id, blockId: block.id,

View File

@@ -15,7 +15,7 @@ type ScrollController = {
}; };
export class ScrollManager { export class ScrollManager {
private _editor: Block_editor; private _editor: BlockEditor;
private _scrollContainer: HTMLElement; private _scrollContainer: HTMLElement;
private _animationFrame: null | number = null; private _animationFrame: null | number = null;
private _eventName = 'scrolling'; private _eventName = 'scrolling';

View File

@@ -143,7 +143,7 @@ export const useRecastView = () => {
updateView, updateView,
renameView, renameView,
removeView, removeView,
// TODO reorder API // TODO: reorder API
withKanbanView, withKanbanView,
}; };

View File

@@ -192,7 +192,7 @@ export const CommandMenuContainer = ({
useEffect(() => { useEffect(() => {
const sub = hooks const sub = hooks
.get(HookType.ON_ROOT_NODE_KEYDOWN_CAPTURE) .get(HookType.ON_ROOT_NODE_KEYDOWN_CAPTURE)
.subscribe(handle_key_down); .subscribe(handleKeyDown);
return () => { return () => {
sub.unsubscribe(); sub.unsubscribe();

View File

@@ -34,6 +34,7 @@ export const InlineMenuContainer = ({ editor }: InlineMenuContainerProps) => {
!editor.blockHelper.getCurrentSelection(anchorNode.id) || !editor.blockHelper.getCurrentSelection(anchorNode.id) ||
editor.blockHelper.isSelectionCollapsed(anchorNode.id) editor.blockHelper.isSelectionCollapsed(anchorNode.id)
) { ) {
setShowMenu(false);
return; return;
} }
@@ -43,25 +44,14 @@ export const InlineMenuContainer = ({ editor }: InlineMenuContainerProps) => {
setSelectionInfo(info); setSelectionInfo(info);
setShowMenu(true); setShowMenu(true);
setContainerStyle({ setContainerStyle({
left: rect.left - editor.container.getBoundingClientRect().left, left: rect.left - left,
top: anchorNode.dom.offsetTop - 64, top: rect.top - top - 64,
}); });
}); });
return unsubscribe; return unsubscribe;
}, [editor]); }, [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 ? ( return showMenu && containerStyle ? (
<ClickAwayListener onClickAway={() => setShowMenu(false)}>
<Grow <Grow
in={showMenu} in={showMenu}
style={{ transformOrigin: '0 0 0' }} style={{ transformOrigin: '0 0 0' }}
@@ -82,7 +72,6 @@ export const InlineMenuContainer = ({ editor }: InlineMenuContainerProps) => {
/> />
</ToolbarContainer> </ToolbarContainer>
</Grow> </Grow>
</ClickAwayListener>
) : null; ) : null;
}; };

View File

@@ -20,7 +20,7 @@ export const Tooltip = forwardRef<
>((props, ref) => { >((props, ref) => {
const { content, placement = 'top-start' } = props; const { content, placement = 'top-start' } = props;
const style = useTooltipStyle(); const style = useTooltipStyle();
// 如果没有内容,则永远隐藏 // If there is no content, hide forever
const visibleProp = content ? {} : { visible: false }; const visibleProp = content ? {} : { visible: false };
return ( return (
<Popper <Popper

View File

@@ -1,7 +1,7 @@
import type { IOption } from 'ffc-js-client-side-sdk/esm/types'; import type { IOption } from 'ffc-js-client-side-sdk/esm/types';
export const config: IOption = { export const config: IOption = {
secret: process.env['AFFINE_FEATURE_FLAG_TOKEN'], secret: process.env['AFFINE_FEATURE_FLAG_TOKEN'] || '',
anonymous: true, anonymous: true,
// user: { // user: {
// userName: 'the user's user name', // userName: 'the user's user name',