@capawesome/capacitor-text-interaction 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ require 'json'
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = 'CapawesomeCapacitorTextInteraction'
7
+ s.version = package['version']
8
+ s.summary = package['description']
9
+ s.license = package['license']
10
+ s.homepage = package['repository']['url']
11
+ s.author = package['author']
12
+ s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
+ s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
+ s.ios.deployment_target = '15.0'
15
+ s.dependency 'Capacitor'
16
+ s.swift_version = '5.1'
17
+ end
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Robin Genz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/Package.swift ADDED
@@ -0,0 +1,28 @@
1
+ // swift-tools-version: 5.9
2
+ import PackageDescription
3
+
4
+ let package = Package(
5
+ name: "CapawesomeCapacitorTextInteraction",
6
+ platforms: [.iOS(.v15)],
7
+ products: [
8
+ .library(
9
+ name: "CapawesomeCapacitorTextInteraction",
10
+ targets: ["TextInteractionPlugin"])
11
+ ],
12
+ dependencies: [
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
14
+ ],
15
+ targets: [
16
+ .target(
17
+ name: "TextInteractionPlugin",
18
+ dependencies: [
19
+ .product(name: "Capacitor", package: "capacitor-swift-pm"),
20
+ .product(name: "Cordova", package: "capacitor-swift-pm")
21
+ ],
22
+ path: "ios/Plugin"),
23
+ .testTarget(
24
+ name: "TextInteractionPluginTests",
25
+ dependencies: ["TextInteractionPlugin"],
26
+ path: "ios/PluginTests")
27
+ ]
28
+ )
package/README.md ADDED
@@ -0,0 +1,173 @@
1
+ # Capacitor Text Interaction Plugin
2
+
3
+ Capacitor plugin to enable and disable text interaction (selection, magnifier, callout menu) in the app's WebView.
4
+
5
+ <div class="capawesome-z29o10a">
6
+ <a href="https://cloud.capawesome.io/" target="_blank">
7
+ <img alt="Deliver Live Updates to your Capacitor app with Capawesome Cloud" src="https://cloud.capawesome.io/assets/banners/cloud-build-and-deploy-capacitor-apps.png?t=1" />
8
+ </a>
9
+ </div>
10
+
11
+ ## Features
12
+
13
+ - ✋ **Text interaction**: Enable and disable text interaction at runtime.
14
+ - 🔍 **State**: Read whether text interaction is currently enabled.
15
+ - 🧩 **Zero-config**: No changes to your native project required.
16
+ - 📦 **CocoaPods & SPM**: Supports CocoaPods and Swift Package Manager for iOS.
17
+ - 🔁 **Up-to-date**: Always supports the latest Capacitor version.
18
+
19
+ Missing a feature? Just [open an issue](https://github.com/capawesome-team/capacitor-plugins/issues) and we'll take a look!
20
+
21
+ ## Newsletter
22
+
23
+ Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our [Capawesome Newsletter](https://cloud.capawesome.io/newsletter/).
24
+
25
+ ## Compatibility
26
+
27
+ | Plugin Version | Capacitor Version | Status |
28
+ | -------------- | ----------------- | -------------- |
29
+ | 0.x.x | >=8.x.x | Active support |
30
+
31
+ ## Installation
32
+
33
+ You can use our **AI-Assisted Setup** to install the plugin.
34
+ Add the [Capawesome Skills](https://github.com/capawesome-team/skills) to your AI tool using the following command:
35
+
36
+ ```bash
37
+ npx skills add capawesome-team/skills --skill capacitor-plugins
38
+ ```
39
+
40
+ Then use the following prompt:
41
+
42
+ ```
43
+ Use the `capacitor-plugins` skill from `capawesome-team/skills` to install the `@capawesome/capacitor-text-interaction` plugin in my project.
44
+ ```
45
+
46
+ If you prefer **Manual Setup**, install the plugin by running the following commands and follow the platform-specific instructions below:
47
+
48
+ ```bash
49
+ npm install @capawesome/capacitor-text-interaction
50
+ npx cap sync
51
+ ```
52
+
53
+ This plugin is only available on **iOS**. On Android and Web, all methods reject as unimplemented. On Web, use the CSS `user-select` property to prevent text selection instead.
54
+
55
+ ### iOS
56
+
57
+ No additional setup is required.
58
+
59
+ ## Configuration
60
+
61
+ No configuration required for this plugin.
62
+
63
+ ## Usage
64
+
65
+ ```typescript
66
+ import { TextInteraction } from '@capawesome/capacitor-text-interaction';
67
+
68
+ const enable = async () => {
69
+ await TextInteraction.enable();
70
+ };
71
+
72
+ const disable = async () => {
73
+ await TextInteraction.disable();
74
+ };
75
+
76
+ const isEnabled = async () => {
77
+ const { enabled } = await TextInteraction.isEnabled();
78
+ return enabled;
79
+ };
80
+ ```
81
+
82
+ ## API
83
+
84
+ <docgen-index>
85
+
86
+ * [`disable()`](#disable)
87
+ * [`enable()`](#enable)
88
+ * [`isEnabled()`](#isenabled)
89
+ * [Interfaces](#interfaces)
90
+
91
+ </docgen-index>
92
+
93
+ <docgen-api>
94
+ <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
95
+
96
+ ### disable()
97
+
98
+ ```typescript
99
+ disable() => Promise<void>
100
+ ```
101
+
102
+ Disable text interaction in the app's WebView.
103
+
104
+ This turns off system text-interaction gestures such as text selection,
105
+ the selection magnifier and the callout (copy/paste) menu.
106
+
107
+ Only available on iOS.
108
+
109
+ **Since:** 0.1.0
110
+
111
+ --------------------
112
+
113
+
114
+ ### enable()
115
+
116
+ ```typescript
117
+ enable() => Promise<void>
118
+ ```
119
+
120
+ Enable text interaction in the app's WebView.
121
+
122
+ Text interaction is enabled by default.
123
+
124
+ Only available on iOS.
125
+
126
+ **Since:** 0.1.0
127
+
128
+ --------------------
129
+
130
+
131
+ ### isEnabled()
132
+
133
+ ```typescript
134
+ isEnabled() => Promise<IsEnabledResult>
135
+ ```
136
+
137
+ Check whether text interaction is currently enabled in the app's WebView.
138
+
139
+ Only available on iOS.
140
+
141
+ **Returns:** <code>Promise&lt;<a href="#isenabledresult">IsEnabledResult</a>&gt;</code>
142
+
143
+ **Since:** 0.1.0
144
+
145
+ --------------------
146
+
147
+
148
+ ### Interfaces
149
+
150
+
151
+ #### IsEnabledResult
152
+
153
+ | Prop | Type | Description | Since |
154
+ | ------------- | -------------------- | ---------------------------------------------- | ----- |
155
+ | **`enabled`** | <code>boolean</code> | Whether text interaction is currently enabled. | 0.1.0 |
156
+
157
+ </docgen-api>
158
+
159
+ ## Text Interaction Behavior
160
+
161
+ Text interaction covers the system gestures that let a user work with text in the WebView: text selection, the selection magnifier and the callout (copy/paste) menu.
162
+
163
+ - **Beyond CSS**: The CSS `user-select: none` property prevents text selection for specific elements and covers most cases. This plugin disables the system text-interaction gestures as a whole, which is useful for app-like UIs where accidental text selection breaks the experience.
164
+ - **Default state**: Text interaction is enabled by default.
165
+ - **Runtime toggling**: Changes apply to the WebView's configuration. If a change does not take effect immediately on already-rendered content, reload the WebView content to apply it.
166
+
167
+ ## Changelog
168
+
169
+ See [CHANGELOG.md](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/text-interaction/CHANGELOG.md).
170
+
171
+ ## License
172
+
173
+ See [LICENSE](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/text-interaction/LICENSE).
@@ -0,0 +1,58 @@
1
+ ext {
2
+ junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
6
+ }
7
+
8
+ buildscript {
9
+ repositories {
10
+ google()
11
+ mavenCentral()
12
+ }
13
+ dependencies {
14
+ classpath 'com.android.tools.build:gradle:8.13.0'
15
+ }
16
+ }
17
+
18
+ apply plugin: 'com.android.library'
19
+
20
+ android {
21
+ namespace = "io.capawesome.capacitorjs.plugins.textinteraction"
22
+ compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
23
+ defaultConfig {
24
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
25
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
26
+ versionCode 1
27
+ versionName "1.0"
28
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
29
+ }
30
+ buildTypes {
31
+ release {
32
+ minifyEnabled false
33
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
34
+ }
35
+ }
36
+ lintOptions {
37
+ abortOnError = false
38
+ }
39
+ compileOptions {
40
+ sourceCompatibility JavaVersion.VERSION_21
41
+ targetCompatibility JavaVersion.VERSION_21
42
+ }
43
+ }
44
+
45
+ repositories {
46
+ google()
47
+ mavenCentral()
48
+ }
49
+
50
+
51
+ dependencies {
52
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
53
+ implementation project(':capacitor-android')
54
+ implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
55
+ testImplementation "junit:junit:$junitVersion"
56
+ androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
57
+ androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
58
+ }
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,30 @@
1
+ package io.capawesome.capacitorjs.plugins.textinteraction;
2
+
3
+ import androidx.annotation.NonNull;
4
+ import com.getcapacitor.Plugin;
5
+ import com.getcapacitor.PluginCall;
6
+ import com.getcapacitor.PluginMethod;
7
+ import com.getcapacitor.annotation.CapacitorPlugin;
8
+
9
+ @CapacitorPlugin(name = "TextInteraction")
10
+ public class TextInteractionPlugin extends Plugin {
11
+
12
+ @PluginMethod
13
+ public void disable(PluginCall call) {
14
+ rejectCallAsUnimplemented(call);
15
+ }
16
+
17
+ @PluginMethod
18
+ public void enable(PluginCall call) {
19
+ rejectCallAsUnimplemented(call);
20
+ }
21
+
22
+ @PluginMethod
23
+ public void isEnabled(PluginCall call) {
24
+ rejectCallAsUnimplemented(call);
25
+ }
26
+
27
+ private void rejectCallAsUnimplemented(@NonNull PluginCall call) {
28
+ call.unimplemented("This method is not available on this platform.");
29
+ }
30
+ }
File without changes
package/dist/docs.json ADDED
@@ -0,0 +1,93 @@
1
+ {
2
+ "api": {
3
+ "name": "TextInteractionPlugin",
4
+ "slug": "textinteractionplugin",
5
+ "docs": "",
6
+ "tags": [],
7
+ "methods": [
8
+ {
9
+ "name": "disable",
10
+ "signature": "() => Promise<void>",
11
+ "parameters": [],
12
+ "returns": "Promise<void>",
13
+ "tags": [
14
+ {
15
+ "name": "since",
16
+ "text": "0.1.0"
17
+ }
18
+ ],
19
+ "docs": "Disable text interaction in the app's WebView.\n\nThis turns off system text-interaction gestures such as text selection,\nthe selection magnifier and the callout (copy/paste) menu.\n\nOnly available on iOS.",
20
+ "complexTypes": [],
21
+ "slug": "disable"
22
+ },
23
+ {
24
+ "name": "enable",
25
+ "signature": "() => Promise<void>",
26
+ "parameters": [],
27
+ "returns": "Promise<void>",
28
+ "tags": [
29
+ {
30
+ "name": "since",
31
+ "text": "0.1.0"
32
+ }
33
+ ],
34
+ "docs": "Enable text interaction in the app's WebView.\n\nText interaction is enabled by default.\n\nOnly available on iOS.",
35
+ "complexTypes": [],
36
+ "slug": "enable"
37
+ },
38
+ {
39
+ "name": "isEnabled",
40
+ "signature": "() => Promise<IsEnabledResult>",
41
+ "parameters": [],
42
+ "returns": "Promise<IsEnabledResult>",
43
+ "tags": [
44
+ {
45
+ "name": "since",
46
+ "text": "0.1.0"
47
+ }
48
+ ],
49
+ "docs": "Check whether text interaction is currently enabled in the app's WebView.\n\nOnly available on iOS.",
50
+ "complexTypes": [
51
+ "IsEnabledResult"
52
+ ],
53
+ "slug": "isenabled"
54
+ }
55
+ ],
56
+ "properties": []
57
+ },
58
+ "interfaces": [
59
+ {
60
+ "name": "IsEnabledResult",
61
+ "slug": "isenabledresult",
62
+ "docs": "",
63
+ "tags": [
64
+ {
65
+ "text": "0.1.0",
66
+ "name": "since"
67
+ }
68
+ ],
69
+ "methods": [],
70
+ "properties": [
71
+ {
72
+ "name": "enabled",
73
+ "tags": [
74
+ {
75
+ "text": "true",
76
+ "name": "example"
77
+ },
78
+ {
79
+ "text": "0.1.0",
80
+ "name": "since"
81
+ }
82
+ ],
83
+ "docs": "Whether text interaction is currently enabled.",
84
+ "complexTypes": [],
85
+ "type": "boolean"
86
+ }
87
+ ]
88
+ }
89
+ ],
90
+ "enums": [],
91
+ "typeAliases": [],
92
+ "pluginConfigs": []
93
+ }
@@ -0,0 +1,43 @@
1
+ export interface TextInteractionPlugin {
2
+ /**
3
+ * Disable text interaction in the app's WebView.
4
+ *
5
+ * This turns off system text-interaction gestures such as text selection,
6
+ * the selection magnifier and the callout (copy/paste) menu.
7
+ *
8
+ * Only available on iOS.
9
+ *
10
+ * @since 0.1.0
11
+ */
12
+ disable(): Promise<void>;
13
+ /**
14
+ * Enable text interaction in the app's WebView.
15
+ *
16
+ * Text interaction is enabled by default.
17
+ *
18
+ * Only available on iOS.
19
+ *
20
+ * @since 0.1.0
21
+ */
22
+ enable(): Promise<void>;
23
+ /**
24
+ * Check whether text interaction is currently enabled in the app's WebView.
25
+ *
26
+ * Only available on iOS.
27
+ *
28
+ * @since 0.1.0
29
+ */
30
+ isEnabled(): Promise<IsEnabledResult>;
31
+ }
32
+ /**
33
+ * @since 0.1.0
34
+ */
35
+ export interface IsEnabledResult {
36
+ /**
37
+ * Whether text interaction is currently enabled.
38
+ *
39
+ * @example true
40
+ * @since 0.1.0
41
+ */
42
+ enabled: boolean;
43
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface TextInteractionPlugin {\n /**\n * Disable text interaction in the app's WebView.\n *\n * This turns off system text-interaction gestures such as text selection,\n * the selection magnifier and the callout (copy/paste) menu.\n *\n * Only available on iOS.\n *\n * @since 0.1.0\n */\n disable(): Promise<void>;\n /**\n * Enable text interaction in the app's WebView.\n *\n * Text interaction is enabled by default.\n *\n * Only available on iOS.\n *\n * @since 0.1.0\n */\n enable(): Promise<void>;\n /**\n * Check whether text interaction is currently enabled in the app's WebView.\n *\n * Only available on iOS.\n *\n * @since 0.1.0\n */\n isEnabled(): Promise<IsEnabledResult>;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface IsEnabledResult {\n /**\n * Whether text interaction is currently enabled.\n *\n * @example true\n * @since 0.1.0\n */\n enabled: boolean;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { TextInteractionPlugin } from './definitions';
2
+ declare const TextInteraction: TextInteractionPlugin;
3
+ export * from './definitions';
4
+ export { TextInteraction };
@@ -0,0 +1,7 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+ const TextInteraction = registerPlugin('TextInteraction', {
3
+ web: () => import('./web').then(m => new m.TextInteractionWeb()),
4
+ });
5
+ export * from './definitions';
6
+ export { TextInteraction };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,eAAe,GAAG,cAAc,CACpC,iBAAiB,EACjB;IACE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;CACjE,CACF,CAAC;AAEF,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { TextInteractionPlugin } from './definitions';\n\nconst TextInteraction = registerPlugin<TextInteractionPlugin>(\n 'TextInteraction',\n {\n web: () => import('./web').then(m => new m.TextInteractionWeb()),\n },\n);\n\nexport * from './definitions';\nexport { TextInteraction };\n"]}
@@ -0,0 +1,7 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ import type { TextInteractionPlugin, IsEnabledResult } from './definitions';
3
+ export declare class TextInteractionWeb extends WebPlugin implements TextInteractionPlugin {
4
+ disable(): Promise<void>;
5
+ enable(): Promise<void>;
6
+ isEnabled(): Promise<IsEnabledResult>;
7
+ }
@@ -0,0 +1,13 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ export class TextInteractionWeb extends WebPlugin {
3
+ async disable() {
4
+ throw this.unimplemented('Not implemented on web.');
5
+ }
6
+ async enable() {
7
+ throw this.unimplemented('Not implemented on web.');
8
+ }
9
+ async isEnabled() {
10
+ throw this.unimplemented('Not implemented on web.');
11
+ }
12
+ }
13
+ //# sourceMappingURL=web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,kBACX,SAAQ,SAAS;IAGjB,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,MAAM;QACV,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,SAAS;QACb,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { TextInteractionPlugin, IsEnabledResult } from './definitions';\n\nexport class TextInteractionWeb\n extends WebPlugin\n implements TextInteractionPlugin\n{\n async disable(): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async enable(): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async isEnabled(): Promise<IsEnabledResult> {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n"]}
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var core = require('@capacitor/core');
4
+
5
+ const TextInteraction = core.registerPlugin('TextInteraction', {
6
+ web: () => Promise.resolve().then(function () { return web; }).then(m => new m.TextInteractionWeb()),
7
+ });
8
+
9
+ class TextInteractionWeb extends core.WebPlugin {
10
+ async disable() {
11
+ throw this.unimplemented('Not implemented on web.');
12
+ }
13
+ async enable() {
14
+ throw this.unimplemented('Not implemented on web.');
15
+ }
16
+ async isEnabled() {
17
+ throw this.unimplemented('Not implemented on web.');
18
+ }
19
+ }
20
+
21
+ var web = /*#__PURE__*/Object.freeze({
22
+ __proto__: null,
23
+ TextInteractionWeb: TextInteractionWeb
24
+ });
25
+
26
+ exports.TextInteraction = TextInteraction;
27
+ //# sourceMappingURL=plugin.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst TextInteraction = registerPlugin('TextInteraction', {\n web: () => import('./web').then(m => new m.TextInteractionWeb()),\n});\nexport * from './definitions';\nexport { TextInteraction };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class TextInteractionWeb extends WebPlugin {\n async disable() {\n throw this.unimplemented('Not implemented on web.');\n }\n async enable() {\n throw this.unimplemented('Not implemented on web.');\n }\n async isEnabled() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,eAAe,GAAGA,mBAAc,CAAC,iBAAiB,EAAE;AAC1D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;AACpE,CAAC;;ACFM,MAAM,kBAAkB,SAASC,cAAS,CAAC;AAClD,IAAI,MAAM,OAAO,GAAG;AACpB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,SAAS,GAAG;AACtB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js ADDED
@@ -0,0 +1,30 @@
1
+ var capacitorTextInteraction = (function (exports, core) {
2
+ 'use strict';
3
+
4
+ const TextInteraction = core.registerPlugin('TextInteraction', {
5
+ web: () => Promise.resolve().then(function () { return web; }).then(m => new m.TextInteractionWeb()),
6
+ });
7
+
8
+ class TextInteractionWeb extends core.WebPlugin {
9
+ async disable() {
10
+ throw this.unimplemented('Not implemented on web.');
11
+ }
12
+ async enable() {
13
+ throw this.unimplemented('Not implemented on web.');
14
+ }
15
+ async isEnabled() {
16
+ throw this.unimplemented('Not implemented on web.');
17
+ }
18
+ }
19
+
20
+ var web = /*#__PURE__*/Object.freeze({
21
+ __proto__: null,
22
+ TextInteractionWeb: TextInteractionWeb
23
+ });
24
+
25
+ exports.TextInteraction = TextInteraction;
26
+
27
+ return exports;
28
+
29
+ })({}, capacitorExports);
30
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst TextInteraction = registerPlugin('TextInteraction', {\n web: () => import('./web').then(m => new m.TextInteractionWeb()),\n});\nexport * from './definitions';\nexport { TextInteraction };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class TextInteractionWeb extends WebPlugin {\n async disable() {\n throw this.unimplemented('Not implemented on web.');\n }\n async enable() {\n throw this.unimplemented('Not implemented on web.');\n }\n async isEnabled() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,eAAe,GAAGA,mBAAc,CAAC,iBAAiB,EAAE;IAC1D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACpE,CAAC;;ICFM,MAAM,kBAAkB,SAASC,cAAS,CAAC;IAClD,IAAI,MAAM,OAAO,GAAG;IACpB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,SAAS,GAAG;IACtB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ;;;;;;;;;;;;;;;"}
@@ -0,0 +1,16 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class IsEnabledResult: NSObject, Result {
5
+ let enabled: Bool
6
+
7
+ init(enabled: Bool) {
8
+ self.enabled = enabled
9
+ }
10
+
11
+ @objc public func toJSObject() -> AnyObject {
12
+ var result = JSObject()
13
+ result["enabled"] = enabled
14
+ return result as AnyObject
15
+ }
16
+ }
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>$(DEVELOPMENT_LANGUAGE)</string>
7
+ <key>CFBundleExecutable</key>
8
+ <string>$(EXECUTABLE_NAME)</string>
9
+ <key>CFBundleIdentifier</key>
10
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
+ <key>CFBundleInfoDictionaryVersion</key>
12
+ <string>6.0</string>
13
+ <key>CFBundleName</key>
14
+ <string>$(PRODUCT_NAME)</string>
15
+ <key>CFBundlePackageType</key>
16
+ <string>FMWK</string>
17
+ <key>CFBundleShortVersionString</key>
18
+ <string>1.0</string>
19
+ <key>CFBundleVersion</key>
20
+ <string>$(CURRENT_PROJECT_VERSION)</string>
21
+ <key>NSPrincipalClass</key>
22
+ <string></string>
23
+ </dict>
24
+ </plist>
@@ -0,0 +1,5 @@
1
+ import Capacitor
2
+
3
+ @objc public protocol Result {
4
+ @objc func toJSObject() -> AnyObject
5
+ }
@@ -0,0 +1,32 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class TextInteraction: NSObject {
5
+ private let plugin: TextInteractionPlugin
6
+
7
+ init(plugin: TextInteractionPlugin) {
8
+ self.plugin = plugin
9
+ }
10
+
11
+ @objc public func disable(completion: @escaping (Error?) -> Void) {
12
+ setEnabled(false, completion: completion)
13
+ }
14
+
15
+ @objc public func enable(completion: @escaping (Error?) -> Void) {
16
+ setEnabled(true, completion: completion)
17
+ }
18
+
19
+ @objc public func isEnabled(completion: @escaping (IsEnabledResult?, Error?) -> Void) {
20
+ DispatchQueue.main.async {
21
+ let enabled = self.plugin.bridge?.webView?.configuration.preferences.isTextInteractionEnabled ?? true
22
+ completion(IsEnabledResult(enabled: enabled), nil)
23
+ }
24
+ }
25
+
26
+ private func setEnabled(_ enabled: Bool, completion: @escaping (Error?) -> Void) {
27
+ DispatchQueue.main.async {
28
+ self.plugin.bridge?.webView?.configuration.preferences.isTextInteractionEnabled = enabled
29
+ completion(nil)
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,68 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc(TextInteractionPlugin)
5
+ public class TextInteractionPlugin: CAPPlugin, CAPBridgedPlugin {
6
+ public let identifier = "TextInteractionPlugin"
7
+ public let jsName = "TextInteraction"
8
+ public let pluginMethods: [CAPPluginMethod] = [
9
+ CAPPluginMethod(name: "disable", returnType: CAPPluginReturnPromise),
10
+ CAPPluginMethod(name: "enable", returnType: CAPPluginReturnPromise),
11
+ CAPPluginMethod(name: "isEnabled", returnType: CAPPluginReturnPromise)
12
+ ]
13
+
14
+ public static let tag = "TextInteractionPlugin"
15
+
16
+ private var implementation: TextInteraction?
17
+
18
+ override public func load() {
19
+ self.implementation = TextInteraction(plugin: self)
20
+ }
21
+
22
+ @objc func disable(_ call: CAPPluginCall) {
23
+ implementation?.disable { error in
24
+ if let error = error {
25
+ self.rejectCall(call, error)
26
+ return
27
+ }
28
+ self.resolveCall(call)
29
+ }
30
+ }
31
+
32
+ @objc func enable(_ call: CAPPluginCall) {
33
+ implementation?.enable { error in
34
+ if let error = error {
35
+ self.rejectCall(call, error)
36
+ return
37
+ }
38
+ self.resolveCall(call)
39
+ }
40
+ }
41
+
42
+ @objc func isEnabled(_ call: CAPPluginCall) {
43
+ implementation?.isEnabled { result, error in
44
+ if let error = error {
45
+ self.rejectCall(call, error)
46
+ return
47
+ }
48
+ self.resolveCall(call, result)
49
+ }
50
+ }
51
+
52
+ private func rejectCall(_ call: CAPPluginCall, _ error: Error) {
53
+ CAPLog.print("[", TextInteractionPlugin.tag, "] ", error)
54
+ call.reject(error.localizedDescription)
55
+ }
56
+
57
+ private func resolveCall(_ call: CAPPluginCall) {
58
+ call.resolve()
59
+ }
60
+
61
+ private func resolveCall(_ call: CAPPluginCall, _ result: Result?) {
62
+ if let result = result?.toJSObject() as? JSObject {
63
+ call.resolve(result)
64
+ } else {
65
+ call.resolve()
66
+ }
67
+ }
68
+ }
package/package.json ADDED
@@ -0,0 +1,91 @@
1
+ {
2
+ "name": "@capawesome/capacitor-text-interaction",
3
+ "version": "0.0.1",
4
+ "description": "Capacitor plugin to enable and disable text interaction in the WebView.",
5
+ "main": "dist/plugin.cjs.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/esm/index.d.ts",
8
+ "unpkg": "dist/plugin.js",
9
+ "files": [
10
+ "android/src/main/",
11
+ "android/build.gradle",
12
+ "dist/",
13
+ "ios/Plugin/",
14
+ "CapawesomeCapacitorTextInteraction.podspec",
15
+ "Package.swift"
16
+ ],
17
+ "author": "Robin Genz <mail@robingenz.dev>",
18
+ "license": "MIT",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/capawesome-team/capacitor-plugins.git"
22
+ },
23
+ "bugs": {
24
+ "url": "https://github.com/capawesome-team/capacitor-plugins/issues"
25
+ },
26
+ "funding": [
27
+ {
28
+ "type": "github",
29
+ "url": "https://github.com/sponsors/capawesome-team/"
30
+ },
31
+ {
32
+ "type": "opencollective",
33
+ "url": "https://opencollective.com/capawesome"
34
+ }
35
+ ],
36
+ "homepage": "https://capawesome.io/docs/sdks/capacitor/text-interaction/",
37
+ "keywords": [
38
+ "capacitor",
39
+ "plugin",
40
+ "native"
41
+ ],
42
+ "scripts": {
43
+ "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
44
+ "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..",
45
+ "verify:android": "cd android && ./gradlew clean build test && cd ..",
46
+ "verify:web": "npm run build",
47
+ "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
48
+ "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
49
+ "eslint": "eslint . --ext ts",
50
+ "prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
51
+ "swiftlint": "node-swiftlint",
52
+ "docgen": "docgen --api TextInteractionPlugin --output-readme README.md --output-json dist/docs.json",
53
+ "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
54
+ "clean": "rimraf ./dist",
55
+ "watch": "tsc --watch",
56
+ "ios:pod:install": "cd ios && pod install --repo-update && cd ..",
57
+ "ios:spm:install": "cd ios && swift package resolve && cd ..",
58
+ "prepublishOnly": "npm run build"
59
+ },
60
+ "devDependencies": {
61
+ "@capacitor/android": "8.0.0",
62
+ "@capacitor/cli": "8.0.0",
63
+ "@capacitor/core": "8.0.0",
64
+ "@capacitor/docgen": "0.3.1",
65
+ "@capacitor/ios": "8.0.0",
66
+ "@ionic/eslint-config": "0.4.0",
67
+ "eslint": "8.57.0",
68
+ "prettier-plugin-java": "2.6.7",
69
+ "rimraf": "6.1.2",
70
+ "rollup": "4.53.3",
71
+ "swiftlint": "2.0.0",
72
+ "typescript": "5.9.3"
73
+ },
74
+ "peerDependencies": {
75
+ "@capacitor/core": ">=8.0.0"
76
+ },
77
+ "eslintConfig": {
78
+ "extends": "@ionic/eslint-config/recommended"
79
+ },
80
+ "capacitor": {
81
+ "ios": {
82
+ "src": "ios"
83
+ },
84
+ "android": {
85
+ "src": "android"
86
+ }
87
+ },
88
+ "publishConfig": {
89
+ "access": "public"
90
+ }
91
+ }