{"id":20187434,"url":"https://github.com/wordpress-mobile/azteceditor-android","last_synced_at":"2025-04-13T22:33:31.293Z","repository":{"id":9729068,"uuid":"63134364","full_name":"wordpress-mobile/AztecEditor-Android","owner":"wordpress-mobile","description":"A reusable native Android rich text editor component.","archived":false,"fork":false,"pushed_at":"2025-03-21T23:22:39.000Z","size":7023,"stargazers_count":712,"open_issues_count":125,"forks_count":119,"subscribers_count":34,"default_branch":"trunk","last_synced_at":"2025-04-06T20:03:44.759Z","etag":null,"topics":["android","android-library","editor","html","kotlin","native","rich-text-editor"],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wordpress-mobile.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-07-12T06:58:31.000Z","updated_at":"2025-04-04T09:19:09.000Z","dependencies_parsed_at":"2024-03-07T16:31:22.916Z","dependency_job_id":"1ffd1f7f-281e-45b9-a2b3-003635bd56fc","html_url":"https://github.com/wordpress-mobile/AztecEditor-Android","commit_stats":{"total_commits":3129,"total_committers":48,"mean_commits":65.1875,"dds":0.7120485778203899,"last_synced_commit":"2b3694c8b71cc7c2672989494ba526150490344b"},"previous_names":[],"tags_count":102,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wordpress-mobile%2FAztecEditor-Android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wordpress-mobile%2FAztecEditor-Android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wordpress-mobile%2FAztecEditor-Android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wordpress-mobile%2FAztecEditor-Android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wordpress-mobile","download_url":"https://codeload.github.com/wordpress-mobile/AztecEditor-Android/tar.gz/refs/heads/trunk","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248790902,"owners_count":21162111,"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":["android","android-library","editor","html","kotlin","native","rich-text-editor"],"created_at":"2024-11-14T03:23:45.831Z","updated_at":"2025-04-13T22:33:31.234Z","avatar_url":"https://github.com/wordpress-mobile.png","language":"Kotlin","readme":"\u003ch1\u003e\u003cimg align=\"center\" width=50px height=50px src=\"https://github.com/wordpress-mobile/AztecEditor-Android/raw/trunk/RepoAssets/aztec.png\" alt=\"Aztec Logo\"/\u003e\u0026nbsp;Aztec: Native HTML Editor for Android\u003c/h1\u003e\n\n[![CircleCI](https://circleci.com/gh/wordpress-mobile/AztecEditor-Android.svg?style=svg)](https://circleci.com/gh/wordpress-mobile/AztecEditor-Android)\n\nAztec (which extends EditText) is a rich-text editor component for writing HTML\ndocuments in Android.\n\n## Minimum Android Supported Version\n\nYou can check the minimum Android version supported by looking at the `minSdkVersion` configuration within [build.gradle](https://github.com/wordpress-mobile/AztecEditor-Android/blob/trunk/build.gradle).\n\n\u003cimg align=\"center\" width=360px height=640px src=\"https://github.com/wordpress-mobile/AztecEditor-Android/raw/trunk/visual_editor.png\" alt=\"Visual Editor\"/\u003e \u003cimg align=\"center\" width=360px height=640px src=\"https://github.com/wordpress-mobile/AztecEditor-Android/raw/trunk/code_editor.png\" alt=\"Visual Editor\"/\u003e\n\n## Getting started\n\nDeclare the main components in your layout:\n\nVisual editor\n```XML\n\u003corg.wordpress.aztec.AztecText\n    android:id=\"@+id/visual\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:scrollbars=\"vertical\"\n    android:imeOptions=\"flagNoExtractUi\"\n    aztec:historyEnable=\"false\" /\u003e\n```\nSource editor\n```XML\n\u003corg.wordpress.aztec.source.SourceViewEditText\n    android:id=\"@+id/source\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:inputType=\"textNoSuggestions|textMultiLine\"\n    android:scrollbars=\"vertical\"\n    android:imeOptions=\"flagNoExtractUi\"\n    aztec:codeBackgroundColor=\"@android:color/transparent\"\n    aztec:codeTextColor=\"@android:color/white\" /\u003e\n```\n\nToolbar\n```XML\n\u003corg.wordpress.aztec.toolbar.AztecToolbar\n    android:id=\"@+id/formatting_toolbar\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"@dimen/format_bar_height\"\n    android:layout_alignParentBottom=\"true\" /\u003e\n```\n\nInflate the views:\n```kotlin\nval visualEditor = findViewById\u003cAztecText\u003e(R.id.visual)\nval sourceEditor = findViewById\u003cSourceViewEditText\u003e(R.id.source)\nval toolbar = findViewById\u003cAztecToolbar\u003e(R.id.formatting_toolbar)\n```\n\nConfigure Aztec with a provided image \u0026 video loaders:\n```kotlin\nAztec.with(visualEditor, sourceEditor, toolbar, context)\n    .setImageGetter(GlideImageLoader(context))\n    .setVideoThumbnailGetter(GlideVideoThumbnailLoader(context))\n```\n\nFor more options, such as edit history, listeners and plugins please refer to the [demo app implementation](https://github.com/wordpress-mobile/AztecEditor-Android/blob/trunk/app/src/main/kotlin/org/wordpress/aztec/demo/MainActivity.kt).\n\n## Build and test\n\nBuild the library, build the example project and run unit tests:\n\n```shell\n$ ./gradlew build\n```\n\nRun unit tests only:\n\n```shell\n$ ./gradlew test\n```\n\n### Before running instrumentation tests\n\nEspresso [advises](https://google.github.io/android-testing-support-library/docs/espresso/setup/#setup-your-test-environment) disabling system animations on devices used for testing:\n\n\u003e On your device, under Settings-\u003eDeveloper options disable the following 3 settings:\n\u003e\n\u003e - Window animation scale\n\u003e - Transition animation scale\n\u003e - Animator duration scale\n\nOne additional setup step is also required to handle an Espresso issue with clicks (see the caveats below):\n\nOn your device, under Settings -\u003e Accessibility -\u003e Touch \u0026 hold delay, set the delay to `Long`.\n\nRun the instrumentation tests:\n\n```shell\n$ ./gradlew cAT\n```\n\n## Integrating Aztec in your project\n\n```gradle\nrepositories {\n    maven { url \"https://a8c-libs.s3.amazonaws.com/android\" }\n}\n```\n```gradle\ndependencies {\n    api \"org.wordpress:aztec:v1.6.2\"\n}\n```\n\nBrave developers can either use the project as a source distribution\nor have fun with the latest snapshot at their own risk:\n\n```gradle\ndependencies {\n    api \"org.wordpress:aztec:trunk-{commit_sha1}\"\n    // As an example, for '3f004c8c8cd4b53ab9748f42f373cf00a30e9d86' commit sha1, this would look like:\n    // api \"org.wordpress:aztec:trunk-3f004c8c8cd4b53ab9748f42f373cf00a30e9d86\"\n}\n```\n\n## Modifications\n\nYou can use the API to modify Aztec behaviour. \n\n### Toolbar items\n\nIf you want to limit the functionality the Aztec library provides, you can change it calling the `setToolbarItems` method on `AztecToolbar`. \nThe following example will enable only `bold`, `plugins` and `list` items in the given order.\n\n```kotlin\naztecToolbar.setToolbarItems(ToolbarItems.BasicLayout(ToolbarAction.BOLD, ToolbarItems.PLUGINS, ToolbarAction.LIST))\n```\n\nYou can set new items which are not enabled by default. `ToolbarAction.CODE` and `ToolbarAction.PRE`. \n- `CODE` represents inline HTML code \n- `PRE` represents a preformat block (including code block)\n\n### Task list\n\nThere is an optional list type you can enable in the editor. In addition to ordered and unordered lists you can use `task list`. \nA task list is an unordered list which shows and saves checkboxes instead of the bullets. Enable it by calling the following method.\n```kotlin\naztecToolbar.enableTaskList()\n```\n\n### Nested blocks\n\nBy default Aztec allows nested blocks. In certain cases this doesn't have to be the preferred behaviour. There is an option to disable nested blocks.\nWhen switched, this editor will always add media and horizontal rule after the currently selected block, not in the middle of it.\n```kotlin\naztecText.addMediaAfterBlocks()\n```\n\n### Placeholder API\n\nAztec now supports placeholders to draw views which are not natively supported by the EditText and Spannable API. \nThe functionality creates a span in the visual editor and draws an Android view over it. \nThe view is moved around when the user changes anything in the editor and allows you to draw things like video that can be played inline in the editor.\nIn order to use the API you have to create an instance of `PlaceholderManager` and initialize it in your `onCreate` call like this: \n\n```kotlin\nprivate lateinit var placeholderManager: PlaceholderManager\noverride fun onCreate(savedInstanceState: Bundle?) {\n    placeholderManager = PlaceholderManager(visualEditor, findViewById(R.id.container_frame_layout))\n    aztec.addPlugin(placeholderManager)\n    aztec.addOnMediaDeletedListener(placeholderManager)\n}\noverride fun onDestroy() {\n    placeholderManager.onDestroy()\n}\n```\n\nYou can create a custom `PlaceholderAdapter` to prepare and draw your view. \nYou can check the sample `ImageWithCaptionAdapter` which draws a simple Android view with an image and a caption. \nHowever, you can implement things like `YouTube` view or `Video` view with playback controls.\nDon't forget to register your `PlaceholderAdapter` like this: \n\n```kotlin\nplaceholderManager.registerAdapter(ImageWithCaptionAdapter())\n```\n\nOnce you have initialized both the manager and the adapter, you can use the manager methods to insert or remove placeholders.\n\n```kotlin\nplaceholderManager.insertItem(adapterType, attributes)\nplaceholderManager.removeItem(predicate)\n```\n\n\n## Code formatting\n\nWe use [ktlint](https://github.com/shyiko/ktlint) for Kotlin linting. You can run ktlint using `./gradlew ktlint`, and you can also run `./gradlew ktlintFormat` for auto-formatting. There is no IDEA plugin (like Checkstyle's) at this time.\n\n## Reference\n\n* [Spans, a Powerful Concept](http://flavienlaurent.com/blog/2014/01/31/spans/ \"Spans, a Powerful Concept.\").\n* [Spanned, Android Reference Documentation](http://developer.android.com/reference/android/text/Spanned.html \"Spanned | Android Developers\").\n* Aztec was inspired by [Knife](https://github.com/mthli/Knife).\n\n## License\n\nAztec is an open source project covered by the [Mozilla Public License Version 2.0](LICENSE.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwordpress-mobile%2Fazteceditor-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwordpress-mobile%2Fazteceditor-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwordpress-mobile%2Fazteceditor-android/lists"}