Skip to content

Commit

Permalink
feat: 编辑器默认状态
Browse files Browse the repository at this point in the history
  • Loading branch information
limaofeng committed Jun 27, 2022
1 parent 9dea13c commit 2427b11
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 6 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"devDependencies": {
"@apollo/client": "^3.6.9",
"@asany/icons": "^0.2.12",
"@asany/tree": "^0.1.23",
"@babel/core": "^7.16.0",
"@commitlint/cli": "^17.0.2",
"@commitlint/config-conventional": "^17.0.2",
Expand Down
32 changes: 31 additions & 1 deletion src/AsanyContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,37 @@ export type IAsanyStoreContext<D> = {
/**
* 创建Content状态
*/
export const AsanyContext = React.createContext<IAsanyStoreContext<any>>([] as any);
export const AsanyContext = React.createContext<IAsanyStoreContext<any>>({
getState() {
return {
save: (project: AsanyProject) => {
console.warn('project', project);
},
isReady: true,
project: {} as any,
mode: 'VIEW',
workspace: {},
features: {
zoom: false,
ruler: false,
drag: false,
selecto: false,
},
plugins: {},
ui: {
screen: {
zoom: 1,
},
} as any,
};
},
subscribe() {
return () => {};
},
dispatch(action: any) {
console.warn('action', action);
},
});

export interface AsanyProviderProps {
children: JSX.Element;
Expand Down
10 changes: 5 additions & 5 deletions src/properties/combine/MultipleWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// import Sortable, { ISortableItem, SortableItemContentProps } from '../../sortable';
import React, { memo, useCallback, useMemo, useRef, useState } from 'react';

import Sortable, { SortableItemProps, dragPreview } from '@asany/sortable';
import Sortable, { SortableItemProps } from '@asany/sortable';
import { Icon } from '@asany/icons';

import { generateUUID } from '../../utils';
Expand Down Expand Up @@ -235,10 +235,10 @@ export function MultipleWrapper<T>(props: MultipleWrapperProps) {
tag="ul"
items={value}
itemRender={itemRender}
preview={{
render: dragPreview(itemRender),
axisLocked: true,
}}
// preview={{
// render: dragPreview(itemRender),
// axisLocked: true,
// }}
onChange={handleSortChange}
/>
) : (
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@
lodash-es "^4.17.21"
react-flip-toolkit "^7.0.14"

"@asany/tree@^0.1.23":
version "0.1.23"
resolved "https://registry.npmjs.org/@asany/tree/-/tree-0.1.23.tgz#0c0f5bddaf1999b714442c55424c6f0d20e58216"
integrity sha512-+IGtJkrnTMbLhl1uyn57MVvZsdlgOk1jVK91EktjzNlDAZx7lg4LtCYZmCjemIPTsvXFIaPdOSWCLUUN2OHsbA==
dependencies:
"@asany/sortable" "^0.1.36"
classnames "^2.3.1"

"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.16.7", "@babel/code-frame@^7.5.5", "@babel/code-frame@^7.8.3":
version "7.16.7"
resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789"
Expand Down

0 comments on commit 2427b11

Please sign in to comment.