My OSX app embed a webview and display a custom toolbar for editing fonts/colors/font size etc. The webview loads an html and the user is able to edit it. My questions are:
- how to edit the text properties like font, color or size for the selected text?
- how to know the font's properties for the portion of text where the cursor laying? (i want change the information displayed in the toolbar)
I know it is possible because the webview has the right click menu with all the functionalities I'm looking for, but I want replicate this functionalities in my toolbar:
For test purpose I'm trying to set the font size in this way but nothing happens
[_contentWebView changeFont:[NSFont systemFontOfSize:32]];
[_contentWebView setNeedsDisplay:YES];
The apple documentation about editing function in the webview is really poor (creepy example) , someone can suggest me a tutorial, a book or something when find a rich documentation about the webview?
update:
I can retrive the selected HTML with this code:
-(NSString *)getSelectedHtml
{
DOMRange *ff = [self selectedDOMRange];
NSString *marki = [ff markupString];
return marki;
}
but I DON'T want manipulate directly html... :(