Add Selection/Range methods based on anchestor element
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 20/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- html
- Lĩnh vực
- web-dev
Hướng nghiên cứu
Start by reading the suggested Selection and Window IDL interfaces and the requirements for contextElement, character offsets, and innerText-style line breaks. Determine the intended API behavior, error cases, and AddRange integration before implementation; done requires an agreed specification and corresponding tests.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Add function prototypes for getting/setting anchorNode/anchorOffset and focusNode/focusOffset as character offsets based on a given anchestor node.
The suggested functionality is necessary to track and regain a selection in an editing host when DOM manipulation takes place.
Suggested IDL Interfaces
partial interface Selection {
[Throws]
Range? getRangeAt(unsigned long index, Element contextElement);
};
partial interface Window {
[Throws] Selection? getSelection(Element contextElement);
};
Details
1.
const selObj = window.getSelection(contextElement: HTMLElement);
Should yield:
selObj.anchorNode === selObj.focusNode === contextElement;
selObj.anchorOffset = AnchorCharacterOffsetFromContextElement(contextElement);
selObj.focusOffset = FocusCharacterOffsetFromContextElement(contextElement);
2.
const rngObj = window.getSelection().getRangeAt(index: number, contextElement: HTMLElement);
Should yield:
rngObj.commonAncestorContainer === rngObj.startContainer === rngObj.endContainer === contextElement;
rngObj.startOffset = AnchorCharacterOffsetFromContextElement(contextElement);
rngObj.endOffset = FocusCharacterOffsetFromContextElement(contextElement);
Both suggested functions are supposed to either throw an ReferenceError or yield void 0 when contextElement is not an anchestor of both, selObj.anchorNode/selObj.focusNode and rngObj.startOffset/rngObj.endOffset, resp.
selObj.AddRange() should take above Range object, recognize that it is based on a context element and put the cursor selection according to the character offsets given in a Range object; based on contextElement.
Character count should mimic the behaviour of the Element.innerText property, i.e. considering <br/> elements, <p> elements and block elements following inline elements as new-line characters (= \n).
- Ngôn ngữ chính
- HTML
- Star
- 49
- Fork
- 30
- 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
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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 w3c/selection-api
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
w3c/selection-api#354 ·
-
Agenda+
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
w3c/selection-api#361 · 2 bình luận ·
-
Remove single range restriction for selection interface apisCó thể làm lại được @sambandaru đã nhận 138 ngày trước và không có pull request nào đang mở. Đang mở
w3c/selection-api#358 · 2 bình luận · 1 người được giao ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
w3c/selection-api#355 ·
-
the steps of Selection.extend() does not check whether the given offset is valid in the containerĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 55/100
w3c/selection-api#353 · 1 bình luận ·
Tất cả issue của w3c/selection-api
Issue tương tự
-
feature task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
RealDevSquad/website-www#1178 ·
-
priority: P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
PedestrianDynamics/pyFDS-Evac#338 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
accessibility bug revealjs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
quarto-dev/quarto-cli#14961 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Simple] NavigationBar primary commands do not render AppBarButton.Content when it is a UIElementĐang mởcontrol/navigationbar kind/bug triage/untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
unoplatform/uno.toolkit.ui#1652 ·
Maintainer thường phản hồi trong vòng 1 ngày