tiddly-gittly / tiddlywiki-whiteboard

Tiny little drawing app in TW, using tldraw. Providing diagram widget and whiteboard view.
https://tiddly-gittly.github.io/tiddlywiki-whiteboard/
MIT License
19 stars 1 forks source link

在两个note之间拖动箭头,鼠标按压时间长了报错 #43

Open linonetwo opened 5 months ago

linonetwo commented 5 months ago

可能是 Copy on select 导致的?在从一个note上拉出箭头,在另一个note上停留1s后出现。

Uncaught TypeError: Cannot read properties of undefined (reading 'writeText')
    at handleNativeOrMenuCopy (widget.js:1:928062)
    at HTMLDocument.r (widget.js:1:929222)
    at a (copy-on-select.js:1:1100)
        var handleNativeOrMenuCopy = t=>{
            var r = t.getContentFromCurrentPage(t.getSelectedShapeIds());
            if (r) {
                var i = (0,
                import_lz_string.compressToBase64)(JSON.stringify({
                    type: "application/tldraw",
                    kind: "content",
                    data: r
                }));
                if ("undefined" != typeof navigator) {
                    r = r.shapes.map(e=>t.isShapeOfType(e, "text") || t.isShapeOfType(e, "geo") || t.isShapeOfType(e, "arrow") ? e.props.text : t.isShapeOfType(e, "bookmark") || t.isShapeOfType(e, "embed") ? e.props.url : null).filter(isNonNull);
                    if (null != (n = navigator.clipboard) && n.write) {
                        var n = new Blob(["<tldraw>".concat(i, "</tldraw>")],{
                            type: "text/html"
                        });
                        let e = r.join(" ");
                        "" === e && (e = " "),
                        navigator.clipboard.write([new ClipboardItem({
                            "text/html": n,
                            "text/plain": new Blob([e],{
                                type: "text/plain"
                            })
                        })])
                    } else
                        navigator.clipboard.writeText && navigator.clipboard.writeText("<tldraw>".concat(i, "</tldraw>"))
                }
            } else
                navigator && navigator.clipboard && navigator.clipboard.writeText("")
        }