feat:增加图片插入

This commit is contained in:
黄云飞
2021-11-20 18:04:41 +08:00
parent b4553560af
commit 4160abfac8
24 changed files with 238 additions and 62 deletions
+8
View File
@@ -1,6 +1,14 @@
import { ElementType, IElement } from ".."
import { ZERO } from "../dataset/constant/Common"
export function writeText(text: string) {
if (!text) return
window.navigator.clipboard.writeText(text.replaceAll(ZERO, `\n`))
}
export function writeTextByElementList(elementList: IElement[]) {
const text = elementList
.map(p => !p.type || p.type === ElementType.TEXT ? p.value : '')
.join('')
writeText(text)
}
+7
View File
@@ -41,4 +41,11 @@ export function findParent(node: Element, filterFn: Function, includeSelf: boole
}
}
return null
}
export function getUUID(): string {
function S4(): string {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)
}
return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4())
}