提交 83062888 编写于 作者: 2 23700113@qq.com

feat: editor添加blur、getSelectionText、scrollIntoView方法

上级 7f36cd88
...@@ -17,7 +17,7 @@ UniServiceJSBridge.subscribe('onEditorMethodCallback', ({ ...@@ -17,7 +17,7 @@ UniServiceJSBridge.subscribe('onEditorMethodCallback', ({
callback.invoke(callbackId, data) callback.invoke(callbackId, data)
}) })
const methods = ['insertDivider', 'insertImage', 'insertText', 'setContents', 'getContents', 'clear', 'removeFormat', 'undo', 'redo'] const methods = ['insertDivider', 'insertImage', 'insertText', 'setContents', 'getContents', 'clear', 'removeFormat', 'undo', 'redo', 'blur', 'getSelectionText', 'scrollIntoView']
export class EditorContext { export class EditorContext {
constructor (id, pageId) { constructor (id, pageId) {
......
...@@ -205,6 +205,19 @@ export default { ...@@ -205,6 +205,19 @@ export default {
case 'redo': case 'redo':
quill.history.redo() quill.history.redo()
break break
case 'blur':
quill.blur()
break
case 'getSelectionText':
range = quill.selection.savedRange
res = { text: '' }
if (range && range.length !== 0) {
res.text = quill.getText(range.index, range.length)
}
break
case 'scrollIntoView':
quill.scrollIntoView()
break
default: default:
break break
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册