mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-17 12:41:44 +02:00
refactor core onPaste handler
This commit is contained in:
@@ -284,8 +284,9 @@ function Plugin(options = {}) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
onPaste(e, paste, state, editor) {
|
onPaste(e, paste, state, editor) {
|
||||||
if (paste.type == 'files') return
|
switch (paste.type) {
|
||||||
|
case 'text':
|
||||||
|
case 'html': {
|
||||||
let transform = state.transform()
|
let transform = state.transform()
|
||||||
|
|
||||||
paste.text
|
paste.text
|
||||||
@@ -296,6 +297,8 @@ function Plugin(options = {}) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
return transform.apply()
|
return transform.apply()
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user