diegoles / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

Suggested patch #554

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Probably you are not interesteed in supporting Safari Mobile on IOS for the 
goog editor but here a small patch that makes work the focus function:

before: goog.editor.Field:focus
goog.editor.Field.prototype.focus = function() {
  if (!goog.editor.BrowserFeature.HAS_CONTENT_EDITABLE &&
      this.usesIframe()) {
    // In designMode, only the window itself can be focused; not the element.
    this.getEditableDomHelper().getWindow().focus();
  } else {
    if (goog.userAgent.OPERA) {
      // Opera will scroll to the bottom of the focused document, even
      // if it is contained in an iframe that is scrolled to the top and
      // the bottom flows past the end of it. To prevent this,
      // save the scroll position of the document containing the editor
      // iframe, then restore it after the focus.
      var scrollX = this.appWindow_.pageXOffset;
      var scrollY = this.appWindow_.pageYOffset;
    }
    this.getElement().focus();
    if (goog.userAgent.OPERA) {
      this.appWindow_.scrollTo(
          /** @type {number} */ (scrollX), /** @type {number} */ (scrollY));
    }
  }
};

after:

goog.editor.Field.prototype.focus = function() {
  if (!goog.editor.BrowserFeature.HAS_CONTENT_EDITABLE &&
      this.usesIframe()) {
    // In designMode, only the window itself can be focused; not the element.
    this.getEditableDomHelper().getWindow().focus();
  } else {
    if (goog.userAgent.OPERA) {
      // Opera will scroll to the bottom of the focused document, even
      // if it is contained in an iframe that is scrolled to the top and
      // the bottom flows past the end of it. To prevent this,
      // save the scroll position of the document containing the editor
      // iframe, then restore it after the focus.
      var scrollX = this.appWindow_.pageXOffset;
      var scrollY = this.appWindow_.pageYOffset;
    }
    this.getEditableDomHelper().getWindow().focus();//patch
    this.getElement().focus();
    if (goog.userAgent.OPERA) {
      this.appWindow_.scrollTo(
          /** @type {number} */ (scrollX), /** @type {number} */ (scrollY));
    }
  }
};

Cheers
Matija

Original issue reported on code.google.com by matija...@gmail.com on 24 Apr 2013 at 10:20

GoogleCodeExporter commented 8 years ago
Hi there.

We can't accept the patch without a signed agreement.

https://code.google.com/p/closure-library/wiki/Contributors
https://developers.google.com/open-source/cla/individual

Please ping when this is done.

Original comment by nn...@google.com on 24 Apr 2013 at 1:39

GoogleCodeExporter commented 8 years ago
ping :-)

Il 24/04/13 15:39, closure-library@googlecode.com ha scritto:

Original comment by matija...@gmail.com on 24 Apr 2013 at 2:24

GoogleCodeExporter commented 8 years ago
If you're still interested in this fix, please create a Pull Request for the 
GitHub issue: https://github.com/google/closure-library/issues/60

Original comment by joelt...@google.com on 18 Aug 2015 at 11:52