Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion stack/cas/castext2/blocks/adaptauto.block.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function compile($format, $options): ?MP_Node {
$list[] = new MP_String('script');
$list[] = new MP_String(json_encode(['type' => 'module']));

$code = 'import {stack_js} from "' . stack_cors_link('stackjsiframe.min.js') . '";';
$code = 'import stack_js from "' . stack_cors_link('stackjsiframe.min.js') . '";';
$code .= 'document.addEventListener("DOMContentLoaded", function(){';
$list[] = new MP_String($code);

Expand Down
2 changes: 1 addition & 1 deletion stack/cas/castext2/blocks/adaptbutton.block.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function compile($format, $options): ?MP_Node {
$list[] = new MP_String('script');
$list[] = new MP_String(json_encode(['type' => 'module']));

$code = "\nimport {stack_js} from '" . stack_cors_link('stackjsiframe.min.js') . "';\n";
$code = "\nimport stack_js from '" . stack_cors_link('stackjsiframe.min.js') . "';\n";
$code .= "stack_js.request_access_to_input('" . $this->params['save_state'] . "', true).then((id) => {\n";
$code .= "const input = document.getElementById(id);\n";
$code .= "if (input.value=='true'){ hide_and_show(); }\n";
Expand Down
4 changes: 2 additions & 2 deletions stack/cas/castext2/blocks/geogebra.block.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ public function compile($format, $options): ?MP_Node {
$r->items[] = new MP_String('<div style="' . $style .
'"><div class="geogebrabox" id="geogebrabox" style="width:100%;height:100%;"></div></div><script type="module">');
// For binding we need to import the binding libraries.
$r->items[] = new MP_String("\nimport {stack_js} from '" . stack_cors_link('stackjsiframe.min.js') . "';\n");
$r->items[] = new MP_String("\nimport stack_js from '" . stack_cors_link('stackjsiframe.min.js') . "';\n");
// TO-DO: minify.
$r->items[] = new MP_String("import {stack_geogebra} from '" . stack_cors_link('stackgeogebra.js') . "';\n");
$r->items[] = new MP_String("import stack_geogebra from '" . stack_cors_link('stackgeogebra.js') . "';\n");

// Lets define the common bits of code.
$commonprecode = 'var presetparams = {"id":"applet","appName":"classic","width":800,"height": 600,' .
Expand Down
2 changes: 1 addition & 1 deletion stack/cas/castext2/blocks/javascript.block.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function compile($format, $options): ?MP_Node {
$r->items[] = new MP_String('&nbsp;<script type="module">');

// For binding and other use we need to import the stack_js library.
$r->items[] = new MP_String("\nimport {stack_js} from '" . stack_cors_link('stackjsiframe.min.js') . "';\n");
$r->items[] = new MP_String("\nimport stack_js from '" . stack_cors_link('stackjsiframe.min.js') . "';\n");

// Do we need to bind anything?
if (count($inputs) > 0) {
Expand Down
4 changes: 2 additions & 2 deletions stack/cas/castext2/blocks/jsxgraph.block.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ public function compile($format, $options): ?MP_Node {
'"><div class="jxgbox" id="jxgbox" style="width:100%;height:100%;"></div></div><script type="module">');

// For binding we need to import the binding libraries.
$r->items[] = new MP_String("\nimport {stack_js} from '" . stack_cors_link('stackjsiframe.min.js') . "';\n");
$r->items[] = new MP_String("import {stack_jxg} from '" . stack_cors_link('stackjsxgraph.min.js') . "';\n");
$r->items[] = new MP_String("\nimport stack_js from '" . stack_cors_link('stackjsiframe.min.js') . "';\n");
$r->items[] = new MP_String("import stack_jxg from '" . stack_cors_link('stackjsxgraph.min.js') . "';\n");

// Do we need to bind anything?
if (count($inputs) > 0) {
Expand Down
4 changes: 2 additions & 2 deletions stack/cas/castext2/blocks/parsons.block.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ public function compile($format, $options): ?MP_Node {
// JS script.
$r->items[] = new MP_String('<script type="module">');

$importcode = "\nimport {stack_js} from '" . stack_cors_link('stackjsiframe.min.js') . "';\n";
$importcode .= "import {Sortable} from '" . stack_cors_link('sortablecore.min.js') . "';\n";
$importcode = "\nimport stack_js from '" . stack_cors_link('stackjsiframe.min.js') . "';\n";
$importcode .= "import Sortable from '" . stack_cors_link('sortablecore.min.js') . "';\n";
$importcode .= "import {preprocess_steps,
stack_sortable,
get_iframe_height,
Expand Down
2 changes: 1 addition & 1 deletion stack/cas/castext2/blocks/reveal.block.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function compile($format, $options): ?MP_Node {
}
$body->items[] = new MP_String('</div>');

$code = 'import {stack_js} from "' . stack_cors_link('stackjsiframe.min.js') . '";';
$code = 'import stack_js from "' . stack_cors_link('stackjsiframe.min.js') . '";';
$code .= 'stack_js.request_access_to_input("' . $this->params['input'] . '", true).then((id) => {';
// So that should give us access to the input.
// Once we get the access immediately bind a listener to it.
Expand Down
Loading