Skip to content

Commit 576043d

Browse files
authored
Merge pull request #656 from wordpress-mobile/feature/Aztec-for-React-Native-step-two
[Aztec for RN] Hide the HTML button if source editor is not set
2 parents a0427b3 + bf1124a commit 576043d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/source/SourceViewEditText.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import org.wordpress.aztec.spans.AztecCursorSpan
2222
import org.wordpress.aztec.util.InstanceStateUtils
2323

2424
@SuppressLint("SupportAnnotationUsage")
25-
class SourceViewEditText : android.support.v7.widget.AppCompatEditText, TextWatcher {
25+
open class SourceViewEditText : android.support.v7.widget.AppCompatEditText, TextWatcher {
2626
companion object {
2727
val RETAINED_CONTENT_KEY = "RETAINED_CONTENT_KEY"
2828
}

aztec/src/main/kotlin/org/wordpress/aztec/toolbar/AztecToolbar.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class AztecToolbar : FrameLayout, IAztecToolbar, OnMenuItemClickListener {
5858
private lateinit var layoutExpandedTranslateInEnd: Animation
5959
private lateinit var layoutExpandedTranslateOutStart: Animation
6060

61+
private lateinit var htmlButton: RippleToggleButton
6162
private lateinit var buttonMediaCollapsed: RippleToggleButton
6263
private lateinit var buttonMediaExpanded: RippleToggleButton
6364

@@ -372,6 +373,10 @@ class AztecToolbar : FrameLayout, IAztecToolbar, OnMenuItemClickListener {
372373
highlightAppliedStyles(selStart, selEnd)
373374
}
374375
})
376+
377+
if (sourceEditor == null) {
378+
htmlButton.visibility = View.GONE
379+
}
375380
}
376381

377382
private fun initView(attrs: AttributeSet?) {
@@ -384,6 +389,7 @@ class AztecToolbar : FrameLayout, IAztecToolbar, OnMenuItemClickListener {
384389
View.inflate(context, layout, this)
385390

386391
toolbarScrolView = findViewById(R.id.format_bar_button_scroll)
392+
htmlButton = findViewById(R.id.format_bar_button_html)
387393

388394
setAdvancedState()
389395
setupMediaToolbar()

0 commit comments

Comments
 (0)