easy-file-system 2.1.119 → 2.1.121
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/example.js +53 -36
- package/lib/explorer.js +20 -9
- package/lib/item/entry/drag.js +15 -22
- package/lib/span/name.js +14 -7
- package/package.json +2 -2
- package/src/explorer.js +27 -11
- package/src/item/entry/drag.js +17 -27
- package/src/span/name.js +15 -7
package/src/item/entry/drag.js
CHANGED
|
@@ -13,17 +13,17 @@ import { adjustSourceEntryPath, adjustTargetEntryPath } from "../../utilities/pa
|
|
|
13
13
|
|
|
14
14
|
class DragEntryItem extends EntryItem {
|
|
15
15
|
nameSpanChangeHandler = (event, element) => {
|
|
16
|
-
const
|
|
16
|
+
const created = this.isCreated(),
|
|
17
|
+
explorer = this.getExplorer(),
|
|
18
|
+
nameSpanName = this.getNameSpanName();
|
|
17
19
|
|
|
18
|
-
if (
|
|
20
|
+
if ((nameSpanName === PERIOD) || (nameSpanName === EMPTY_STRING)) {
|
|
19
21
|
this.cancel();
|
|
20
22
|
|
|
21
23
|
return;
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
const
|
|
25
|
-
explorer = this.getExplorer(),
|
|
26
|
-
dragEntryItem = this; ///
|
|
26
|
+
const dragEntryItem = this; ///
|
|
27
27
|
|
|
28
28
|
this.reset();
|
|
29
29
|
|
|
@@ -85,16 +85,6 @@ class DragEntryItem extends EntryItem {
|
|
|
85
85
|
return selected;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
hasNameChanged() {
|
|
89
|
-
const name = this.getName(),
|
|
90
|
-
nameSpanName = this.getNameSpanName(),
|
|
91
|
-
nameChanged = (name !== PERIOD) ?
|
|
92
|
-
(nameSpanName !== name) :
|
|
93
|
-
(nameSpanName !== EMPTY_STRING); ///
|
|
94
|
-
|
|
95
|
-
return nameChanged;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
88
|
isReadOnly() {
|
|
99
89
|
const { readOnly } = this.properties;
|
|
100
90
|
|
|
@@ -209,31 +199,31 @@ class DragEntryItem extends EntryItem {
|
|
|
209
199
|
explorer.disable();
|
|
210
200
|
}
|
|
211
201
|
|
|
212
|
-
reset() {
|
|
213
|
-
const created = this.isCreated(),
|
|
214
|
-
explorer = this.getExplorer();
|
|
215
|
-
|
|
216
|
-
this.cancelNameSpan();
|
|
217
|
-
|
|
218
|
-
this.setCreated(created);
|
|
219
|
-
|
|
220
|
-
explorer.enable();
|
|
221
|
-
}
|
|
222
|
-
|
|
223
202
|
cancel() {
|
|
224
203
|
const name = this.getName(),
|
|
225
204
|
created = this.isCreated(),
|
|
205
|
+
explorer = this.getExplorer(),
|
|
226
206
|
nameSpanName = name; ///
|
|
227
207
|
|
|
228
208
|
this.setNameSpanName(nameSpanName);
|
|
229
209
|
|
|
230
|
-
this.
|
|
210
|
+
this.resetNameSpan();
|
|
211
|
+
|
|
212
|
+
explorer.enable(); ///
|
|
231
213
|
|
|
232
214
|
if (created) {
|
|
233
215
|
this.remove();
|
|
234
216
|
}
|
|
235
217
|
}
|
|
236
218
|
|
|
219
|
+
reset() {
|
|
220
|
+
const explorer = this.getExplorer();
|
|
221
|
+
|
|
222
|
+
this.resetNameSpan();
|
|
223
|
+
|
|
224
|
+
explorer.enable();
|
|
225
|
+
}
|
|
226
|
+
|
|
237
227
|
didMount() {
|
|
238
228
|
this.onStopDrag(this.stopDragHandler);
|
|
239
229
|
|
package/src/span/name.js
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
import withStyle from "easy-with-style"; ///
|
|
4
4
|
|
|
5
5
|
import { keyCodes, arrayUtilities } from "necessary";
|
|
6
|
+
import { Element, window, document } from "easy";
|
|
6
7
|
|
|
7
8
|
import nameSpanMixins from "../mixins/nameSpan";
|
|
8
9
|
|
|
9
10
|
import { TRUE, CONTENT_EDITABLE } from "../constants";
|
|
10
|
-
import { Element, window, document } from "easy";
|
|
11
11
|
|
|
12
12
|
const { first } = arrayUtilities,
|
|
13
13
|
{ ENTER_KEY_CODE, ESCAPE_KEY_CODE } = keyCodes;
|
|
@@ -38,9 +38,17 @@ class NameSpan extends Element {
|
|
|
38
38
|
|
|
39
39
|
setName(name) {
|
|
40
40
|
const domElement = this.getDOMElement(),
|
|
41
|
-
{
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
{ firstChild } = domElement;
|
|
42
|
+
|
|
43
|
+
let textNode;
|
|
44
|
+
|
|
45
|
+
if (firstChild !== null) {
|
|
46
|
+
textNode = firstChild; ///
|
|
47
|
+
} else {
|
|
48
|
+
textNode = document.createTextNode();
|
|
49
|
+
|
|
50
|
+
domElement.appendChild(textNode);
|
|
51
|
+
}
|
|
44
52
|
|
|
45
53
|
textNode.nodeValue = name; ///
|
|
46
54
|
}
|
|
@@ -70,7 +78,7 @@ class NameSpan extends Element {
|
|
|
70
78
|
this.onKeyDown(this.keyDownHandler);
|
|
71
79
|
}
|
|
72
80
|
|
|
73
|
-
|
|
81
|
+
reset() {
|
|
74
82
|
this.offKeyDown(this.keyDownHandler);
|
|
75
83
|
|
|
76
84
|
this.removeAttribute(CONTENT_EDITABLE, TRUE);
|
|
@@ -78,7 +86,7 @@ class NameSpan extends Element {
|
|
|
78
86
|
|
|
79
87
|
parentContext() {
|
|
80
88
|
const editNameSpan = this.edit.bind(this), ///
|
|
81
|
-
|
|
89
|
+
resetNameSpan = this.reset.bind(this), ///
|
|
82
90
|
getNameSpanName = this.getName.bind(this), ///
|
|
83
91
|
setNameSpanName = this.setName.bind(this), ///
|
|
84
92
|
onNameSpanChange = this.onChange.bind(this), ///
|
|
@@ -88,7 +96,7 @@ class NameSpan extends Element {
|
|
|
88
96
|
|
|
89
97
|
return ({
|
|
90
98
|
editNameSpan,
|
|
91
|
-
|
|
99
|
+
resetNameSpan,
|
|
92
100
|
getNameSpanName,
|
|
93
101
|
setNameSpanName,
|
|
94
102
|
onNameSpanChange,
|