# Android-WYSIWYG-Editor1 **Repository Path**: wangfeigit/android-wysiwyg-editor1 ## Basic Information - **Project Name**: Android-WYSIWYG-Editor1 - **Description**: 富文本编辑器 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-11-13 - **Last Updated**: 2024-11-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [ ![Download](https://api.bintray.com/packages/irshu/maven/laser-native-editor/images/download.svg) ](https://bintray.com/irshu/maven/laser-native-editor/_latestVersion) ![enter image description here](https://img.shields.io/badge/issues-16-yellow.svg) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) Android-WYSIWYG-Editor =================== An iframe free text editor that uses native components in the content tree. Motivation was to create a clean native feel WYSIWYG editor like medium.com has. [](https://play.google.com/store/apps/details?id=com.github.irshulx.wysiwyg_editor) ## Changelog ## [3.0.4 - 30 July 2019] - Updates glide to 4.9.0 ## [3.0.3 - 20 December 2018] - **Introducing Macro's** - Macro's are equivalent to components in react/vue.js. It lets you add a custom block into the editor where you get to control what gets rendered into the editor. Read more about this below on Macro's section. - Add blockquote support - Replaced image loader library **Picasso** with **Glide**, so to make use of it's rich customization api. - An improved editor navigation. ## [2.3.2 - 01 December 2018] - Links on editor will now respond to click - Fix for editor rendering wrong order from serialised string/html Please find all the latest releases/changelogs on https://github.com/irshuLx/Android-WYSIWYG-Editor/releases Contributions ------------ You can clone from the `master` branch. Once ready to merge , please open a pull request to `dev` branch. Be sure to merge the latest from "upstream" before making a pull request! I can then review and merge it back to master Download ------------ gradle: compile 'com.github.irshulx:laser-native-editor:3.0.3' or maven: com.github.irshulx laser-native-editor 3.0.3 pom Demo -------------- ![](https://github.com/irshuLx/Android-WYSIWYG-Editor/raw/master/screens/ezgif-3-4b5b0fc2bd.gif) ![](https://github.com/irshuLx/Android-WYSIWYG-Editor/raw/master/screens/ezgif-3-3c5a0f84f2.gif)  ![](https://github.com/irshuLx/Android-WYSIWYG-Editor/raw/master/screens/ezgif-3-b3c73d7be8.gif)   ![](https://github.com/irshuLx/Android-WYSIWYG-Editor/raw/master/screens/screenshot1.png)  ![](https://github.com/irshuLx/Android-WYSIWYG-Editor/raw/master/screens/screenshot2.png)  ![](https://github.com/irshuLx/Android-WYSIWYG-Editor/raw/master/screens/screenshot3.png)![](https://github.com/irshuLx/Android-WYSIWYG-Editor/raw/master/screens/screenshot4.png) ![](https://github.com/irshuLx/Android-WYSIWYG-Editor/raw/master/screens/screenshot5.png) Features ------------- - **Renderer or Editor**: You can use it as a **Renderer** to Render the content or use it as an **Editor** to create the content. - **No Webviews used** to render the content. It uses Native EditText, ImageView and as such to render the contents. - **HTML Parser:** Render your HTML Code into the editor and vice versa. - **Integration with web based WYSIWYG's:** HTMLParser helps the Editor to work seemlessly with the WYSIWYG editor on your web platform. The editor is built, so that every part of the design have been exposed and is available for customization. **Available Controls:** | Control | Usage | | :------- | :-----: | | `H1`, `H2` and `H3` | Insert Headings | | `Blockquote` | Insert a blockquote | | `Bold`, `Italic`,`Color`, `Intent` & `Outdent` | Format the text | | `Image Picker`| Insert Images to the editor from storage or a URL | | `Hyperlinks` | Add Links to the editor |`Location Selector` | Use the embedded map editor to tag and insert locations to the editor | |`Numbered` and `Bulleted` Lists | Let's you created Unorderd and Ordered lists | |`Line Divider` | Add a divider Usage ------------------- For a complete overview of the implementation, please take a look at [EditorTestActivity.java](https://github.com/irshuLx/Android-WYSIWYG-Editor/blob/master/sample/src/main/java/com/github/irshulx/wysiwyg/EditorTestActivity.java) **Layout XML** **Activity** @Override protected void onCreate(Bundle savedInstanceState) { editor = (Editor) findViewById(R.id.editor); findViewById(R.id.action_h1).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.updateTextStyle(EditorTextStyle.H1); } }); findViewById(R.id.action_h2).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.updateTextStyle(EditorTextStyle.H2); } }); findViewById(R.id.action_h3).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.updateTextStyle(EditorTextStyle.H3); } }); findViewById(R.id.action_bold).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.updateTextStyle(EditorTextStyle.BOLD); } }); findViewById(R.id.action_Italic).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.updateTextStyle(EditorTextStyle.ITALIC); } }); findViewById(R.id.action_indent).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.updateTextStyle(EditorTextStyle.INDENT); } }); findViewById(R.id.action_outdent).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.updateTextStyle(EditorTextStyle.OUTDENT); } }); findViewById(R.id.action_bulleted).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.insertList(false); } }); findViewById(R.id.action_color).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.updateTextColor("#FF3333"); } }); findViewById(R.id.action_unordered_numbered).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.insertList(true); } }); findViewById(R.id.action_hr).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.insertDivider(); } }); findViewById(R.id.action_insert_image).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.openImagePicker(); } }); findViewById(R.id.action_insert_link).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.insertLink(); } }); findViewById(R.id.action_erase).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.clearAllContents(); } }); findViewById(R.id.action_blockquote).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.updateTextStyle(EditorTextStyle.BLOCKQUOTE); } }); editor.render(); } If you are using **Image Pickers**, Add the following into your **Activity**: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == editor.PICK_IMAGE_REQUEST && resultCode == Activity.RESULT_OK&& data != null && data.getData() != null) { Uri uri = data.getData(); try { Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), uri); editor.insertImage(bitmap); } catch (IOException e) { e.printStackTrace(); } } else if (resultCode == Activity.RESULT_CANCELED) { // editor.RestoreState(); } } You can also programmatically append text into the editor using HTML like so: editor.render("

Hello man, whats up!

"); editor.render("
This is another paragraph!
"); Please be reminded, nested HTML **ARE NOT** supported at the moment except for `