Skip to content

Commit

Permalink
🐛 Fix not being able to copy multiple blocks in catnip
Browse files Browse the repository at this point in the history
  • Loading branch information
CosmoMyzrailGorynych committed Sep 19, 2024
1 parent 74b570d commit cbedbc2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/node_requires/catnip/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,9 @@ export const clearSelection = (): void => {
multipleSelection.clear();
redrawSelectedBlocks(previouslySelected, previousMap);
};
export const copySelected = () => {
clipboard = structuredClone(getTopBlocks([...multipleSelection.keys()]));
};
export const getSelectionHTML = (): void => {
const html = [];
const dummy = document.createElement('catnip-block');
Expand Down
4 changes: 2 additions & 2 deletions src/riotTags/catnip/catnip-block-list.tag
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ catnip-block-list(
this.namespace = 'catnip';
this.mixin(require('src/node_requires/riotMixins/voc').default);

const {getDeclaration, getMenuMutators, mutate, startBlocksTransmit, endBlocksTransmit, getTransmissionType, getSuggestedTarget, setSuggestedTarget, emptyTexture, copy, canPaste, paste, setSelection, toggleSelection, getSelectionHTML, isSelected, removeSelectedBlocks} = require('src/node_requires/catnip');
const {getDeclaration, getMenuMutators, mutate, startBlocksTransmit, endBlocksTransmit, getTransmissionType, getSuggestedTarget, setSuggestedTarget, emptyTexture, copySelected, canPaste, paste, setSelection, toggleSelection, getSelectionHTML, isSelected, removeSelectedBlocks} = require('src/node_requires/catnip');
const {isDev} = require('src/node_requires/platformUtils');

this.getSuggestedTarget = getSuggestedTarget;
Expand Down Expand Up @@ -149,7 +149,7 @@ catnip-block-list(
label: this.voc.copySelection,
icon: 'copy',
click: () => {
copy([this.contextBlock]);
copySelected();
this.contextBlock = false;
this.update();
}
Expand Down

0 comments on commit cbedbc2

Please sign in to comment.