easy-file-system 2.1.258 → 2.1.260

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/src/span/name.js CHANGED
@@ -63,6 +63,8 @@ class NameSpan extends Element {
63
63
 
64
64
  this.addAttribute(CONTENT_EDITABLE, TRUE);
65
65
 
66
+ this.onKeyDown(this.keyDownHandler);
67
+
66
68
  const html = this.html(),
67
69
  range = document.createRange(),
68
70
  selection = window.getSelection(),
@@ -79,8 +81,6 @@ class NameSpan extends Element {
79
81
  selection.removeAllRanges();
80
82
 
81
83
  selection.addRange(range);
82
-
83
- this.onKeyDown(this.keyDownHandler);
84
84
  }
85
85
 
86
86
  reset() {
@@ -89,14 +89,35 @@ class NameSpan extends Element {
89
89
  this.removeAttribute(CONTENT_EDITABLE, TRUE);
90
90
  }
91
91
 
92
+ isEditable() {
93
+ const contentEditableAttribute = this.hasAttribute(CONTENT_EDITABLE),
94
+ editable = contentEditableAttribute; ///
95
+
96
+ return editable;
97
+ }
98
+
99
+ didMount() {
100
+ ///
101
+ }
102
+
103
+ willUnmount() {
104
+ const editable = this.isEditable();
105
+
106
+ if (editable) {
107
+ const created = this.isCreated();
108
+
109
+ this.cancel(created);
110
+ }
111
+ }
112
+
92
113
  parentContext() {
93
114
  const editNameSpan = this.edit.bind(this), ///
94
115
  resetNameSpan = this.reset.bind(this), ///
95
116
  getNameSpanName = this.getName.bind(this), ///
96
117
  setNameSpanName = this.setName.bind(this), ///
97
118
  onCustomNameSpanCancel = this.onCustomCancel.bind(this), ///
98
- offCustomNameSpanCancel = this.offCustomCancel.bind(this), ///
99
119
  onCustomNameSpanChange = this.onCustomChange.bind(this), ///
120
+ offCustomNameSpanCancel = this.offCustomCancel.bind(this), ///
100
121
  offCustomNameSpanChange = this.offCustomChange.bind(this); ///
101
122
 
102
123
  return ({
@@ -105,8 +126,8 @@ class NameSpan extends Element {
105
126
  getNameSpanName,
106
127
  setNameSpanName,
107
128
  onCustomNameSpanCancel,
108
- offCustomNameSpanCancel,
109
129
  onCustomNameSpanChange,
130
+ offCustomNameSpanCancel,
110
131
  offCustomNameSpanChange
111
132
  });
112
133
  }