1
在长按手势上,上下文操作菜单沿选定文本出现。 但是,除非我从菜单中选择一个选项,否则不会隐藏。上下文操作菜单在Ionic(Android)中未隐藏
首先,使上下文操作菜单,我用这个:
overflow-scroll = "true" in the ion-content.
在CSS类中,我写道:
-webkit-user-select: auto;
但现在我不能隐藏它。它锁定在我看来。即使在我的网络视图中的任何地方触摸,它仍然启用。隐藏上下文菜单我用这个:
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-touch-callout:none;
但仍然没有获得成功。这个特定的问题仅限于android。对于iOS,它工作正常。任何帮助,将不胜感激。
离子版本 - 2.1.0
更新
我终于找到了答案。
我用了以下两种方法。第一种方法是长按选择文本,第二种方法是删除选择。
/*----------- To get selection--------*/
$scope.getSelectionText = function() {
var text = "";
if (window.getSelection) {
text = window.getSelection().toString();
$scope.selectMode = true;
} else if (document.selection && document.selection.type != "Control") {
text = document.selection.createRange().text;
$scope.selectMode = true;
}
return text;
};
/*---------------To remove selection----------*/
$scope.remove = function(){
if (window.getSelection) {
if (window.getSelection().empty) { // Chrome
window.getSelection().empty();
} else if (window.getSelection().removeAllRanges) { // Firefox
window.getSelection().removeAllRanges();
}
} else if (document.selection) { // IE?
document.selection.empty();
}
};
并添加NG-点击您的DIV
<div class="selectable" ng-click="remove()">
<ng-include src="activeTab.url"></ng-include>
</div>