{"hidden":false,"children":[{"configs":{"itemId":"module","loginRequired":"false"},"expanded":true,"children":[{"configs":{"layout":"fit","itemId":"win","resizable":"true","editWin":"true","closeAction":"destroy","width":"800","title":"JavaScript 脚本编辑器","iconCls":"file_js_icon","height":"460","maximizable":"true"},"expanded":true,"children":[{"configs":{"itemId":"panel1"},"expanded":true,"children":[{"configs":{"isConfig":"true","itemId":"bbar"},"expanded":true,"children":[{"configs":{"itemId":"fillItem","text":"->"},"expanded":false,"children":[],"type":"item"},{"configs":{"itemId":"cursorLabel","xtype":"tbtext","text":"&#160;"},"expanded":false,"children":[],"type":"item"}],"type":"toolbar"}],"type":"panel"}],"type":"window","events":{"afterrender":"var config, panel = app.panel1;\npanel.update('<textarea><\/textarea>');\nconfig = {\n  lineNumbers: true,\n  theme: Wb.editTheme,\n  highlightSelectionMatches: {\n    showToken: /\\w/\n  },\n  mode: {\n    name: 'text/javascript',\n    globalVars: true\n  },\n  gutters: ['CodeMirror-lint-markers'],\n  lint: true,\n  matchBrackets: true,\n  extraKeys: {\n    'Ctrl-/': 'toggleComment',\n    'Shift-Ctrl-F': function(doc) {\n      if (doc.options.readOnly)\n        return;\n      var cursor = doc.getCursor(),\n        scroll = doc.getScrollInfo();\n      doc.autoFormatRange({\n        line: 0,\n        ch: 0\n      }, {\n        line: Number.MAX_VALUE,\n        ch: Number.MAX_VALUE\n      });\n      doc.scrollTo(scroll.left, scroll.top);\n      doc.setCursor(cursor);\n    }\n  }\n};\napp.editor = CodeMirror.fromTextArea(panel.el.down('textarea', true), config);\npanel.mon(panel, 'resize', function(panel, width, height) {\n  if (app.editor && !panel.destroying) {\n    Ext.fly(app.editor.getScrollerElement()).setHeight(panel.body.getHeight());\n    app.editor.refresh();\n  }\n});\napp.editor.on('cursorActivity', function() {\n  var o = app.editor.getCursor();\n  app.cursorLabel.setText((o.line + 1) + ':' + (o.ch + 1));\n});","ok":"if (app.callbackParam)\n  Ext.callback(app.callbackParam, app, [app.editor.getValue(), win]);"}}],"type":"module","events":{"initialize":"Wb.apply(app, {\n  doShow: function() {\n    app.win.show();\n    app.editor.setValue(app.valueParam || '');\n    setTimeout(function() {\n      app.editor.focus();\n    }, 10);\n  },\n  /**\n   * 显示JavaScript编辑器对话框。\n   * @param {String} title 对话框标题。\n   * @param {String} value 编辑器中需要编辑的脚本内容。\n   * @param {Function} callback 点击对话框确定按钮时的回调事件，可使用参数value和win，表示编辑的脚本内容和窗口对象。\n   */\n  show: function(title, value, callback) {\n    app.valueParam = value;\n    app.callbackParam = callback;\n    if (title)\n      app.win.setTitle(title);\n    if (window.CodeMirror)\n      app.doShow();\n    else {\n      Wb.addLink(['wb/libs/cm/cmirror.css', 'wb/libs/cm/cmirror.js'],\n        app.doShow\n      );\n    }\n  }\n});"}}],"roles":{},"title":"JS编辑器","iconCls":"","inframe":false,"pageLink":""}