wasabeef / richeditor-android

RichEditor for Android is a beautiful Rich Text WYSIWYG Editor for Android.
Apache License 2.0
6.24k stars 1.2k forks source link

Is there a proper way to edit img and video?/有更合適的方法編輯圖片影片嗎? #266

Open Kenny50 opened 3 years ago

Kenny50 commented 3 years ago

I hope a intuition behavior when using editor, which means every time I insert img or video, they should change to a new line, more importantly be able to remove by backspace and Actually I done this function by

class MRich @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null)
    : RichEditor(context, attrs){

    override fun insertImage(url: String?, alt: String?) {
        exec("javascript:RE.prepareInsert();")
        exec("javascript:RE.insertHTML('<img src=\"$url\" alt=\"$alt\" width=\"100%\"><br><br>');")
    }

    override fun insertVideo(url: String?) {
        exec("javascript:RE.prepareInsert();")
        exec("javascript:RE.insertHTML('</p><video src=\"$url\" width=\"100%\" controls=\"\"></video><br><br>')")
    }
}

although it fit the purpose, but I think it will be more user friendly when click the img or video, the Cursor should show after img/video, therefore user can easily delete it. Currently I had to delete it from the line under it.

p.s. far as I know,

before it, so I can delete it, but I can't have 100% control of cursor, sometimes when I insert a video then type, they jump previous line.

--------------------------------中------------------------------- 我希望能夠直覺的編輯圖片和影片,需求是插入後自動跳行,並且可以透過鍵盤來刪除,我現在透過上面的代碼完成這些功能,但同時我也遇到新的問題

對用戶更直覺的方法應該是點擊圖片/影片後,游標會移動到圖片/影片後面,就可以立刻刪除,現在只能從他下面的一行開始刪 p.s.video是block element,我必須在胎顏面加一個段落標籤才能把他刪除,但有時插入影片後再打字,會跳到前一行文字