@tinglinzh/react-native-markdownview 0.3.0 → 0.4.0
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.
|
@@ -1,13 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Old Architecture
|
|
2
|
+
* Old Architecture view manager — pure Objective-C implementation.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Framework targets don't support bridging headers, so we:
|
|
5
|
+
* 1. Keep this file as ObjC (no bridging header needed).
|
|
6
|
+
* 2. Import the auto-generated Swift header to access RNMarkdownView.
|
|
7
|
+
* 3. Delete the separate RNMarkdownViewManager.swift file.
|
|
8
|
+
*
|
|
9
|
+
* The Swift-generated header is emitted by the compiler as
|
|
10
|
+
* "react_native_markdownview-Swift.h" (pod name, hyphens → underscores).
|
|
7
11
|
*/
|
|
8
12
|
#import <React/RCTViewManager.h>
|
|
13
|
+
#import "react_native_markdownview-Swift.h"
|
|
14
|
+
|
|
15
|
+
@interface RNMarkdownViewManager : RCTViewManager
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation RNMarkdownViewManager
|
|
19
|
+
|
|
20
|
+
RCT_EXPORT_MODULE()
|
|
21
|
+
|
|
22
|
+
- (UIView *)view
|
|
23
|
+
{
|
|
24
|
+
return [[RNMarkdownView alloc] init];
|
|
25
|
+
}
|
|
9
26
|
|
|
10
|
-
|
|
27
|
+
+ (BOOL)requiresMainQueueSetup
|
|
28
|
+
{
|
|
29
|
+
return YES;
|
|
30
|
+
}
|
|
11
31
|
|
|
12
32
|
// ─── Content ────────────────────────────────────────────────────────────────
|
|
13
33
|
/// Raw markdown string.
|
|
@@ -24,11 +44,11 @@ RCT_EXPORT_VIEW_PROPERTY(onLinkPress, RCTDirectEventBlock)
|
|
|
24
44
|
RCT_EXPORT_VIEW_PROPERTY(onImagePress, RCTDirectEventBlock)
|
|
25
45
|
|
|
26
46
|
/// Fires when lines are selected in a code block.
|
|
27
|
-
/// Payload: { startLine: number, endLine: number, contents: string
|
|
47
|
+
/// Payload: { startLine: number, endLine: number, contents: string, language: string }
|
|
28
48
|
RCT_EXPORT_VIEW_PROPERTY(onLineSelection, RCTDirectEventBlock)
|
|
29
49
|
|
|
30
50
|
/// Fires when the intrinsic content height changes.
|
|
31
|
-
/// Payload: {
|
|
51
|
+
/// Payload: { width: number, height: number }
|
|
32
52
|
RCT_EXPORT_VIEW_PROPERTY(onContentSizeChange, RCTDirectEventBlock)
|
|
33
53
|
|
|
34
54
|
@end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinglinzh/react-native-markdownview",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "React Native wrapper for MarkdownView — native iOS/macOS markdown rendering with GFM, syntax highlighting, LaTeX math, and unified diff support",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -15,11 +15,11 @@ Pod::Spec.new do |s|
|
|
|
15
15
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
16
16
|
s.swift_version = "5.9"
|
|
17
17
|
|
|
18
|
-
#
|
|
18
|
+
# Allow the Swift compiler to find the MarkdownView module when it is added
|
|
19
|
+
# to the host app via Xcode's Swift Package integration.
|
|
20
|
+
# Framework targets cannot use bridging headers; ObjC↔Swift interop is handled
|
|
21
|
+
# via the auto-generated "-Swift.h" header imported in RNMarkdownViewManager.m.
|
|
19
22
|
s.pod_target_xcconfig = {
|
|
20
|
-
"SWIFT_OBJC_BRIDGING_HEADER" => "$(PODS_TARGET_SRCROOT)/ios/react-native-markdownview-Bridging-Header.h",
|
|
21
|
-
# Allow the Swift compiler to find the MarkdownView Swift module when it is
|
|
22
|
-
# added to the host app via SPM (Xcode embeds SPM-built modules here).
|
|
23
23
|
"SWIFT_INCLUDE_PATHS" => "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/PackageFrameworks/**",
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import UIKit
|
|
3
|
-
|
|
4
|
-
/// Old Architecture view manager.
|
|
5
|
-
/// The ObjC bridge in RNMarkdownViewManager.m exports props and this class.
|
|
6
|
-
@objc(RNMarkdownViewManager)
|
|
7
|
-
final class RNMarkdownViewManager: RCTViewManager {
|
|
8
|
-
|
|
9
|
-
override func view() -> UIView! {
|
|
10
|
-
RNMarkdownView()
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
override static func requiresMainQueueSetup() -> Bool {
|
|
14
|
-
true
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bridging header for Swift ↔ Objective-C interop within this pod.
|
|
3
|
-
*
|
|
4
|
-
* The CocoaPods build system picks up SWIFT_OBJC_BRIDGING_HEADER via
|
|
5
|
-
* the pod_target_xcconfig in the podspec and makes these React Native
|
|
6
|
-
* Objective-C headers visible to all Swift source files in the pod.
|
|
7
|
-
*/
|
|
8
|
-
#import <React/RCTViewManager.h>
|
|
9
|
-
#import <React/RCTBridgeModule.h>
|
|
10
|
-
#import <React/RCTEventEmitter.h>
|
|
11
|
-
#import <React/RCTView.h>
|
|
12
|
-
#import <React/RCTUIManager.h>
|