Skip to content

Commit

Permalink
Merge branch 'main' into @tomekzaw/emoji-font-size
Browse files Browse the repository at this point in the history
  • Loading branch information
tomekzaw committed Mar 23, 2024
2 parents 052297f + fb85ea4 commit adf5035
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 40 deletions.
10 changes: 5 additions & 5 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ PODS:
- React-jsi (= 0.73.4)
- React-logger (= 0.73.4)
- React-perflogger (= 0.73.4)
- RNLiveMarkdown (0.1.25):
- RNLiveMarkdown (0.1.28):
- glog
- RCT-Folly (= 2022.05.16.00)
- React-Core
Expand Down Expand Up @@ -1314,7 +1314,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
boost: d3f49c53809116a5d38da093a8aa78bf551aed09
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
FBLazyVector: 84f6edbe225f38aebd9deaf1540a4160b1f087d7
FBReactNativeSpec: d0086a479be91c44ce4687a962956a352d2dc697
Flipper: c7a0093234c4bdd456e363f2f19b2e4b27652d44
Expand All @@ -1326,7 +1326,7 @@ SPEC CHECKSUMS:
Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
FlipperKit: 37525a5d056ef9b93d1578e04bc3ea1de940094f
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
hermes-engine: b2669ce35fc4ac14f523b307aff8896799829fe2
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
Expand Down Expand Up @@ -1371,9 +1371,9 @@ SPEC CHECKSUMS:
React-runtimescheduler: ed48e5faac6751e66ee1261c4bd01643b436f112
React-utils: 6e5ad394416482ae21831050928ae27348f83487
ReactCommon: 840a955d37b7f3358554d819446bffcf624b2522
RNLiveMarkdown: 0ea4e12f010552fcf5085fa6f514a1aa37e37955
RNLiveMarkdown: 1608aa096bc493fc2f91a91015e96b1592a3a874
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
Yoga: 1b901a6d6eeba4e8a2e8f308f708691cdb5db312
Yoga: 64cd2a583ead952b0315d5135bf39e053ae9be70

