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

Feature/JS-5752: Url preview logic #1065

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

mhlv
Copy link
Contributor

@mhlv mhlv commented Nov 21, 2024


  • I understand that contributing to this repository will require me to agree with the CLA

Description

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🤖 Build
  • 🔁 CI

Related Tickets & Documents

Mobile & Desktop Screenshots/Recordings

Added tests?

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help

Added to documentation?

  • 📜 README.md
  • 📓 tech-docs
  • 🙅 no documentation needed

[optional] Are there any post-deployment tasks we need to perform?

@mhlv mhlv self-assigned this Nov 21, 2024
src/scss/block/chat/attachment.scss Outdated Show resolved Hide resolved
src/ts/component/block/chat.tsx Outdated Show resolved Hide resolved
@@ -87,7 +88,7 @@ const ChatAttachment = observer(class ChatAttachment extends React.Component<Pro
};

case I.ObjectLayout.Bookmark: {
content = this.renderBookmark();
content = bookmarkAsDefault ? this.renderDefault() : this.renderBookmark();
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not understand how this should work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i pass bookmarkAsDefault=true in case there are more than 1 attachment in the message and for all attachments in the message form

Comment on lines +488 to +498
window.setTimeout(() => {
for (const url of urls) {
const { from, to, isLocal, value } = url;
const param = isLocal ? `file://${value}` : value;

this.marks = Mark.adjust(this.marks, from - 1, value.length + 1);
this.marks.push({ type: I.MarkType.Link, range: { from, to }, param});
this.addBookmark(param, true);
};
this.updateMarkup(text, this.range.to + 1, this.range.to + 1);
}, 150);

Choose a reason for hiding this comment

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

setTimeout? Looks like workaround.

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.

3 participants