B4A Library RichEditor view

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 :D but to insert from Assets use this line

B4X:
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 :))
 

Attachments

  • SMMRichEditor.zip
    13.2 KB · Views: 515
  • CopytoAssetsFolder.zip
    5.8 KB · Views: 518
  • SMMRichEditor2.zip
    13.3 KB · Views: 421
  • SMMRichEditor0.03.zip
    13.7 KB · Views: 307
  • SMMRichEditor0.04.zip
    13.9 KB · Views: 341
  • SMMRichEditor0.05.zip
    14 KB · Views: 462
Last edited:

tsteward

Well-Known Member
Licensed User
Longtime User
Ok what about ordered or unordered lists?
 

tsteward

Well-Known Member
Licensed User
Longtime User
When I run this library in debug mode I always get file not found error file:///android.asset/editor.html
Is there anyway to get this to work in debug mode?
 

tsteward

Well-Known Member
Licensed User
Longtime User
Ok please how do I create a list?
Set italics richEd.setItalic
set header richEd.heading = 1

But how do I make an ordered(numbered) or unordered list?
 

migliore150267

Member
Licensed User
Longtime User
Hi,
This editor is fantastic but i can't find this function:
re.TextColor
That is present in the list of supported functions on GitHub.


Can you add it ?

Thanks in advance:)
 

peacemaker

Expert
Licensed User
Longtime User
Pardon me, but why such lib is needed, if there is CSbuilder possibility to make any "reach" text and images on any label, button....?
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
Hi again,
Sorry for the requests, but you could also add:
re.TextFontSize ?
Check V0.05 on the first post , it has FontSize As Int[write only]

Pardon me, but why such lib is needed, if there is CSbuilder possibility to make any "reach" text and images on any label, button....?
I do not know why it is needed :D but it is always great to have alternatives
 

Phayao

Active Member
Licensed User
Longtime User
Hello,

thanks for this very useful library - I have an addition question:
Is it possible to set the cursor programmatically inside the editor ? Maybe with the use of some javascript ?

Help is very appreciated,

Chris
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
Hello,

thanks for this very useful library - I have an addition question:
Is it possible to set the cursor programmatically inside the editor ? Maybe with the use of some javascript ?

Help is very appreciated,

Chris
I don't think this editor has a function to set cursor if you find it here https://github.com/wasabeef/richeditor-android , I will add it to my wrapper .
And I am sorry I am not good at JavaScript
 

Rusty

Well-Known Member
Licensed User
Longtime User
This would be much more friendly if a small sample project was created where it creates the editor and shows how to add/change/delete text... :)
Rusty
 

Guenter Becker

Active Member
Licensed User
Hello Friend,
good work done but where is the function setbullets?? I like to create ordered and unordered list.
 

ascot1

Member
Licensed User
Longtime User
Hello,
can someone post a sample project because i can't get it to work ... thanks in advance
 
Top