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.

style(md): restyle media resize handles (#2590)

Seamusa09a77c75ed6
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/ResizeHandle.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/ResizeHandle.tsx
index 32ab63ee27..2ec1f9a636 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/ResizeHandle.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/ResizeHandle.tsx
@@ -1,4 +1,3 @@
-import { cornerClip } from '@core/util/clipPath';
import { createEffect, createSignal, onCleanup, onMount } from 'solid-js';
const MIN_IMAGE_HEIGHT = 50;
@@ -109,28 +108,10 @@ export function ResizeHandle(props: ResizeHandleProps) {
handleRef.removeEventListener('pointerup', handlePointerUp);
});
- const translateX = () => {
- if (props.side === 'left') {
- return innerVisible()
- ? 'translateX(-2px)'
- : 'translateX(calc(-100% - 2px))';
- } else {
- return innerVisible()
- ? 'translateX(calc(-100% + 2px + 1rem))'
- : 'translateX(calc(2px + 1rem))';
- }
- };
-
- const clipPath = () => {
- return props.side === 'left'
- ? cornerClip(0, '1rem', '1rem', 0)
- : cornerClip('1rem', 0, 0, '1rem');
- };
-
return (
<div
ref={handleRef}
- class="w-4 absolute top-0 h-full cursor-col-resize z-1 transition-colors duration-200 flex flex-col justify-center group"
+ class="w-4 absolute top-0 h-full cursor-col-resize z-1"
classList={{
'right-0': props.side === 'right',
'left-0': props.side === 'left',
@@ -140,26 +121,16 @@ export function ResizeHandle(props: ResizeHandleProps) {
}}
>
<div
- class="w-3 h-[50%] bg-panel transition-transform duration-100 min-h-8 flex flex-row py-6 pointer-events-none"
+ class="w-1 h-[50%] min-h-8 absolute top-1/2 bg-ink ring-2 ring-panel rounded-full transition-all duration-200 pointer-events-none"
classList={{
- 'justify-start': props.side === 'left',
- 'justify-end': props.side === 'right',
+ 'right-3': props.side === 'right',
+ 'left-3': props.side === 'left',
}}
style={{
- transform: translateX(),
- 'clip-path': clipPath(),
+ opacity: innerVisible() || isDragging() ? 0.5 : 0,
+ transform: `translateY(-50%) ${isDragging() ? 'scale(1.2)' : 'scale(1)'}`,
}}
- >
- <div
- class="h-full w-0.25 group-hover:w-0.5 transition-transform duration-30"
- style={{
- transform: innerVisible() ? 'scaleY(1)' : 'scaleY(0)',
- 'background-color': isDragging()
- ? 'var(--color-accent)'
- : 'var(--color-ink-extra-muted)',
- }}
- />
- </div>
+ />
</div>
);
}
diff --git a/js/app/packages/core/component/LexicalMarkdown/plugins/actions/actions.ts b/js/app/packages/core/component/LexicalMarkdown/plugins/actions/actions.ts
index 275cf942e8..b6588283d4 100644
--- a/js/app/packages/core/component/LexicalMarkdown/plugins/actions/actions.ts
+++ b/js/app/packages/core/component/LexicalMarkdown/plugins/actions/actions.ts
@@ -150,7 +150,7 @@ export const ACTIONS: Action[] = [
icon: ImageIcon,
action: (editor: LexicalEditor) => {
queueMicrotask(() => {
- editor.dispatchCommand(TRY_INSERT_MEDIA_UPLOAD_COMMAND, 'image');
+ editor.dispatchCommand(TRY_INSERT_MEDIA_UPLOAD_COMMAND, 'all');
});
},
},
@@ -162,7 +162,7 @@ export const ACTIONS: Action[] = [
icon: VideoIcon,
action: (editor: LexicalEditor) => {
queueMicrotask(() => {
- editor.dispatchCommand(TRY_INSERT_MEDIA_UPLOAD_COMMAND, 'video');
+ editor.dispatchCommand(TRY_INSERT_MEDIA_UPLOAD_COMMAND, 'all');
});
},
},
diff --git a/js/app/packages/core/component/LexicalMarkdown/plugins/media/mediaPlugin.ts b/js/app/packages/core/component/LexicalMarkdown/plugins/media/mediaPlugin.ts
index 28a58f47fe..aaffb58b23 100644
--- a/js/app/packages/core/component/LexicalMarkdown/plugins/media/mediaPlugin.ts
+++ b/js/app/packages/core/component/LexicalMarkdown/plugins/media/mediaPlugin.ts
@@ -88,8 +88,9 @@ export const UPDATE_MEDIA_SIZE_COMMAND: LexicalCommand<
[NodeKey, { width: number; height: number }, MediaType]
> = createCommand('UPDATE_MEDIA_SIZE_COMMAND');
-export const TRY_INSERT_MEDIA_UPLOAD_COMMAND: LexicalCommand<MediaType> =
- createCommand('TRY_INSERT_MEDIA_UPLOAD_COMMAND');
+export const TRY_INSERT_MEDIA_UPLOAD_COMMAND: LexicalCommand<
+ MediaType | 'all'
+> = createCommand('TRY_INSERT_MEDIA_UPLOAD_COMMAND');
export function validateMediaFile(file: File, mediaType: MediaType): boolean {
const ext = fileExtension(file.name);
@@ -539,7 +540,12 @@ function registerMediaPlugin(editor: LexicalEditor) {
(mediaType) => {
const input = document.createElement('input');
input.type = 'file';
- input.accept = mediaType === 'video' ? 'video/*' : 'image/*';
+ input.accept = 'image/*';
+ if (mediaType === 'video') {
+ input.accept = 'video/*';
+ } else if (mediaType === 'all') {
+ input.accept = 'image/*,video/*';
+ }
input.multiple = true;
input.style.display = 'none';