How can I react meaningfully to a changeAttributes: delegation pass-through from WebView?

后端 未结 2 1789
萌比男神i
萌比男神i 2021-02-15 17:22

WebView supports, through the WebEditingDelegate, a mechanism for the delegate to implement custom behavior for a variety of actions the WebView<

2条回答
  •  情话喂你
    2021-02-15 17:37

    Have you looked at the source code?

    WebHTMLView.mm

    I don't see how -changeAttributes: is calling -webView:doCommandBySelector:, as within this class it's only called inside its own -doCommandBySelector: method.

    - (void)changeAttributes:(id)sender
    {
        [self _applyStyleToSelection:[self _styleForAttributeChange:sender] withUndoAction:EditActionChangeAttributes];
    }
    
    
    - (void)doCommandBySelector:(SEL)aSelector
    {
    …
        if (![[webView _editingDelegateForwarder] webView:webView doCommandBySelector:aSelector] && coreFrame) {
    …
    }
    

    Also, why can't you subclass WebHTMLView? Is it because of the Mac App Store restrictions on API? Does WebKit count as private? I thought it was Open Source.

    -Wil

提交回复
热议问题