Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5d35599
Common: add per-element flexibility for design-width
ascholerChemeketa Aug 18, 2025
65b4899
HTML: new pubvar for design-width
ascholerChemeketa Aug 18, 2025
18dd355
HTML: use customizable design-width varaible
ascholerChemeketa Aug 18, 2025
1a7ee8d
Guide: add documentation for design-width pub var
ascholerChemeketa Jan 13, 2026
43b9f50
HTML: expand max width on iframe standalone pages
ascholerChemeketa Aug 18, 2025
db301f3
Assembly: generate interactive-platform identifier for all interactives
ascholerChemeketa Aug 18, 2025
9f0d6cb
HTML: add resize-behavior pubvars for interactives and varients
ascholerChemeketa Aug 18, 2025
5ffafe8
HTML: add get-resize-behavior templates for interactives
ascholerChemeketa Aug 18, 2025
e888de9
HTML: custom design-width handling for interactives and slates
ascholerChemeketa Aug 18, 2025
f4d520e
HTML: refactor size-pixels-style-attribute
ascholerChemeketa Aug 18, 2025
36e21e5
HTML: interactives and slates use resize-behavior setting
ascholerChemeketa Aug 19, 2025
c1bec20
HTML: add container around interactives iframes
ascholerChemeketa Aug 19, 2025
8bc5998
CSS: force wide interactives to scroll instead of stretching page width
ascholerChemeketa Aug 19, 2025
621a998
Localization: add "open in new tab"
ascholerChemeketa Aug 18, 2025
33ff06e
HTML: add open in new window link button to interactives
ascholerChemeketa Aug 19, 2025
6f1e9ff
CSS: style open in new window link for interactives
ascholerChemeketa Aug 19, 2025
419bbcd
Sample article: set pubfile resize-behavior
ascholerChemeketa Aug 19, 2025
1aa93be
Sample article: cleanup layouts from included js/css in interactives
ascholerChemeketa Aug 19, 2025
db3c9c6
Sample article: adjust interatives layouts
ascholerChemeketa Aug 19, 2025
ec51b05
Sample article: add interactive layout examples
ascholerChemeketa Aug 19, 2025
dd45aeb
JS: lti_iframe_resizer updates height/width attribute and style
ascholerChemeketa Aug 19, 2025
93be635
Guide: add documentation for resize-behavior pub var
ascholerChemeketa Jan 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions css/components/_pretext.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ $navbar-breakpoint: 800px !default;
@use 'google-search';
@use 'pretext-search';
@use 'interactives/runestone';
@use 'interactives/other';
@use 'interactives/webwork';
@use 'interactives/sagecell';

Expand Down
34 changes: 34 additions & 0 deletions css/components/interactives/_other.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.interactive-iframe-container {
max-width: 100%;
overflow: auto;
& > iframe {
margin-left: auto;
margin-right: auto;
display: block;
}
}

.interactive-iframe-container__opener {
display: block;
margin-right: 5px;
margin-top: 11px;
margin-bottom: 5px;
font-size: 0.8rem;
& .icon {
font-size: 18px;
}

// if figcaption or instructions follow, this should float next to that
&:has(+ figcaption, + .instructions) {
float: left;
z-index: 1; // place above fig caption in render stack
position: relative; // for z-index
}

// and if both, the figcaption should clear
+ .instructions + figcaption {
clear: left;
}

+ .instructions { margin-top: .5em; }
}
42 changes: 42 additions & 0 deletions doc/guide/publisher/publication-file.xml
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,48 @@
<li><c>yes</c>: show a button in the navigation bar, that when clicked, displays a popup allowing the user to copy an iframe code snippet to paste into their website or LMS.</li>
</ul></p>
</subsection>

<subsection xml:id="online-interactives-options">
<title>Interactives Options</title>
<idx><h>publisher options</h><h>html interactives</h></idx>

<p>
The
<cd>
<cline>/publication/html</cline>
</cd>
element can have an attribute <attr>design-width</attr> with an integer value. This will be used as the base value for converting the percentage based widths of an interactive into a pixel values when that is required. The default value is <c>600</c> (100% width is 600px).
</p>

