mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-31 17:19:56 +08:00
refactor(core): doc property (#8465)
doc property upgraded to use orm. The visibility of the property are simplified to three types: `always show`, `always hide`, `hide when empty`, and the default is `always show`.  Added a sidebar view to manage properties  new property ui in workspace settings  Property lists can be collapsed 
This commit is contained in:
@@ -182,6 +182,11 @@ export const useDraggable = <D extends DNDData = DNDData>(
|
||||
let previewPosition: DraggableDragPreviewPosition =
|
||||
options.dragPreviewPosition ?? 'native';
|
||||
|
||||
source.element.dataset['dragPreview'] = 'true';
|
||||
requestAnimationFrame(() => {
|
||||
delete source.element.dataset['dragPreview'];
|
||||
});
|
||||
|
||||
if (enableCustomDragPreview.current) {
|
||||
setCustomNativeDragPreview({
|
||||
getOffset: (...args) => {
|
||||
|
||||
@@ -49,6 +49,12 @@ export const treeLine = style({
|
||||
height: 2,
|
||||
right: 0,
|
||||
},
|
||||
|
||||
selectors: {
|
||||
['&[data-no-terminal="true"]::before']: {
|
||||
display: 'none',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const lineAboveStyles = style({
|
||||
@@ -143,7 +149,7 @@ export const left = style({
|
||||
|
||||
export const edgeLine = style({
|
||||
vars: {
|
||||
[terminalSize]: '8px',
|
||||
[terminalSize]: '6px',
|
||||
},
|
||||
display: 'block',
|
||||
position: 'absolute',
|
||||
@@ -156,11 +162,17 @@ export const edgeLine = style({
|
||||
// Terminal
|
||||
'::before': {
|
||||
content: '""',
|
||||
width: terminalSize,
|
||||
height: terminalSize,
|
||||
width: 0,
|
||||
height: 0,
|
||||
boxSizing: 'border-box',
|
||||
position: 'absolute',
|
||||
border: `${terminalSize} solid ${cssVar('--affine-primary-color')}`,
|
||||
borderRadius: '50%',
|
||||
},
|
||||
|
||||
selectors: {
|
||||
['&[data-no-terminal="true"]::before']: {
|
||||
display: 'none',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -10,14 +10,17 @@ import * as styles from './drop-indicator.css';
|
||||
export type DropIndicatorProps = {
|
||||
instruction?: Instruction | null;
|
||||
edge?: Edge | null;
|
||||
noTerminal?: boolean;
|
||||
};
|
||||
|
||||
function getTreeElement({
|
||||
instruction,
|
||||
isBlocked,
|
||||
noTerminal,
|
||||
}: {
|
||||
instruction: Exclude<Instruction, { type: 'instruction-blocked' }>;
|
||||
isBlocked: boolean;
|
||||
noTerminal?: boolean;
|
||||
}): ReactElement | null {
|
||||
const style = {
|
||||
[styles.horizontalIndent]: `${instruction.currentLevel * instruction.indentPerLevel}px`,
|
||||
@@ -31,6 +34,7 @@ function getTreeElement({
|
||||
<div
|
||||
className={clsx(styles.treeLine, styles.lineAboveStyles)}
|
||||
style={assignInlineVars(style)}
|
||||
data-no-terminal={noTerminal}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -39,6 +43,7 @@ function getTreeElement({
|
||||
<div
|
||||
className={clsx(styles.treeLine, styles.lineBelowStyles)}
|
||||
style={assignInlineVars(style)}
|
||||
data-no-terminal={noTerminal}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -48,6 +53,7 @@ function getTreeElement({
|
||||
<div
|
||||
className={clsx(styles.outlineStyles)}
|
||||
style={assignInlineVars(style)}
|
||||
data-no-terminal={noTerminal}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -61,6 +67,7 @@ function getTreeElement({
|
||||
<div
|
||||
className={clsx(styles.treeLine, styles.lineBelowStyles)}
|
||||
style={assignInlineVars(style)}
|
||||
data-no-terminal={noTerminal}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -88,13 +95,14 @@ const edgeStyles: Record<Edge, string> = {
|
||||
right: styles.right,
|
||||
};
|
||||
|
||||
function getEdgeElement(edge: Edge, gap: number = 0) {
|
||||
function getEdgeElement(edge: Edge, gap: number = 0, noTerminal?: boolean) {
|
||||
const lineOffset = `calc(-0.5 * (${gap}px + 2px))`;
|
||||
|
||||
const orientation = edgeToOrientationMap[edge];
|
||||
|
||||
return (
|
||||
<div
|
||||
data-no-terminal={noTerminal}
|
||||
className={clsx([
|
||||
styles.edgeLine,
|
||||
orientationStyles[orientation],
|
||||
@@ -105,9 +113,13 @@ function getEdgeElement(edge: Edge, gap: number = 0) {
|
||||
);
|
||||
}
|
||||
|
||||
export function DropIndicator({ instruction, edge }: DropIndicatorProps) {
|
||||
export function DropIndicator({
|
||||
instruction,
|
||||
edge,
|
||||
noTerminal,
|
||||
}: DropIndicatorProps) {
|
||||
if (edge) {
|
||||
return getEdgeElement(edge, 0);
|
||||
return getEdgeElement(edge, 0, noTerminal);
|
||||
}
|
||||
if (instruction) {
|
||||
if (instruction.type === 'instruction-blocked') {
|
||||
|
||||
Reference in New Issue
Block a user