CN-983 feat: 基本信息图的基本样式

This commit is contained in:
chenjinsong
2023-05-06 19:39:28 +08:00
parent 76e8fe9734
commit a3c2fcb1d8
8 changed files with 438 additions and 7 deletions

View File

@@ -1253,3 +1253,21 @@ export function getWidthByLanguage (language) {
}
}
}
export function selectElementText (el) {
const range = document.createRange() // create new range object
range.selectNodeContents(el) // set range to encompass desired element text
const selection = window.getSelection() // get Selection object from currently user selected text
selection.removeAllRanges() // unselect any user selected text (if any)
selection.addRange(range) // add range to Selection object to select it
}
export function copySelectionText () {
let copySuccess // var to check whether execCommand successfully executed
try {
copySuccess = document.execCommand('copy') // run command to copy selected text to clipboard
} catch (e) {
copySuccess = false
}
return copySuccess
}