PODFILE CHECKSUM: 8cb8ab8858b4911d497d269a353fbfff868afef0

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@expensify/react-native-live-markdown",
"version": "0.1.26",
"version": "0.1.28",
"description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
12 changes: 6 additions & 6 deletions parser/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"typescript": "^5.3.3"
},
"dependencies": {
"expensify-common": "git+ssh://[email protected]/Expensify/expensify-common.git#77d0b150ba6bfbe7a64b3c3e30b65592b2e58c4a",
"expensify-common": "git+ssh://[email protected]/Expensify/expensify-common.git#dc8ea983f9e06308cdb9151a9cdfa82bd11502e1",
"patch-package": "^8.0.0",
"underscore": "^1.13.6"
}
Expand Down
39 changes: 16 additions & 23 deletions parser/patches/expensify-common+1.0.0.patch
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
diff --git a/node_modules/expensify-common/lib/CONST.jsx b/node_modules/expensify-common/lib/CONST.jsx
index a8efadf..8b7ca6d 100644
index b402256..02f8e87 100644
--- a/node_modules/expensify-common/lib/CONST.jsx
+++ b/node_modules/expensify-common/lib/CONST.jsx
@@ -356,14 +356,14 @@ export const CONST = {
@@ -356,7 +356,7 @@ export const CONST = {
*
* @type RegExp
*/
- EMOJIS: /[\p{Extended_Pictographic}\u200d\u{1f1e6}-\u{1f1ff}\u{1f3fb}-\u{1f3ff}\u{e0020}-\u{e007f}\u20E3\uFE0F]|[#*0-9]\uFE0F?\u20E3/gu,
+ EMOJIS: /[\u200d\u{1f1e6}-\u{1f1ff}\u{1f3fb}-\u{1f3ff}\u{e0020}-\u{e007f}\u20E3\uFE0F]|[#*0-9]\uFE0F?\u20E3/gu,

/**
* Regex matching an text containing an Emoji that can be a single emoji or made up by some different emojis
*
* @type RegExp
*/
- EMOJI_RULE: /[\p{Extended_Pictographic}](\u200D[\p{Extended_Pictographic}]|[\u{1F3FB}-\u{1F3FF}]|[\u{E0020}-\u{E007F}]|\uFE0F|\u20E3)*|[\u{1F1E6}-\u{1F1FF}]{2}|[#*0-9]\uFE0F?\u20E3/gu,
+ EMOJI_RULE: /^(?!x)x/gu,
},

REPORT: {
diff --git a/node_modules/expensify-common/lib/ExpensiMark.js b/node_modules/expensify-common/lib/ExpensiMark.js
index f835d84..c65d2c6 100644
index 181101a..83991d1 100644
--- a/node_modules/expensify-common/lib/ExpensiMark.js
+++ b/node_modules/expensify-common/lib/ExpensiMark.js
@@ -7,8 +7,8 @@ const MARKDOWN_LINK_REGEX = new RegExp(`\\[([^\\][]*(?:\\[[^\\][]*][^\\][]*)*)]\
Expand All @@ -34,7 +26,7 @@ index f835d84..c65d2c6 100644
/**
* The list of regex replacements to do on a comment. Check the link regex is first so links are processed
* before other delimiters
@@ -489,7 +489,7 @@ export default class ExpensiMark {
@@ -482,7 +482,7 @@ export default class ExpensiMark {
* @type {Number}
*/
this.currentQuoteDepth = 0;
Expand All @@ -43,7 +35,7 @@ index f835d84..c65d2c6 100644

/**
* Replaces markdown with html elements
@@ -535,7 +535,7 @@ export default class ExpensiMark {
@@ -528,7 +528,7 @@ export default class ExpensiMark {
}

return replacedText;
Expand All @@ -52,7 +44,7 @@ index f835d84..c65d2c6 100644

/**
* Checks matched URLs for validity and replace valid links with html elements
@@ -642,7 +642,7 @@ export default class ExpensiMark {
@@ -635,7 +635,7 @@ export default class ExpensiMark {
}

return replacedText;
Expand All @@ -61,7 +53,7 @@ index f835d84..c65d2c6 100644

/**
* Checks matched Emails for validity and replace valid links with html elements
@@ -681,7 +681,7 @@ export default class ExpensiMark {
@@ -674,7 +674,7 @@ export default class ExpensiMark {
replacedText = replacedText.concat(textToCheck.substr(startIndex));
}
return replacedText;
Expand All @@ -70,7 +62,7 @@ index f835d84..c65d2c6 100644

/**
* replace block element with '\n' if :
@@ -721,7 +721,7 @@ export default class ExpensiMark {
@@ -714,7 +714,7 @@ export default class ExpensiMark {
});

return joinedText;
Expand All @@ -79,7 +71,7 @@ index f835d84..c65d2c6 100644

/**
* Replaces HTML with markdown
@@ -748,7 +748,7 @@ export default class ExpensiMark {
@@ -741,7 +741,7 @@ export default class ExpensiMark {
generatedMarkdown = generatedMarkdown.replace(rule.regex, rule.replacement);
});
return Str.htmlDecode(this.replaceBlockElementWithNewLine(generatedMarkdown));
Expand All @@ -88,7 +80,7 @@ index f835d84..c65d2c6 100644

/**
* Convert HTML to text
@@ -767,7 +767,7 @@ export default class ExpensiMark {
@@ -760,7 +760,7 @@ export default class ExpensiMark {
// We use 'htmlDecode' instead of 'unescape' to replace entities like ' '
replacedText = Str.htmlDecode(replacedText);
return replacedText;
Expand All @@ -97,7 +89,7 @@ index f835d84..c65d2c6 100644

/**
* Modify text for Quotes replacing chevrons with html elements
@@ -830,7 +830,7 @@ export default class ExpensiMark {
@@ -823,7 +823,7 @@ export default class ExpensiMark {
replacedText = textToCheck;
}
return replacedText;
Expand All @@ -106,7 +98,7 @@ index f835d84..c65d2c6 100644

/**
* Format the content of blockquote if the text matches the regex or else just return the original text
@@ -851,7 +851,7 @@ export default class ExpensiMark {
@@ -844,7 +844,7 @@ export default class ExpensiMark {
return replacement(textToFormat);
}
return textToCheck;
Expand All @@ -115,7 +107,7 @@ index f835d84..c65d2c6 100644

/**
* Check if the input text includes only the open or the close tag of an element.
@@ -890,7 +890,7 @@ export default class ExpensiMark {
@@ -883,7 +883,7 @@ export default class ExpensiMark {

// If there are any tags left in the stack, they're unclosed
return tagStack.length !== 0;
Expand All @@ -124,7 +116,7 @@ index f835d84..c65d2c6 100644

/**
* @param {String} comment
@@ -912,7 +912,7 @@ export default class ExpensiMark {
@@ -905,7 +905,7 @@ export default class ExpensiMark {
console.warn('Error parsing url in ExpensiMark.extractLinksInMarkdownComment', {error: e});
return undefined;
}
Expand All @@ -133,9 +125,10 @@ index f835d84..c65d2c6 100644

/**
* Compares two markdown comments and returns a list of the links removed in a new comment.
@@ -927,3 +927,5 @@ export default class ExpensiMark {
@@ -920,3 +920,5 @@ export default class ExpensiMark {
return linksInOld === undefined || linksInNew === undefined ? [] : _.difference(linksInOld, linksInNew);
}
}
+
+ExpensiMark.initializer();
\ No newline at end of file
6 changes: 3 additions & 3 deletions parser/react-native-live-markdown-parser.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/parserUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function parseText(target: HTMLElement, text: string, curosrPositionIndex: numbe
const markdownRanges: MarkdownRange[] = ranges as MarkdownRange[];
const rootSpan = targetElement.firstChild as HTMLElement | null;

if (targetElement.innerHTML === '<br>' || (rootSpan && rootSpan.innerHTML === '\n')) {
if (!text || targetElement.innerHTML === '<br>' || (rootSpan && rootSpan.innerHTML === '\n')) {
targetElement.innerHTML = '';
targetElement.innerText = '';
}
Expand Down

0 comments on commit adf5035

Please sign in to comment.