qword 1.0.0 → 1.0.1
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 +5 -0
- package/client/qword.js +27 -0
- package/dist/qword.js +2 -0
- package/dist/qword.js.map +1 -0
- package/dist-dev/qword.js +1 -1
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/client/qword.js
CHANGED
|
@@ -27,6 +27,7 @@ import {createPatch} from 'daffy';
|
|
|
27
27
|
import * as restafary from 'restafary/client';
|
|
28
28
|
import {tryCatch} from 'try-catch';
|
|
29
29
|
import {vim} from '@replit/codemirror-vim';
|
|
30
|
+
import {tryToCatch} from 'try-to-catch';
|
|
30
31
|
import Story from './story.js';
|
|
31
32
|
import loadRemote, {loadModules, loadOptions} from './loadremote.js';
|
|
32
33
|
import _clipboard from './_clipboard.js';
|
|
@@ -99,6 +100,13 @@ export default function Qword(el, options = {}, callback = noop) {
|
|
|
99
100
|
Qword.prototype._init = async function() {
|
|
100
101
|
const prefix = this._PREFIX;
|
|
101
102
|
|
|
103
|
+
const [error, config] = await tryToCatch(load.json, this._PREFIX + '/edit.json');
|
|
104
|
+
|
|
105
|
+
if (error)
|
|
106
|
+
return smalltalk.alert(this._TITLE, 'Could not load edit.json!');
|
|
107
|
+
|
|
108
|
+
this._Config = config;
|
|
109
|
+
|
|
102
110
|
await Promise.all([
|
|
103
111
|
loadOptions(prefix),
|
|
104
112
|
loadModules(prefix),
|
|
@@ -364,6 +372,20 @@ Qword.prototype.sha = function() {
|
|
|
364
372
|
return shaObj.getHash('HEX');
|
|
365
373
|
};
|
|
366
374
|
|
|
375
|
+
Qword.prototype.setOption = function(name, value) {
|
|
376
|
+
const {_Ace} = this;
|
|
377
|
+
const preventOverwrite = () => {
|
|
378
|
+
this._Config.options[name] = value;
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
preventOverwrite();
|
|
382
|
+
|
|
383
|
+
if (name === 'keyMap')
|
|
384
|
+
this.setKeyMap(value);
|
|
385
|
+
|
|
386
|
+
return this;
|
|
387
|
+
};
|
|
388
|
+
|
|
367
389
|
Qword.prototype.setOptions = function(options) {
|
|
368
390
|
const theme = EditorView.theme({
|
|
369
391
|
'&': {
|
|
@@ -403,3 +425,8 @@ Qword.prototype._loadOptions = async function() {
|
|
|
403
425
|
|
|
404
426
|
return data;
|
|
405
427
|
};
|
|
428
|
+
|
|
429
|
+
Qword.prototype.enableKey = function() {
|
|
430
|
+
this._isKey = true;
|
|
431
|
+
return this;
|
|
432
|
+
};
|