dsh-cad-studio 0.26.0 → 0.26.1

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.
Files changed (2) hide show
  1. package/client.js +17 -4
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -1097,6 +1097,21 @@ window.__ModuleLoader__.load({
1097
1097
  // better-sidebar matches on the extension WITHOUT the dot (see its builtin
1098
1098
  // viewers: ['md','markdown']), so a dot-prefixed list would never match.
1099
1099
  /** mm³ → a unit a human reads without counting zeros (1 L = 1e6 mm³). */
1100
+ // Ctrl+Z belongs to the panel whenever the focus is not in a text field.
1101
+ // Checking the tag alone is wrong: a range slider (opacity) is an INPUT too,
1102
+ // and while it keeps focus after a drag every undo press was swallowed until
1103
+ // the popover closed. Only elements that actually edit text keep the browser's
1104
+ // own undo.
1105
+ const TEXT_INPUT_TYPES = new Set(['', 'text', 'search', 'url', 'tel', 'email', 'password', 'number', 'date', 'time', 'datetime-local', 'month', 'week'])
1106
+ function isTextEntry(el) {
1107
+ if (!el || !el.tagName) return false
1108
+ const tag = String(el.tagName).toLowerCase()
1109
+ if (tag === 'textarea') return true
1110
+ if (el.isContentEditable) return true
1111
+ if (tag !== 'input') return false
1112
+ return TEXT_INPUT_TYPES.has(String(el.type || 'text').toLowerCase())
1113
+ }
1114
+
1100
1115
  function formatVolume(mm3) {
1101
1116
  const v = Number(mm3) || 0
1102
1117
  if (v >= 1e6) return `${(v / 1e6).toFixed(2)} L`
@@ -1685,8 +1700,7 @@ const FILE_EXTS = ['step', 'stp', 'iges', 'igs', 'brep', 'stl']
1685
1700
  if (!(event.ctrlKey || event.metaKey)) return
1686
1701
  if (key !== 'z' && key !== 'y') return
1687
1702
  const target = event.target
1688
- const tag = target && target.tagName ? target.tagName.toLowerCase() : ''
1689
- if (tag === 'input' || tag === 'textarea' || tag === 'select' || (target && target.isContentEditable)) return
1703
+ if (isTextEntry(target)) return
1690
1704
  if (panelRef.current === 'features') return
1691
1705
  const host = panelRootRef.current
1692
1706
  const focused = document.activeElement
@@ -2073,8 +2087,7 @@ const FILE_EXTS = ['step', 'stp', 'iges', 'igs', 'brep', 'stl']
2073
2087
  : []
2074
2088
  useEffect(() => {
2075
2089
  const onKey = (event) => {
2076
- const tag = (event.target && event.target.tagName) || ''
2077
- if (/^(INPUT|TEXTAREA|SELECT)$/.test(tag)) return
2090
+ if (isTextEntry(event.target)) return
2078
2091
  if (!(event.metaKey || event.ctrlKey) || !featureModel) return
2079
2092
  const key = String(event.key || '').toLowerCase()
2080
2093
  if (key === 'z') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-cad-studio",
3
- "version": "0.26.0",
3
+ "version": "0.26.1",
4
4
  "type": "module",
5
5
  "description": "CAD Studio — FreeCAD 桥(给 AI 的 14 个工具)+ Web 右栏 3D 面板:建模/装配/关节运动/出图/多页签查看",
6
6
  "exports": {