webkit - Getting source HTML from a WebView in Cocoa -
i'm working on os x program user light wysiwyg html editing in webview. being new programming cocoa , webkit, have absolutely no idea how selected text webview - intention being take user selected, add html code (like div's or span's) around text, , replace selected text modified code. how can accomplished?
i'm programming project macruby, i'd appreciate objective-c programmers well. thank you!
you can ask webview's -selecteddomrange , you'll domrange object back. can use object find out selected. domrange, webkit dom objects, objective-c representation of standard w3c domrange object, see domrange.h methods/properties supports.
you can replace current selection using -replaceselectionwithmarkupstring:, -replaceselectionwithtext: or -replaceselectionwithnode: methods of webview.
Comments
Post a Comment