qword 1.0.2 → 1.0.3
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/ChangeLog +8 -0
- package/README.md +2 -3
- package/client/qword.js +28 -3
- package/client/save.js +2 -2
- package/dist/qword.js +1 -1
- package/dist/qword.js.map +1 -1
- package/dist-dev/qword.js +2 -2
- package/package.json +2 -3
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -14,13 +14,12 @@ Fork of [edward](https://github.com/cloudcmd/edward "Edward").
|
|
|
14
14
|
|
|
15
15
|
<img width="601" height="295" alt="image" src="https://github.com/user-attachments/assets/e632f48a-ef74-4d5c-bbe8-8f6e44151d00" />
|
|
16
16
|
|
|
17
|
-
|
|
18
17
|
## Features
|
|
19
18
|
|
|
20
19
|
- Syntax highlighting based on extension of file for over 90 languages.
|
|
21
20
|
- Built-in `emmet` (for html files)
|
|
22
21
|
- Drag n drop (drag file from desktop to editor).
|
|
23
|
-
- Configurable options ([json/edit.json][edit.json] could be
|
|
22
|
+
- Configurable options ([json/edit.json][edit.json] could be overridden by `~/.qword.json`)
|
|
24
23
|
|
|
25
24
|
## Install
|
|
26
25
|
|
|
@@ -52,7 +51,7 @@ Usage: `qword [filename]`
|
|
|
52
51
|
## API
|
|
53
52
|
|
|
54
53
|
qword could be used as middleware for [express](http://expressjs.com "Express").
|
|
55
|
-
For this
|
|
54
|
+
For this purpose API could be used.
|
|
56
55
|
|
|
57
56
|
### Server
|
|
58
57
|
|
package/client/qword.js
CHANGED
|
@@ -78,7 +78,7 @@ export default function Qword(el, options = {}, callback = noop) {
|
|
|
78
78
|
this._keymapCompartment = new Compartment();
|
|
79
79
|
this._fontCompartment = new Compartment();
|
|
80
80
|
this._langCompartment = new Compartment();
|
|
81
|
-
|
|
81
|
+
this._historyCompartment = new Compartment();
|
|
82
82
|
this._vimCompartment = new Compartment();
|
|
83
83
|
|
|
84
84
|
this._Element.addEventListener('drop', this._onDrop.bind(this));
|
|
@@ -132,14 +132,18 @@ Qword.prototype._init = async function() {
|
|
|
132
132
|
|
|
133
133
|
Qword.prototype._initEditor = function() {
|
|
134
134
|
this._Element.style.height = '100vh';
|
|
135
|
+
|
|
135
136
|
const baseExtensions = () => [
|
|
137
|
+
this._historyCompartment.of([
|
|
138
|
+
history(),
|
|
139
|
+
keymap.of(historyKeymap),
|
|
140
|
+
]),
|
|
136
141
|
lineNumbers(),
|
|
137
142
|
history(),
|
|
138
143
|
highlightActiveLine(),
|
|
139
144
|
syntaxHighlighting(defaultHighlightStyle),
|
|
140
145
|
oneDark,
|
|
141
146
|
this._langCompartment.of(javascript()),
|
|
142
|
-
// ✅ FIX: vim теперь через compartment
|
|
143
147
|
this._vimCompartment.of([]),
|
|
144
148
|
keymap.of([
|
|
145
149
|
...defaultKeymap,
|
|
@@ -260,6 +264,7 @@ Qword.prototype.setValueFirst = function(name, value) {
|
|
|
260
264
|
this._FileName = name;
|
|
261
265
|
this._Value = value;
|
|
262
266
|
|
|
267
|
+
this.clearHistory();
|
|
263
268
|
this.moveCursorTo(0, 0);
|
|
264
269
|
|
|
265
270
|
return this;
|
|
@@ -374,7 +379,6 @@ Qword.prototype.sha = function() {
|
|
|
374
379
|
};
|
|
375
380
|
|
|
376
381
|
Qword.prototype.setOption = function(name, value) {
|
|
377
|
-
const {_Ace} = this;
|
|
378
382
|
const preventOverwrite = () => {
|
|
379
383
|
this._Config.options[name] = value;
|
|
380
384
|
};
|
|
@@ -431,3 +435,24 @@ Qword.prototype.enableKey = function() {
|
|
|
431
435
|
this._isKey = true;
|
|
432
436
|
return this;
|
|
433
437
|
};
|
|
438
|
+
|
|
439
|
+
Qword.prototype.clearHistory = function() {
|
|
440
|
+
if (!this._view)
|
|
441
|
+
return this;
|
|
442
|
+
|
|
443
|
+
this._view.dispatch({
|
|
444
|
+
effects: this._historyCompartment.reconfigure(this._vimEnabled ? [] : [
|
|
445
|
+
history(),
|
|
446
|
+
keymap.of(historyKeymap),
|
|
447
|
+
]),
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
const {cm} = this._view;
|
|
451
|
+
|
|
452
|
+
cm.state.vim.undoHistory = [];
|
|
453
|
+
cm.state.vim.redoHistory = [];
|
|
454
|
+
cm.state.vim.globalState.jumpList = [];
|
|
455
|
+
|
|
456
|
+
return this;
|
|
457
|
+
};
|
|
458
|
+
|
package/client/save.js
CHANGED
|
@@ -34,9 +34,9 @@ async function save() {
|
|
|
34
34
|
if (!zip)
|
|
35
35
|
return this._write(_filename, value);
|
|
36
36
|
|
|
37
|
-
const
|
|
37
|
+
const zippedValue = await zipio(value);
|
|
38
38
|
|
|
39
|
-
return this._write(`${_filename}?unzip`,
|
|
39
|
+
return this._write(`${_filename}?unzip`, zippedValue);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
function _setValue(ctx) {
|