fix:copyAction复制问题 (#10254)

This commit is contained in:
hsm-lv 2024-05-17 10:49:02 +08:00 committed by GitHub
parent 307fbf95aa
commit 5ea18679d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 6 deletions

View File

@ -1443,10 +1443,10 @@ run action ajax
> `< 1.8.0 及以下版本`,以下属性与 args 同级。
| 属性名 | 类型 | 默认值 | 说明 |
| ---------- | ------------------------------------ | ----------- | ---------------------------------- |
| copyFormat | `string` | `text/html` | 复制格式 |
| content | [模板](../../docs/concepts/template) | - | 指定复制的内容。可用 `${xxx}` 取值 |
| 属性名 | 类型 | 默认值 | 说明 |
| ---------- | ------------------------------------ | ------ | ---------------------------------- |
| copyFormat | `string` | - | 复制格式 |
| content | [模板](../../docs/concepts/template) | - | 指定复制的内容。可用 `${xxx}` 取值 |
### 打印

View File

@ -34,7 +34,7 @@ export class CopyAction implements RendererAction {
if (action.args?.content) {
event.context.env?.copy?.(action.args.content, {
format: action.args?.copyFormat ?? 'text/html'
format: action.args?.copyFormat
});
}
}

View File

@ -70,5 +70,5 @@ test('EventAction:copy', async () => {
expect(copy.mock.calls[1][0]).toEqual(
'the content is <a href="http://www.baidu.com">link</a> <b>bold</b>'
);
expect(copy.mock.calls[1][1]).toEqual({format: 'text/html'});
expect(copy.mock.calls[1][1]).toEqual({format: undefined});
});