Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Kenny50 opened this issue Aug 13, 2021 · 0 comments

Comments

@Kenny50
Copy link

Kenny50 commented Aug 13, 2021

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,我必須在胎顏面加一個段落標籤才能把他刪除,但有時插入影片後再打字,會跳到前一行文字

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant