Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Fix sizing and scrolling issues from latest upstream-master #2658

Merged
merged 7 commits into from
Jan 25, 2013

Conversation

jasonsanjose
Copy link
Member

@njx Fixes #2655, #2523, #2521.

  • Handle redraw event on the widget (from the host editor) and refresh inline instances of CodeMirror
  • Consolidate sizeInlineWidgetToContents() calls into an update event listener. Whenever an inline editor update's it's display, we force a new height on the inline widget container

I'm also seeing #2657 fixed in my branch. But I'm not sure how my changes would have affected horizontal scrolling.

@ghost ghost assigned njx Jan 24, 2013
@njx
Copy link
Contributor

njx commented Jan 25, 2013

FYI, #2657 still repros in this branch--you might have to resize the window narrower and then wider a few times to see it.

@njx
Copy link
Contributor

njx commented Jan 25, 2013

Reviewing

@@ -1051,7 +1043,8 @@ define(function (require, exports, module) {
Editor.prototype.setInlineWidgetHeight = function (inlineWidget, height, ensureVisible) {
var self = this,
node = inlineWidget.htmlContent,
oldHeight = (node && $(node).height()) || 0;
oldHeight = (node && $(node).height()) || 0,
changed = (oldHeight !== height);

$(node).height(height);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're now calling this on every update of the inline editor, we should be careful that we're not doing any work we don't need to. I would hope this is a no-op if the height hasn't changed, but to be safe, could we guard this inside the if (changed) block?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@njx
Copy link
Contributor

njx commented Jan 25, 2013

Review done. Looks good and seems to work--just the one comment.

@jasonsanjose
Copy link
Member Author

@njx ready to review

if (!inlineWidget.info) {
if (inlineWidget.info !== undefined) {
// Notify CodeMirror for the height change
inlineWidget.info.changed();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually--this should still (also) be in the if (changed), right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@njx
Copy link
Contributor

njx commented Jan 25, 2013

Re-reviewed, still needs one tweak.

if (!inlineWidget.info) {
if (changed && inlineWidget.info !== undefined) {
// Notify CodeMirror for the height change
inlineWidget.info.changed();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not quite right, sorry :) -- this will make it so we bail (in the else below) if changed is false even if inlineWidget.info is defined, so we would skip executing the ensureVisible code (which we should only skip if inlineWidget.info is undefined).

@njx
Copy link
Contributor

njx commented Jan 25, 2013

Just one more thing...

@jasonsanjose
Copy link
Member Author

@njx Whoops. Thanks for pointing that out.


$(node).height(height);
oldHeight = (node && $(node).height()) || 0,
changed = (oldHeight !== height)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing comma

@njx
Copy link
Contributor

njx commented Jan 25, 2013

Fixed the last little bit. Merging.

njx added a commit that referenced this pull request Jan 25, 2013
Fix sizing and scrolling issues from latest upstream-master
@njx njx merged commit 0edf332 into cmv3 Jan 25, 2013
@jasonsanjose jasonsanjose deleted the jasonsanjose/cmv3 branch January 25, 2013 05:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants