{"record":{"id":"98fad507f628203b","repo":"ssssssss-team/spider-flow","slug":"inputstyle-can-not-yet-be-changed-in-a-running-e","errorCode":null,"errorMessage":"inputStyle can not (yet) be changed in a running editor","messagePattern":"inputStyle can not \\(yet\\) be changed in a running editor","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"spider-flow-web/src/main/resources/static/js/codemirror/codemirror.js","lineNumber":7720,"sourceCode":"        for (var pos = 0;;) {\n          var found = line.text.indexOf(val, pos);\n          if (found == -1) { break }\n          pos = found + val.length;\n          newBreaks.push(Pos(lineNo, found));\n        }\n        lineNo++;\n      });\n      for (var i = newBreaks.length - 1; i >= 0; i--)\n        { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }\n    });\n    option(\"specialChars\", /[\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u061c\\u200b-\\u200f\\u2028\\u2029\\ufeff\\ufff9-\\ufffc]/g, function (cm, val, old) {\n      cm.state.specialChars = new RegExp(val.source + (val.test(\"\\t\") ? \"\" : \"|\\t\"), \"g\");\n      if (old != Init) { cm.refresh(); }\n    });\n    option(\"specialCharPlaceholder\", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true);\n    option(\"electricChars\", true);\n    option(\"inputStyle\", mobile ? \"contenteditable\" : \"textarea\", function () {\n      throw new Error(\"inputStyle can not (yet) be changed in a running editor\") // FIXME\n    }, true);\n    option(\"spellcheck\", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true);\n    option(\"autocorrect\", false, function (cm, val) { return cm.getInputField().autocorrect = val; }, true);\n    option(\"autocapitalize\", false, function (cm, val) { return cm.getInputField().autocapitalize = val; }, true);\n    option(\"rtlMoveVisually\", !windows);\n    option(\"wholeLineUpdateBefore\", true);\n\n    option(\"theme\", \"default\", function (cm) {\n      themeChanged(cm);\n      updateGutters(cm);\n    }, true);\n    option(\"keyMap\", \"default\", function (cm, val, old) {\n      var next = getKeyMap(val);\n      var prev = old != Init && getKeyMap(old);\n      if (prev && prev.detach) { prev.detach(cm, next); }\n      if (next.attach) { next.attach(cm, prev || null); }\n    });\n    option(\"extraKeys\", null);","sourceCodeStart":7702,"sourceCodeEnd":7738,"githubUrl":"https://github.com/ssssssss-team/spider-flow/blob/c799cca99c7d064673dc79e6ef06a08bbc0e292d/spider-flow-web/src/main/resources/static/js/codemirror/codemirror.js#L7702-L7738","documentation":"The inputStyle option ('textarea' vs 'contenteditable') determines how the editor captures keyboard input and is only read at construction time. Its option handler deliberately throws because changing it on a live editor is not implemented.","triggerScenarios":"Calling cm.setOption('inputStyle', 'contenteditable'|'textarea') after the editor instance was created, or an options UI applying saved inputStyle to an already-initialized editor.","commonSituations":"Settings panels that persist user preferences and apply them via setOption, mobile-detection code switching input styles at runtime, or framework wrappers re-applying all options on update.","solutions":["Re-create the editor with the desired inputStyle: capture value/mode/options, destroy (cm.toTextArea() or remove), and re-instantiate","Set inputStyle only in the constructor options object","Guard the settings code so inputStyle is only applied on first creation"],"exampleFix":"// before\ncm.setOption(\"inputStyle\", \"contenteditable\");\n// after\nvar val = cm.getValue(), opts = cm.options;\ncm.toTextArea();\ncm = CodeMirror.fromTextArea(textareaEl,\n  Object.assign({}, opts, {inputStyle: \"contenteditable\", value: val}));","handlingStrategy":"fallback","validationCode":"function applyInputStyle(cm, style) {\n  if (cm.getOption(\"inputStyle\") !== style) {\n    recreateEditorWithOption(cm, \"inputStyle\", style); // setOption will throw\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  cm.setOption(\"inputStyle\", style);\n} catch (e) {\n  if (/inputStyle can not/.test(e.message)) {\n    recreateEditor(cm, {inputStyle: style}); // destroy + re-create with new option\n  } else { throw e; }\n}","preventionTips":["Treat inputStyle as construction-time only; pass it in the initial options object","In settings UIs, mark inputStyle as \"requires reload\" and rebuild the editor on change","When applying saved option sets, filter out inputStyle for existing editors"],"tags":["codemirror","configuration","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"c799cca99c7d064673dc79e6ef06a08bbc0e292d","analyzedAt":"2026-09-08T13:47:08.225Z","contentChangedAt":"2026-09-08T13:47:08.225Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}