Enabling Editing

By setting the editable attribute of a WebView object you can make all the web content displayed in that view editable. Editing the content will change the underlying Document Object Model (DOM). However, setting the editable attribute to YES does not modify the editing attributes of the DOM objects—the WebView attribute setting overrides the DOM attributes.

For example, to modify the MiniBrowser application located in /Developer/Examples/WebKit, set the editable attribute to YES after the nib file is loaded in MyDocument’s windowControllerDidLoadNib: method as follows:

- (void)windowControllerDidLoadNib:(NSWindowController *) aController
    [super windowControllerDidLoadNib:aController];
    // Set editable flag
    [webView setEditable:YES];

Now when you build and run the application, you can add, delete, and modify the HTML content displayed in a WebView object. See Saving and Loading Web Content for how to get the HTML source from the DOM.