@expensify/react-native-live-markdown 0.1.60 → 0.1.62
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/android/src/main/java/com/expensify/livemarkdown/MarkdownStyle.java +18 -0
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownUtils.java +4 -0
- package/ios/RCTMarkdownStyle.h +2 -0
- package/ios/RCTMarkdownStyle.mm +6 -0
- package/ios/RCTMarkdownUtils.mm +3 -0
- package/lib/commonjs/MarkdownTextInput.web.js +8 -3
- package/lib/commonjs/MarkdownTextInput.web.js.map +1 -1
- package/lib/commonjs/MarkdownTextInputDecoratorViewNativeComponent.js.map +1 -1
- package/lib/commonjs/styleUtils.js +4 -0
- package/lib/commonjs/styleUtils.js.map +1 -1
- package/lib/commonjs/web/parserUtils.js +3 -0
- package/lib/commonjs/web/parserUtils.js.map +1 -1
- package/lib/module/MarkdownTextInput.web.js +8 -3
- package/lib/module/MarkdownTextInput.web.js.map +1 -1
- package/lib/module/MarkdownTextInputDecoratorViewNativeComponent.js.map +1 -1
- package/lib/module/styleUtils.js +4 -0
- package/lib/module/styleUtils.js.map +1 -1
- package/lib/module/web/parserUtils.js +3 -0
- package/lib/module/web/parserUtils.js.map +1 -1
- package/lib/parser/react-native-live-markdown-parser.js +17 -17
- package/lib/typescript/src/MarkdownTextInput.web.d.ts.map +1 -1
- package/lib/typescript/src/MarkdownTextInputDecoratorViewNativeComponent.d.ts +4 -0
- package/lib/typescript/src/MarkdownTextInputDecoratorViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/styleUtils.d.ts.map +1 -1
- package/lib/typescript/src/web/parserUtils.d.ts +1 -1
- package/lib/typescript/src/web/parserUtils.d.ts.map +1 -1
- package/package.json +1 -1
- package/parser/react-native-live-markdown-parser.js +17 -17
- package/src/MarkdownTextInput.web.tsx +6 -3
- package/src/MarkdownTextInputDecoratorViewNativeComponent.ts +4 -0
- package/src/styleUtils.ts +4 -0
- package/src/web/parserUtils.ts +4 -1
|
@@ -310,9 +310,7 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>(
|
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
const
|
|
314
|
-
const newWidth = hostNode.offsetWidth;
|
|
315
|
-
const newHeight = hostNode.offsetHeight;
|
|
313
|
+
const {offsetWidth: newWidth, offsetHeight: newHeight} = divRef.current;
|
|
316
314
|
|
|
317
315
|
if (newHeight !== dimensions.current?.height || newWidth !== dimensions.current.width) {
|
|
318
316
|
dimensions.current = {height: newHeight, width: newWidth};
|
|
@@ -569,6 +567,11 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>(
|
|
|
569
567
|
}
|
|
570
568
|
}, [autoFocus]);
|
|
571
569
|
|
|
570
|
+
useEffect(() => {
|
|
571
|
+
// update content size when the input styles change
|
|
572
|
+
handleContentSizeChange();
|
|
573
|
+
}, [handleContentSizeChange, inputStyles]);
|
|
574
|
+
|
|
572
575
|
useEffect(() => {
|
|
573
576
|
if (!divRef.current || !selection || (contentSelection.current && selection.start === contentSelection.current.start && selection.end === contentSelection.current.end)) {
|
|
574
577
|
return;
|
package/src/styleUtils.ts
CHANGED
package/src/web/parserUtils.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as BrowserUtils from './browserUtils';
|
|
|
4
4
|
|
|
5
5
|
type PartialMarkdownStyle = StyleUtilsTypes.PartialMarkdownStyle;
|
|
6
6
|
|
|
7
|
-
type MarkdownType = 'bold' | 'italic' | 'strikethrough' | 'emoji' | 'link' | 'code' | 'pre' | 'blockquote' | 'h1' | 'syntax' | 'mention-here' | 'mention-user';
|
|
7
|
+
type MarkdownType = 'bold' | 'italic' | 'strikethrough' | 'emoji' | 'link' | 'code' | 'pre' | 'blockquote' | 'h1' | 'syntax' | 'mention-here' | 'mention-user' | 'mention-report';
|
|
8
8
|
|
|
9
9
|
type MarkdownRange = {
|
|
10
10
|
type: MarkdownType;
|
|
@@ -42,6 +42,9 @@ function addStyling(targetElement: HTMLElement, type: MarkdownType, markdownStyl
|
|
|
42
42
|
case 'mention-user':
|
|
43
43
|
Object.assign(node.style, markdownStyle.mentionUser);
|
|
44
44
|
break;
|
|
45
|
+
case 'mention-report':
|
|
46
|
+
Object.assign(node.style, markdownStyle.mentionReport);
|
|
47
|
+
break;
|
|
45
48
|
case 'link':
|
|
46
49
|
Object.assign(node.style, {
|
|
47
50
|
...markdownStyle.link,
|