qword 1.1.19 → 1.1.21

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/dist-dev/qword.js CHANGED
@@ -722,7 +722,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n__webpack_require__.d(__webp
722
722
  \**************************/
723
723
  (__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
724
724
  "use strict";
725
- eval("{__webpack_require__.r(__webpack_exports__);\n__webpack_require__.d(__webpack_exports__, {\n createEditor: () => (createEditor)\n});\n/* import */ var _codemirror_state__rspack_import_4 = __webpack_require__(/*! @codemirror/state */ \"./node_modules/@codemirror/state/dist/index.js\");\n/* import */ var _codemirror_view__rspack_import_5 = __webpack_require__(/*! @codemirror/view */ \"./node_modules/@codemirror/view/dist/index.js\");\n/* import */ var _codemirror_commands__rspack_import_6 = __webpack_require__(/*! @codemirror/commands */ \"./node_modules/@codemirror/commands/dist/index.js\");\n/* import */ var _codemirror_language__rspack_import_7 = __webpack_require__(/*! @codemirror/language */ \"./node_modules/@codemirror/language/dist/index.js\");\n/* import */ var _highlight_js__rspack_import_0 = __webpack_require__(/*! ./highlight.js */ \"./client/highlight.js\");\n/* import */ var _options_options_js__rspack_import_1 = __webpack_require__(/*! ./options/options.js */ \"./client/options/options.js\");\n/* import */ var _options_vim_keep_indent_after_vim_paste_js__rspack_import_2 = __webpack_require__(/*! ./options/vim/keep-indent-after-vim-paste.js */ \"./client/options/vim/keep-indent-after-vim-paste.js\");\n/* import */ var _decorations_js__rspack_import_3 = __webpack_require__(/*! ./decorations.js */ \"./client/decorations.js\");\n\n\n\n\n\n\n\n\nfunction createEditor(element, options = {}) {\n const { value = '', mode = 'javascript', keyMap = 'default', theme = 'default', lineNumbers = true, readOnly = false, foldGutter: fold = false, updateListener } = options;\n const themeCompartment = new _codemirror_state__rspack_import_4.Compartment();\n const keymapCompartment = new _codemirror_state__rspack_import_4.Compartment();\n const langCompartment = new _codemirror_state__rspack_import_4.Compartment();\n const historyCompartment = new _codemirror_state__rspack_import_4.Compartment();\n const hideCursorOnBlur = _codemirror_view__rspack_import_5.EditorView.theme({\n '&:not(.cm-focused) .cm-fat-cursor': {\n display: 'none'\n }\n });\n const extensions = [\n historyCompartment.of([\n (0,_codemirror_commands__rspack_import_6.history)(),\n _codemirror_view__rspack_import_5.keymap.of(_codemirror_commands__rspack_import_6.historyKeymap)\n ]),\n _decorations_js__rspack_import_3.markField,\n _decorations_js__rspack_import_3.lineField,\n themeCompartment.of((0,_options_options_js__rspack_import_1.themeExtension)(theme)),\n keymapCompartment.of((0,_options_options_js__rspack_import_1.keymapExtension)(keyMap)),\n (0,_codemirror_language__rspack_import_7.bracketMatching)(),\n langCompartment.of((0,_options_options_js__rspack_import_1.languageExtension)(mode)),\n (0,_codemirror_language__rspack_import_7.syntaxHighlighting)(_highlight_js__rspack_import_0.highlightStyle),\n (0,_codemirror_language__rspack_import_7.indentOnInput)(),\n _options_vim_keep_indent_after_vim_paste_js__rspack_import_2.normalizeVimPaste,\n _codemirror_language__rspack_import_7.indentUnit.of(' '),\n ...lineNumbers ? [\n (0,_codemirror_view__rspack_import_5.lineNumbers)()\n ] : [],\n ...fold ? [\n (0,_codemirror_language__rspack_import_7.foldGutter)(),\n (0,_codemirror_language__rspack_import_7.codeFolding)()\n ] : [],\n ...readOnly ? [\n _codemirror_state__rspack_import_4.EditorState.readOnly.of(true)\n ] : [],\n ...updateListener ? [\n _codemirror_view__rspack_import_5.EditorView.updateListener.of(updateListener)\n ] : [],\n (0,_codemirror_view__rspack_import_5.drawSelection)(),\n hideCursorOnBlur\n ];\n const view = new _codemirror_view__rspack_import_5.EditorView({\n state: _codemirror_state__rspack_import_4.EditorState.create({\n doc: value,\n extensions\n }),\n parent: element\n });\n view._themeCompartment = themeCompartment;\n view._keymapCompartment = keymapCompartment;\n view._langCompartment = langCompartment;\n view._historyCompartment = historyCompartment;\n return view;\n}\n\n\n//# sourceURL=webpack://qword/./client/create.js?af24\n}");
725
+ eval("{__webpack_require__.r(__webpack_exports__);\n__webpack_require__.d(__webpack_exports__, {\n createEditor: () => (createEditor),\n onTabKeydown: () => (onTabKeydown)\n});\n/* import */ var _codemirror_state__rspack_import_4 = __webpack_require__(/*! @codemirror/state */ \"./node_modules/@codemirror/state/dist/index.js\");\n/* import */ var _codemirror_view__rspack_import_5 = __webpack_require__(/*! @codemirror/view */ \"./node_modules/@codemirror/view/dist/index.js\");\n/* import */ var _codemirror_commands__rspack_import_3 = __webpack_require__(/*! @codemirror/commands */ \"./node_modules/@codemirror/commands/dist/index.js\");\n/* import */ var _codemirror_language__rspack_import_6 = __webpack_require__(/*! @codemirror/language */ \"./node_modules/@codemirror/language/dist/index.js\");\n/* import */ var _highlight_js__rspack_import_0 = __webpack_require__(/*! ./highlight.js */ \"./client/highlight.js\");\n/* import */ var _options_options_js__rspack_import_1 = __webpack_require__(/*! ./options/options.js */ \"./client/options/options.js\");\n/* import */ var _decorations_js__rspack_import_2 = __webpack_require__(/*! ./decorations.js */ \"./client/decorations.js\");\n\n\n\n\n\n\n\nfunction onTabKeydown(event, view) {\n if (event.key !== 'Tab') return false;\n event.preventDefault();\n (0,_codemirror_commands__rspack_import_3.indentMore)(view);\n return true;\n}\nfunction createEditor(element, options = {}) {\n const { value = '', mode = 'javascript', keyMap = 'default', theme = 'default', lineNumbers = true, readOnly = false, foldGutter: fold = false, updateListener } = options;\n const themeCompartment = new _codemirror_state__rspack_import_4.Compartment();\n const keymapCompartment = new _codemirror_state__rspack_import_4.Compartment();\n const langCompartment = new _codemirror_state__rspack_import_4.Compartment();\n const historyCompartment = new _codemirror_state__rspack_import_4.Compartment();\n const hideCursorOnBlur = _codemirror_view__rspack_import_5.EditorView.theme({\n '&:not(.cm-focused) .cm-fat-cursor': {\n display: 'none'\n }\n });\n const extensions = [\n historyCompartment.of([\n (0,_codemirror_commands__rspack_import_3.history)(),\n _codemirror_view__rspack_import_5.keymap.of(_codemirror_commands__rspack_import_3.historyKeymap)\n ]),\n _decorations_js__rspack_import_2.markField,\n _decorations_js__rspack_import_2.lineField,\n themeCompartment.of((0,_options_options_js__rspack_import_1.themeExtension)(theme)),\n keymapCompartment.of((0,_options_options_js__rspack_import_1.keymapExtension)(keyMap)),\n (0,_codemirror_language__rspack_import_6.bracketMatching)(),\n langCompartment.of((0,_options_options_js__rspack_import_1.languageExtension)(mode)),\n (0,_codemirror_language__rspack_import_6.syntaxHighlighting)(_highlight_js__rspack_import_0.highlightStyle),\n (0,_codemirror_language__rspack_import_6.indentOnInput)(),\n _codemirror_language__rspack_import_6.indentUnit.of(' '),\n ...lineNumbers ? [\n (0,_codemirror_view__rspack_import_5.lineNumbers)()\n ] : [],\n ...fold ? [\n (0,_codemirror_language__rspack_import_6.foldGutter)(),\n (0,_codemirror_language__rspack_import_6.codeFolding)()\n ] : [],\n ...readOnly ? [\n _codemirror_state__rspack_import_4.EditorState.readOnly.of(true)\n ] : [],\n ...updateListener ? [\n _codemirror_view__rspack_import_5.EditorView.updateListener.of(updateListener)\n ] : [],\n _codemirror_view__rspack_import_5.EditorView.domEventHandlers({\n keydown: onTabKeydown\n }),\n (0,_codemirror_view__rspack_import_5.drawSelection)(),\n hideCursorOnBlur\n ];\n const view = new _codemirror_view__rspack_import_5.EditorView({\n state: _codemirror_state__rspack_import_4.EditorState.create({\n doc: value,\n extensions\n }),\n parent: element\n });\n view._themeCompartment = themeCompartment;\n view._keymapCompartment = keymapCompartment;\n view._langCompartment = langCompartment;\n view._historyCompartment = historyCompartment;\n return view;\n}\n\n\n//# sourceURL=webpack://qword/./client/create.js?af24\n}");
726
726
 
727
727
  },
728
728
  "./client/decorations.js"
@@ -785,7 +785,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n__webpack_require__.d(__webp
785
785
  \***********************************/
786
786
  (__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
787
787
  "use strict";
788
- eval("{__webpack_require__.r(__webpack_exports__);\n__webpack_require__.d(__webpack_exports__, {\n indentKeymap: () => (indentKeymap),\n keymapExtension: () => (keymapExtension),\n languageExtension: () => (languageExtension),\n setOption: () => (setOption),\n themeExtension: () => (themeExtension)\n});\n/* import */ var _codemirror_view__rspack_import_5 = __webpack_require__(/*! @codemirror/view */ \"./node_modules/@codemirror/view/dist/index.js\");\n/* import */ var _codemirror_lang_javascript__rspack_import_7 = __webpack_require__(/*! @codemirror/lang-javascript */ \"./node_modules/@codemirror/lang-javascript/dist/index.js\");\n/* import */ var _codemirror_lang_json__rspack_import_8 = __webpack_require__(/*! @codemirror/lang-json */ \"./node_modules/@codemirror/lang-json/dist/index.js\");\n/* import */ var _codemirror_lang_html__rspack_import_9 = __webpack_require__(/*! @codemirror/lang-html */ \"./node_modules/@codemirror/lang-html/dist/index.js\");\n/* import */ var _replit_codemirror_vim__rspack_import_4 = __webpack_require__(/*! @replit/codemirror-vim */ \"./node_modules/@replit/codemirror-vim/dist/index.js\");\n/* import */ var _uiw_codemirror_theme_nord__rspack_import_0 = __webpack_require__(/*! @uiw/codemirror-theme-nord */ \"./node_modules/@uiw/codemirror-theme-nord/esm/index.js\");\n/* import */ var _codemirror_state__rspack_import_6 = __webpack_require__(/*! @codemirror/state */ \"./node_modules/@codemirror/state/dist/index.js\");\n/* import */ var _codemirror_commands__rspack_import_3 = __webpack_require__(/*! @codemirror/commands */ \"./node_modules/@codemirror/commands/dist/index.js\");\n/* import */ var _vim_keep_indent_after_enter_vim_js__rspack_import_1 = __webpack_require__(/*! ./vim/keep-indent-after-enter-vim.js */ \"./client/options/vim/keep-indent-after-enter-vim.js\");\n/* import */ var _vim_keep_indent_after_vim_paste_js__rspack_import_2 = __webpack_require__(/*! ./vim/keep-indent-after-vim-paste.js */ \"./client/options/vim/keep-indent-after-vim-paste.js\");\n\n\n\n\n\n\n\n\n\n\nconst enterKeepIndent = {\n key: 'Enter',\n run: _codemirror_commands__rspack_import_3.insertNewlineAndIndent\n};\nfunction keymapExtension(name) {\n if (name === 'vim') return [\n (0,_replit_codemirror_vim__rspack_import_4.vim)(),\n _vim_keep_indent_after_enter_vim_js__rspack_import_1.keepIndentAfterEnterVim,\n _vim_keep_indent_after_vim_paste_js__rspack_import_2.normalizeVimPaste\n ];\n if (name === 'emacs') return _codemirror_view__rspack_import_5.keymap.of([\n ..._codemirror_commands__rspack_import_3.emacsStyleKeymap,\n _codemirror_commands__rspack_import_3.indentWithTab\n ]);\n return _codemirror_state__rspack_import_6.Prec.highest(_codemirror_view__rspack_import_5.keymap.of([\n enterKeepIndent,\n _codemirror_commands__rspack_import_3.indentWithTab,\n ..._codemirror_commands__rspack_import_3.defaultKeymap\n ]));\n}\nfunction themeExtension(name) {\n if (name === 'nord' || name === 'dark' || name === 'one-dark') return _uiw_codemirror_theme_nord__rspack_import_0.nord;\n return [];\n}\nconst indentKeymap = _codemirror_view__rspack_import_5.keymap.of([\n _codemirror_commands__rspack_import_3.indentWithTab\n]);\nfunction languageExtension(mode) {\n const name = typeof mode === 'object' ? mode?.name : mode;\n if (name === 'javascript' || name === 'js') return (0,_codemirror_lang_javascript__rspack_import_7.javascript)();\n if (name === 'json') return (0,_codemirror_lang_json__rspack_import_8.json)();\n if (name === 'html') return (0,_codemirror_lang_html__rspack_import_9.html)();\n return [];\n}\nfunction setOption(view, key, value) {\n if (key === 'theme') return view.dispatch({\n effects: view._themeCompartment.reconfigure(themeExtension(value))\n });\n if (key === 'keyMap') return view.dispatch({\n effects: view._keymapCompartment.reconfigure(keymapExtension(value))\n });\n if (key === 'mode') return view.dispatch({\n effects: view._langCompartment.reconfigure(languageExtension(value))\n });\n}\n\n\n//# sourceURL=webpack://qword/./client/options/options.js?54b8\n}");
788
+ eval("{__webpack_require__.r(__webpack_exports__);\n__webpack_require__.d(__webpack_exports__, {\n indentKeymap: () => (indentKeymap),\n keymapExtension: () => (keymapExtension),\n languageExtension: () => (languageExtension),\n setOption: () => (setOption),\n themeExtension: () => (themeExtension)\n});\n/* import */ var _codemirror_view__rspack_import_4 = __webpack_require__(/*! @codemirror/view */ \"./node_modules/@codemirror/view/dist/index.js\");\n/* import */ var _codemirror_lang_javascript__rspack_import_6 = __webpack_require__(/*! @codemirror/lang-javascript */ \"./node_modules/@codemirror/lang-javascript/dist/index.js\");\n/* import */ var _codemirror_lang_json__rspack_import_7 = __webpack_require__(/*! @codemirror/lang-json */ \"./node_modules/@codemirror/lang-json/dist/index.js\");\n/* import */ var _codemirror_lang_html__rspack_import_8 = __webpack_require__(/*! @codemirror/lang-html */ \"./node_modules/@codemirror/lang-html/dist/index.js\");\n/* import */ var _replit_codemirror_vim__rspack_import_3 = __webpack_require__(/*! @replit/codemirror-vim */ \"./node_modules/@replit/codemirror-vim/dist/index.js\");\n/* import */ var _uiw_codemirror_theme_nord__rspack_import_0 = __webpack_require__(/*! @uiw/codemirror-theme-nord */ \"./node_modules/@uiw/codemirror-theme-nord/esm/index.js\");\n/* import */ var _codemirror_state__rspack_import_5 = __webpack_require__(/*! @codemirror/state */ \"./node_modules/@codemirror/state/dist/index.js\");\n/* import */ var _codemirror_commands__rspack_import_2 = __webpack_require__(/*! @codemirror/commands */ \"./node_modules/@codemirror/commands/dist/index.js\");\n/* import */ var _vim_keep_indent_after_enter_vim_js__rspack_import_1 = __webpack_require__(/*! ./vim/keep-indent-after-enter-vim.js */ \"./client/options/vim/keep-indent-after-enter-vim.js\");\n\n\n\n\n\n\n\n\n\nconst enterKeepIndent = {\n key: 'Enter',\n run: _codemirror_commands__rspack_import_2.insertNewlineAndIndent\n};\nfunction keymapExtension(name) {\n if (name === 'vim') return [\n (0,_replit_codemirror_vim__rspack_import_3.vim)(),\n _vim_keep_indent_after_enter_vim_js__rspack_import_1.keepIndentAfterEnterVim\n ];\n if (name === 'emacs') return _codemirror_view__rspack_import_4.keymap.of([\n ..._codemirror_commands__rspack_import_2.emacsStyleKeymap,\n _codemirror_commands__rspack_import_2.indentWithTab\n ]);\n return _codemirror_state__rspack_import_5.Prec.highest(_codemirror_view__rspack_import_4.keymap.of([\n enterKeepIndent,\n _codemirror_commands__rspack_import_2.indentWithTab,\n ..._codemirror_commands__rspack_import_2.defaultKeymap\n ]));\n}\nfunction themeExtension(name) {\n if (name === 'nord' || name === 'dark' || name === 'one-dark') return _uiw_codemirror_theme_nord__rspack_import_0.nord;\n return [];\n}\nconst indentKeymap = _codemirror_view__rspack_import_4.keymap.of([\n _codemirror_commands__rspack_import_2.indentWithTab\n]);\nfunction languageExtension(mode) {\n const name = typeof mode === 'object' ? mode?.name : mode;\n if (name === 'javascript' || name === 'js') return (0,_codemirror_lang_javascript__rspack_import_6.javascript)();\n if (name === 'json') return (0,_codemirror_lang_json__rspack_import_7.json)();\n if (name === 'html') return (0,_codemirror_lang_html__rspack_import_8.html)();\n return [];\n}\nfunction setOption(view, key, value) {\n if (key === 'theme') return view.dispatch({\n effects: view._themeCompartment.reconfigure(themeExtension(value))\n });\n if (key === 'keyMap') return view.dispatch({\n effects: view._keymapCompartment.reconfigure(keymapExtension(value))\n });\n if (key === 'mode') return view.dispatch({\n effects: view._langCompartment.reconfigure(languageExtension(value))\n });\n}\n\n\n//# sourceURL=webpack://qword/./client/options/options.js?54b8\n}");
789
789
 
790
790
  },
791
791
  "./client/options/vim/keep-indent-after-enter-vim.js"
@@ -794,16 +794,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n__webpack_require__.d(__webp
794
794
  \***********************************************************/
795
795
  (__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
796
796
  "use strict";
797
- eval("{__webpack_require__.r(__webpack_exports__);\n__webpack_require__.d(__webpack_exports__, {\n keepIndentAfterEnterVim: () => (keepIndentAfterEnterVim)\n});\n/* import */ var _codemirror_state__rspack_import_0 = __webpack_require__(/*! @codemirror/state */ \"./node_modules/@codemirror/state/dist/index.js\");\n\nconst keepIndentAfterEnterVim = _codemirror_state__rspack_import_0.EditorState.transactionFilter.of((tr)=>{\n if (!tr.docChanged) return tr;\n const selection = tr.newSelection.main;\n if (!selection.empty) return tr;\n const pos = selection.head;\n const line = tr.newDoc.lineAt(pos);\n if (pos !== line.from) return tr;\n if (line.number === 1) return tr;\n const previousLine = tr.newDoc.line(line.number - 1);\n const indent = previousLine.text.match(/^\\s*/)?.[0] || '';\n if (!indent) return tr;\n let insertedNewline = false;\n let alreadyIndented = false;\n let isMultilinePaste = false;\n tr.changes.iterChanges((_fromA, _toA, _fromB, _toB, inserted)=>{\n const text = inserted.toString();\n if (text.includes('\\n')) insertedNewline = true;\n if (text.split('\\n').length > 2) isMultilinePaste = true;\n if (text.endsWith(`\\n${indent}`)) alreadyIndented = true;\n });\n if (!insertedNewline || alreadyIndented || isMultilinePaste) return tr;\n return [\n tr,\n {\n changes: {\n from: pos,\n insert: indent\n },\n selection: {\n anchor: pos + indent.length\n },\n sequential: true\n }\n ];\n});\n\n\n//# sourceURL=webpack://qword/./client/options/vim/keep-indent-after-enter-vim.js?bba9\n}");
798
-
799
- },
800
- "./client/options/vim/keep-indent-after-vim-paste.js"
801
- /*!***********************************************************!*\
802
- !*** ./client/options/vim/keep-indent-after-vim-paste.js ***!
803
- \***********************************************************/
804
- (__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
805
- "use strict";
806
- eval("{__webpack_require__.r(__webpack_exports__);\n__webpack_require__.d(__webpack_exports__, {\n normalizeVimPaste: () => (normalizeVimPaste)\n});\n/* import */ var _codemirror_state__rspack_import_0 = __webpack_require__(/*! @codemirror/state */ \"./node_modules/@codemirror/state/dist/index.js\");\n\nconst normalizeVimPaste = _codemirror_state__rspack_import_0.EditorState.transactionFilter.of((tr)=>{\n if (!tr.docChanged) return tr;\n if (!tr.isUserEvent('input.type.compose')) return tr;\n if (!tr.newSelection.empty) return tr;\n const pos = tr.newSelection.main.head;\n const line = tr.newDoc.lineAt(pos);\n if (pos !== line.from) return tr;\n let hasNewlineInsert = false;\n tr.changes.iterChanges((fromA, toA, fromB, toB, inserted)=>{\n if (inserted.toString().includes('\\n')) hasNewlineInsert = true;\n });\n if (!hasNewlineInsert) return tr;\n const destIndent = line.text.match(/^\\s*/)?.[0] || '';\n if (!destIndent) return tr;\n let hasBuggyPrefix = false;\n tr.changes.iterChanges((fromA, toA, fromB, toB, inserted)=>{\n const text = inserted.toString();\n if (text.startsWith('\\n') && text.slice(1).startsWith(destIndent)) hasBuggyPrefix = true;\n });\n if (!hasBuggyPrefix) return tr;\n const newAnnotations = tr.annotations.filter((a)=>a.type !== _codemirror_state__rspack_import_0.Transaction.userEvent).concat(_codemirror_state__rspack_import_0.Transaction.userEvent.of('input.paste'));\n return _codemirror_state__rspack_import_0.Transaction.create(tr.startState, tr.changes, tr.selection, tr.effects, newAnnotations, tr.scrollIntoView);\n});\n\n\n//# sourceURL=webpack://qword/./client/options/vim/keep-indent-after-vim-paste.js?c566\n}");
797
+ eval("{__webpack_require__.r(__webpack_exports__);\n__webpack_require__.d(__webpack_exports__, {\n keepIndentAfterEnterVim: () => (keepIndentAfterEnterVim)\n});\n/* import */ var _codemirror_state__rspack_import_0 = __webpack_require__(/*! @codemirror/state */ \"./node_modules/@codemirror/state/dist/index.js\");\n\nconst keepIndentAfterEnterVim = _codemirror_state__rspack_import_0.EditorState.transactionFilter.of((tr)=>{\n if (!tr.docChanged) return tr;\n const selection = tr.newSelection.main;\n if (!selection.empty) return tr;\n const pos = selection.head;\n const line = tr.newDoc.lineAt(pos);\n if (pos !== line.from) return tr;\n if (line.number === 1) return tr;\n const previousLine = tr.newDoc.line(line.number - 1);\n const indent = previousLine.text.match(/^\\s*/)?.[0] || '';\n if (!indent) return tr;\n let insertedNewline = false;\n let alreadyIndented = false;\n tr.changes.iterChanges((_fromA, _toA, _fromB, _toB, inserted)=>{\n const text = inserted.toString();\n if (text === '\\n') insertedNewline = true;\n if (text.endsWith(`\\n${indent}`)) alreadyIndented = true;\n });\n if (!insertedNewline || alreadyIndented) return tr;\n return [\n tr,\n {\n changes: {\n from: pos,\n insert: indent\n },\n selection: {\n anchor: pos + indent.length\n },\n sequential: true\n }\n ];\n});\n\n\n//# sourceURL=webpack://qword/./client/options/vim/keep-indent-after-enter-vim.js?bba9\n}");
807
798
 
808
799
  },
809
800
  "./client/position.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qword",
3
- "version": "1.1.19",
3
+ "version": "1.1.21",
4
4
  "description": "Web editor based on CodeMirror 6",
5
5
  "main": "./server/index.js",
6
6
  "exports": {
@@ -1,54 +0,0 @@
1
- import {EditorState, Transaction} from '@codemirror/state';
2
-
3
- export const normalizeVimPaste = EditorState.transactionFilter.of((tr) => {
4
- if (!tr.docChanged)
5
- return tr;
6
-
7
- if (!tr.isUserEvent('input.type.compose'))
8
- return tr;
9
-
10
- if (!tr.newSelection.empty)
11
- return tr;
12
-
13
- const pos = tr.newSelection.main.head;
14
- const line = tr.newDoc.lineAt(pos);
15
-
16
- if (pos !== line.from)
17
- return tr;
18
-
19
- let hasNewlineInsert = false;
20
- tr.changes.iterChanges((fromA, toA, fromB, toB, inserted) => {
21
- if (inserted.toString().includes('\n'))
22
- hasNewlineInsert = true;
23
- });
24
-
25
- if (!hasNewlineInsert)
26
- return tr;
27
-
28
- const destIndent = line.text.match(/^\s*/)?.[0] || '';
29
- if (!destIndent)
30
- return tr;
31
-
32
- let hasBuggyPrefix = false;
33
- tr.changes.iterChanges((fromA, toA, fromB, toB, inserted) => {
34
- const text = inserted.toString();
35
- if (text.startsWith('\n') && text.slice(1).startsWith(destIndent))
36
- hasBuggyPrefix = true;
37
- });
38
-
39
- if (!hasBuggyPrefix)
40
- return tr;
41
-
42
- const newAnnotations = tr.annotations
43
- .filter((a) => a.type !== Transaction.userEvent)
44
- .concat(Transaction.userEvent.of('input.paste'));
45
-
46
- return Transaction.create(
47
- tr.startState,
48
- tr.changes,
49
- tr.selection,
50
- tr.effects,
51
- newAnnotations,
52
- tr.scrollIntoView
53
- );
54
- });