Posted 9 November 2021, 8:29 pm EST
Hey guys, i’m having problem with setting paste options. Basically what I want to achieve is to paste everything from the clipboard on ctrl+v if the content was copied from my spreadJS canvas, but copy only values if it was copied from for example google sheets, excel etc.
My current code looks something like:
spread.bind(GC.Spread.Sheets.Events.ClipboardPasting, (_, { sheet, pasteData }) => {
// this if just an example for checking if what's in clipboard comes from GS
if (pasteData.html.includes('<google-sheets-html-origin>')) {
sheet.options.clipBoardOptions = 1;
} else {
sheet.options.clipBoardOptions = 0;
}
});
The problem with this solution is that it changes after the pasting. For example I copy from google sheets, then I paste into spreadJS and it didn’t change but if i paste it once more, it works. It seems as if these options are being set too late but there isn’t any “beforeClipboardPaste” event or something. Thank you for the help!