Browse Source
Using Components.canMove() for validation
- shifted to canMove() for paste validation
- fixed typo
pull/4243/head
Muhammad Junaid
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
1 additions and
5 deletions
-
src/commands/view/PasteComponent.js
|
|
|
@ -5,7 +5,6 @@ export default { |
|
|
|
const em = ed.getModel(); |
|
|
|
const clp = em.get('clipboard'); |
|
|
|
const selected = ed.getSelected(); |
|
|
|
const sorter = ed.BlockManager.getConfig().getSorter(); |
|
|
|
|
|
|
|
if (clp && selected) { |
|
|
|
ed.getSelectedAll().forEach(comp => { |
|
|
|
@ -18,10 +17,7 @@ export default { |
|
|
|
const at = coll.indexOf(comp) + 1; |
|
|
|
const addOpts = { at, action: opts.action || 'paste-component' }; |
|
|
|
const copyable = clp.filter(cop => cop.get('copyable')); |
|
|
|
const pasteable = copyable.filter(cop => { |
|
|
|
return sorter.validTarget(cop.getEl(), selected.getEl()).valid |
|
|
|
|| sorter.validTarget(cop.parent()?.getEl(), selected.getEl()).valid; |
|
|
|
}); |
|
|
|
const pasteable = copyable.filter(cop => editor.Components.canMove(comp.parent(), cop).result); |
|
|
|
|
|
|
|
if (contains(clp, comp) && comp.get('copyable')) { |
|
|
|
added = coll.add(comp.clone(), addOpts); |
|
|
|
|