[TIMOB-16369] Android: Disable copy,define,share popup contextual bar inside webview when selecting text
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-12-06T23:19:14.000+0000 |
Affected Version/s | Release 3.2.0 |
Fix Version/s | Release 6.1.0 |
Components | Android |
Labels | n/a |
Reporter | Jignesh Kasundra |
Assignee | Frankie Merzadyan |
Created | 2014-01-31T10:03:46.000+0000 |
Updated | 2016-12-08T22:13:17.000+0000 |
Description
Hi...
In webView when selecting the content or text a default popup menu gets appeared with the options copy, define, share etc.
Is it possible to remove this option without blocking webview text selection? Also, add some new menu option?
---
We should add a boolean property to disable the default set of context actions in the action bar. We may *also* want to allow disable text selection altogether.
var webView = Ti.UI.createWebView({
disableTextSelection: false,
disableContextMenu: true
});
Attachments
File | Date | Size |
---|---|---|
local_webview.html | 2016-09-14T09:28:25.000+0000 | 1927 |
Contextual Action Bar use case: http://developer.android.com/design/patterns/actionbar.html
Moving this feature request to engineering for further evaluation and prioritization. There is a pull request from the reporter for this feature but it is most likely on the wrong branch. https://github.com/appcelerator/titanium_mobile/pull/5309
Any word on this? The ticket is nearly two years old.
Might be time to start addressing some of these old tickets?
is there any time frame on this ticket ? as the ticket is raised two year back. the contextual action bar is very important for the application.
[~jignesh.igp] Just want to check, this is the removal of the ability to copy in the webview? Do you have a image that can be shared to show what you mean?
!http://testaz3.azardi.com/issue/copypaste.jpg!
Thanks for the photo.
[~bearus] [~timpoulsen] [~jignesh.igp] How exactly would you use this? For [~jignesh.igp], I assume you would just like the ability to stop this?
i need to stop that default contextual action bar which have options like copy , share etc. without blocking text selection. the contextual action bar (displayed on top in the image) get appeared on selecting text and i want to prevent that options ( copy , share etc)
I'm afraid I commented four months ago and I don't recall exactly what my needs were at the time. I think it was to put a "share-to-specific app" shortcut in that action bar in place of the defaults.
The Android Contextual ActionBar (CAB) is much more than copy-paste from a WebView, or adding a Sharing Action Provider (which is exposed on my ActionBarExtras Module). Here's a native library to expose the CAB that shows an use-case different than the aforementioned.
So for now, the issue in this ticket would be [~jignesh.igp]'s issue on needing to stop/disable the CAB.
yes i need to stop/disable the CAB.
okay great. i am also facing same issue with iOS platform as well. after selecting a text in webview it shows me copy , define , share options so that also i need to stop/disable.
Hello is that this ticket is under evaluation ?
So for iOS, I guess [~jignesh.igp] means the popup that is shown when you select text. That is a native behavior and should not be prevented from the native-side. Instead, the user can/should change the HTML attributes that disable text-selection. See [this thread](http://stackoverflow.com/a/6051172/5537752) on how to insert a CSS-snippet in your webview-source and it should work. Otherwise, please specify what exactly needs to be specified.
hello for iOS, the thread you suggested is also blocking the text selection. i need to disable only popup contextual menu which is appeared after selecting text. I know its iOS behavior but as i shared a screen shot of one of the iOS reading application where they hides the option like copy. (http://testaz3.azardi.com/issue/Reference.jpg) because the content we are rendering into webview is very valuable and need to prevent it from copy and share. for Android i think the engineering was done by Ashraf Abu and was planed to release the fix with the version 6.0.0
I introduced the new property
disableSelection
to disable the text-selection and hide the callout-bubble when being set totrue
(default is stillfalse
for backwards-compatibility) PR: https://github.com/appcelerator/titanium_mobile/pull/8378 Demo (local_webview.html is attached from the KitchenSink):CR and FT passed. you can use url: "http://google.com" instead. with disableSelection: true, you can try to press and hold any text, there will not be any pop up.
[~cng] I believe this requires Android parity.
[~fmerzadyan] can you take a look at implementing the android part?
Just to clarify, do you want to remove all options in contextual action bar: copy, share, select all, web search and assist? I put a placeholder text and icon just for demonstration of what I have right now. [link screenshot](http://s21.postimg.org/ueyct6kpz/cab_screenshot.png)
I think that's acceptable since it's a similar behavior in iOS.
Ok, so I've tried to bring a little sanity to this ticket/request: - This ticket should cover being able to disable the default context bar actions when selecting text on Android. - TIMOB-23992 is the equivalent ticket for iOS - TIMOB-23993 is the feature request that [~timpoulsen] seemed to be asking for, which is to not necessarily to disable the context actions, but to substitute/add custom items there.
Merged PR to master. Can now use the disableContentMenu boolean property to disable the default context action bar from showing (cut/copy/paste/share) when selecting text in a WebView.
When
disableContextMenu
is set tofalse
the context menu does not come up with SDK 6.1.0. Reopening. Appc Studio : 4.8.1.201611291132 SDK Version : 6.1.0.v20161201064221 Mac OS Version : 10.12 Xcode Version : Xcode 8.1 Build version 8B62 Appc CLI AND Appc NPM : {"NPM":"4.2.9-1","CLI":"6.1.0-302"} Ti CLI : 5.0.11 Alloy : 1.9.4 Node : v4.6.0 Device: running 7.1Pixelmaster: https://github.com/appcelerator/titanium_mobile/pull/8660
Verified feature, when setting
disableContextMenu
totrue
the contextual bar is no longer present, settingdisableContextMenu
tofalse
allows the contextual bar to be seen. *Environement*