mirror of
https://github.com/leanote/leanote-android.git
synced 2026-01-13 07:03:54 +08:00
toggle icon when state of header changed; set content in silent
This commit is contained in:
@@ -21,7 +21,8 @@ public abstract class Editor {
|
||||
ITALIC,
|
||||
ORDER_LIST,
|
||||
UNORDER_LIST,
|
||||
BLOCK_QUOTE;
|
||||
HEADER,
|
||||
BLOCK_QUOTE
|
||||
}
|
||||
|
||||
protected EditorListener mListener;
|
||||
|
||||
@@ -78,6 +78,9 @@ public class QuillCallbackHandler {
|
||||
case "blockquote":
|
||||
formatStatusMap.put(Editor.Style.BLOCK_QUOTE, getBoolean((Boolean) format.getValue()));
|
||||
break;
|
||||
case "header":
|
||||
Double headerLevel = ((Double)format.getValue());
|
||||
formatStatusMap.put(Editor.Style.HEADER, headerLevel != null && headerLevel > 0);
|
||||
}
|
||||
}
|
||||
return formatStatusMap;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class RichTextEditor extends Editor implements OnJsEditorStateChangedList
|
||||
|
||||
@Override
|
||||
public void setContent(String content) {
|
||||
execJs(String.format(Locale.US, "quill.pasteHTML('%s');", HtmlUtils.escapeHtml(content)));
|
||||
execJs(String.format(Locale.US, "quill.pasteHTML('%s', 'silent');", HtmlUtils.escapeHtml(content)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -331,6 +331,11 @@ public class EditorFragment extends Fragment implements Editor.EditorListener {
|
||||
case BLOCK_QUOTE:
|
||||
mQuoteBtn.setChecked(enabled);
|
||||
break;
|
||||
case HEADER:
|
||||
if (mHeadingBtn != null) {
|
||||
mHeadingBtn.setChecked(enabled);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -357,6 +362,11 @@ public class EditorFragment extends Fragment implements Editor.EditorListener {
|
||||
case UNORDER_LIST:
|
||||
mUnorderListBtn.setChecked(enabled);
|
||||
break;
|
||||
case HEADER:
|
||||
if (mHeadingBtn != null) {
|
||||
mHeadingBtn.setChecked(enabled);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
app/src/main/res/drawable-xxhdpi/ic_header_richtext_disable.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_header_richtext_disable.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 268 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_header_richtext_enable.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_header_richtext_enable.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 270 B |
@@ -42,8 +42,8 @@
|
||||
<org.houxg.leamonax.widget.ToggleImageButton
|
||||
android:id="@+id/btn_heading"
|
||||
style="@style/FormatButton"
|
||||
app:checkedDrawable="@drawable/ic_heading_enable"
|
||||
app:uncheckedDrawable="@drawable/ic_heading_disable" />
|
||||
app:checkedDrawable="@drawable/ic_header_richtext_enable"
|
||||
app:uncheckedDrawable="@drawable/ic_header_richtext_disable" />
|
||||
|
||||
<org.houxg.leamonax.widget.ToggleImageButton
|
||||
android:id="@+id/btn_unorder_list"
|
||||
|
||||
Reference in New Issue
Block a user