Skip to content

Commit 678154b

Browse files
committed
Revert HTML toggle method
1 parent e84ffe4 commit 678154b

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ class AztecToolbar : FrameLayout, OnMenuItemClickListener {
258258
editor!!.visibility = View.GONE
259259
sourceEditor!!.visibility = View.VISIBLE
260260

261-
enableFormatButtons(false)
261+
toggleHtmlMode(true)
262262
} else {
263263
toggleButton(findViewById(ToolbarAction.HTML.buttonId), false)
264264
showMediaUploadDialog()
@@ -268,7 +268,7 @@ class AztecToolbar : FrameLayout, OnMenuItemClickListener {
268268
editor!!.visibility = View.VISIBLE
269269
sourceEditor!!.visibility = View.GONE
270270

271-
enableFormatButtons(true)
271+
toggleHtmlMode(false)
272272
}
273273
}
274274

@@ -312,16 +312,24 @@ class AztecToolbar : FrameLayout, OnMenuItemClickListener {
312312
return null
313313
}
314314

315-
fun enableFormatButtons(isEnabled: Boolean) {
315+
private fun toggleHtmlMode(isHtmlMode: Boolean) {
316316
ToolbarAction.values().forEach { action ->
317317
if (action == ToolbarAction.HTML) {
318-
toggleButton(findViewById(action.buttonId), !isEnabled)
318+
toggleButton(findViewById(action.buttonId), isHtmlMode)
319319
} else {
320-
toggleButtonState(findViewById(action.buttonId), isEnabled)
320+
toggleButtonState(findViewById(action.buttonId), !isHtmlMode)
321321
}
322322
}
323323
}
324324

325+
fun enableFormatButtons(isEnabled: Boolean) {
326+
ToolbarAction.values().forEach { action ->
327+
if (action != ToolbarAction.HTML) {
328+
toggleButtonState(findViewById(action.buttonId), isEnabled)
329+
}
330+
}
331+
}
332+
325333
private fun showMediaUploadDialog() {
326334
if (!isEditorAttached()) return
327335

0 commit comments

Comments
 (0)