@expensify/react-native-live-markdown 0.1.171 → 0.1.173
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/lib/commonjs/MarkdownTextInput.web.js.map +1 -1
- package/lib/commonjs/web/inputElements/inlineImage.js +8 -2
- package/lib/commonjs/web/inputElements/inlineImage.js.map +1 -1
- package/lib/module/MarkdownTextInput.web.js.map +1 -1
- package/lib/module/web/inputElements/inlineImage.js +8 -2
- package/lib/module/web/inputElements/inlineImage.js.map +1 -1
- package/lib/parser/react-native-live-markdown-parser.js +25 -22
- package/lib/typescript/src/MarkdownTextInput.web.d.ts +1 -0
- package/lib/typescript/src/MarkdownTextInput.web.d.ts.map +1 -1
- package/lib/typescript/src/web/inputElements/inlineImage.d.ts.map +1 -1
- package/package.json +1 -1
- package/parser/react-native-live-markdown-parser.js +25 -22
- package/src/MarkdownTextInput.web.tsx +1 -0
- package/src/web/inputElements/inlineImage.ts +8 -2
|
@@ -75,11 +75,17 @@ function handleOnLoad(
|
|
|
75
75
|
justifyContent: 'center',
|
|
76
76
|
}),
|
|
77
77
|
});
|
|
78
|
-
|
|
79
78
|
Object.assign(img.style, !err && imgStyle);
|
|
80
79
|
|
|
81
80
|
targetElement.appendChild(imageContainer);
|
|
82
81
|
|
|
82
|
+
const currentInputElement = currentInput;
|
|
83
|
+
if (currentInput.imageElements) {
|
|
84
|
+
currentInputElement.imageElements.push(img);
|
|
85
|
+
} else {
|
|
86
|
+
currentInputElement.imageElements = [img];
|
|
87
|
+
}
|
|
88
|
+
|
|
83
89
|
const imageClientHeight = Math.max(img.clientHeight, imageContainer.clientHeight);
|
|
84
90
|
Object.assign(imageContainer.style, {
|
|
85
91
|
height: `${imageClientHeight}px`,
|
|
@@ -164,7 +170,7 @@ function addInlineImagePreview(
|
|
|
164
170
|
|
|
165
171
|
// If the inline image markdown with the same href exists in the current input, use it instead of creating new one.
|
|
166
172
|
// Prevents from image flickering and layout jumps
|
|
167
|
-
const alreadyLoadedPreview = currentInput.
|
|
173
|
+
const alreadyLoadedPreview = currentInput.imageElements?.find((el) => el?.src === imageHref);
|
|
168
174
|
const loadedImageContainer = alreadyLoadedPreview?.parentElement;
|
|
169
175
|
|
|
170
176
|
if (loadedImageContainer && loadedImageContainer.getAttribute('data-type') === 'inline-container') {
|