Skip to content

Commit c8a5e8a

Browse files
committed
- skip cell copy/cut if we are editing in textarea to preserve content editing experience.
- bump version
1 parent 2af26e6 commit c8a5e8a

File tree

8 files changed

+33
-22
lines changed

8 files changed

+33
-22
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Logs
22

3+
## v0.6.7
4+
5+
- skip cell copy/cut if we are editing in textarea to preserve content editing experience.
6+
7+
38
## v0.6.6
49

510
- add `enableScrolling` option for enabling scrolling which by default is true

dist/index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,15 @@
350350
if (e.keyCode === 86 && (e.metaKey || e.ctrlKey)) {
351351
return;
352352
}
353-
if (e.keyCode === 67 && (e.metaKey || e.ctrlKey)) {
354-
return this$.copy();
355-
}
356-
if (e.keyCode === 88 && (e.metaKey || e.ctrlKey)) {
357-
return this$.copy({
358-
cut: true
359-
});
353+
if (!this$.editing.on) {
354+
if (e.keyCode === 67 && (e.metaKey || e.ctrlKey)) {
355+
return this$.copy();
356+
}
357+
if (e.keyCode === 88 && (e.metaKey || e.ctrlKey)) {
358+
return this$.copy({
359+
cut: true
360+
});
361+
}
360362
}
361363
if (!this$.eventInScope(e)) {
362364
return;

dist/index.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "@plotdb/sheet",
44
"license": "MIT",
55
"description": "spreadsheet",
6-
"version": "0.6.6",
6+
"version": "0.6.7",
77
"style": "dist/index.min.css",
88
"browser": "dist/index.min.js",
99
"main": "dist/index.min.js",

src/index.ls

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,10 @@ sheet.prototype = Object.create(Object.prototype) <<< do
171171
@dom.textarea.addEventListener \keydown, (e) ~>
172172
code = e.keyCode
173173
if e.keyCode == 86 and (e.metaKey or e.ctrlKey) => return # handled by paste event
174-
if e.keyCode == 67 and (e.metaKey or e.ctrlKey) => return @copy!
175-
if e.keyCode == 88 and (e.metaKey or e.ctrlKey) => return @copy cut: true
174+
# if we are currently editing, let OS take care of copy/cut for us.
175+
if !@editing.on =>
176+
if e.keyCode == 67 and (e.metaKey or e.ctrlKey) => return @copy!
177+
if e.keyCode == 88 and (e.metaKey or e.ctrlKey) => return @copy cut: true
176178
if !@event-in-scope(e) => return
177179
if code == 8 =>
178180
if !@les.node => return
@@ -686,7 +688,7 @@ sheet.prototype = Object.create(Object.prototype) <<< do
686688
# - to reproduce: remove setTimeout, click on random cell, try pressing right arrow key.
687689
# sometimes selection moves, sometimes not.
688690
# - perhaps this is because we do render-selection in mousedown,
689-
# and click event send focus to clicked element. if this is the case,
691+
# and click event send focus to clicked element. if this is the case,
690692
# we may need to prevent refocusing once textarea.focus is on going. TODO
691693
setTimeout (~> @dom.textarea.focus!), 0
692694

web/static/assets/lib/@plotdb/sheet/dev/index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,15 @@
350350
if (e.keyCode === 86 && (e.metaKey || e.ctrlKey)) {
351351
return;
352352
}
353-
if (e.keyCode === 67 && (e.metaKey || e.ctrlKey)) {
354-
return this$.copy();
355-
}
356-
if (e.keyCode === 88 && (e.metaKey || e.ctrlKey)) {
357-
return this$.copy({
358-
cut: true
359-
});
353+
if (!this$.editing.on) {
354+
if (e.keyCode === 67 && (e.metaKey || e.ctrlKey)) {
355+
return this$.copy();
356+
}
357+
if (e.keyCode === 88 && (e.metaKey || e.ctrlKey)) {
358+
return this$.copy({
359+
cut: true
360+
});
361+
}
360362
}
361363
if (!this$.eventInScope(e)) {
362364
return;

web/static/assets/lib/@plotdb/sheet/dev/index.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)