{"id":21130036,"url":"https://github.com/mr5/icarus-android","last_synced_at":"2025-12-29T23:37:12.188Z","repository":{"id":57721604,"uuid":"56924966","full_name":"mr5/icarus-android","owner":"mr5","description":"[DISCONTINUED] Rrich text editor for android platform. 安卓富文本编辑器，暂停维护","archived":false,"fork":false,"pushed_at":"2017-08-23T02:39:13.000Z","size":1193,"stargazers_count":741,"open_issues_count":22,"forks_count":135,"subscribers_count":32,"default_branch":"master","last_synced_at":"2023-11-07T14:59:39.636Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mr5.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-23T15:00:51.000Z","updated_at":"2023-09-16T16:23:34.000Z","dependencies_parsed_at":"2022-09-26T21:50:18.257Z","dependency_job_id":null,"html_url":"https://github.com/mr5/icarus-android","commit_stats":null,"previous_names":[],"tags_count":1,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mr5%2Ficarus-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mr5%2Ficarus-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mr5%2Ficarus-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mr5%2Ficarus-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mr5","download_url":"https://codeload.github.com/mr5/icarus-android/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225476377,"owners_count":17480215,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T05:32:12.945Z","updated_at":"2025-12-29T23:37:12.151Z","avatar_url":"https://github.com/mr5.png","language":"JavaScript","funding_links":[],"categories":["Libs"],"sub_categories":["\u003cA NAME=\"Widget\"\u003e\u003c/A\u003eWidget"],"readme":"## icarus-android\nMaybe the best rich text editor on android platform. Base on [Simditor](https://github.com/mycolorway/simditor)\n\n![demo](demo.gif)\t\n\n\n## Features\n* Alignment (left/center/right)\n* Bold\n* Blockquote\n* Code\n* Horizontal ruler\n* Italic\n* Image\n* Indent\n* Link\n* Outdent\n* Ordered List\n* Unordered List\n* Underline\n* Raw html (Insert anything to any selection range that you want via API)\n\n## Usage\nAdd this line to your `build.gradle` file under your module directory.\n```groovy\ncompile 'com.github.mr5:icarus:0.1.14'\n```\nJava codes:\n```java\nimport android.app.Activity;\nimport android.webkit.WebView;\nimport android.widget.TextView;\n\nimport com.github.mr5.icarus.entity.Options;\nimport com.github.mr5.icarus.button.TextViewButton;\nclass EditorActivity extends Activity {\n\tprotected WebView webView;\n    protected Icarus icarus;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        // Get WebView from your layout, or create it manually.\n        setContentView(R.layout.activity_main);\n        webView = (WebView) findViewById(R.id.editor);\n        // I offered a toolbar to manage editor buttons which implements TextView that with icon fonts. \n        // It's just a collection, not an Android View implementation. \n        // TextViewToolbar will listen click events on all buttons that added to it. \n        // You can implement your own `Toolbar`, to prevent these default behaviors.\n        TextViewToolbar toolbar = new TextViewToolbar();\n        Options options = new Options();\n        options.setPlaceholder(\"Placeholder...\");\n        icarus = new Icarus(toolbar, options, webView);\n        TextView boldButton = new TextViewButton()\n        boldButton.setName(Button.NAME_BOLD);\n\t\ttoolbar.addButton(boldButton);\n        icarus.render();\n    }\n }\n```\n\n[Sample](https://github.com/mr5/icarus-android/tree/master/samples)\n\n## Button Names\nsee [Button.java](library/src/main/java/com/github/mr5/icarus/button/Button.java)\n\n## Options\n#### placeholder: String\n\n\u003e Placeholder of Editor. Use the placeholder attribute value of the textarea by default.\n\ndefault: \"Icarus editor.\"\n\n\nExample:\n\n```java\noptions.setPlaceholder(\"Input something...\");\n```\n\n#### defaultImage: String\n\n\u003e Default image placeholder. Used when inserting pictures in Edtior.\n\ndefault: \"images/image.png\"\n\nExample:\n\n```java\noptions.setDefaultImage(\"file:///android_asset/xxx.jpg\");\n```\n\n#### cleanPaste: Boolean\n\n\u003e Remove all styles in paste content automatically.\n\ndefault:  false\n\nExample:\n\n```java\noptions.setCleanPaste(true);\n```\n\n#### allowedTags: String[]\n\n\u003e Tags that are allowed in Editor\n\ndefault: {\"br\", \"span\", \"a\", \"img\", \"b\", \"strong\", \"i\", \"strike\", \"u\", \"font\", \"p\", \"ul\", \"ol\", \"li\", \"blockquote\", \"pre\", \"code\", \"h1\", \"h2\", \"h3\", \"h4\", \"hr\"}\n\nExample:\n\n```java\n// option replacement.\noptions.setAllowedTags(Arrays.asList(\"a\", \"span\", \"img\");\n// add tag to current tag list.\noptions.addAllowedTag(\"pre\");\n```\n\n#### allowedAttributes: Map\u0026lt;String, List\u0026lt;String\u0026gt;\u0026gt;\n\n\n\u003e Whitelist of tag attributes.  Note that custom whitelist will be merged into the default one.\n\ndefault:\n\n```javascript\nimg: {\"src\", \"alt\", \"width\", \"height\", \"data-non-image\"}\na: {\"href\", \"target\"}\nfont: {\"color\"}\ncode: {\"class\"}\n```\n\nExample:\n\n```java\n// option replacement.\noptions.setAllowedAttributes(new HashMap\u003cString, List\u003cString\u003e\u003e());\n// add new attribute to current tag list.\noptions.addAllowedAttributes(\"a\", Arrays.asList(\"class\", \"src\", \"alt\", \"data-type\"));\n```\n\n## Load Javascript or Stylesheet files.\n\n```java\nicarus.loadCSS(\"file:///android_asset/editor.css\");\nicarus.loadJs(\"file:///android_asset/test.js\");\n```\n\n## Popover\n\nSome buttons depend user's actions, such as `Button.NAME_LINK`, `Button.NAME_IMAGE`. So you want to show a popover for user to do these actions. Icarus offered 3 Popover Implementations, [`HtmlPopoverImpl`](library/src/main/java/com/github/mr5/icarus/popover/HtmlPopoverImpl.java),  [`ImagePopoverImpl`](library/src/main/java/com/github/mr5/icarus/popover/ImagePopoverImpl.java),  [`LinkPopoverImpl`](library/src/main/java/com/github/mr5/icarus/popover/LinkPopoverImpl.java),  \n\n![popover](popover.png)\t\n\nSamples:\n```java\nTextView imageButtonTextView = (TextView) findViewById(R.id.button_image);\nimageButtonTextView.setTypeface(iconfont);\nTextViewButton imageButton = new TextViewButton(imageButtonTextView, icarus);\nimageButton.setName(Button.NAME_IMAGE);\nimageButton.setPopover(new ImagePopoverImpl(imageButtonTextView, icarus));\n\ntoolbar.addButton(imageButton);\n```\n\n\u003e You can implement your own popover to handler user's actions.\n\n## Insert html to current selection\n\n```java\nicarus.insertHtml(\"\u003ciframe src=\\\\\"xxx\\\\\"\u003e\u003c/iframe\u003e\");\n```\n\n## Contents getting and setting\n```java\n// Get contents\nicarus.getContent(new Callback() {\n                @Override\n                public void run(String params) {\n\t                Gson gson = new Gson();\n\t\t\t        Html html = gson.fromJson(params, Html.class);\n\t\t\t\t\tLog.d(\"Content gotten\", html.getContent());\n                }\n            });\n\n\n// Set contents\nicarus.setContent(\"new content\");\n```\n\n## License\n[MIT](https://opensource.org/licenses/MIT)\n\n\n\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-icarus--android-green.svg?style=true)](https://android-arsenal.com/details/1/3601)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmr5%2Ficarus-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmr5%2Ficarus-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmr5%2Ficarus-android/lists"}