mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-12 20:10:09 +02:00
Redesign idea (#343)
* Redisign idea * Code cleanup * Fixed to right container * Reoredered layout * Reordering panels * Export dialog * Removed redunant code * Fixed not removing temp canvas * Fixed preview not using only selected elements * Returned file name on export * Toggle export selected/all elements * Hide copy to clipboard button if no support of clipboard * Added border to swatches * Fixed modal flickering
This commit is contained in:

committed by
Christopher Chedeau

parent
8104c8525d
commit
79aee53ff6
17
src/utils.ts
17
src/utils.ts
@@ -62,3 +62,20 @@ export function debounce<T extends any[]>(
|
||||
handle = window.setTimeout(() => fn(...args), timeout);
|
||||
};
|
||||
}
|
||||
|
||||
export function selectNode(node: Element) {
|
||||
const selection = window.getSelection();
|
||||
if (selection) {
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(node);
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
}
|
||||
}
|
||||
|
||||
export function removeSelection() {
|
||||
const selection = window.getSelection();
|
||||
if (selection) {
|
||||
selection.removeAllRanges();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user