@dfosco/storyboard-react 4.0.0-beta.7 → 4.0.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/canvas/CanvasPage.jsx +19 -10
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dfosco/storyboard-react",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@dfosco/storyboard-core": "4.0.0-beta.
|
|
7
|
-
"@dfosco/tiny-canvas": "4.0.0-beta.
|
|
6
|
+
"@dfosco/storyboard-core": "4.0.0-beta.9",
|
|
7
|
+
"@dfosco/tiny-canvas": "4.0.0-beta.9",
|
|
8
8
|
"@neodrag/react": "^2.3.1",
|
|
9
9
|
"glob": "^11.0.0",
|
|
10
10
|
"jsonc-parser": "^3.3.1",
|
|
@@ -1006,22 +1006,31 @@ export default function CanvasPage({ name }) {
|
|
|
1006
1006
|
e.preventDefault()
|
|
1007
1007
|
setSelectedWidgetIds(new Set())
|
|
1008
1008
|
}
|
|
1009
|
-
// Copy
|
|
1009
|
+
// Copy shortcuts (single widget selected):
|
|
1010
|
+
// - cmd+c → copy URL/content
|
|
1011
|
+
// - Shift+C (no cmd) → copy widget ID (or file path for images)
|
|
1010
1012
|
const mod = e.metaKey || e.ctrlKey
|
|
1011
|
-
if (mod && e.key === 'c' && selectedWidgetIds.size === 1) {
|
|
1013
|
+
if (mod && e.key === 'c' && !e.shiftKey && selectedWidgetIds.size === 1) {
|
|
1012
1014
|
const widgetId = [...selectedWidgetIds][0]
|
|
1013
1015
|
const widget = localWidgets?.find(w => w.id === widgetId)
|
|
1014
1016
|
if (widget) {
|
|
1015
1017
|
e.preventDefault()
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
navigator.clipboard.writeText(
|
|
1018
|
+
const url = getWidgetCopyableUrl(widget)
|
|
1019
|
+
if (url) {
|
|
1020
|
+
navigator.clipboard.writeText(url).catch(() => {})
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
// Shift+C (uppercase C, no cmd) → copy ID or file path
|
|
1025
|
+
if (e.key === 'C' && e.shiftKey && !mod && selectedWidgetIds.size === 1) {
|
|
1026
|
+
const widgetId = [...selectedWidgetIds][0]
|
|
1027
|
+
const widget = localWidgets?.find(w => w.id === widgetId)
|
|
1028
|
+
if (widget) {
|
|
1029
|
+
e.preventDefault()
|
|
1030
|
+
if (widget.type === 'image' && widget.props?.src) {
|
|
1031
|
+
navigator.clipboard.writeText(`src/canvas/images/${widget.props.src}`).catch(() => {})
|
|
1019
1032
|
} else {
|
|
1020
|
-
|
|
1021
|
-
const url = getWidgetCopyableUrl(widget)
|
|
1022
|
-
if (url) {
|
|
1023
|
-
navigator.clipboard.writeText(url).catch(() => {})
|
|
1024
|
-
}
|
|
1033
|
+
navigator.clipboard.writeText(widgetId).catch(() => {})
|
|
1025
1034
|
}
|
|
1026
1035
|
}
|
|
1027
1036
|
}
|