Skip to content

Commit db2d318

Browse files
authored
Update FindOnPage.md
Added info to startfind, added /// for documentation of matchcountchanged events, addressed case sensitivity question
1 parent 24c70af commit db2d318

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

FindOnPage.md

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -543,11 +543,14 @@ namespace Microsoft.Web.WebView2.Core
543543
[availability("staging")]
544544
interface ICoreWebView2FindConfiguration
545545
{
546-
// Gets or sets the find term used for the find operation. Returns the find term.
546+
/// Gets or sets the find term used for the find operation. Returns the find term.
547547
String FindTerm { get; set; };
548-
// Gets or sets the direction of the find operation (forward or backward). Returns the find direction.
548+
/// Gets or sets the direction of the find operation (forward or backward). Returns the find direction.
549549
CoreWebView2FindDirection FindDirection { get; set; };
550-
// Determines if the find operation is case sensitive. Returns TRUE if the find is case sensitive, FALSE otherwise.
550+
/// Determines if the find operation is case sensitive. Returns TRUE if the find is case sensitive, FALSE otherwise.
551+
/// In text operations such as case sensitivity and word breaking, the behavior can vary by locale, which may be influenced by both the browser's UI locale and the document's language settings. The browser's UI locale
552+
/// typically provides a default handling approach, while the document's language settings (e.g., specified using the HTML lang attribute) can override these defaults to apply locale-specific rules. This dual consideration
553+
/// ensures that text is processed in a manner consistent with user expectations and the linguistic context of the content
551554
Boolean IsCaseSensitive { get; set; };
552555
// Determines if only whole words should be matched during the find operation. Returns TRUE if only whole words should be matched, FALSE otherwise.
553556
Boolean ShouldMatchWord { get; set; };
@@ -567,10 +570,19 @@ namespace Microsoft.Web.WebView2.Core
567570
/// Displays the Find bar and starts the find operation. If a find session was already ongoing, it will be stopped and replaced with this new instance.
568571
/// If called with an empty string, the Find bar is displayed but no finding occurs. Changing the configuration object after initiation won't affect the ongoing find session.
569572
/// To change the ongoing find session, StartFindAsync must be called again with a new or modified configuration object.
570-
/// This method is primarily designed for HTML document queries.
573+
/// StartFind supports, HTML, PDF, and TXT document queries. In general this api is designed for text based find sessions.
574+
//// If you start a find session programmatically on another file format that doesnt have text fields, the find session will try to execute but will fail to find any matches. (It will silently fail)
571575
/// Note: The asynchronous action completes when the UI has been displayed with the find term in the UI bar, and the matches have populated on the counter on the find bar.
572576
/// There may be a slight latency between the UI display and the matches populating in the counter.
573577
/// The MatchCountChanged and ActiveMatchIndexChanged events are only raised after StartFindAsync has completed, otherwise they will have their default values (-1 for both).
578+
/// When initiating a find session while another session is in progress, the behavior of
579+
/// the active match index depends on the direction set for the find operation (forward or backward).
580+
/// However, calling StartFind again during an ongoing find operation does not resume from the point
581+
/// of the current active match. For example, given the text "1 1 A 1 1" and initiating a find session for "A",
582+
/// then starting another find session for "1", it will start searching from the beginning of the document,
583+
/// regardless of the previous active match. This behavior indicates that changing the find query initiates a
584+
/// completely new find session, rather than continuing from the previous match index. This distinction is essential
585+
/// to understand when utilizing the StartFind method for navigating through text matches.
574586
Windows.Foundation.IAsyncAction StartFindAsync(CoreWebView2FindConfiguration configuration);
575587

576588

@@ -614,15 +626,15 @@ namespace Microsoft.Web.WebView2.Core
614626
Int32 MatchCount { get; };
615627

616628
/// Registers an event handler for the MatchCountChanged event.
617-
This event is raised when the total count of matches in the document changes due to a new find operation or changes in the document.
618-
The parameter is the event handler to be added. Returns a token representing the added event handler. This token can be used to unregister the event handler.
629+
/// This event is raised when the total count of matches in the document changes due to a new find operation or changes in the document.
630+
/// The parameter is the event handler to be added. Returns a token representing the added event handler. This token can be used to unregister the event handler.
619631
[event_handler("", "", "")]
620632
event Windows.Foundation.TypedEventHandler<CoreWebView2Find, Object> MatchCountChanged;
621633

622634
/// Registers an event handler for the ActiveMatchIndexChanged event. This event is raised when the index of the currently active match changes.
623-
This can happen when the user navigates to a different match or when the active match is changed programmatically.
624-
The parameter is the event handler to be added. Returns a token representing the added event handler.
625-
This token can be used to unregister the event handler.
635+
/// This can happen when the user navigates to a different match or when the active match is changed programmatically.
636+
/// The parameter is the event handler to be added. Returns a token representing the added event handler.
637+
/// This token can be used to unregister the event handler.
626638
[event_handler("", "", "")]
627639
event Windows.Foundation.TypedEventHandler<CoreWebView2Find, Object> ActiveMatchIndexChanged;
628640
};
@@ -636,13 +648,4 @@ to integrate text finding and navigation functionalities into WebView2 applicati
636648
It emphasizes the usage of interfaces such as `ICoreWebView2Find` and
637649
`ICoreWebView2FindConfiguration` to perform find operations effectively.
638650

639-
Additional Info:
640-
When initiating a find session while another session is in progress, the behavior of
641-
the active match index depends on the direction set for the find operation (forward or backward).
642-
However, calling StartFind again during an ongoing find operation does not resume from the point
643-
of the current active match. For example, given the text "1 1 A 1 1" and initiating a find session for "A",
644-
then starting another find session for "1", it will start searching from the beginning of the document,
645-
regardless of the previous active match. This behavior indicates that changing the find query initiates a
646-
completely new find session, rather than continuing from the previous match index. This distinction is essential
647-
to understand when utilizing the StartFind method for navigating through text matches.
648651

0 commit comments

Comments
 (0)