Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
h5p-editor-php-library
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
h5p-editor-php-library
Commits
2f319eb3
Commit
2f319eb3
authored
3 years ago
by
Paal Joergensen
Browse files
Options
Downloads
Patches
Plain Diff
HFP-2016/JI-2432 Fix resizing on exiting fullscreen
parent
237b2cf4
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/h5peditor-editor.js
+13
-8
13 additions, 8 deletions
scripts/h5peditor-editor.js
with
13 additions
and
8 deletions
scripts/h5peditor-editor.js
+
13
−
8
View file @
2f319eb3
...
...
@@ -108,9 +108,12 @@ ns.Editor = function (library, defaultParams, replace, iframeLoaded) {
/**
* Checks if iframe needs resizing, and then resize it.
*
* @private
* @public
* @param {bool} force If true, force resizing
*/
var
resize
=
function
()
{
self
.
resize
=
function
(
force
)
{
force
=
(
force
===
undefined
?
false
:
force
);
if
(
!
iframe
.
contentDocument
||
!
iframe
.
contentDocument
.
body
||
self
.
preventResize
)
{
return
;
// Prevent crashing when iframe is unloaded
}
...
...
@@ -120,10 +123,10 @@ ns.Editor = function (library, defaultParams, replace, iframeLoaded) {
previousHeight
.
scroll
===
iframe
.
contentDocument
.
body
.
scrollHeight
&&
previousHeight
.
client
===
iframe
.
contentWindow
.
document
.
body
.
clientHeight
;
if
(
heightNotChanged
||
(
if
(
!
force
&&
(
heightNotChanged
||
(
iframe
.
clientHeight
===
iframe
.
contentDocument
.
body
.
scrollHeight
&&
Math
.
abs
(
iframe
.
contentDocument
.
body
.
scrollHeight
-
iframe
.
contentWindow
.
document
.
body
.
clientHeight
)
<=
1
))
{
))
)
{
return
;
// Do not resize unless page and scrolling differs
// Note: ScrollHeight may be 1px larger in some cases(Edge) where the actual height is a fraction.
}
...
...
@@ -202,7 +205,7 @@ ns.Editor = function (library, defaultParams, replace, iframeLoaded) {
self
.
selector
.
appendTo
(
$container
.
html
(
''
));
// Resize iframe when selector resizes
self
.
selector
.
on
(
'
resize
'
,
resize
);
self
.
selector
.
on
(
'
resize
'
,
self
.
resize
.
bind
(
self
)
);
/**
* Event handler for exposing events
...
...
@@ -229,7 +232,7 @@ ns.Editor = function (library, defaultParams, replace, iframeLoaded) {
var
limitedResize
=
function
()
{
if
(
!
running
)
{
running
=
setTimeout
(
function
()
{
resize
();
self
.
resize
();
running
=
null
;
},
40
);
// 25 fps cap
}
...
...
@@ -245,12 +248,12 @@ ns.Editor = function (library, defaultParams, replace, iframeLoaded) {
});
H5P
.
$window
.
resize
(
limitedResize
);
resize
();
self
.
resize
();
}
else
{
// Use an interval for resizing the iframe
(
function
resizeInterval
()
{
resize
();
self
.
resize
();
setTimeout
(
resizeInterval
,
40
);
// No more than 25 times per second
})();
}
...
...
@@ -508,6 +511,8 @@ ns.Editor.prototype.semiFullscreen = function ($iframe, $element, done) {
iframeWindow
.
document
.
body
.
removeEventListener
(
'
keyup
'
,
handleKeyup
);
done
();
// Callback for UI
self
.
resize
(
true
);
}
return
restore
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment