easy-file-system 2.1.14 → 2.1.17

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.
@@ -27,23 +27,25 @@ class DragEntryItem extends EntryItem {
27
27
 
28
28
  if (created) {
29
29
  explorer.createDragEntryItem(dragEntryItem, () => {
30
- this.cancel();
30
+ this.done();
31
31
  });
32
32
 
33
33
  return;
34
34
  }
35
35
 
36
36
  explorer.renameDragEntryItem(dragEntryItem, () => {
37
- this.cancel();
37
+ this.done();
38
38
  });
39
39
  }
40
40
 
41
41
  nameSpanCancelHandler = (event, element) => {
42
42
  const created = this.isCreated();
43
43
 
44
- created ?
45
- this.remove() :
46
- this.cancel();
44
+ if (created) {
45
+ this.remove();
46
+ }
47
+
48
+ this.done();
47
49
  }
48
50
 
49
51
  startDragHandler = (element) => {
@@ -172,6 +174,8 @@ class DragEntryItem extends EntryItem {
172
174
  this.setNameSpanName(nameSpanName);
173
175
 
174
176
  this.editNameSpan();
177
+
178
+ this.disableDrag();
175
179
  }
176
180
 
177
181
  edit() {
@@ -184,15 +188,19 @@ class DragEntryItem extends EntryItem {
184
188
  this.setNameSpanName(nameSpanName);
185
189
 
186
190
  this.editNameSpan();
191
+
192
+ this.disableDrag();
187
193
  }
188
194
 
189
- cancel() {
195
+ done() {
190
196
  const name = this.getName(),
191
197
  nameSpanName = name; ///
192
198
 
193
199
  this.setNameSpanName(nameSpanName);
194
200
 
195
201
  this.cancelNameSpan();
202
+
203
+ this.enableDrag();
196
204
  }
197
205
 
198
206
  didMount() {
package/src/span/name.js CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  import withStyle from "easy-with-style"; ///
4
4
 
5
- import { arrayUtilities } from "necessary";
5
+ import { keyCodes, arrayUtilities } from "necessary";
6
6
 
7
7
  import nameSpanMixins from "../mixins/nameSpan";
8
8
 
9
+ import { TRUE, CONTENT_EDITABLE } from "../constants";
9
10
  import { Element, window, document } from "easy";
10
- import { ENTER_KEY_CODE, ESCAPE_KEY_CODE } from "../keyCodes";
11
- import { ROLE, TRUE, TEXTBOX, CONTENT_EDITABLE } from "../constants";
12
11
 
13
- const { first } = arrayUtilities;
12
+ const { first } = arrayUtilities,
13
+ { ENTER_KEY_CODE, ESCAPE_KEY_CODE } = keyCodes;
14
14
 
15
15
  class NameSpan extends Element {
16
16
  keyDownHandler = (event, element) => {
@@ -30,7 +30,8 @@ class NameSpan extends Element {
30
30
  }
31
31
 
32
32
  isEditable() {
33
- const editable = this.hasClass("editable");
33
+ const contentEditable = this.hasAttribute(CONTENT_EDITABLE),
34
+ editable = contentEditable; ///
34
35
 
35
36
  return editable;
36
37
  }
@@ -54,10 +55,6 @@ class NameSpan extends Element {
54
55
  edit() {
55
56
  this.focus();
56
57
 
57
- this.addClass("editable");
58
-
59
- this.addAttribute(ROLE, TEXTBOX);
60
-
61
58
  this.addAttribute(CONTENT_EDITABLE, TRUE);
62
59
 
63
60
  const html = this.html(),
@@ -83,10 +80,6 @@ class NameSpan extends Element {
83
80
  cancel() {
84
81
  this.offKeyDown(this.keyDownHandler);
85
82
 
86
- this.removeClass("editable");
87
-
88
- this.removeAttribute(ROLE, TEXTBOX);
89
-
90
83
  this.removeAttribute(CONTENT_EDITABLE, TRUE);
91
84
  }
92
85
 
@@ -133,7 +126,7 @@ export default withStyle(NameSpan)`
133
126
  font-weight: inherit;
134
127
  font-family: inherit;
135
128
 
136
- .editable {
129
+ [contentEditable] {
137
130
  border: 1px solid black;
138
131
  padding: 4px;
139
132
  }
package/lib/keyCodes.js DELETED
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- ENTER_KEY_CODE: function() {
13
- return ENTER_KEY_CODE;
14
- },
15
- ESCAPE_KEY_CODE: function() {
16
- return ESCAPE_KEY_CODE;
17
- },
18
- DELETE_KEY_CODE: function() {
19
- return DELETE_KEY_CODE;
20
- },
21
- BACKSPACE_KEY_CODE: function() {
22
- return BACKSPACE_KEY_CODE;
23
- }
24
- });
25
- var ENTER_KEY_CODE = 13;
26
- var ESCAPE_KEY_CODE = 27;
27
- var DELETE_KEY_CODE = 46;
28
- var BACKSPACE_KEY_CODE = 8;
29
-
30
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9rZXlDb2Rlcy5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuZXhwb3J0IGNvbnN0IEVOVEVSX0tFWV9DT0RFID0gMTM7XG5leHBvcnQgY29uc3QgRVNDQVBFX0tFWV9DT0RFID0gMjc7XG5leHBvcnQgY29uc3QgREVMRVRFX0tFWV9DT0RFID0gNDY7XG5leHBvcnQgY29uc3QgQkFDS1NQQUNFX0tFWV9DT0RFID0gODtcbiJdLCJuYW1lcyI6WyJFTlRFUl9LRVlfQ09ERSIsIkVTQ0FQRV9LRVlfQ09ERSIsIkRFTEVURV9LRVlfQ09ERSIsIkJBQ0tTUEFDRV9LRVlfQ09ERSJdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7O0lBRWFBLGNBQWM7ZUFBZEE7O0lBQ0FDLGVBQWU7ZUFBZkE7O0lBQ0FDLGVBQWU7ZUFBZkE7O0lBQ0FDLGtCQUFrQjtlQUFsQkE7OztBQUhOLElBQU1ILGlCQUFpQjtBQUN2QixJQUFNQyxrQkFBa0I7QUFDeEIsSUFBTUMsa0JBQWtCO0FBQ3hCLElBQU1DLHFCQUFxQiJ9
package/src/keyCodes.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
-
3
- export const ENTER_KEY_CODE = 13;
4
- export const ESCAPE_KEY_CODE = 27;
5
- export const DELETE_KEY_CODE = 46;
6
- export const BACKSPACE_KEY_CODE = 8;