(informal protocol)
Framework | /System/Library/Frameworks/WebKit.framework |
Availability | Available in Mac OS X v10.3.9 and later. |
Companion guide | |
Declared in | WebEditingDelegate.h |
You use a WebEditingDelegate to control or augment the editing behavior of a WebView object. Objects conforming to the WebEditingDelegate informal protocol may receive should messages before or did messages after an editing action. Typically, you implement an editing delegate if you want to change the default editing behavior.
– webView:shouldApplyStyle:toElementsInDOMRange:
– webView:shouldBeginEditingInDOMRange:
– webView:shouldChangeSelectedDOMRange:toDOMRange:affinity:stillSelecting:
– webView:shouldChangeTypingStyle:toStyle:
– webView:shouldDeleteDOMRange:
– webView:shouldEndEditingInDOMRange:
– webView:shouldInsertNode:replacingDOMRange:givenAction:
– webView:shouldInsertText:replacingDOMRange:givenAction:
– webViewDidBeginEditing:
– webViewDidChange:
– webViewDidChangeSelection:
– webViewDidChangeTypingStyle:
– webViewDidEndEditing:
Returns the undo manager to be used by a webView.
- (NSUndoManager *)undoManagerForWebView:(WebView *)webView
WebEditingDelegate.h
Returns whether the receiver will perform a command instead of the webView.
- (BOOL)webView:(WebView *)webView doCommandBySelector:(SEL)command
This method returns YES
if the receiver will perform command, NO
otherwise. Implement this method if you want to perform command instead of letting the webView perform command.
WebEditingDelegate.h
Returns whether the user should be allowed to apply a style to a range of content.
- (BOOL)webView:(WebView *)webView shouldApplyStyle:(DOMCSSStyleDeclaration *)style toElementsInDOMRange:(DOMRange *)range
This method returns YES
if the user should be allowed to apply a style, specified by style, to the content, specified by range, in webView, NO
otherwise.
WebEditingDelegate.h
Returns whether the user is allowed to edit a range of content in a web view.
- (BOOL)webView:(WebView *)webView shouldBeginEditingInDOMRange:(DOMRange *)range
This method returns YES
if the user is allowed to edit webView, NO
otherwise. This method is invoked when a web view attempts to become the first responder or when the user drops an object on webView. The range argument marks the section of the begin-editing request and is used to determine if editing is allowed. Typically, range is not the current selection but may becomes the current selection if this method returns YES
.
WebEditingDelegate.h
Returns whether the user should be allowed to change the selected range.
- (BOOL)webView:(WebView *)webView shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag
This method returns YES
if the user is allowed to change the selected range specified by the currentRange and proposedRange arguments; otherwise, NO
. The selectionAffinity argument specifies the direction of the selection. The flag argument is YES
if the user is still selecting, NO
otherwise.
WebEditingDelegate.h
Returns whether the user should be allowed to change the typing style in a web view.
- (BOOL)webView:(WebView *)webView shouldChangeTypingStyle:(DOMCSSStyleDeclaration *)currentStyle toStyle:(DOMCSSStyleDeclaration *)proposedStyle
This method returns YES
if the user should be allowed to change the typing style in webView to proposedStyle, NO
otherwise. The currentStyle argument is the old style. You can implement this method to take some other action—for example, set the typing style to a different style—and return NO
.
WebEditingDelegate.h
Returns whether the user should be allowed to delete a range of content.
- (BOOL)webView:(WebView *)webView shouldDeleteDOMRange:(DOMRange *)range
This method should returns YES
if the user should be allowed to delete the content specified by range, NO
otherwise. This method may perform an alternate action—for example, delete a different range—and return NO
.
WebEditingDelegate.h
Returns whether the user should be allowed to end editing.
- (BOOL)webView:(WebView *)webView shouldEndEditingInDOMRange:(DOMRange *)range
This method returns YES
if the user should be allowed to end editing webView, NO
otherwise. This method is invoked when a web view attempts to resign as the first responder. Typically, the range argument designates the current selection, although it might not. Use the range argument to help determine if the user can end editing. If this method returnsYES
, webView will end editing and resign as the first responder.
WebEditingDelegate.h
Returns whether the user should be allowed to insert a node in place of a range of content.
- (BOOL)webView:(WebView *)webView shouldInsertNode:(DOMNode *)node replacingDOMRange:(DOMRange *)range givenAction:(WebViewInsertAction)action
This method returns YES
if the user should be allowed to insert node in webView, NO
otherwise. The range argument is the portion of the content that will be replaced with node. The action argument indicates the type of user action that initiated the insertion. This method may perform an alternate action—for example, insert a different node—and return NO
.
WebEditingDelegate.h
Returns whether a user should be allowed to insert text in place of a range of content.
- (BOOL)webView:(WebView *)webView shouldInsertText:(NSString *)text replacingDOMRange:(DOMRange *)range givenAction:(WebViewInsertAction)action
This method returns YES
if the user should be allowed to insert text in webView, NO
otherwise. This method is invoked when one of the replaceSelectionWith...
messages is sent to a webView. The range argument is the portiion of the document that will be replaced with text. The action argument indicates the type of user action that initiated the insertion. This method may perform an alternate action—for example, insert different text—and return NO
.
WebEditingDelegate.h
Sent by the default notification center when the user begins editing the web view.
- (void)webViewDidBeginEditing:(NSNotification *)notification
The notification argument is always WebViewDidBeginEditingNotification
. You can retrieve the WebView object by sending object
to notification.
WebEditingDelegate.h
Sent by the default notification center when the user changes content in the web view.
- (void)webViewDidChange:(NSNotification *)notification
The notification argument is always WebViewDidChangeNotification
. You can retrieve the WebView object by sending object
to notification.
– webView:shouldDeleteDOMRange:
– webView:shouldInsertNode:replacingDOMRange:givenAction:
– webView:shouldInsertText:replacingDOMRange:givenAction:
– webView:shouldDeleteDOMRange:
WebEditingDelegate.h
Sent by the default notification center when the user changes the selection in the web view.
- (void)webViewDidChangeSelection:(NSNotification *)notification
The notification argument is always WebViewDidChangeSelectionNotification
. You can retrieve the WebView object by sending object
to notification.
WebEditingDelegate.h
Sent by the default notification center when the user changes the typing style in the web view.
- (void)webViewDidChangeTypingStyle:(NSNotification *)notification
The notification argument is always WebViewDidChangeTypingStyleNotification
. You can retrieve the WebView object by sending object
to notification.
WebEditingDelegate.h
Sent by the default notification center when the user stops editing the web view.
- (void)webViewDidEndEditing:(NSNotification *)notification
The notification argument is always WebViewDidEndEditingNotification
. You can retrieve the WebView object by sending object
to notification.
WebEditingDelegate.h
Indicate the type of user action that initiated a delegate message.
typedef enum { WebViewInsertActionTyped, WebViewInsertActionPasted, WebViewInsertActionDropped, } WebViewInsertAction;
WebViewInsertActionTyped
Indicates the user inserted content by typing.
Available in Mac OS X v10.3 and later.
Declared in WebEditingDelegate.h
.
WebViewInsertActionPasted
Indicates the user inserted content by pasting.
Available in Mac OS X v10.3 and later.
Declared in WebEditingDelegate.h
.
WebViewInsertActionDropped
Indicates the user inserted content by dropping.
Available in Mac OS X v10.3 and later.
Declared in WebEditingDelegate.h
.
These constants are described in WebEditingDelegate
.
© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-04-08)