|
| 1 | +diff --git a/node_modules/@ant-design/pro-components/es/layout/components/SettingDrawer/index.js b/node_modules/@ant-design/pro-components/es/layout/components/SettingDrawer/index.js |
| 2 | +index 179a389..9d455e2 100644 |
| 3 | +--- a/node_modules/@ant-design/pro-components/es/layout/components/SettingDrawer/index.js |
| 4 | ++++ b/node_modules/@ant-design/pro-components/es/layout/components/SettingDrawer/index.js |
| 5 | +@@ -486,7 +486,33 @@ export const SettingDrawer = props => { |
| 6 | + id: 'app.setting.copyinfo' |
| 7 | + })); |
| 8 | + } catch (error) { |
| 9 | +- // console.log(error); |
| 10 | ++ // Fallback to document.execCommand for older browsers or non-secure contexts |
| 11 | ++ try { |
| 12 | ++ const textArea = document.createElement('textarea'); |
| 13 | ++ textArea.value = genCopySettingJson(settingState); |
| 14 | ++ textArea.style.position = 'fixed'; |
| 15 | ++ textArea.style.top = '0'; |
| 16 | ++ textArea.style.left = '0'; |
| 17 | ++ textArea.style.opacity = '0'; |
| 18 | ++ document.body.appendChild(textArea); |
| 19 | ++ textArea.focus(); |
| 20 | ++ textArea.select(); |
| 21 | ++ const successful = document.execCommand('copy'); |
| 22 | ++ document.body.removeChild(textArea); |
| 23 | ++ if (successful) { |
| 24 | ++ message.success(formatMessage({ |
| 25 | ++ id: 'app.setting.copyinfo' |
| 26 | ++ })); |
| 27 | ++ } else { |
| 28 | ++ message.error(formatMessage({ |
| 29 | ++ id: 'app.setting.copyinfo' |
| 30 | ++ }).replace('拷贝成功', '拷贝失败').replace('copy success', 'copy failed').replace('拷貝成功', '拷貝失敗')); |
| 31 | ++ } |
| 32 | ++ } catch (fallbackError) { |
| 33 | ++ message.error(formatMessage({ |
| 34 | ++ id: 'app.setting.copyinfo' |
| 35 | ++ }).replace('拷贝成功', '拷贝失败').replace('copy success', 'copy failed').replace('拷貝成功', '拷貝失敗')); |
| 36 | ++ } |
| 37 | + } |
| 38 | + }, |
| 39 | + children: formatMessage({ |
| 40 | +diff --git a/node_modules/@ant-design/pro-components/lib/layout/components/SettingDrawer/index.js b/node_modules/@ant-design/pro-components/lib/layout/components/SettingDrawer/index.js |
| 41 | +index 2ceb1d7..ee33af1 100644 |
| 42 | +--- a/node_modules/@ant-design/pro-components/lib/layout/components/SettingDrawer/index.js |
| 43 | ++++ b/node_modules/@ant-design/pro-components/lib/layout/components/SettingDrawer/index.js |
| 44 | +@@ -492,7 +492,33 @@ const SettingDrawer = props => { |
| 45 | + id: 'app.setting.copyinfo' |
| 46 | + })); |
| 47 | + } catch (error) { |
| 48 | +- // console.log(error); |
| 49 | ++ // Fallback to document.execCommand for older browsers or non-secure contexts |
| 50 | ++ try { |
| 51 | ++ const textArea = document.createElement('textarea'); |
| 52 | ++ textArea.value = genCopySettingJson(settingState); |
| 53 | ++ textArea.style.position = 'fixed'; |
| 54 | ++ textArea.style.top = '0'; |
| 55 | ++ textArea.style.left = '0'; |
| 56 | ++ textArea.style.opacity = '0'; |
| 57 | ++ document.body.appendChild(textArea); |
| 58 | ++ textArea.focus(); |
| 59 | ++ textArea.select(); |
| 60 | ++ const successful = document.execCommand('copy'); |
| 61 | ++ document.body.removeChild(textArea); |
| 62 | ++ if (successful) { |
| 63 | ++ _antd.message.success(formatMessage({ |
| 64 | ++ id: 'app.setting.copyinfo' |
| 65 | ++ })); |
| 66 | ++ } else { |
| 67 | ++ _antd.message.error(formatMessage({ |
| 68 | ++ id: 'app.setting.copyinfo' |
| 69 | ++ }).replace('拷贝成功', '拷贝失败').replace('copy success', 'copy failed').replace('拷貝成功', '拷貝失敗')); |
| 70 | ++ } |
| 71 | ++ } catch (fallbackError) { |
| 72 | ++ _antd.message.error(formatMessage({ |
| 73 | ++ id: 'app.setting.copyinfo' |
| 74 | ++ }).replace('拷贝成功', '拷贝失败').replace('copy success', 'copy failed').replace('拷貝成功', '拷貝失敗')); |
| 75 | ++ } |
| 76 | + } |
| 77 | + }, |
| 78 | + children: formatMessage({ |
0 commit comments