You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-35Lines changed: 25 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,31 +2,11 @@
2
2
3
3
> Visit [original repo](https://github.com/wix/react-native-zss-rich-text-editor) first
4
4
5
-
This resolves [#171](https://github.com/wix/react-native-zss-rich-text-editor/issues/171), [#174](https://github.com/wix/react-native-zss-rich-text-editor/issues/174), and [#178](https://github.com/wix/react-native-zss-rich-text-editor/issues/178)
6
-
7
-
## Inspirations
8
-
9
-
For now, the original library has problems of using two deprecated modules, ListView and react-native-webview-bridge-updated. ListView problem is solved by [Ankit-96](https://github.com/Ankit-96) 's [PR](https://github.com/wix/react-native-zss-rich-text-editor/pull/179). So I focused on removing react-native-webview-bridge-updated and making use of react-native-webview.
10
-
11
-
## What I did
12
-
13
-
- Did just like what [Ankit-96](https://github.com/Ankit-96) did; replaced ListView with FlatList
14
-
- Replaced react-native-webview-bridge-updated with react-native-webview
15
-
- Instead of injecting `MessageHandler` into webpage(WebViewBridge) and sending message through `sendToBridge`, I directly inject `zss_editor`'s function calls through `injectJavaScript`. To achieve that, I fixed `WebViewMessageHandler.js` to be mapper function, translating functions of `RichTextEditor` to those of `zss_editor`.
16
-
- In `editor.html`, replace `WebViewBridge.send` with `ReactNativeWebView.postMessage`
17
-
- Added `./newExample`. You should `$ cd newExample; yarn; cd ios; pod install; cd ..; react-native run-ios;`.
-`$ yarn add react-native-webview` (I'm not sure why I have to do this)
23
-
-`$ cd ios; pod install;`
24
-
25
-
## Limitations
26
-
27
-
- Tested on RN 0.61.5, iOS only.
28
-
29
-
- Since I worked it for my project only, I did not test it on other versions or on Android platform. If any of you are familiar with both Android and iOS natives, please refer to my project and collaborate.
On Android, add the following to the end of your `android/app/build.gradle`
@@ -51,8 +34,6 @@ project.afterEvaluate {
51
34
}
52
35
```
53
36
54
-
Also, follow instructions [here](https://github.com/alinz/react-native-webview-bridge) to add the native `react-native-webview-bridge-updated` dependency.
55
-
56
37
## Usage
57
38
58
39
`react-native-zss-rich-text-editor` exports two Components and one const dictionary:
@@ -117,8 +98,8 @@ The editor component. Simply place this component in your view hierarchy to rece
117
98
-`alignFull()`
118
99
-`insertBulletsList()`
119
100
-`insertOrderedList()`
120
-
-`insertLink(url, title)`
121
-
-`updateLink(url, title)`
101
+
-`insertLink(url, title, className)`
102
+
-`updateLink(url, title, className)`
122
103
-`insertImage(attributes)`
123
104
-`setSubscript()`
124
105
-`setSuperscript()`
@@ -172,6 +153,14 @@ To know when the title or content are in focus, use the following methods.
172
153
-`isTitleFocused()`
173
154
-`isContentFocused()`
174
155
156
+
To start the @mentioning process, use the following method:
157
+
158
+
-`startMention`
159
+
160
+
To insert an @mention, first either type an @ character to start the @mentioning process or call the startMention method, then use the following method:
161
+
162
+
-`insertMention(url, title, className)`
163
+
175
164
This method registers a function that will get called whenver the cursor position changes or a change is made to the styling of the editor at the cursor's position., The callback will be called with an array of `actions` that are active at the cusor position, allowing a toolbar to respond to changes.
176
165
177
166
-`registerToolbar(listener)`
@@ -235,13 +224,13 @@ Other props supported by the `RichTextToolbar` component are:
235
224
236
225
-`actions`
237
226
238
-
An `array` of `actions` to be provided by this toolbar. The default actions are:
239
-
* `actions.insertImage`
240
-
* `actions.setBold`
241
-
* `actions.setItalic`
242
-
* `actions.insertBulletsList`
243
-
* `actions.insertOrderedList`
244
-
* `actions.insertLink`
227
+
An `array` of `actions` to be provided by this toolbar. The default actions are:
228
+
_`actions.insertImage`
229
+
_`actions.setBold`
230
+
_`actions.setItalic`
231
+
_`actions.insertBulletsList`
232
+
_`actions.insertOrderedList`
233
+
_`actions.insertLink`
245
234
246
235
-`onPressAddLink`
247
236
-`onPressAddImage`
@@ -291,6 +280,7 @@ This is a set of consts of all supported actions. These will be passed in arrays
0 commit comments