Skip to content

Commit

Permalink
Merge pull request #141 from colinricardo/main
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-tey authored Sep 6, 2023
2 parents 9dd424f + 228396b commit b77c596
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "novel",
"version": "0.1.19",
"version": "0.1.20",
"description": "Notion-style WYSIWYG editor with AI-powered autocompletions",
"license": "Apache-2.0",
"main": "./dist/index.js",
Expand Down
15 changes: 6 additions & 9 deletions packages/core/src/ui/editor/bubble-menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,15 @@ export const EditorBubbleMenu: FC<EditorBubbleMenuProps> = (props) => {

const bubbleMenuProps: EditorBubbleMenuProps = {
...props,
shouldShow: ({ view, state, editor }) => {
shouldShow: ({ state, editor }) => {
const { selection } = state;
const { empty } = selection;
const hasEditorFocus = view.hasFocus();

// don't show if image is selected
if (
editor.isActive("image") ||
!hasEditorFocus ||
empty ||
isNodeSelection(selection)
) {
// don't show bubble menu if:
// - the selected node is an image
// - the selection is empty
// - the selection is a node selection (for drag handles)
if (editor.isActive("image") || empty || isNodeSelection(selection)) {
return false;
}
return true;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/ui/editor/bubble-menu/link-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const LinkSelector: FC<LinkSelectorProps> = ({
<form
onSubmit={(e) => {
e.preventDefault();
const input = e.target[0] as HTMLInputElement;
const input = e.currentTarget[0] as HTMLInputElement;
const url = getUrlFromString(input.value);
url && editor.chain().focus().setLink({ href: url }).run();
setIsOpen(false);
Expand Down

1 comment on commit b77c596

@vercel
Copy link

@vercel vercel bot commented on b77c596 Sep 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.