Apr 27, 2016 Replies: 40 Hello all , A wrapper for this library https://github.com/wasabeef/richeditor-android SMMRichEditor Author: SMM Version: 0.05 SMMRichEditor Events: _textchanged (new As String) Fields: ba As BA Methods: AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int) BringToFront DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map) Initialize (EventName As String) Invalidate Invalidate2 (arg0 As Rect) Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int) IsInitialized As Boolean RemoveView RequestFocus As Boolean SendToBack SetBackgroundImage (arg0 As Bitmap) SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int) SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int) SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int) SetVisibleAnimated (arg0 As Int, arg1 As Boolean) clearFocusEditor focusEditor insertImage (path As String, alt As String) insertLink (url As String, text As String) insertTodo loadCSS (cssFile As String) redo removeFormat setAlignCenter setAlignLeft setAlignRight setBlockquote setBold setBullets setIndent setItalic setNumbers setOutdent setPadding (left As Int, top As Int, width As Int, height As Int) setStrikeThrough setSubscript setSuperscript setUnderline undo Properties: Background As Drawable Color As Int [write only] EditorBackgroundColor As Int [write only] EditorFontColor As Int [write only] EditorFontSize As Int [write only] EditorHeight As Int [write only] Enabled As Boolean FontSize As Int [write only] Font size should have a value between 1-7 Heading As Int [write only] Height As Int Html As String Left As Int Padding()() As Int Parent As Object [read only] Placeholder As String [write only] Tag As Object TextBackgroundColor As Int [write only] TextColor As Int [write only] Top As Int Visible As Boolean Width As Int Note : You have to add files in CopytoAssetsFolder.zip to your project's Assets (Add to IDE File tab) I do not understand html images very well but to insert from Assets use this line Code: Copy re.insertImage("file:///android_asset"&"/txt.png","text") re is SMMRichEditor V 2 adds a method (re.Html) to setting or getting HTML V 0.03 adds TextColor (not tested) requested in post #25 V0.04 added loadCSS(String cssFile) , setBullets() , setNumbers(), focusEditor() , clearFocusEditor() V0.05 (I have updated library references above ) 0.16 I think I wrapped all available methods There is an ugly sample attached now Sorry for that it is just to get you started Attachments SMMRichEditor.zip SMMRichEditor.zip 13.2 KB · Views: 1,112 CopytoAssetsFolder.zip CopytoAssetsFolder.zip 5.8 KB · Views: 1,124 SMMRichEditor2.zip SMMRichEditor2.zip 13.3 KB · Views: 982 SMMRichEditor0.03.zip SMMRichEditor0.03.zip 13.7 KB · Views: 899 SMMRichEditor0.04.zip SMMRichEditor0.04.zip 13.9 KB · Views: 862 SMMRichEditor0.05.zip SMMRichEditor0.05.zip 14 KB · Views: 1,025 SMMRichEditor0.16.zip SMMRichEditor0.16.zip 16.1 KB · Views: 544 richeditorsample.zip richeditorsample.zip 9.5 KB · Views: 527 Last edited: Dec 4, 2024 Click to expand...
Hello all , A wrapper for this library https://github.com/wasabeef/richeditor-android SMMRichEditor Author: SMM Version: 0.05 SMMRichEditor Events: _textchanged (new As String) Fields: ba As BA Methods: AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int) BringToFront DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map) Initialize (EventName As String) Invalidate Invalidate2 (arg0 As Rect) Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int) IsInitialized As Boolean RemoveView RequestFocus As Boolean SendToBack SetBackgroundImage (arg0 As Bitmap) SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int) SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int) SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int) SetVisibleAnimated (arg0 As Int, arg1 As Boolean) clearFocusEditor focusEditor insertImage (path As String, alt As String) insertLink (url As String, text As String) insertTodo loadCSS (cssFile As String) redo removeFormat setAlignCenter setAlignLeft setAlignRight setBlockquote setBold setBullets setIndent setItalic setNumbers setOutdent setPadding (left As Int, top As Int, width As Int, height As Int) setStrikeThrough setSubscript setSuperscript setUnderline undo Properties: Background As Drawable Color As Int [write only] EditorBackgroundColor As Int [write only] EditorFontColor As Int [write only] EditorFontSize As Int [write only] EditorHeight As Int [write only] Enabled As Boolean FontSize As Int [write only] Font size should have a value between 1-7 Heading As Int [write only] Height As Int Html As String Left As Int Padding()() As Int Parent As Object [read only] Placeholder As String [write only] Tag As Object TextBackgroundColor As Int [write only] TextColor As Int [write only] Top As Int Visible As Boolean Width As Int Note : You have to add files in CopytoAssetsFolder.zip to your project's Assets (Add to IDE File tab) I do not understand html images very well but to insert from Assets use this line Code: Copy re.insertImage("file:///android_asset"&"/txt.png","text") re is SMMRichEditor V 2 adds a method (re.Html) to setting or getting HTML V 0.03 adds TextColor (not tested) requested in post #25 V0.04 added loadCSS(String cssFile) , setBullets() , setNumbers(), focusEditor() , clearFocusEditor() V0.05 (I have updated library references above ) 0.16 I think I wrapped all available methods There is an ugly sample attached now Sorry for that it is just to get you started
A apty Active Member Licensed User Longtime User Apr 28, 2016 #2 Thank you very much. Can you please make a small example showing how to use the library?
somed3v3loper Well-Known Member Licensed User Longtime User Apr 28, 2016 #3 apty said: Thank you very much. Can you please make a small example showing how to use the library? Click to expand... It is simple like any other view Code: Copy Dim re as SMMRichEditor re.Initialize("re") Activity.Addview(re, 0,0,100%x,100%y) re.EditorBackgroundColor=colors.Yellow Text related methods like bold seem to have effect if some text is selected . you might want to add buttons for them. And for textchanged listener, you add the following Sub Code: Copy Sub re_textchanged(new as string) Log(new) End sub
apty said: Thank you very much. Can you please make a small example showing how to use the library? Click to expand... It is simple like any other view Code: Copy Dim re as SMMRichEditor re.Initialize("re") Activity.Addview(re, 0,0,100%x,100%y) re.EditorBackgroundColor=colors.Yellow Text related methods like bold seem to have effect if some text is selected . you might want to add buttons for them. And for textchanged listener, you add the following Sub Code: Copy Sub re_textchanged(new as string) Log(new) End sub
A apty Active Member Licensed User Longtime User Apr 28, 2016 #4 Thanks a lot. Sorry for the long questions, but please show me how to add a button that changes selected text to italics..I have tried Code: Copy dim bn as Button bn.Initialize("bn") bn.Text="Italic" re.AddToParent(bn,10dip,10dip,100dip,50dip) But it gives me an error
Thanks a lot. Sorry for the long questions, but please show me how to add a button that changes selected text to italics..I have tried Code: Copy dim bn as Button bn.Initialize("bn") bn.Text="Italic" re.AddToParent(bn,10dip,10dip,100dip,50dip) But it gives me an error
somed3v3loper Well-Known Member Licensed User Longtime User Apr 28, 2016 #5 apty said: Thanks a lot. Sorry for the long questions, but please show me how to add a button that changes selected text to italics..I have tried Code: Copy dim bn as Button bn.Initialize("bn") bn.Text="Italic" re.AddToParent(bn,10dip,10dip,100dip,50dip) But it gives me an error Click to expand... AddToParent adds richeditor to a panel or activity, you can't add views to this richeditor view . You should replace this line with Activity.AddView(bn,…..) And add sub bn_click to handle button clicks For example Code: Copy Sub bn_click re.setItalic End sub
apty said: Thanks a lot. Sorry for the long questions, but please show me how to add a button that changes selected text to italics..I have tried Code: Copy dim bn as Button bn.Initialize("bn") bn.Text="Italic" re.AddToParent(bn,10dip,10dip,100dip,50dip) But it gives me an error Click to expand... AddToParent adds richeditor to a panel or activity, you can't add views to this richeditor view . You should replace this line with Activity.AddView(bn,…..) And add sub bn_click to handle button clicks For example Code: Copy Sub bn_click re.setItalic End sub
A apty Active Member Licensed User Longtime User Apr 28, 2016 #6 Sorry...i managed to do it. Was adding it to wrong view
somed3v3loper Well-Known Member Licensed User Longtime User Apr 28, 2016 #7 You need to move Dim re as SMMRichEditor line to Sub Globals
A apty Active Member Licensed User Longtime User Apr 28, 2016 #9 Is it possible to save the editor values to a html file?
A apty Active Member Licensed User Longtime User Apr 28, 2016 #10 Have found the way do to it...Thanks
tsteward Well-Known Member Licensed User Longtime User Nov 17, 2016 #11 apty said: Is it possible to save the editor values to a html file? Click to expand... Any chance showing how you did this
apty said: Is it possible to save the editor values to a html file? Click to expand... Any chance showing how you did this
tsteward Well-Known Member Licensed User Longtime User Nov 17, 2016 #12 Infact any help using this library would be good, I dont understand how to load text into the editor, extract text from editor and then save as html
Infact any help using this library would be good, I dont understand how to load text into the editor, extract text from editor and then save as html
somed3v3loper Well-Known Member Licensed User Longtime User Nov 19, 2016 #13 tsteward said: Infact any help using this library would be good, I dont understand how to load text into the editor, extract text from editor and then save as html Click to expand... I uploaded a new version that adds Html function to set or get editor html .
tsteward said: Infact any help using this library would be good, I dont understand how to load text into the editor, extract text from editor and then save as html Click to expand... I uploaded a new version that adds Html function to set or get editor html .
tsteward Well-Known Member Licensed User Longtime User Nov 19, 2016 #14 That's cool thank you, Managing to get it working, how can I set Heading H1 H2 etc.
somed3v3loper Well-Known Member Licensed User Longtime User Nov 20, 2016 #15 tsteward said: That's cool thank you, Managing to get it working, how can I set Heading H1 H2 etc. Click to expand... re.Heading = 1 or 2 ? I just wrote the wrapper with no knowledge of HTML and CSS .
tsteward said: That's cool thank you, Managing to get it working, how can I set Heading H1 H2 etc. Click to expand... re.Heading = 1 or 2 ? I just wrote the wrapper with no knowledge of HTML and CSS .
tsteward Well-Known Member Licensed User Longtime User Nov 20, 2016 #16 Ok so I don't know anything about wraping code but as it's supported by the original github code I thought it would get wrapped as well.
Ok so I don't know anything about wraping code but as it's supported by the original github code I thought it would get wrapped as well.
somed3v3loper Well-Known Member Licensed User Longtime User Nov 20, 2016 #17 tsteward said: Ok so I don't know anything about wraping code but as it's supported by the original github code I thought it would get wrapped as well. Click to expand... which method from original github project are you trying to use ?
tsteward said: Ok so I don't know anything about wraping code but as it's supported by the original github code I thought it would get wrapped as well. Click to expand... which method from original github project are you trying to use ?
tsteward Well-Known Member Licensed User Longtime User Nov 20, 2016 #18 See the attached in mage it shows they support Header 1, Header 2 etc. I assume like re.setbold there would be a .setheader1 or similar. Or do I just not understand. Also whats ba used for? Thanks Tony Attachments ScreenClip.png 22.5 KB · Views: 1,005
See the attached in mage it shows they support Header 1, Header 2 etc. I assume like re.setbold there would be a .setheader1 or similar. Or do I just not understand. Also whats ba used for? Thanks Tony
somed3v3loper Well-Known Member Licensed User Longtime User Nov 20, 2016 #19 tsteward said: See the attached in mage it shows they support Header 1, Header 2 etc. I assume like re.setbold there would be a .setheader1 or similar. Or do I just not understand. Also whats ba used for? Thanks Tony Click to expand... Did you try something like this? Code: Copy dim re as SMMRichEditor re.Initialize("") re.Heading = 1 Ignore ba it is used by wrapper
tsteward said: See the attached in mage it shows they support Header 1, Header 2 etc. I assume like re.setbold there would be a .setheader1 or similar. Or do I just not understand. Also whats ba used for? Thanks Tony Click to expand... Did you try something like this? Code: Copy dim re as SMMRichEditor re.Initialize("") re.Heading = 1 Ignore ba it is used by wrapper