Hello,
we are currently integrating Writing Tools into our macOS application using NSWritingToolsCoordinator with a custom NSView.
Overall, the integration is going well and we are generally satisfied with the API.
However, text replacement is sometimes not using NSWritingToolsCoordinator callback function.
When selecting “Replace” from a preview in a Writing Tools UI popup, the text replacement is performed via the NSTextInputClient callback function (insertText:), which does not seem correct.
This is especially problematic in multi-context scenarios, because NSTextInputClient insertText: does not provide the required information about the Writing tools context being used. As a result, it is not possible to determine which context is being modified when managing more than a single context.
In our view, Writing Tools should consistently use the callback function of NSWritingToolsCoordinator for text replacement, whatever is the action performed. This is essential for properly handling multi-context use cases.
This issue is reproducible with the sample app project provided here https://developer.apple.com/documentation/appkit/enhancing-your-custom-text-engine-with-writing-tools.
If you define a breakpoint in function
writingToolsCoordinator:replaceRange:inContext:proposedText:reason:animationParameters:completion:
of the Writing tools coordinator,
the function is not triggered if text replacement is performed from a preview like for "Summary" with "replace" button.
NSWritingToolsCoordinator callback function seems to be called only when text replacement is performed directly inline (in the text view) without external preview so.
i have opened a issue with feedback assistant: FB22401950.
Best regards.
0
0
63