Javascript phonegap/cordova是否支持document.execCommand?
我有一个应用程序,我正试图在一个运行在phonegap包装中的所见即所得编辑器中构建。我花了很多时间尝试不同的方法,但我似乎无法让它发挥作用。我几乎是一字不差地用这个 该指令:Javascript phonegap/cordova是否支持document.execCommand?,javascript,ios,html,cordova,wysiwyg,Javascript,Ios,Html,Cordova,Wysiwyg,我有一个应用程序,我正试图在一个运行在phonegap包装中的所见即所得编辑器中构建。我花了很多时间尝试不同的方法,但我似乎无法让它发挥作用。我几乎是一字不差地用这个 该指令: module.directive 'wysiwig', -> restrict: 'A' link: ($scope, ele, attrs)-> $('#editControls a').on 'touchstart', (e) -> role =
module.directive 'wysiwig', ->
restrict: 'A'
link: ($scope, ele, attrs)->
$('#editControls a').on 'touchstart', (e) ->
role = $(this).data('role')
switch role
when 'h1', 'h2', 'p'
document.execCommand('formatBlock', false, role)
else
document.execCommand(role, false, null)
html:
<div id='editControls'>
<a data-role='h1' href='#'>H1</a>
<a data-role='h2' href='#'>H2</a>
<a data-role='p' href='#'>P</a>
</div>
<div id="editor" wysiwig contenteditable="true" ng-model="event.description">
<h1>Hello there</h1>
<p>do some stuff</p>
</div>
你好
做点什么
我知道touchstart正在正确触发,因为我已经发出了警报以确保正确触发。html不会在视图中更新,但是它在普通html站点上工作吗?是的,它在浏览器中工作,没有任何problems@constarr你在这方面有什么进展吗?我写的代码,你是基于它,这将是伟大的,如果知道它在phonegap工作!同样的问题!调查这件事。