The attached screenshot shows composer embedded in the Mac PowerPlant
sample app. The style buttons work, but don't yet update as you move
around the document.

Here's the code that makes the page editable:

  // turn editing on
  nsCOMPtr<nsIEditingSession>   editingSession = do_GetInterface(mWebBrowser);
  nsCOMPtr<nsIDOMWindow>        domWindow = do_GetInterface(mWebBrowser);
  // error checking etc

  rv = editingSession->MakeWindowEditable(domWindow, PR_TRUE);

The buttons dispatch commands via:

  nsCOMPtr<nsICommandManager>   commandManager = do_GetInterface(mWebBrowser);
  rv = commandManager->DoCommand(commandName, NS_LITERAL_STRING(""));

So things are coming together nicely. Work remains to implement
nsICommandManager's UI update callbacks, but the isolation that the
command manager gives you from implementation APIs is really nice.

This stuff isn't checked in yet; I'll be working on a checkin strategy
that does not break current functionality next week.

Simon

Unknown Document

GIF image



Reply via email to