Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Migrate off the OCA.Viewer global before Nextcloud 36

Đang mở
#8,358 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
74/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript
Lĩnh vực
frontend

Hướng nghiên cứu

Bắt đầu trong src/components/card/AttachmentList.vue tại dòng 251 và 262, sau đó theo dõi cách dữ liệu tệp đính kèm được biểu diễn trước khi viewer được mở. Sử dụng hướng dẫn migration của @nextcloud/viewer để chuyển các bước kiểm tra khả năng hiển thị và việc mở, đồng thời giữ lại onClose; hoàn tất khi các tệp đính kèm của card có thể được mở và các loại MIME không được hỗ trợ vẫn không khả dụng trên Viewer 7 và Nextcloud 36.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Deck opens card attachments in the viewer:

  • src/components/card/AttachmentList.vue:251: window.OCA.Viewer.availableHandlers.map(h => h.mimes).flat().includes(mimetype)
  • src/components/card/AttachmentList.vue:262: window.OCA.Viewer.open({ path, onClose })

Flattening availableHandlers[].mimes becomes canView(node). onClose is still there, as
part of the options object: getViewer().open(nodes, file, { onClose }).


OCA.Viewer is gone in Viewer 7.0.0. The viewer ships as the
@nextcloud/viewer library rather than a
bundled app, and nextcloud/server#63954 removes the viewer app from Nextcloud 36 altogether.

Roughly what it looks like:

import { canView, getViewer } from '@nextcloud/viewer'

// OCA.Viewer.open({ path }) / ({ fileInfo, list })
getViewer().open(nodes, file)          // @nextcloud/files nodes
getViewer().openFolder(folder, file)   // when a path is all you have, let it fetch

// OCA.Viewer.mimetypes.includes(mime) / availableHandlers
canView(node)

The part that is not a rename is that the viewer takes @nextcloud/files nodes now, not
fileinfo objects or path strings. Importing the package is also all it takes to get the viewer
onto the page: no LoadViewer event to dispatch, and nothing to check about whether the app is
enabled.

[!IMPORTANT]
There is no compatibility shim, which was a deliberate call, so this is a real port rather
than a rename. Nothing breaks until the server PR lands; after that these calls throw on
Nextcloud 36.

[!TIP]
The developer manual covers the migration under
Critical changes
(being added in nextcloud/documentation#15597), and the
README
has the full before/after table. Happy to help with the port, just ping me.

👾 This issue was written with the help of Claude Code.

Ngôn ngữ chính
JavaScript
Star
1.4k
Fork
358
Merge trung bình
1 ngày 22 giờ
Pull request đã merge (30 ngày)
101

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nextcloud/deck

Tất cả issue của nextcloud/deck

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.