-
Notifications
You must be signed in to change notification settings - Fork 91
gcoai-stream-to-paragraph-field.js
: Fixed duplicate code and an issue with snippet not working.
#1047
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
gcoai-stream-to-paragraph-field.js
: Fixed duplicate code and an issue with snippet not working.
#1047
Conversation
…ue where output wouldn't copy to a plain text Paragraph field if any rich text Paragraph fields existed on the form.
WalkthroughThe pull request refactors the logic in the TinyMCE handling of the Changes
Sequence Diagram(s)sequenceDiagram
participant JS as JavaScript
participant T as TinyMCE Instance
JS->>JS: Check if window.tinyMCE exists and get TinyMCE instance (assign to `tiny`)
alt TinyMCE available
JS->>T: Call setContent(html)
else Not available
JS->>JS: Skip setting content
end
Suggested reviewers
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (4)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
gcoai-stream-to-paragraph-field.js
: Fixed duplicate code and an iss…gcoai-stream-to-paragraph-field.js
: Fixed duplicate code and an issue with snippet not working.
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.
LGTM!
Thanks for getting rid of the duplicate code. It was my mistake 😭
Context
⛑️ Ticket(s): https://secure.helpscout.net/conversation/2853989407/78340?viewId=8172236
Summary
If the Response field is set to a plain text Paragraph field and there are rich text enabled Paragraph fields elsewhere on the form, the
gcoai-stream-to-paragraph-field
snippet fails to copy OpenAI's output to the Response field. This happens because the code checks if TinyMCE is globally available, not whether the specific Response field has TinyMCE enabled.This PR fixes this by modifying the TinyMCE detection to specifically check if the target Response field has TinyMCE enabled, rather than just checking if TinyMCE exists globally.
Additionally, this PR removes duplicate code at the end of the snippet.