Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: copy and paste custom-emoji #1873

Merged
merged 2 commits into from
Mar 9, 2023
Merged

Conversation

patak-dev
Copy link
Member

Reference:

@cyberalien it looks like when we copy and paste, there is no title in the attributes and we are instead adding a alt that has the full :name:

This PR fixes copy and paste, but I don't know if this is correct long term. We also are creating here a custom emoji without a title but this one has a emoji-data-id

Looks like the emoji-data-id is lost on copy and paste.
We could still merge this one as a patch.

@stackblitz
Copy link

stackblitz bot commented Mar 8, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@netlify
Copy link

netlify bot commented Mar 8, 2023

Deploy Preview for elk-docs canceled.

Name Link
🔨 Latest commit fa123d4
🔍 Latest deploy log https://app.netlify.com/sites/elk-docs/deploys/6409bfe0ddc528000893ad12

@netlify
Copy link

netlify bot commented Mar 8, 2023

Deploy Preview for elk-zone ready!

Name Link
🔨 Latest commit fa123d4
🔍 Latest deploy log https://app.netlify.com/sites/elk-zone/deploys/6409bfe017938a0008e98df6
😎 Deploy Preview https://deploy-preview-1873--elk-zone.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@cyberalien
Copy link
Member

With all this weird behaviour going on, maybe it would be better not to assume that value starts/ends with :?

Custom emojis can't have double ::, so it would be safe to just wrap whole chain of attributes, get string, remove first/last entry with regex, which would work the same regardless of which attribute it came from.

Something like this:

return `:${(input.attributes['data-emoji-id'] ?? input.attributes.title ?? input.attributes.alt ?? '').replace(/^:/, '').replace(/:$/,'')}:`

@patak-dev
Copy link
Member Author

Sounds good! I'll change it and merge tomorrow when I'm back

@patak-dev patak-dev enabled auto-merge (squash) March 9, 2023 11:15
@patak-dev patak-dev merged commit 3732a2c into main Mar 9, 2023
@patak-dev patak-dev deleted the fix/custom-emoji-copy-and-paste branch March 9, 2023 11:18
DataDrivenMD pushed a commit to Distal-Labs/elk that referenced this pull request Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants