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 CHANGED
@@ -1,3 +1,8 @@
1
+ 2026.05.13, v1.0.1
2
+
3
+ fix:
4
+ - 1982409 qword: init
5
+
1
6
  2026.05.12, v16.0.2
2
7
 
3
8
  feature:
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
+ };