UX: improve artifact styling add direct share link (#930)
Also remove uneeded sandboxing give this is all handled by artifacts directly
This commit is contained in:
parent
a0aec48606
commit
2652716398
|
@ -52,6 +52,11 @@ module DiscourseAi
|
||||||
padding: 0;
|
padding: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
border: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
iframe {
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -9,7 +9,10 @@ class AiArtifact < ActiveRecord::Base
|
||||||
|
|
||||||
def self.iframe_for(id)
|
def self.iframe_for(id)
|
||||||
<<~HTML
|
<<~HTML
|
||||||
<iframe sandbox="allow-scripts allow-forms" height="600px" src='#{url(id)}' frameborder="0" width="100%"></iframe>
|
<div class='ai-artifact'>
|
||||||
|
<iframe src='#{url(id)}' frameborder="0" height="100%" width="100%"></iframe>
|
||||||
|
<a href='#{url(id)}' target='_blank'>#{I18n.t("discourse_ai.ai_artifact.link")}</a>
|
||||||
|
</div>
|
||||||
HTML
|
HTML
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,6 @@ export default class AiArtifactComponent extends Component {
|
||||||
src={{this.artifactUrl}}
|
src={{this.artifactUrl}}
|
||||||
width="100%"
|
width="100%"
|
||||||
frameborder="0"
|
frameborder="0"
|
||||||
sandbox="allow-scripts allow-forms"
|
|
||||||
></iframe>
|
></iframe>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#unless this.requireClickToRun}}
|
{{#unless this.requireClickToRun}}
|
||||||
|
|
|
@ -173,6 +173,8 @@ en:
|
||||||
title: Surprise
|
title: Surprise
|
||||||
|
|
||||||
discourse_ai:
|
discourse_ai:
|
||||||
|
ai_artifact:
|
||||||
|
link: "Show Artifact in new tab"
|
||||||
unknown_model: "Unknown AI model"
|
unknown_model: "Unknown AI model"
|
||||||
|
|
||||||
tools:
|
tools:
|
||||||
|
|
|
@ -441,7 +441,7 @@ aside .title .avatar {
|
||||||
}
|
}
|
||||||
|
|
||||||
.lightbox-wrapper .meta .filename,
|
.lightbox-wrapper .meta .filename,
|
||||||
.lightbox-wrapper .meta svg,
|
.lightbox-wrapper .meta svg,
|
||||||
.lightbox-wrapper .meta .informations {
|
.lightbox-wrapper .meta .informations {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
@ -450,10 +450,10 @@ aside .title .avatar {
|
||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
custom code highlighting for dark mode support...
|
custom code highlighting for dark mode support...
|
||||||
overrides highlightjs (https://highlightjs.org/) CSS colors.
|
overrides highlightjs (https://highlightjs.org/) CSS colors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.hljs{
|
.hljs{
|
||||||
--hljs-red: #c63c1b;
|
--hljs-red: #c63c1b;
|
||||||
|
@ -461,9 +461,9 @@ aside .title .avatar {
|
||||||
--hljs-lime: #4dff4d;
|
--hljs-lime: #4dff4d;
|
||||||
--hljs-green: #090;
|
--hljs-green: #090;
|
||||||
--hljs-sky: #47c2ff;
|
--hljs-sky: #47c2ff;
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
--hljs-red: #af3719;
|
--hljs-red: #af3719;
|
||||||
--hljs-salmon: #c7705c;
|
--hljs-salmon: #c7705c;
|
||||||
--hljs-lime: #3fcf3f;
|
--hljs-lime: #3fcf3f;
|
||||||
--hljs-green: #048504;
|
--hljs-green: #048504;
|
||||||
|
@ -614,7 +614,7 @@ aside.onebox h3 {
|
||||||
display: block;
|
display: block;
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 384 512'%3E%3C!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--%3E%3Cpath d='M73 39c-14.8-9.1-33.4-9.4-48.5-.9S0 62.6 0 80V432c0 17.4 9.4 33.4 24.5 41.9s33.7 8.1 48.5-.9L361 297c14.3-8.7 23-24.2 23-41s-8.7-32.2-23-41L73 39z' fill='white' /%3E%3C/svg%3E");
|
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 384 512'%3E%3C!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--%3E%3Cpath d='M73 39c-14.8-9.1-33.4-9.4-48.5-.9S0 62.6 0 80V432c0 17.4 9.4 33.4 24.5 41.9s33.7 8.1 48.5-.9L361 297c14.3-8.7 23-24.2 23-41s-8.7-32.2-23-41L73 39z' fill='white' /%3E%3C/svg%3E");
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
width: 5em;
|
width: 5em;
|
||||||
height: 6.25em;
|
height: 6.25em;
|
||||||
|
@ -622,8 +622,13 @@ aside.onebox h3 {
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 32%;
|
top: 32%;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
opacity: 0.85;
|
opacity: 0.85;
|
||||||
transition: opacity 0.25s ease-in-out;
|
transition: opacity 0.25s ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ai-artifact iframe {
|
||||||
|
height: 600px;
|
||||||
|
max-height: 600px;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue