diff --git a/src/renderer/src/editor/tools/MediaAttr.tsx b/src/renderer/src/editor/tools/MediaAttr.tsx
index 939b2345..207776a5 100644
--- a/src/renderer/src/editor/tools/MediaAttr.tsx
+++ b/src/renderer/src/editor/tools/MediaAttr.tsx
@@ -125,7 +125,8 @@ export const MediaAttr = observer(() => {
}, [treeStore.size, store.openSearch])
return (
{
onKeyDown={keydown}
placeholder={'url or file path'}
/>
-
{
- const path = nodeRef.current![1]
- Transforms.setNodes(
- store.editor,
- {url: state().url || '', alt: state().alt || ''},
- {at: path}
- )
- }}
- className={'text-base dark:text-gray-300 text-gray-500 cursor-default duration-300 hover:text-sky-500 ml-2'}
- />
-
-
+
+ {
+ const path = nodeRef.current![1]
+ Transforms.setNodes(
+ store.editor,
+ {url: state().url || '', alt: state().alt || ''},
+ {at: path}
+ )
+ }}
+ className={'dark:text-gray-300 text-gray-500 cursor-default relative'}
+ />
+
+
+
+
+
)
})
diff --git a/src/renderer/src/utils/keyboard.ts b/src/renderer/src/utils/keyboard.ts
index 006ddfee..a49e40ff 100644
--- a/src/renderer/src/utils/keyboard.ts
+++ b/src/renderer/src/utils/keyboard.ts
@@ -88,6 +88,19 @@ export class MenuKey {
ReactEditor.focus(this.state.editor)
}
}
+ if (isHotkey('enter', e) && this.state) {
+ const [node] = Editor.nodes(this.state.editor, {
+ match: n => n.type === 'media'
+ })
+ if (node) {
+ e.preventDefault()
+ Transforms.select(this.state.editor, {
+ path: Path.next(node[1]),
+ offset: 0
+ })
+ ReactEditor.focus(this.state.editor)
+ }
+ }
}, false)
window.electron.ipcRenderer.on('key-task', (e, task: string, other: any) => {
this.run(task, other)