Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update context-menu message #2838

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading