-
-
Notifications
You must be signed in to change notification settings - Fork 588
Conversation
Anything I can do to help here? Thanks~ |
😂 sorry, I a little bit busy recently, this pr almost done, i will check some details as quick as possible |
I found this replacement issue when testing: Kapture.2021-08-26.at.19.34.12.mp4 |
package.json
Outdated
@@ -9,6 +9,7 @@ | |||
"scripts": { | |||
"test": "jest", | |||
"lint": "tsc --noEmit && eslint '*/**/*.{js,ts,tsx}' --quiet", | |||
"lint:fox": "eslint '*/**/*.{js,ts,tsx}' --quiet --fix", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove as lint --fix
works
src/components/EmojiMenu.tsx
Outdated
insertItem = item => { | ||
this.insertBlock(item); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method isn't needed, insertEmoji
?
src/components/EmojiMenu.tsx
Outdated
> | ||
<List> | ||
{items.map((item, index) => { | ||
if (item.name === "separator") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love that you've made it look like the block insert menu, a lot of this is copied straight over which means it's begging for an abstraction so that the code can be reused between popover menus such as @mentions in the future too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx, i will make an abstraction to reused code between emoji and block
src/components/EmojiMenuItem.tsx
Outdated
onClick={disabled ? undefined : onClick} | ||
ref={ref} | ||
> | ||
{title} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the title needs to include the string eg "grinning" next to the emoji, kind of like GitHub – it will help it to look a little nicer too. The emoji might want bumping up in size a touch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/index.tsx
Outdated
@@ -314,6 +318,10 @@ class RichMarkdownEditor extends React.PureComponent<Props, State> { | |||
dictionary, | |||
onShowToast: this.props.onShowToast, | |||
}), | |||
new Emoji({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will need add emoji to disableExtensions in props.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx, i will~
src/plugins/EmojiTrigger.tsx
Outdated
console.log( | ||
match && | ||
state.selection.$from.parent.type.name === "paragraph" && | ||
!isInTable(state), | ||
match | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another debug statement left behind
@@ -0,0 +1,92 @@ | |||
import { InputRule } from "prosemirror-inputrules"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BlockMenuTrigger and EmojiTrigger has lot of copy/paste code, but i not sure to create a common plugin or common trigger extension
selectedIndex: number; | ||
}; | ||
|
||
class BlockMenu extends React.Component<Props, State> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this maybe a big change, EmojiMenu BlockMenu wii reuse CommonBlockMenu
onClick: () => void; | ||
} | ||
) => React.ReactNode; | ||
filterable?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filter items by search
} | ||
) => React.ReactNode; | ||
filterable?: boolean; | ||
items: T[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
render menu item list
onShowToast?: (message: string, id: string) => void; | ||
onLinkToolbarOpen?: () => void; | ||
onClose: () => void; | ||
onClearSearch: () => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
emojimenu and blockmenu has different clearsearch behavior
|
||
const ref = this.menuRef.current; | ||
const offsetHeight = ref ? ref.offsetHeight : 0; | ||
const node = findDomRefAtPos(selection.from, domAtPos); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
emoji should allow insert inside para
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great – getting so close!
package.json
Outdated
@@ -26,8 +26,12 @@ | |||
}, | |||
"dependencies": { | |||
"copy-to-clipboard": "^3.0.8", | |||
"fuzzy-search": "^3.2.1", | |||
"gemoji": "^7.0.0", | |||
"install": "^0.13.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"install": "^0.13.0", |
Not needed, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my fault
src/plugins/EmojiTrigger.tsx
Outdated
import Extension from "../lib/Extension"; | ||
import { run } from "./BlockMenuTrigger"; | ||
|
||
const OPEN_REGEX = /:([0-9a-zA-Z_]+)?$/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to account for ":+" and ":-" starts in the regex here for thumbs up/down
src/components/EmojiMenuItem.tsx
Outdated
}) => { | ||
return ( | ||
<Title> | ||
{emoji} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we wrap the emoji to give it 16px size but keep the text size the same as the other menu?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok ~
src/components/EmojiMenuItem.tsx
Outdated
); | ||
} | ||
|
||
export default withTheme(EmojiMenuItem); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export default withTheme(EmojiMenuItem); | |
export default EmojiMenuItem; |
Shouldn't need withTheme
here
return { | ||
...item, | ||
name: "emoji", | ||
title: name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to use "description" from gemoji here so that the text doesn't contain "_"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe not.. gemoji description longer than name
{
"emoji": "😍",
"names": ["heart_eyes"],
"tags": ["love", "crush"],
"description": "smiling face with heart-eyes",
"category": "Smileys & Emotion"
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mm, maybe we can humanize the name then? (Capitalize, remove underscores)
Feels very strange to show underscores in user facing UI. I know GitHub does it, but GitHub is weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you are right, i will try it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey hey, just testing out the branch and when I go to insert an emoji it always places the text |
Co-authored-by: Tom Moor <tom.moor@gmail.com>
Co-authored-by: Tom Moor <tom.moor@gmail.com>
emoji component; regex; typo
emoji.mp4 |
I had to make a couple of local fixes, but squashed and merged here – bbaf157 Thank you! |
Unfortunately the published version with this merged doesn't seem to work because of gemoji – I haven't yet figured out how to work around it.
|
😓 it looks require esm not supported, i will try changed tsconfig.json: |
its wired, i try it on my webpack project, it works fine |
What did you change? Changing |
i did not change yet, just download |
Ah, okay. It no longer works in |
I try it on |
I'm not sure, Outline is not a complicated build system – https://github.com/outline/outline/blob/main/server/.babelrc I pretty much lost my whole evening to this, so signing off for now. |
(Maybe) Solution 1 convert outline server to native esm Solution 2 I lock gemoji version to cjs version #555 |
Any idea why I'm getting this error when I run tests within my project?
Rich Markdown Editor version: I tried resetting the lock file and event installing |
@tommoor @guatedude2 took look at this pr #557, fix this issue.... |
Thanks @JiangWeixian I'll keep an eye out on the PR! |
#175