Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(md): fix image copy caused by unchecked nulls (#1446)

Seamus60b8d206d5da
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/MarkdownImage.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/MarkdownImage.tsx
index 9faf0fe7fd..7daa4ba473 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/MarkdownImage.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/MarkdownImage.tsx
@@ -320,7 +320,7 @@ export function MarkdownImage(props: ImageDecoratorProps) {
<img
crossorigin="anonymous"
class="h-full object-contain"
- draggable={false}
+ draggable={true}
classList={{
invisible: state() === 'loading' || state() === 'error',
}}
@@ -341,7 +341,7 @@ export function MarkdownImage(props: ImageDecoratorProps) {
</Show>
<Show when={state() === 'loading'}>
- <div class="absolute top-0 left-0 w-full h-full flex flex-col justify-center items-center gap-2 text-ink-extra-muted">
+ <div class="absolute top-0 left-0 w-full h-full flex flex-col justify-center items-center gap-2 text-ink-extra-muted bg-hover/50">
<Spinner />
</div>
</Show>
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/MarkdownVideo.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/MarkdownVideo.tsx
index 8b5e5ef483..0accef88f9 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/MarkdownVideo.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/MarkdownVideo.tsx
@@ -298,7 +298,7 @@ export function MarkdownVideo(props: VideoDecoratorProps) {
<video
crossorigin="anonymous"
class="h-full object-contain"
- draggable={false}
+ draggable={true}
classList={{
invisible: state() === 'loading' || state() === 'error',
}}
@@ -318,7 +318,7 @@ export function MarkdownVideo(props: VideoDecoratorProps) {
</Show>
<Show when={state() === 'loading'}>
- <div class="absolute top-0 left-0 w-full h-full flex flex-col justify-center items-center gap-2 text-ink-extra-muted">
+ <div class="absolute top-0 left-0 w-full h-full flex flex-col justify-center items-center gap-2 text-ink-extra-muted bg-hover/50">
<Spinner />
</div>
</Show>
diff --git a/js/app/packages/lexical-core/nodes/MediaNode.ts b/js/app/packages/lexical-core/nodes/MediaNode.ts
index a02bb66246..a7b7fd9296 100644
--- a/js/app/packages/lexical-core/nodes/MediaNode.ts
+++ b/js/app/packages/lexical-core/nodes/MediaNode.ts
@@ -185,13 +185,13 @@ export abstract class MediaNode<
element.setAttribute('data-src-type', this.__srcType);
element.setAttribute(`data-${this.getMediaType()}-id`, this.__id);
element.setAttribute('data-scale', this.__scale.toString());
- if (this.__constrainedWidth !== undefined) {
+ if (this.__constrainedWidth != null) {
element.setAttribute(
'data-constrained-width',
this.__constrainedWidth.toString()
);
}
- if (this.__constrainedHeight !== undefined) {
+ if (this.__constrainedHeight != null) {
element.setAttribute(
'data-constrained-height',
this.__constrainedHeight.toString()
diff --git a/js/app/packages/lexical-core/transformers/image.ts b/js/app/packages/lexical-core/transformers/image.ts
index 93470a7c5b..e62ac8a513 100644
--- a/js/app/packages/lexical-core/transformers/image.ts
+++ b/js/app/packages/lexical-core/transformers/image.ts
@@ -14,7 +14,7 @@ export const I_IMAGE_CONSTRAINED: ElementTransformer = {
const constrainedWidth = node.getConstrainedWidth();
const constrainedHeight = node.getConstrainedHeight();
- if (constrainedWidth === undefined && constrainedHeight === undefined) {
+ if (constrainedWidth == null && constrainedHeight == null) {
return null;
}
@@ -45,8 +45,8 @@ export const I_IMAGE_CONSTRAINED: ElementTransformer = {
width: data.width || 0,
height: data.height || 0,
scale: data.scale || 1,
- constrainedWidth: data.constrainedWidth,
- constrainedHeight: data.constrainedHeight,
+ constrainedWidth: data.constrainedWidth ?? undefined,
+ constrainedHeight: data.constrainedHeight ?? undefined,
});
parent.append(imageNode);
} catch (e) {