Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Editing text in Safari/macOS gives JavaScript error: undefined is not an object (evaluating 'navigator.clipboard write') #30861

Closed
DD-P opened this issue May 5, 2024 · 6 comments · Fixed by #30862
Labels
type/bug type/upstream This is an issue in one of Gitea's dependencies and should be reported there

Comments

@DD-P
Copy link

DD-P commented May 5, 2024

Description

On typing, the web page displays the above JavaScript clipboard error with eg (http://rad.gitea:12080/assets/js/monaco.14c11225.js @ 415:16905).

This appears to relate to the update of monaco-editor from 0.44.0 to 0.45.0 in ce55a74

I suspect this only occurs when serving over http rather than https as the error does not occur on https://try.gitea.io/

Presumably monaco-editor is now using the async clipboard API. See https://webkit.org/blog/10855/async-clipboard-api/

Gitea Version

1.22.0-rc1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

Screenshot 2024-05-05 at 4 47 14 PM copy

Git Version

2.40.1

Operating System

Ubuntu 23.10

How are you running Gitea?

Dockerised on Proxmox 8.2

Database

MySQL/MariaDB

@DD-P DD-P added the type/bug label May 5, 2024
@wxiaoguang
Copy link
Contributor

wxiaoguang commented May 5, 2024

Could you try 1.22-nightly? The editor has been updated to #30713, I can not reproduce the JS error by my Safari now.

Docker images could be got from https://hub.docker.com/r/gitea/gitea/tags?page=&page_size=&ordering=&name=1.22-nightly, binary 1.22 nightly could be downloaded from https://dl.gitea.com/gitea/1.22/

By the way @techknowlogick , would we like to rename the directory to 1.22-nightly to match the docker image names?

@wxiaoguang
Copy link
Contributor

wxiaoguang commented May 5, 2024

Oops, sorry that #30713 is not backported to 1.22 ..... 😭

Checked again. 30713 is in 1.22-nightly (I misread ....)

@DD-P
Copy link
Author

DD-P commented May 5, 2024

Thank you for quick response. No 1.22-nightly still errors.
Screenshot 2024-05-05 at 6 11 02 PM copy
Screenshot 2024-05-05 at 6 10 53 PM copy

@wxiaoguang
Copy link
Contributor

wxiaoguang commented May 5, 2024

Hmm, it seems to be a longstanding problem in monaco-editor, the code is 3-year old. (TBH, I have no idea why it only happens in 1.22/main .....)

https://github.com/microsoft/vscode/blame/53c1b7b87c7d8aebafdd1e2fbbdbdb04a95612b3/src/vs/platform/clipboard/browser/clipboardService.ts#L55C10-L55C42

Until upstream has a fix (microsoft/monaco-editor#4496), we could ignore such error by: Do not show monaco JS errors #30862

@wxiaoguang wxiaoguang added the type/upstream This is an issue in one of Gitea's dependencies and should be reported there label May 5, 2024
wxiaoguang added a commit that referenced this issue May 5, 2024
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue May 5, 2024
wxiaoguang added a commit that referenced this issue May 5, 2024
Backport #30862 by wxiaoguang

Fix #30861

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
@wxiaoguang
Copy link
Contributor

1.22 nightly including #30866 is ready.

Welcome to take a try and if there is still any problem, please help to report. Thank you very much!

image

image

@DD-P
Copy link
Author

DD-P commented May 6, 2024

Fix in nightly seems perfect. Thank you very much for fixing this so promptly.

@go-gitea go-gitea locked as resolved and limited conversation to collaborators Aug 3, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
type/bug type/upstream This is an issue in one of Gitea's dependencies and should be reported there
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants