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

Attachment menu disabled ("shared from another cloud") in fileless embeds — breaks Deck card descriptions

Đang mở
#9,150 0 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
76/100
Loại issue
Lỗi
Độ 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/createEditor.ts và lần theo đường dẫn fileless createMarkdownContentEditor, sau đó kiểm tra các bước kiểm tra tệp đính kèm trong src/components/Menu/ActionAttachmentUpload.vue và src/components/SuggestionsBar.vue. Tái hiện Deck description embed được mô tả trong issue và xác minh rằng menu tệp đính kèm vẫn được bật, hook onFileInsert do host cung cấp có thể truy cập được và các mục chỉ dành cho việc tải lên vẫn bị ẩn.

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

Mô tả

Describe the bug

Any host app that embeds Text without a fileId (i.e. createEditor/createMarkdownContentEditor, the fileless "markdown content" path) gets its attachment menu permanently disabled, with the misleading tooltip:

Attachments cannot be created or uploaded because this file is shared from another cloud.

There is no federated share and no other cloud involved — there is no file at all.

The most visible victim is Deck card descriptions, reported as nextcloud/deck#7748 (still open, no root cause posted). I traced it and the defect is here in Text, not in Deck.

Root cause

The gate introduced in #7154 (hasOwner, merged 2025-05-06, fixing #7092) assumes a document session always exists. In the fileless embed path it never does.

  1. Deck embeds Text with content only, no fileId:
    https://github.com/nextcloud/deck/blob/main/src/components/card/Description.vue

    this.editor = await window.OCA.Text.createEditor({
      el: this.$refs.editor,
      content: this.card.description,
      readOnly: !this.canEdit,
      onFileInsert: () => { this.showAttachmentModal() },   // <-- host-provided hook
    })
    
  2. In src/createEditor.ts, optionsForCollaboration() is Boolean(options.fileId) && (options.useSession ?? true) → false, so createMarkdownContentEditor() renders MarkdownContentEditorApp.vue.

  3. provideConnection() is called only from src/components/CollaborativeEditor.vue. The markdown-content path never calls it, so the injected openData stays undefined.

  4. src/components/Menu/ActionAttachmentUpload.vue:

    isUploadDisabled() {
      return !this.openData?.hasOwner || !this.networkOnline
    }
    

    undefined?.hasOwner → undefined → falsy → disabled, and menuTitle falls through to the federated-share string.

src/components/SuggestionsBar.vue:107 has the identical check and the identical wrong message.

The irony: provideHooks() in createEditor.ts does provide ACTION_ATTACHMENT_PROMPT from options.onFileInsert, so the host app has already supplied a working "insert file" implementation — Text disables the button before that hook can ever fire. Meanwhile EDITOR_UPLOAD is only provided on the collaborative path, so "Upload from computer" is already correctly hidden in this mode. The only entry that should be reachable is "Insert from Files", which delegates to the host and does not need a file owner.

Steps to reproduce
  1. Install and enable Deck and Text.
  2. Open any Deck card, edit the description with the rich text editor.
  3. Hover the paperclip in the toolbar.
  4. It is greyed out with the "shared from another cloud" tooltip. Uploading via the card's Attachments tab works fine (that path does not go through Text).
Expected behaviour

In the fileless / createMarkdownContentEditor embed, the attachment menu should stay enabled and "Insert from Files" should call the host-provided onFileInsert hook. The hasOwner restriction from #7154 is meaningful only when a document session exists.

Suggested fix

Only apply the owner gate when a connection was actually provided, rather than treating "no session" as "no owner". Something like:

isUploadDisabled() {
  if (!this.networkOnline) { return true }
  // No connection at all => fileless embed; the host app owns attachment handling.
  if (this.openData === undefined && !this.$editorUpload) { return false }
  return !this.openData?.hasOwner
}

and the same in SuggestionsBar.vue. Separately, the tooltip should not claim "shared from another cloud" for every falsy hasOwner — worth distinguishing "no owner" from "federated".

Versions

Reproduced on:

Nextcloud 34.0.1
Text 8.0.0
Deck 1.18.2
PHP 8.3
DB PostgreSQL 17
Browser Chrome

Also reported against NC 32.0.4 / Deck 1.16.3 and NC 33.0.3 in nextcloud/deck#7748, i.e. present since the #7154 merge.

Ngôn ngữ chính
JavaScript
Star
665
Fork
133
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
172

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

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/text

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

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.