{"hidden":false,"children":[{"configs":{"itemId":"module"},"expanded":true,"children":[{"configs":{"layout":"fit","border":"false","itemId":"viewport1"},"expanded":true,"children":[{"configs":{"border":"false","itemId":"panel1"},"expanded":false,"children":[],"type":"panel"}],"type":"viewport","events":{"afterrender":"//本例使用动态加载CodeMirror的js和css库来创建CodeMirror js编辑器\n\n//展现CodeMirror\nfunction render() {\n  var panel = app.panel1;\n\n  //设置textarea html，用于展现CodeMirror。\n  panel.update('<textarea><\/textarea>');\n  //把CodeMirror对象引用添加到panel\n  panel.editor = CodeMirror.fromTextArea(panel.el.down('textarea', true), {\n    lineNumbers: true,\n    mode: 'text/javascript'\n  });\n\n  //调整CodeMirror控件，以适应容器大小。\n  panel.mon(panel, 'resize', function(panel, width, height) {\n    if (panel.editor && !panel.destroying) {\n      Ext.fly(panel.editor.getScrollerElement()).setHeight(height);\n      panel.editor.refresh();\n    }\n  });\n  panel.editor.focus(); //设置焦点\n}\n\n//如果已经加载CodeMirror\nif (window.CodeMirror)\n  render();\nelse {\n  //动态加载css和js链接并展现\n  Wb.addLink(['wb/libs/cm/cmirror.css', 'wb/libs/cm/cmirror.js'],\n    render //回调函数\n  );\n}"}}],"type":"module"}],"roles":{"demo":1},"title":"动态引用链接","iconCls":"","inframe":false,"pageLink":""}