<p>
The
<cd>
<cline>/publication/html/interactives</cline>
</cd>
element can have an attribute <attr>resize-behavior</attr> that is used to control how interactives respond to window resizing. Possible values are:
<ul>
<li><c>fixed-height</c> (default): interactives will maintain their initial height as the window size changes. When the content becomes too wide to display, a horizontal scrollbar will appear.</li>
<li><c>responsive</c>: interactives will resize dynamically as the window size changes to maintain their aspect ratio.</li>
</ul>
In addition to this global setting, you can add child elemements to
<cd>
<cline>/publication/html/interactives</cline>
</cd>
to set the resize behavior for specific types of interactives. Each child element should be named after the interactive type (e.g. <c>geogebra</c> or <c>desmos</c>) and have a <attr>resize-behavior</attr> attribute with the same possible values as above. Settings on these child elements will override the global setting for that specific interactive type. Known interactive types that can be specified this way are:
<ul>
<li>calcplot3d</li>
<li>circuitjs</li>
<li>d3</li>
<li>desmos</li>
<li>doenetml</li>
<li>geogebra</li>
<li>iframe</li>
<li>javascript</li>
<li>jsxgraph</li>
<li>sage</li>
</ul>
</p>
</subsection>
</section>

<section xml:id="publication-file-revealjs">
Expand Down
3 changes: 2 additions & 1 deletion examples/sample-article/media/code/d3/collision.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ force.start();

var svg = d3.select("#d3-collision").append("svg")
.attr("width", width)
.attr("height", height);
.attr("height", height)
.attr("display", "block");

svg.selectAll("circle")
.data(nodes.slice(1))
Expand Down
15 changes: 10 additions & 5 deletions examples/sample-article/media/code/d3/graph-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,32 @@
main()

function main() {
var range = 50
setSize(data)

// Add more data when we have a larger canvas
var range = Math.pow(width, 1.3) / 50
var data = {
nodes:d3.range(0, range).map(function(d){ return {label: "l"+d ,r:~~d3.randomUniform(4, 16)()}}),
links:d3.range(0, range).map(function(){ return {source:~~d3.randomUniform(range)(), target:~~d3.randomUniform(range)()} })
}

setSize(data)
drawChart(data)
}

function setSize(data) {
width = document.querySelector("#d3-graph-layout").clientWidth
height = document.querySelector("#d3-graph-layout").clientHeight
// boundingRect provides true decimal values for dimensions.
// clientWidth/clientHeight are integer values that may have been rounded up
let boundingRect = document.querySelector("#d3-graph-layout").getBoundingClientRect()
width = Math.floor(boundingRect.width)
height = Math.floor(boundingRect.height)

margin = {top:0, left:0, bottom:0, right:0 }


chartWidth = width - (margin.left+margin.right)
chartHeight = height - (margin.top+margin.bottom)

svg.attr("width", width).attr("height", height)
svg.attr("width", width).attr("height", height).attr("display", "block")


chartLayer
Expand Down
3 changes: 2 additions & 1 deletion examples/sample-article/media/code/mcclure/slope.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ h1 {
svg {
background: white;
border: 1px solid darkslategray;
margin: 20px;
margin-top: 20px;
margin-bottom: 20px;
}

.function_radio_container {
Expand Down
2 changes: 1 addition & 1 deletion examples/sample-article/media/code/mcclure/slope.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

var body_width = 600;
$("body").css("width", body_width);
var svg_width = 580, svg_height = 400, graph_padding = 20;
var svg_width = 600, svg_height = 400, graph_padding = 20;
$("#the_graph").css("margin-left", (body_width-svg_width)/2);
var svg = d3.select("#the_graph")
.attr("width", svg_width)
Expand Down
19 changes: 19 additions & 0 deletions examples/sample-article/media/code/splice/splice-resize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const bodyEl = document.body;
bodyEl.style.background = 'red';

const growBtn = document.createElement('button');
growBtn.textContent = 'Grow';
document.currentScript.parentElement.appendChild(growBtn);

growBtn.addEventListener('click', () => {
const currentHeight = bodyEl.clientHeight;
const newHeight = currentHeight + 100;
bodyEl.style.height = `${newHeight}px`;
window.parent.postMessage(
{
subject: 'lti.frameResize',
height: newHeight,
},
'*'
)
});
2 changes: 1 addition & 1 deletion examples/sample-article/media/code/threejs/catenoid.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/sample-article/media/code/threejs/saddle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions examples/sample-article/publication.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
<!-- Banner options, these default to "yes" but can be set to -->
<!-- "no" toremove the indicated element from the top banner -->
<banner byline="yes" subtitle="yes"/>
<interactives resize-behavior="responsive">
<javascript resize-behavior="fixed-height"/>
<jsxgraph resize-behavior="fixed-height"/>
<sage resize-behavior="fixed-height"/>
<circuitjs resize-behavior="fixed-height"/>
<d3 resize-behavior="fixed-height"/>
</interactives>
</html>

<!-- 10pt font is the default -->
Expand Down
Loading