qword 1.0.0 → 1.0.2
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 +10 -0
- package/client/qword.js +28 -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),
|
|
@@ -123,6 +131,7 @@ Qword.prototype._init = async function() {
|
|
|
123
131
|
};
|
|
124
132
|
|
|
125
133
|
Qword.prototype._initEditor = function() {
|
|
134
|
+
this._Element.style.height = '100vh';
|
|
126
135
|
const baseExtensions = () => [
|
|
127
136
|
lineNumbers(),
|
|
128
137
|
history(),
|
|
@@ -364,6 +373,20 @@ Qword.prototype.sha = function() {
|
|
|
364
373
|
return shaObj.getHash('HEX');
|
|
365
374
|
};
|
|
366
375
|
|
|
376
|
+
Qword.prototype.setOption = function(name, value) {
|
|
377
|
+
const {_Ace} = this;
|
|
378
|
+
const preventOverwrite = () => {
|
|
379
|
+
this._Config.options[name] = value;
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
preventOverwrite();
|
|
383
|
+
|
|
384
|
+
if (name === 'keyMap')
|
|
385
|
+
this.setKeyMap(value);
|
|
386
|
+
|
|
387
|
+
return this;
|
|
388
|
+
};
|
|
389
|
+
|
|
367
390
|
Qword.prototype.setOptions = function(options) {
|
|
368
391
|
const theme = EditorView.theme({
|
|
369
392
|
'&': {
|
|
@@ -403,3 +426,8 @@ Qword.prototype._loadOptions = async function() {
|
|
|
403
426
|
|
|
404
427
|
return data;
|
|
405
428
|
};
|
|
429
|
+
|
|
430
|
+
Qword.prototype.enableKey = function() {
|
|
431
|
+
this._isKey = true;
|
|
432
|
+
return this;
|
|
433
|
+
};
|