AztecEditor-Android

by wordpress-mobile

wordpress-mobile / AztecEditor-Android

A reusable native Android rich text editor component.

489 Stars 82 Forks Last release: 29 days ago (v1.3.45) Mozilla Public License 2.0 3.3K Commits 77 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Aztec Logo Aztec: Native HTML Editor for Android

CircleCI

Aztec (which extends EditText) is a rich-text editor component for writing HTML documents in Android.

Supports Android 4.1+ (API 16 - Jelly Bean)

Visual Editor Visual Editor

Getting started

Declare the main components in your layout:

Visual editor

XML

Source editor
XML

Toolbar

XML

Inflate the views:

kotlin
val visualEditor = findViewById(R.id.visual)
val sourceEditor = findViewById(R.id.source)
val toolbar = findViewById(R.id.formatting_toolbar)

Configure Aztec with a provided image & video loaders:

kotlin
Aztec.with(visualEditor, sourceEditor, toolbar, context)
    .setImageGetter(GlideImageLoader(context))
    .setVideoThumbnailGetter(GlideVideoThumbnailLoader(context))

For more options, such as edit history, listeners and plugins please refer to the demo app implementation.

Build and test

Build the library, build the example project and run unit tests:

$ ./gradlew build

Run unit tests only:

$ ./gradlew test

Before running instrumentation tests

Espresso advises disabling system animations on devices used for testing:

On your device, under Settings->Developer options disable the following 3 settings:

  • Window animation scale
  • Transition animation scale
  • Animator duration scale

One additional setup step is also required to handle an Espresso issue with clicks (see the caveats below):

On your device, under Settings -> Accessibility -> Touch & hold delay, set the delay to

Long
.

Run the instrumentation tests:

$ ./gradlew cAT

Integrating Aztec in your project

You can import Aztec into your project using Jitpack:

gradle
repositories {
    maven { url "https://jitpack.io" }
}
gradle
dependencies {
    api ('com.github.wordpress-mobile.WordPress-Aztec-Android:aztec:v1.3.44')
}

Brave developers can either use the project as a source distribution or have fun with the latest snapshot at their own risk:

dependencies {
    api ('com.github.wordpress-mobile.WordPress-Aztec-Android:aztec:develop-SNAPSHOT')
}

Code formatting

We use 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.

Reference

License

Aztec is an open source project covered by the Mozilla Public License Version 2.0.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.