Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Content Not Refreshed Correctly when Modifying Pasted Content in Callbacks#1107

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
chadrschroeder wants to merge1 commit intobasecamp:main
base:main
Choose a base branch
Loading
fromchadrschroeder:issue_1103

Conversation

@chadrschroeder
Copy link

Fixes#1103.

Whenpasting plain text content or aURL, if you modify the content in atrix-change ortrix-paste callback, the changes aren't reflected in the editor after the paste is finished. The changes are reflected later if you start to type in the editor.

This pull request updates how the render is performed to match other areas likethis.

danielnc reacted with rocket emoji
…aste and trix-change callbacks are refreshed in the editor when pasting plain text
@danielnc
Copy link

Bump to see what are the plans to get this merged and/or a workaround based on issue#1103

@jondkinney
Copy link

I'm seeing this as well and have a feature where I want to copy some text from a spot in my UI and paste it into Trix to be processed as another instance of an existing ContentAttachment. However, because of this bug, it doesn't work until you press space or type another character, as described above.

I ended up working around this by having the copy feature write HTML to the clipboard even though I really only need plain text. For whatever reason Trix does process the paste with HTML properly.

functioncopyDateTag(button){consttaskDiv=button.closest('.task-date-tag');constpastableString=taskDiv.querySelector('.pastable-date-tag-string');constcontent=`${pastableString.textContent.trim()}`;// Need to use HTML because if you paste plain text into Trix it will not// process the pasted content as a ContentAttachment until another char// is pressed. See https://github.com/basecamp/trix/pull/1107constclipboardItem=newClipboardItem({'text/html':newBlob([content],{type:'text/html'}),'text/plain':newBlob([content],{type:'text/plain'})});navigator.clipboard.write([clipboardItem]).then(()=>{// Update button text while preserving the iconconstoriginalText=button.innerHTML;consticon=button.querySelector('svg').outerHTML;button.innerHTML=`${icon} Copied!`;setTimeout(()=>{button.innerHTML=originalText;},2000);}).catch(error=>console.error('Failed to copy:',error));}

But it'd be nice to get this one merged!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Content Not Refreshed Correctly for pasteEventHasPlainTextOnly Special Case

3 participants

@chadrschroeder@danielnc@jondkinney

[8]ページ先頭

©2009-2025 Movatter.jp