Merge pull request #10197 from nwind/fix-word-print

fix: 修复 word 打印失效问题
This commit is contained in:
hsm-lv 2024-05-10 16:13:10 +08:00 committed by GitHub
commit e143806de9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,7 +8,7 @@ import {
} from './Action';
export interface IPrintAction extends ListenerAction {
actionType: 'copy';
actionType: 'print';
args: {
id?: string;
ids?: string[];
@ -28,6 +28,15 @@ export class PrintAction implements RendererAction {
renderer: ListenerContext,
event: RendererEvent<any>
) {
// 兼容之前的 word 打印
if (action.componentId) {
const targetComponent = event.context.scoped?.getComponentById(
action.componentId
);
targetComponent?.doAction?.(action, event.data, true, action.args);
return;
}
if (action.args?.id) {
const element = document.querySelector(`[data-id='${action.args.id}']`);
if (element) {