react-native-nitro-markdown 0.6.0 → 0.6.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.
package/.watchmanconfig
ADDED
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# react-native-nitro-markdown
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/react-native-nitro-markdown)
|
|
4
4
|
[](./LICENSE)
|
|
5
5
|
[](https://reactnative.dev/)
|
|
6
6
|
[](https://github.com/mrousavy/nitro)
|
|
@@ -157,7 +157,7 @@ session.append("Streaming content...");
|
|
|
157
157
|
| `append` | `(chunk: string) => number` | Append text, returns new UTF-16 length |
|
|
158
158
|
| `clear` | `() => void` | Clear buffer, emit reset event |
|
|
159
159
|
| `reset` | `(text: string) => void` | Replace full buffer content |
|
|
160
|
-
| `replace` | `(from, to, text) => number` | Partial buffer mutation |
|
|
160
|
+
| `replace` | `(from, to, text) => number` | Partial buffer mutation; out-of-bounds ranges are clamped and invalid ranges throw |
|
|
161
161
|
| `getAllText` | `() => string` | Get full session text |
|
|
162
162
|
| `getLength` | `() => number` | Get UTF-16 length without copy |
|
|
163
163
|
| `getTextRange` | `(from, to) => string` | Get substring range |
|
|
@@ -131,7 +131,13 @@ class HybridMarkdownSession: HybridMarkdownSessionSpec {
|
|
|
131
131
|
lock.lock()
|
|
132
132
|
defer { lock.unlock() }
|
|
133
133
|
guard from.isFinite && to.isFinite && from >= 0 && to >= 0 && from <= to else {
|
|
134
|
-
|
|
134
|
+
throw NSError(
|
|
135
|
+
domain: "NitroMarkdown",
|
|
136
|
+
code: 2,
|
|
137
|
+
userInfo: [
|
|
138
|
+
NSLocalizedDescriptionKey: "Invalid range: from=\(from) and to=\(to) must be finite, from must be >= 0, and to must be >= from"
|
|
139
|
+
]
|
|
140
|
+
)
|
|
135
141
|
}
|
|
136
142
|
let nsBuffer = NSMutableString(string: buffer)
|
|
137
143
|
let length = nsBuffer.length
|
|
@@ -141,11 +147,8 @@ class HybridMarkdownSession: HybridMarkdownSessionSpec {
|
|
|
141
147
|
nsBuffer.replaceCharacters(in: NSRange(location: start, length: end - start), with: text)
|
|
142
148
|
buffer = nsBuffer as String
|
|
143
149
|
newLength = Double((buffer as NSString).length)
|
|
144
|
-
notifyFrom =
|
|
145
|
-
notifyTo =
|
|
146
|
-
}
|
|
147
|
-
if start == end && text.isEmpty {
|
|
148
|
-
return newLength
|
|
150
|
+
notifyFrom = Double(start)
|
|
151
|
+
notifyTo = Double(start + utf16Length(text))
|
|
149
152
|
}
|
|
150
153
|
notifyListeners(from: notifyFrom, to: notifyTo)
|
|
151
154
|
return newLength
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nitro-markdown",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "High-performance Markdown parser for React Native using Nitro Modules and md4c",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"nitrogen",
|
|
41
41
|
"nitro.json",
|
|
42
42
|
"*.podspec",
|
|
43
|
+
".watchmanconfig",
|
|
43
44
|
"!**/__tests__",
|
|
44
45
|
"!**/__fixtures__",
|
|
45
46
|
"!**/__mocks__",
|
|
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.authors = package["author"]
|
|
12
12
|
|
|
13
13
|
s.platforms = { :ios => "15.1" }
|
|
14
|
-
s.source = { :git => "https://github.com/JoaoPauloCMarra/react-native-nitro-markdown.git", :tag => "#{s.version}" }
|
|
14
|
+
s.source = { :git => "https://github.com/JoaoPauloCMarra/react-native-nitro-markdown.git", :tag => "v#{s.version}" }
|
|
15
15
|
s.module_name = "NitroMarkdown"
|
|
16
16
|
|
|
17
17
|
s.source_files = [
|