diff --git a/app/models/ai_artifact.rb b/app/models/ai_artifact.rb index 8de09602..8abc8421 100644 --- a/app/models/ai_artifact.rb +++ b/app/models/ai_artifact.rb @@ -18,13 +18,21 @@ class AiArtifact < ActiveRecord::Base https://code.jquery.com ] + def self.artifact_version_attribute(version) + if version + "data-artifact-version='#{version}'" + else + "" + end + end + def self.iframe_for(id, version = nil) <<~HTML
HTML diff --git a/assets/javascripts/discourse/components/modal/share-full-topic-modal.gjs b/assets/javascripts/discourse/components/modal/share-full-topic-modal.gjs index b0bf2c02..73c1b8cf 100644 --- a/assets/javascripts/discourse/components/modal/share-full-topic-modal.gjs +++ b/assets/javascripts/discourse/components/modal/share-full-topic-modal.gjs @@ -96,9 +96,14 @@ export default class ShareModal extends Component { } event.stopPropagation(); event.preventDefault(); - const iframeEmbed = ``; + + let version = ""; + if (event.target.dataset.artifactVersion) { + version = `data-ai-artifact-version="${event.target.dataset.artifactVersion}"`; + } + const artifactEmbed = ``; const promise = new Promise((resolve) => { - resolve(iframeEmbed); + resolve(artifactEmbed); }); await clipboardCopyAsync(() => promise);