Skip to content

Commit 09c5b5e

Browse files
committed
refactor: rename internal C++/ObjC symbols from MarkdownInput to MarkdownTextInput
1 parent ad438bf commit 09c5b5e

12 files changed

Lines changed: 57 additions & 56 deletions

android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/ComponentDescriptors.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
#include "MarkdownContainerMeasurementManager.h"
44
#include "MarkdownContainerShadowNode.h"
5-
#include "MarkdownInputMeasurementManager.h"
6-
#include "MarkdownInputShadowNode.h"
5+
#include "MarkdownTextInputMeasurementManager.h"
6+
#include "MarkdownTextInputShadowNode.h"
77
#include "MarkdownTextMeasurementManager.h"
88
#include "MarkdownTextShadowNode.h"
99

@@ -44,20 +44,21 @@ class EnrichedMarkdownTextComponentDescriptor final : public ConcreteComponentDe
4444
const std::shared_ptr<MarkdownTextMeasurementManager> measurementsManager_;
4545
};
4646

47-
class EnrichedMarkdownTextInputComponentDescriptor final : public ConcreteComponentDescriptor<MarkdownInputShadowNode> {
47+
class EnrichedMarkdownTextInputComponentDescriptor final
48+
: public ConcreteComponentDescriptor<MarkdownTextInputShadowNode> {
4849
public:
4950
EnrichedMarkdownTextInputComponentDescriptor(const ComponentDescriptorParameters &parameters)
5051
: ConcreteComponentDescriptor(parameters),
51-
measurementsManager_(std::make_shared<MarkdownInputMeasurementManager>(contextContainer_)) {}
52+
measurementsManager_(std::make_shared<MarkdownTextInputMeasurementManager>(contextContainer_)) {}
5253

5354
void adopt(ShadowNode &shadowNode) const override {
5455
ConcreteComponentDescriptor::adopt(shadowNode);
55-
auto &inputShadowNode = static_cast<MarkdownInputShadowNode &>(shadowNode);
56+
auto &inputShadowNode = static_cast<MarkdownTextInputShadowNode &>(shadowNode);
5657
inputShadowNode.setMeasurementsManager(measurementsManager_);
5758
}
5859

5960
private:
60-
const std::shared_ptr<MarkdownInputMeasurementManager> measurementsManager_;
61+
const std::shared_ptr<MarkdownTextInputMeasurementManager> measurementsManager_;
6162
};
6263

6364
void EnrichedMarkdownTextSpec_registerComponentDescriptorsFromCodegen(

android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownInputState.cpp

Lines changed: 0 additions & 9 deletions
This file was deleted.

android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownInputMeasurementManager.cpp renamed to android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextInputMeasurementManager.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "MarkdownInputMeasurementManager.h"
1+
#include "MarkdownTextInputMeasurementManager.h"
22
#include "conversions.h"
33

44
#include <fbjni/fbjni.h>
@@ -9,9 +9,9 @@ using namespace facebook::jni;
99

1010
namespace facebook::react {
1111

12-
Size MarkdownInputMeasurementManager::measure(SurfaceId surfaceId, int viewTag,
13-
const EnrichedMarkdownTextInputProps &props,
14-
LayoutConstraints layoutConstraints) const {
12+
Size MarkdownTextInputMeasurementManager::measure(SurfaceId surfaceId, int viewTag,
13+
const EnrichedMarkdownTextInputProps &props,
14+
LayoutConstraints layoutConstraints) const {
1515
const jni::global_ref<jobject> &fabricUIManager = contextContainer_->at<jni::global_ref<jobject>>("FabricUIManager");
1616

1717
static const auto measure =

android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownInputMeasurementManager.h renamed to android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextInputMeasurementManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
namespace facebook::react {
88

9-
class MarkdownInputMeasurementManager {
9+
class MarkdownTextInputMeasurementManager {
1010
public:
11-
MarkdownInputMeasurementManager(const std::shared_ptr<const ContextContainer> &contextContainer)
11+
MarkdownTextInputMeasurementManager(const std::shared_ptr<const ContextContainer> &contextContainer)
1212
: contextContainer_(contextContainer) {}
1313

1414
Size measure(SurfaceId surfaceId, int viewTag, const EnrichedMarkdownTextInputProps &props,

android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownInputShadowNode.cpp renamed to android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextInputShadowNode.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
#include "MarkdownInputShadowNode.h"
1+
#include "MarkdownTextInputShadowNode.h"
22

33
#include <react/renderer/core/LayoutContext.h>
44

55
namespace facebook::react {
66

7-
extern const char MarkdownInputComponentName[] = "EnrichedMarkdownTextInput";
7+
extern const char MarkdownTextInputComponentName[] = "EnrichedMarkdownTextInput";
88

9-
void MarkdownInputShadowNode::setMeasurementsManager(
10-
const std::shared_ptr<MarkdownInputMeasurementManager> &measurementsManager) {
9+
void MarkdownTextInputShadowNode::setMeasurementsManager(
10+
const std::shared_ptr<MarkdownTextInputMeasurementManager> &measurementsManager) {
1111
ensureUnsealed();
1212
measurementsManager_ = measurementsManager;
1313
}
1414

15-
void MarkdownInputShadowNode::dirtyLayoutIfNeeded() {
15+
void MarkdownTextInputShadowNode::dirtyLayoutIfNeeded() {
1616
const auto state = this->getStateData();
1717
const auto counter = state.getForceHeightRecalculationCounter();
1818

@@ -22,8 +22,8 @@ void MarkdownInputShadowNode::dirtyLayoutIfNeeded() {
2222
}
2323
}
2424

25-
Size MarkdownInputShadowNode::measureContent(const LayoutContext &layoutContext,
26-
const LayoutConstraints &layoutConstraints) const {
25+
Size MarkdownTextInputShadowNode::measureContent(const LayoutContext &layoutContext,
26+
const LayoutConstraints &layoutConstraints) const {
2727
return measurementsManager_->measure(getSurfaceId(), getTag(), getConcreteProps(), layoutConstraints);
2828
}
2929

android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownInputShadowNode.h renamed to android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextInputShadowNode.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
#pragma once
22

3-
#include "MarkdownInputMeasurementManager.h"
4-
#include "MarkdownInputState.h"
3+
#include "MarkdownTextInputMeasurementManager.h"
4+
#include "MarkdownTextInputState.h"
55

66
#include <react/renderer/components/EnrichedMarkdownTextSpec/EventEmitters.h>
77
#include <react/renderer/components/EnrichedMarkdownTextSpec/Props.h>
88
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
99

1010
namespace facebook::react {
1111

12-
JSI_EXPORT extern const char MarkdownInputComponentName[];
12+
JSI_EXPORT extern const char MarkdownTextInputComponentName[];
1313

14-
class MarkdownInputShadowNode final
15-
: public ConcreteViewShadowNode<MarkdownInputComponentName, EnrichedMarkdownTextInputProps,
16-
EnrichedMarkdownTextInputEventEmitter, MarkdownInputState> {
14+
class MarkdownTextInputShadowNode final
15+
: public ConcreteViewShadowNode<MarkdownTextInputComponentName, EnrichedMarkdownTextInputProps,
16+
EnrichedMarkdownTextInputEventEmitter, MarkdownTextInputState> {
1717
public:
1818
using ConcreteViewShadowNode::ConcreteViewShadowNode;
1919

20-
MarkdownInputShadowNode(ShadowNode const &sourceShadowNode, ShadowNodeFragment const &fragment)
20+
MarkdownTextInputShadowNode(ShadowNode const &sourceShadowNode, ShadowNodeFragment const &fragment)
2121
: ConcreteViewShadowNode(sourceShadowNode, fragment) {
2222
dirtyLayoutIfNeeded();
2323
}
@@ -29,15 +29,15 @@ class MarkdownInputShadowNode final
2929
return traits;
3030
}
3131

32-
void setMeasurementsManager(const std::shared_ptr<MarkdownInputMeasurementManager> &measurementsManager);
32+
void setMeasurementsManager(const std::shared_ptr<MarkdownTextInputMeasurementManager> &measurementsManager);
3333

3434
void dirtyLayoutIfNeeded();
3535

3636
Size measureContent(const LayoutContext &layoutContext, const LayoutConstraints &layoutConstraints) const override;
3737

3838
private:
3939
int forceHeightRecalculationCounter_{0};
40-
std::shared_ptr<MarkdownInputMeasurementManager> measurementsManager_;
40+
std::shared_ptr<MarkdownTextInputMeasurementManager> measurementsManager_;
4141
};
4242

4343
} // namespace facebook::react
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "MarkdownTextInputState.h"
2+
3+
namespace facebook::react {
4+
5+
int MarkdownTextInputState::getForceHeightRecalculationCounter() const {
6+
return forceHeightRecalculationCounter_;
7+
}
8+
9+
} // namespace facebook::react

android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownInputState.h renamed to android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextInputState.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
namespace facebook::react {
66

7-
class MarkdownInputState {
7+
class MarkdownTextInputState {
88
public:
9-
MarkdownInputState() : forceHeightRecalculationCounter_(0) {}
9+
MarkdownTextInputState() : forceHeightRecalculationCounter_(0) {}
1010

11-
MarkdownInputState(MarkdownInputState const &previousState, folly::dynamic data)
11+
MarkdownTextInputState(MarkdownTextInputState const &previousState, folly::dynamic data)
1212
: forceHeightRecalculationCounter_((int)data["forceHeightRecalculationCounter"].getInt()) {}
1313

1414
folly::dynamic getDynamic() const {

ios/input/ENRMInputTextView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
NS_ASSUME_NONNULL_BEGIN
88

99
@interface ENRMInputTextView : ENRMPlatformTextView
10-
@property (nonatomic, weak, nullable) EnrichedMarkdownTextInput *markdownInput;
10+
@property (nonatomic, weak, nullable) EnrichedMarkdownTextInput *markdownTextInput;
1111
@end
1212

1313
NS_ASSUME_NONNULL_END

ios/input/ENRMInputTextView.mm

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ - (void)copy:(id)sender
2020
}
2121

2222
NSString *plainText = [self.text substringWithRange:selection];
23-
NSString *markdown = [self.markdownInput markdownForSelectedRange];
23+
NSString *markdown = [self.markdownTextInput markdownForSelectedRange];
2424

2525
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
2626
NSMutableDictionary *items = [NSMutableDictionary dictionary];
@@ -49,8 +49,8 @@ - (void)paste:(id)sender
4949
markdown = [[NSString alloc] initWithData:markdownValue encoding:NSUTF8StringEncoding];
5050
}
5151

52-
if (markdown.length > 0 && self.markdownInput != nil) {
53-
[self.markdownInput pasteMarkdown:markdown];
52+
if (markdown.length > 0 && self.markdownTextInput != nil) {
53+
[self.markdownTextInput pasteMarkdown:markdown];
5454
return;
5555
}
5656

@@ -74,8 +74,8 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender
7474
- (void)layoutSubviews
7575
{
7676
[super layoutSubviews];
77-
if (self.markdownInput != nil) {
78-
[self.markdownInput scheduleRelayoutIfNeeded];
77+
if (self.markdownTextInput != nil) {
78+
[self.markdownTextInput scheduleRelayoutIfNeeded];
7979
}
8080
}
8181

@@ -93,7 +93,7 @@ - (void)copy:(id)sender
9393
}
9494

9595
NSString *plainText = [self.string substringWithRange:selection];
96-
NSString *markdown = [self.markdownInput markdownForSelectedRange];
96+
NSString *markdown = [self.markdownTextInput markdownForSelectedRange];
9797

9898
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
9999
[pasteboard clearContents];
@@ -121,8 +121,8 @@ - (void)paste:(id)sender
121121
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
122122

123123
NSString *markdown = [pasteboard stringForType:kENRMMarkdownPasteboardType];
124-
if (markdown.length > 0 && self.markdownInput != nil) {
125-
[self.markdownInput pasteMarkdown:markdown];
124+
if (markdown.length > 0 && self.markdownTextInput != nil) {
125+
[self.markdownTextInput pasteMarkdown:markdown];
126126
return;
127127
}
128128

@@ -158,17 +158,17 @@ - (void)mouseDown:(NSEvent *)event
158158
- (NSMenu *)menuForEvent:(NSEvent *)event
159159
{
160160
NSMenu *menu = [super menuForEvent:event];
161-
if (self.markdownInput != nil) {
162-
return [self.markdownInput enrichedMenuForEvent:event defaultMenu:menu textView:self];
161+
if (self.markdownTextInput != nil) {
162+
return [self.markdownTextInput enrichedMenuForEvent:event defaultMenu:menu textView:self];
163163
}
164164
return menu;
165165
}
166166

167167
- (void)layout
168168
{
169169
[super layout];
170-
if (self.markdownInput != nil) {
171-
[self.markdownInput scheduleRelayoutIfNeeded];
170+
if (self.markdownTextInput != nil) {
171+
[self.markdownTextInput scheduleRelayoutIfNeeded];
172172
}
173173
}
174174

0 commit comments

Comments
 (0)