Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/406.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在UIWebview IOS 5中使用CodeMirror2代码选择文本_Javascript_Ios5_Uiwebview_Contenteditable_Codemirror - Fatal编程技术网

Javascript 如何在UIWebview IOS 5中使用CodeMirror2代码选择文本

Javascript 如何在UIWebview IOS 5中使用CodeMirror2代码选择文本,javascript,ios5,uiwebview,contenteditable,codemirror,Javascript,Ios5,Uiwebview,Contenteditable,Codemirror,我尝试使用CodeMirror 2在UIWebview IOS 5中制作文本编辑器。但我在文本选择上有问题。我无法选择文本 这是codemirror.js中的codemirror代码 // Wraps and hides input textarea: '<div style="overflow: hidden; position: relative; ' + 'width: 3px; height: 0px;">' + '<textare

我尝试使用CodeMirror 2在UIWebview IOS 5中制作文本编辑器。但我在文本选择上有问题。我无法选择文本

这是codemirror.js中的codemirror代码

// Wraps and hides input textarea:
'<div style="overflow: hidden; position: relative; ' + 
             'width: 3px; height: 0px;">' + 
    '<textarea style="position: absolute; padding: 0; ' +
                     'width: 1px;" wrap="off" autocorrect="off" ' +
                     'autocapitalize="off">' + 
    '</textarea>' +
'</div>' +
//包装和隐藏输入文本区域:
'' + 
'' + 
'' +
'' +
根据这段代码,我想我必须将“div”与contenteditable属性一起使用。 我计划用contenteditable属性将textarea更改为“div”,因为目前iOS5支持contenteditable属性。但是,我不知道该怎么做。有人知道如何解决我的问题吗


谢谢

CodeMirror是以一种避免使用contentEditable的方式构建的,因为在不同浏览器中实现的方式不同

这是在iOS上运行的CodeMirror2自定义版本的演示(我不是作者):

如果您对为使其正常工作而进行的更改感兴趣,请尝试在源代码中搜索“iOS”或“CHANGE”,或者按原样使用它


这里的

非常感谢这项工作,但这是一个非常庞大且有问题的解决方案。