richeditor-android
richeditor-android copied to clipboard
How to edit some content after loading it by mEditor.loadData(someData)? thnks
I am also facing the same issue. After calling the mEditor.loadData() method, I am not able to edit the loaded data. Can you guys please give me some solution?
Can anyone help me with this? It's really a very emerging issue right now.
Thanks in Advance...
@boby1975 Can you please help me with this part?
@bmadaras @lijunjieone @richfuns Anyone can help me on this question?
@boby1975 Can you please help me with this part?
Use richEditor.setHtml(htmlString)
@boby1975 yes I have used the richEditor.setHtml(htmlString) method. But still, I am not able to focus on the Editor after display the data. Is there anything I`m missing? Please let me know.
Try this richEditor.setInputEnabled(true)
@boby1975 I have used the following methods to enable the Editor View after loading the data. mEditor.setHtml(Globals.getInstance().currentClub.getDescription()); mEditor.setInputEnabled(true); mEditor.setClickable(true); mEditor.setFocusable(true); mEditor.setFocusableInTouchMode(true); mEditor.setSaveEnabled(true);
@boby1975 Thanks for your help... It's appreciated...
@boby1975 I need one more help from you... How can we send an image with bitmap or Base64? Right now Editor only accepts Url in String.
@boby1975 I have used the following methods to enable the Editor View after loading the data. mEditor.setHtml(Globals.getInstance().currentClub.getDescription()); mEditor.setInputEnabled(true); mEditor.setClickable(true); mEditor.setFocusable(true); mEditor.setFocusableInTouchMode(true); mEditor.setSaveEnabled(true);
may be this helps in my class RichEditor .. public RichEditor(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr);
setVerticalScrollBarEnabled(false);
setHorizontalScrollBarEnabled(false);
getSettings().setJavaScriptEnabled(true);
getSettings().setUseWideViewPort(true);
getSettings().setLoadWithOverviewMode(true);
getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING);
getSettings().setSupportZoom(true);
setWebChromeClient(new WebChromeClient());
setWebViewClient(createWebviewClient());
loadUrl(SETUP_HTML);
applyAttributes(context, attrs);
}
@boby1975 I need one more help from you... How can we send an image with bitmap or Base64? Right now Editor only accepts Url in String.
You can insert image by url and base64 as well when editor has focus examples: file file_oops.png is located in assets folder String imagePath = "file:///android_asset/file_oops.png"; richEditor.insertImage(imagePath, "fileName");
or base64 image String imageBase64 = "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; richEditor.insertImage(imageBase64, "fileName");
PS in rich_editor.js you can change/add some functions example RE.insertImage = function(url, alt) { var html = '<img src="' + url + '"' + ' style="width: 300px; display: block; vertical-align: top; margin: 5px auto; text-align: center; font-family: Nunito, Arial, sans-serif; box-sizing: border-box; max-width: 100%; padding: 0px; border: 0px; outline: 0px; font-size: 100%; background: transparent;"' + ' alt="' + alt + '" />'; RE.insertHTML(html); }
@boby1975 Do I need to append "data:image/png;base64," this string with base64 data string in richEditor.insertImage(imageBase64, "fileName") method?
Yes. See my working example above
@boby1975 I have prepared base 64 String with appending "data:image/png;base64,. But still, HTML not loaded on the preview. IF I am using a local path for displaying an image, It will load the image..but at the same time, we can`t see those images on the server or iOS.
@boby1975 Can you please help me with my previous comment?
@boby1975 I have used base64 image String imageBase64 = "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; richEditor.insertImage(imageBase64, "fileName"); An editor couldn`t load the Image HTML using the above code. Can you please help me?
For Base64, use this function(loadDataWithBaseURL). but it is slow in loading.
@vikas-jain-plutus were you able to solve the base64 load issue? I'm in a similar boat cause my app needs to load image as base64 as well.