Skip to content

Commit

Permalink
fix: revert a recent PR that made the draggable attribute conditional (
Browse files Browse the repository at this point in the history
…#3379)

* fix: revert a recent PR that made the draggable attribute conditional

* chore: cut semver

* docs: add a step to remove .jsx extension from example code

* chore: update semver
  • Loading branch information
darthtrevino committed Feb 6, 2022
1 parent 89aa31d commit fa20dc8
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .yarn/versions/196dbc06.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
releases:
react-dnd-html5-backend: patch
react-dnd-examples: patch

declined:
- react-dnd-documentation
- test-suite-cra
- test-suite-vite
- react-dnd-test-utils
2 changes: 1 addition & 1 deletion packages/backend-html5/src/HTML5BackendImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export class HTML5BackendImpl implements Backend {
const handleDragStart = (e: any) => this.handleDragStart(e, sourceId)
const handleSelectStart = (e: any) => this.handleSelectStart(e)

node.setAttribute('draggable', '' + this.monitor.canDragSource(sourceId))
node.setAttribute('draggable', 'true')
node.addEventListener('dragstart', handleDragStart)
node.addEventListener('selectstart', handleSelectStart)

Expand Down
3 changes: 2 additions & 1 deletion packages/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
"build_esm": "swc -C module.type=es6 -d dist/esm src/",
"build_cjs": "swc -C module.type=commonjs -d dist/cjs src/",
"esm_hack": "node ../../scripts/esmify.mjs",
"jsx_hack": "node ../../scripts/unjsxify.mjs dist/docs",
"build_docs": "tsc -b tsconfig.docs.json",
"build": "run-s build_types build_esm build_cjs build_docs esm_hack"
"build": "run-s build_types build_esm build_cjs build_docs esm_hack jsx_hack"
},
"dependencies": {
"dnd-core": "workspace:packages/dnd-core",
Expand Down
32 changes: 32 additions & 0 deletions scripts/unjsxify.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* eslint-disable */
import fs from 'fs/promises'
import path from 'path'

const pathArg = process.argv[2]
console.log("process path ", pathArg)

async function processDir(dir) {
const entries = await fs.readdir(dir)
for (const entry of entries) {
const entryPath = path.join(dir, entry)
const stat = await fs.stat(entryPath)
if (stat.isDirectory()) {
await processDir(entryPath)
} else {
if (entryPath.endsWith('.jsx')) {
await jsx2jsName(entryPath)
}
}
}
}

function jsx2jsName(entryPath) {
const newPath = entryPath.replace('.jsx', '.js')
console.log(`${entryPath} => ${newPath}`)
return fs.rename(entryPath, newPath)
}

if (!pathArg) {
throw new Error('arg must be defined')
}
await processDir(pathArg)

0 comments on commit fa20dc8

Please sign in to comment.