Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into release/1.3.0-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
JackLian committed Jan 12, 2024
2 parents 684ccb8 + 1132a30 commit 0724922
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
4 changes: 4 additions & 0 deletions packages/designer/src/designer/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class Clipboard implements IClipboard {

private waitFn?: (data: any, e: ClipboardEvent) => void;

constructor() {
this.injectCopyPaster(document);
}

isCopyPasteEvent(e: Event) {
this.isCopyPaster(e.target);
}
Expand Down
2 changes: 0 additions & 2 deletions packages/designer/src/designer/designer-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import BuiltinDragGhostComponent from './drag-ghost';
import { Designer, DesignerProps } from './designer';
import { ProjectView } from '../project';
import './designer.less';
import { clipboard } from './clipboard';

type IProps = DesignerProps & {
designer?: Designer;
Expand Down Expand Up @@ -44,7 +43,6 @@ export class DesignerView extends Component<IProps> {
if (onMount) {
onMount(this.designer);
}
clipboard.injectCopyPaster(document);
this.designer.postEvent('mount', this.designer);
}

Expand Down
22 changes: 5 additions & 17 deletions packages/engine/src/inner-plugins/default-context-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
IPublicTypeNodeSchema,
} from '@alilc/lowcode-types';
import { isProjectSchema } from '@alilc/lowcode-utils';
import { Notification } from '@alifd/next';
import { Message } from '@alifd/next';
import { intl } from '../locale';

function getNodesSchema(nodes: IPublicModelNode[]) {
Expand All @@ -27,19 +27,13 @@ async function getClipboardText(): Promise<IPublicTypeNodeSchema[]> {
if (isProjectSchema(data)) {
resolve(data.componentsTree);
} else {
Notification.open({
content: intl('NotValidNodeData'),
type: 'error',
});
Message.error(intl('NotValidNodeData'));
reject(
new Error(intl('NotValidNodeData')),
);
}
} catch (error) {
Notification.open({
content: intl('NotValidNodeData'),
type: 'error',
});
Message.error(intl('NotValidNodeData'));
reject(error);
}
},
Expand Down Expand Up @@ -143,10 +137,7 @@ export const defaultContextMenu = (ctx: IPublicModelPluginContext) => {
return doc?.checkNesting(parent, dragNodeObject);
});
if (canAddNodes.length === 0) {
Notification.open({
content: `${nodeSchema.map(d => utilsIntl(d.title || d.componentName)).join(',')}等组件无法放置到${utilsIntl(parent.title || parent.componentName as any)}内`,
type: 'error',
});
Message.error(`${nodeSchema.map(d => utilsIntl(d.title || d.componentName)).join(',')}等组件无法放置到${utilsIntl(parent.title || parent.componentName as any)}内`);
return;
}
const nodes: IPublicModelNode[] = [];
Expand Down Expand Up @@ -194,10 +185,7 @@ export const defaultContextMenu = (ctx: IPublicModelPluginContext) => {
return doc?.checkNesting(node, dragNodeObject);
});
if (canAddNodes.length === 0) {
Notification.open({
content: `${nodeSchema.map(d => utilsIntl(d.title || d.componentName)).join(',')}等组件无法放置到${utilsIntl(node.title || node.componentName as any)}内`,
type: 'error',
});
Message.error(`${nodeSchema.map(d => utilsIntl(d.title || d.componentName)).join(',')}等组件无法放置到${utilsIntl(node.title || node.componentName as any)}内`);
return;
}

Expand Down

0 comments on commit 0724922

Please sign in to comment.