Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix HTML editor resize bug #739

Closed
wants to merge 1 commit into from
Closed

Fix HTML editor resize bug #739

wants to merge 1 commit into from

Conversation

Willard21
Copy link

High-level description of change

Fixes #738
When the HTML editor is drag-resized by the user, the height always returns to 400. This PR attempts to fix that by setting the default height to the current height if it exists when resizing.

Are there performance implications for this change?

No. This is a very small change.

Have you added tests to cover this new/updated code?

No. No intended functionality was changed.

Risks involved

This change shouldn't carry any risks as long as the editor height is always either falsey or a number, or a height is passed to the function. From what I can tell, the only time the height isn't passed to the function is when the user resizes it.

Are there any dependencies or blockers for merging this?

No.

How can we verify that this change works?

I can't verify that this doesn't break anything on page load because the horizontal resize code appears to be in a different repo, but I tested the updated function in production by pasting it into the Javascript console on any resized webpage program, then resizing it.

window.LiveEditor.prototype.updateCanvasSize = function updateCanvasSize(width, height) {
    width = width || this.defaultOutputWidth;
    height = height || this.editorHeight || this.defaultOutputHeight;

    this.$el.find(this.dom.CANVAS_WRAP).width(width);
    this.$el.find(this.dom.ALL_OUTPUT).height(height);

    // Set the editor height to be the same as the canvas height
    this.$el.find(this.dom.EDITOR).height(this.editorHeight || height);

    this.trigger("canvasSizeUpdated", {
        width: width,
        height: height
    });
}

@Willard21
Copy link
Author

Going through the bug tracker, I noticed that the editor height is apparently supposed to be adjustable, and is being prevented by a bug, so maybe defaulting the canvas height to the editor height isn't the ideal fix. Instead, perhaps defaultOutputHeight should be set to options.height || 400 during initialization (and same with width for consistency).

@Willard21 Willard21 closed this Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resizing a webpage's width sets it to 400px tall regardless of starting height
1 participant