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

Add beforeCopy prop to customize copyText before clipboard action

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

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
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
react, typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Start by locating the copy feature and the relevant Copied or main JsonView component mentioned in the issue. Trace how copyText reaches the clipboard action, then check existing component tests or examples. Done means an optional beforeCopy callback can transform the computed text while preserving the current behavior when it is absent.

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

Mô tả

Feature Request: beforeCopy Prop for Custom Clipboard Content

Summary:
When using the copy feature, allow developers to intercept and modify the copied content before it is sent to the clipboard, by introducing a beforeCopy function prop.

Motivation:
Currently, the copied value (copyText) is determined internally and cannot be changed by the consumer. In some cases, developers may want to format, sanitize, or otherwise modify the value before it is copied. Providing a hook/prop for this increases flexibility and control for library users.

Proposed API:
Add a new optional prop beforeCopy to the relevant component (e.g., <Copied /> or main JsonView), which receives the computed copyText and returns the new string to be copied. For example:

copyText = beforeCopy ? beforeCopy(copyText) : copyText

Example Usage:

<JsonView.Copied beforeCopy={(text) => text.replace(/\"/g, '')} />

Benefits:

  • Allows custom transformations on copied content
  • Backwards compatible (default: no change)
  • Simple implementation

Labels:

  • enhancement
Ngôn ngữ chính
TypeScript
Star
420
Fork
24
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 uiwjs/react-json-view

Tất cả issue của uiwjs/react-json-view

Issue tương tự

Thêm issue về TypeScript

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.