Improve editing values with {return} in text fields; Add hyperlink detection.
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include <richio.h> // StrPrintf
|
||||
#include <string_utils.h>
|
||||
#include <fmt/chrono.h>
|
||||
#include <wx/regex.h>
|
||||
|
||||
|
||||
/**
|
||||
@@ -548,6 +549,26 @@ wxString UnescapeHTML( const wxString& aString )
|
||||
}
|
||||
|
||||
|
||||
wxString RemoveHTMLTags( const wxString& aInput )
|
||||
{
|
||||
wxString str = aInput;
|
||||
wxRegEx( wxS( "<[^>]*>" ) ).ReplaceAll( &str, wxEmptyString );
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
wxString LinkifyHTML( wxString aStr )
|
||||
{
|
||||
wxRegEx regex( wxS( "\\b(https?|ftp|file)://([-\\w+&@#/%?=~|!:,.;]*[^.<>\\s\u00b6])" ),
|
||||
wxRE_ICASE );
|
||||
|
||||
regex.ReplaceAll( &aStr, "<a href=\"\\0\">\\0</a>" );
|
||||
|
||||
return aStr;
|
||||
}
|
||||
|
||||
|
||||
bool NoPrintableChars( const wxString& aString )
|
||||
{
|
||||
wxString tmp = aString;
|
||||
|
||||
Reference in New Issue
Block a user