Commit b52a30b8 authored by Maarten de Waard's avatar Maarten de Waard 🤘🏻
Browse files

Merge branch '56-bug-jump-to-diagram-in-a-unit' into 'master'

Resolve "Bug: Jump to diagram in a Unit"

Closes #56

See merge request totem/ind!46
parents a2fe9511 709483e9
......@@ -122961,6 +122961,22 @@ Sidebar.prototype.addPaletteFunctions = function(id, title, expanded, fns) {
this.old_addPaletteFunctions(id, title, expand, fns);
};
 
/**
* Override focus() to prevent execution in EditorUi for an iframe.
*
* We render our diagrams in an iframe and the library code in the EditorUi
* class calls focus() on its container right after the HTML elements for it are
* created. This makes the browser scroll to the last rendered diagram on the
* page, skipping previous diagrams or content. Below is a grotesque hack to
* prevent that call, without modifying the library code.
*/
var oldHTMLFocus = HTMLElement.prototype.focus;
HTMLElement.prototype.focus = function () {
// Only prevent execution for this specific div:
if (this.className !== 'geDiagramContainer') {
oldHTMLFocus.apply(this, arguments);
}
};
/**
* Function: debug
*
......@@ -244,3 +244,20 @@ Sidebar.prototype.addPaletteFunctions = function(id, title, expanded, fns) {
var expand = expanded || (id === 'totem-security');
this.old_addPaletteFunctions(id, title, expand, fns);
};
/**
* Override focus() to prevent execution in EditorUi for an iframe.
*
* We render our diagrams in an iframe and the library code in the EditorUi
* class calls focus() on its container right after the HTML elements for it are
* created. This makes the browser scroll to the last rendered diagram on the
* page, skipping previous diagrams or content. Below is a grotesque hack to
* prevent that call, without modifying the library code.
*/
var oldHTMLFocus = HTMLElement.prototype.focus;
HTMLElement.prototype.focus = function () {
// Only prevent execution for this specific div:
if (this.className !== 'geDiagramContainer') {
oldHTMLFocus.apply(this, arguments);
}
};
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment