Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: remove header bar from image

thecodrr7a8be78e978e
diff --git a/packages/editor/dist/es/extensions/image/component.js b/packages/editor/dist/es/extensions/image/component.js
index 9b1c5cff4..cb021a2b5 100644
--- a/packages/editor/dist/es/extensions/image/component.js
+++ b/packages/editor/dist/es/extensions/image/component.js
@@ -12,6 +12,8 @@ import { Box, Flex, Image } from "rebass";
import { Resizable } from "re-resizable";
import { useEffect, useRef } from "react";
import { DesktopOnly } from "../../components/responsive";
+import { Icon } from "../../toolbar/components/icon";
+import { Icons } from "../../toolbar/icons";
import { ToolbarGroup } from "../../toolbar/components/toolbar-group";
export function ImageComponent(props) {
const { editor, updateAttributes, node, selected } = props;
@@ -56,34 +58,27 @@ export function ImageComponent(props) {
width: ref.clientWidth,
height: ref.clientHeight,
});
- }, lockAspectRatio: true }, { children: [_jsx(Flex, Object.assign({ width: "100%", "data-drag-handle": true, draggable: true, sx: {
- position: "relative",
- justifyContent: "end",
- borderTop: editor.isEditable
- ? "20px solid var(--bgSecondary)"
- : "none",
- borderTopLeftRadius: "default",
- borderTopRightRadius: "default",
- borderColor: selected ? "border" : "bgSecondary",
- cursor: "pointer",
- ":hover": {
- borderColor: "border",
- },
- } }, { children: _jsx(DesktopOnly, { children: selected && (_jsx(Flex, Object.assign({ sx: { position: "relative", justifyContent: "end" } }, { children: _jsx(Flex, Object.assign({ sx: {
- position: "absolute",
- top: -40,
- mb: 2,
- alignItems: "end",
- } }, { children: _jsx(ToolbarGroup, { editor: editor, tools: [
- "imageAlignLeft",
- "imageAlignCenter",
- "imageAlignRight",
- "imageProperties",
- ], sx: {
- boxShadow: "menu",
- borderRadius: "default",
- bg: "background",
- } }) })) }))) }) })), _jsx(Image, Object.assign({ "data-drag-image": true, ref: imageRef, alt: alt, src: "/placeholder.svg", title: title, width: "100%", height: "100%", sx: {
+ }, lockAspectRatio: true }, { children: [_jsx(DesktopOnly, { children: selected && (_jsx(Flex, Object.assign({ sx: { position: "relative", justifyContent: "end" } }, { children: _jsx(Flex, Object.assign({ sx: {
+ position: "absolute",
+ top: -40,
+ mb: 2,
+ alignItems: "end",
+ } }, { children: _jsx(ToolbarGroup, { editor: editor, tools: [
+ "imageAlignLeft",
+ "imageAlignCenter",
+ "imageAlignRight",
+ "imageProperties",
+ ], sx: {
+ boxShadow: "menu",
+ borderRadius: "default",
+ bg: "background",
+ } }) })) }))) }), selected && (_jsx(Icon, { className: "drag-handle", "data-drag-handle": true, draggable: true, path: Icons.dragHandle, sx: {
+ cursor: "grab",
+ position: "absolute",
+ top: 2,
+ left: 2,
+ zIndex: 999,
+ } })), _jsx(Image, Object.assign({ "data-drag-image": true, ref: imageRef, alt: alt, src: "/placeholder.svg", title: title, width: "100%", height: "100%", sx: {
bg: "bgSecondary",
border: selected
? "2px solid var(--primary)"
diff --git a/packages/editor/src/extensions/image/component.tsx b/packages/editor/src/extensions/image/component.tsx
index eb359b452..f1e7a28d6 100644
--- a/packages/editor/src/extensions/image/component.tsx
+++ b/packages/editor/src/extensions/image/component.tsx
@@ -69,56 +69,50 @@ export function ImageComponent(
}}
lockAspectRatio={true}
>
- <Flex
- width={"100%"}
- data-drag-handle
- draggable
- sx={{
- position: "relative",
- justifyContent: "end",
- borderTop: editor.isEditable
- ? "20px solid var(--bgSecondary)"
- : "none",
- borderTopLeftRadius: "default",
- borderTopRightRadius: "default",
- borderColor: selected ? "border" : "bgSecondary",
- cursor: "pointer",
- ":hover": {
- borderColor: "border",
- },
- }}
- >
- <DesktopOnly>
- {selected && (
- <Flex sx={{ position: "relative", justifyContent: "end" }}>
- <Flex
+ <DesktopOnly>
+ {selected && (
+ <Flex sx={{ position: "relative", justifyContent: "end" }}>
+ <Flex
+ sx={{
+ position: "absolute",
+ top: -40,
+ mb: 2,
+ alignItems: "end",
+ }}
+ >
+ <ToolbarGroup
+ editor={editor}
+ tools={[
+ "imageAlignLeft",
+ "imageAlignCenter",
+ "imageAlignRight",
+ "imageProperties",
+ ]}
sx={{
- position: "absolute",
- top: -40,
- mb: 2,
- alignItems: "end",
+ boxShadow: "menu",
+ borderRadius: "default",
+ bg: "background",
}}
- >
- <ToolbarGroup
- editor={editor}
- tools={[
- "imageAlignLeft",
- "imageAlignCenter",
- "imageAlignRight",
- "imageProperties",
- ]}
- sx={{
- boxShadow: "menu",
- borderRadius: "default",
- bg: "background",
- }}
- />
- </Flex>
+ />
</Flex>
- )}
- </DesktopOnly>
- </Flex>
-
+ </Flex>
+ )}
+ </DesktopOnly>
+ {selected && (
+ <Icon
+ className="drag-handle"
+ data-drag-handle
+ draggable
+ path={Icons.dragHandle}
+ sx={{
+ cursor: "grab",
+ position: "absolute",
+ top: 2,
+ left: 2,
+ zIndex: 999,
+ }}
+ />
+ )}
<Image
data-drag-image
ref={imageRef}