@expensify/react-native-live-markdown 0.1.29 → 0.1.31
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/MarkdownEmojiSpan.java +9 -0
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownStyle.java +7 -0
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownUtils.java +3 -0
- package/ios/RCTMarkdownStyle.h +1 -0
- package/ios/RCTMarkdownStyle.mm +4 -0
- package/ios/RCTMarkdownUtils.mm +8 -1
- package/lib/commonjs/MarkdownTextInput.web.js +0 -20
- package/lib/commonjs/MarkdownTextInput.web.js.map +1 -1
- package/lib/commonjs/MarkdownTextInputDecoratorViewNativeComponent.js.map +1 -1
- package/lib/commonjs/styleUtils.js +3 -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 +0 -20
- package/lib/module/MarkdownTextInput.web.js.map +1 -1
- package/lib/module/MarkdownTextInputDecoratorViewNativeComponent.js.map +1 -1
- package/lib/module/styleUtils.js +3 -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 +18 -18
- package/lib/typescript/src/MarkdownTextInput.web.d.ts.map +1 -1
- package/lib/typescript/src/MarkdownTextInputDecoratorViewNativeComponent.d.ts +3 -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 +18 -18
- package/src/MarkdownTextInput.web.tsx +0 -18
- package/src/MarkdownTextInputDecoratorViewNativeComponent.ts +3 -0
- package/src/styleUtils.ts +3 -0
- package/src/web/parserUtils.ts +4 -1
|
@@ -514,24 +514,6 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>(
|
|
|
514
514
|
[numberOfLines],
|
|
515
515
|
);
|
|
516
516
|
|
|
517
|
-
useEffect(() => {
|
|
518
|
-
// update event listeners events objects
|
|
519
|
-
const originalAddEventListener = EventTarget.prototype.addEventListener;
|
|
520
|
-
EventTarget.prototype.addEventListener = function (eventName, callback) {
|
|
521
|
-
if (eventName === 'paste' && typeof callback === 'function') {
|
|
522
|
-
originalAddEventListener.call(this, eventName, function (event) {
|
|
523
|
-
if (divRef.current && divRef.current.contains(event.target as Node)) {
|
|
524
|
-
// pasting returns styled span elements as event.target instead of the contentEditable div. We want to keep the div as the target
|
|
525
|
-
Object.defineProperty(event, 'target', {writable: false, value: divRef.current});
|
|
526
|
-
}
|
|
527
|
-
callback(event);
|
|
528
|
-
});
|
|
529
|
-
} else {
|
|
530
|
-
originalAddEventListener.call(this, eventName, callback);
|
|
531
|
-
}
|
|
532
|
-
};
|
|
533
|
-
}, []);
|
|
534
|
-
|
|
535
517
|
useEffect(() => {
|
|
536
518
|
if (!divRef.current) {
|
|
537
519
|
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' | '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';
|
|
8
8
|
|
|
9
9
|
type MarkdownRange = {
|
|
10
10
|
type: MarkdownType;
|
|
@@ -33,6 +33,9 @@ function addStyling(targetElement: HTMLElement, type: MarkdownType, markdownStyl
|
|
|
33
33
|
case 'strikethrough':
|
|
34
34
|
node.style.textDecoration = 'line-through';
|
|
35
35
|
break;
|
|
36
|
+
case 'emoji':
|
|
37
|
+
Object.assign(node.style, markdownStyle.emoji);
|
|
38
|
+
break;
|
|
36
39
|
case 'mention-here':
|
|
37
40
|
Object.assign(node.style, markdownStyle.mentionHere);
|
|
38
41
|
break;
|