Make data-empty Attribute Optional in toggleEmptyMark to Prevent Unintended DOM Manipulation
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 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ệ
- javascript, typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Đọc toggleEmptyMark trong src/components/dom.ts và toggleInputsEmptyMark trong src/components/block/index.ts, đặc biệt là cách enableLineBreaks và data-mutation-free ảnh hưởng đến các phần tử hậu duệ. Xác định hành vi opt-in hoặc loại trừ phù hợp, sau đó xác minh rằng data-empty không được thêm vào khi hành vi này bị vô hiệu hóa mà không làm hỏng việc xử lý đầu vào rỗng thông thường.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The toggleEmptyMark() function (relevant code here: toggleEmptyMark Function) is causing significant issues. As it modifies the editor's DOM, it can trigger reactivity within Editor.js plugins developed using JavaScript frameworks like Svelte.
For example, when using a Svelte component with a contenteditable div bound to innerHTML (e.g., bind:innerHTML={html}), the DOM changes triggered by toggleEmptyMark can have disastrous effects, such as loss of the current selection and cursor position.
To avoid these issues, the automatic addition of the data-empty attribute to inputs should be made optional. This change would prevent unnecessary DOM manipulation and improve compatibility with reactive frameworks.
Editor version: 2.30.5
Clarification:
The root cause actually lies within the toggleInputsEmptyMark function (relevant code here: toggleInputsEmptyMark Function).
The problem becomes evident when enableLineBreaks is set to true to allow line breaks in a plugin via the "Enter" key. In this scenario, the data-empty attribute can incorrectly be added to <div> elements within contenteditable areas, which then triggers reactivity and potentially causes issues like losing the cursor position or disrupting the user experience.
Of course i tried setting the data-mutation-free attribute to true on the parent element, but the data-empty attribute is still added to its childs and so the issue remains.
I guess that ensuring the data-empty attribute is not added to all children of an element possessing the data-mutation-free="true" attribute would fix the issue...
As a sidenote:
Implementing placeholder logic through DOM manipulation in a WYSIWYG editor that allows custom plugins is a highly questionable decision, as it has the potential to break everything users have created. At the very least, this feature should have been made opt-in rather than mandatory.
- Ngôn ngữ chính
- TypeScript
- Star
- 32k
- Fork
- 2.2k
- 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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của codex-team/editor.js
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
codex-team/editor.js#3037 ·
-
Floating Promise Anti-Pattern & Premature Caret in Multi-Block PasteCó thể đã có người làm @anshurajbisoyi98-ctrl đã nhận 19 ngày trước. Đang mởbug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
codex-team/editor.js#3032 · 1 bình luận ·
-
Silent Data Loss & Broken Error Contract in Saver.save()Có thể đã có người làm @Sion612 đã nhận 29 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
codex-team/editor.js#3030 ·
-
Complete Omission of block.destroy() in Blocks CollectionCó thể đã có người làm @Minhal128 đã nhận 28 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
codex-team/editor.js#3029 ·
-
Bug: Link cannot be removedCó thể đã có người làm @prathmeshyelne đã nhận 135 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
codex-team/editor.js#3005 · 1 bình luận ·
Tất cả issue của codex-team/editor.js
Issue tương tự
-
createAI: the ai peer range allows ai@6, which the provider cannot work withCó thể đã có người làm @akhil9tiet đã nhận hôm nay. Đang mởbug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 83/100
cloudflare/agents#2690 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[fullsend] E2E: theme — global-header ignores app.branding.fullLogo (RHDHBUGS-3670)Có thể đã có người làm @fullsend-ai-coder đã nhận hôm nay. Đang mởe2e-failure ready-to-code
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
redhat-developer/rhdh-plugin-export-overlays#4503 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs triage 📥
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
ethereum/ethereum-org-website#19601 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Circular app layout navigation and help icons are shifted upward in the official demoĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
cloudscape-design/components#5184 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
agilepathway/label-checker#805 ·
Maintainer thường phản hồi trong vòng 1 ngày