virtual bool HasSelection();
virtual void SelectAll();
virtual wxString GetSelectedText();
- virtual wxString GetSelectedSource() { return ""; }
+ virtual wxString GetSelectedSource();
virtual void ClearSelection();
void RunScript(const wxString& javascript);
RunScript("window.getSelection().selectAllChildren(document.body);");
}
+wxString wxWebViewWebKit::GetSelectedSource()
+{
+ wxString script = ("var range = window.getSelection().getRangeAt(0);"
+ "var element = document.createElement('div');"
+ "element.appendChild(range.cloneContents());"
+ "return element.innerHTML;");
+ id result = [[m_webView windowScriptObject]
+ evaluateWebScript:wxNSStringWithWxString(script)];
+ return wxStringWithNSString([result stringValue]);
+}
+
wxString wxWebViewWebKit::GetPageText()
{
id result = [[m_webView windowScriptObject]