[Geoserver-devel] JavaScript Error on screen resize, getElementById('cm_editor_heigth')

Hi developers,

I see following Javascript error in Geoserver admin gui, when resizing the window.

Uncaught TypeError: Cannot set property ‘disabled’ of null
at resizeStylePage (VM840 jquery.fullscreen-ver-D69DCBA0FF6B036BBEEE78538C81855F.js:22)

geoserver-2.17.0\src\web\core\src\main\java\org\geoserver\web\js\jquery.fullscreen.js:22 is
document.getElementById(‘cm_editor_heigth’).disabled=false;

cm_editor_heigth is (only) available in StyleEditorPage. So on other pages getElementById(‘cm_editor_heigth’) is null !

Maybe it would be better to change jquery.fullscreen.js on line 17 to

if (document.getElementById(‘cm_editor_heigth’)) {
document.getElementById(‘cm_editor_heigth’).disabled=true;
}

and on line 28 to

if (document.getElementById(‘cm_editor_heigth’)) {
document.getElementById(‘cm_editor_heigth’).disabled=false;
}

Existing code:

if (isFullscreen) {
document.getElementById(‘cm_editor_heigth’).disabled=true;
if (document.gsEditors) {
//update the default to the old value
editorDefault = document.gsEditors[“editor”].getWrapperElement().offsetHeight;
}
document.gsEditors[“editor”]
editorHeight = Math.max(300, windowHeight - editorMargin);
previewHeight = Math.max(300, windowHeight - previewMargin);
} else {
document.getElementById(‘cm_editor_heigth’).disabled=false;
}

if (document.gsEditors) {
var editor = document.gsEditors[“editor”];
editor.setSize(“100%”, editorHeight);
editor.refresh();
}
Stefan

···
-- 
Dipl. Ing. Stefan Overkamp
Laakmannsbusch 44, 42555 Velbert 
tel.: 0177 / 79 76 159
[overkamp@...6003...](mailto:overkamp@...6003...)

This is great information - can you open an issue at https://osgeo-org.atlassian.net/projects/GEOS/issues and ideally submit a PR with the change in it at https://github.com/geoserver/geoserver

Thanks again for your help

Ian

···

Ian Turton

I will try. Have never done a pull request.

Stefan

Am 14.05.2020 um 10:09 schrieb Ian Turton:

This is great information - can you open an issue
at https://osgeo-org.atlassian.net/projects/GEOS/issues and ideally
submit a PR with the change in it
at https://github.com/geoserver/geoserver

Thanks again for your help

Ian

On Thu, 14 May 2020 at 08:45, Stefan Overkamp <overkamp@anonymised.com
<mailto:overkamp@anonymised.com>> wrote:

    Hi developers,

    I see following Javascript error in Geoserver admin gui, when
    resizing the window.

    Uncaught TypeError: Cannot set property 'disabled' of null
     at resizeStylePage (VM840
    jquery.fullscreen-ver-D69DCBA0FF6B036BBEEE78538C81855F.js:22)

    geoserver-2.17.0\src\web\core\src\main\java\org\geoserver\web\js\jquery.fullscreen.js:22
    is
    document.getElementById('cm_editor_heigth').disabled=false;

    cm_editor_heigth is (only) available in StyleEditorPage. So on
    other pages getElementById('cm_editor_heigth') is null !

    Maybe it would be better to change jquery.fullscreen.js on line 17 to

    if (document.getElementById('cm_editor_heigth')) {
     document.getElementById('cm_editor_heigth').disabled=true;
    }

    andon line 28 to

    if (document.getElementById('cm_editor_heigth')) {
     document.getElementById('cm_editor_heigth').disabled=false;
    }

    Existing code:

     if (isFullscreen) {
     document.getElementById('cm_editor_heigth').disabled=true;
     if (document.gsEditors) {
     //update the default to the old value
     editorDefault = document.gsEditors["editor"].getWrapperElement().offsetHeight;
     }
     document.gsEditors["editor"]
     editorHeight = Math.max(300, windowHeight - editorMargin);
     previewHeight = Math.max(300, windowHeight - previewMargin);
     } else {
     document.getElementById('cm_editor_heigth').disabled=false;
     }
     if (document.gsEditors) {
     var editor = document.gsEditors["editor"];
     editor.setSize("100%", editorHeight);
     editor.refresh();
     }
    Stefan

    --
    Dipl. Ing. Stefan Overkamp
    Laakmannsbusch 44, 42555 Velbert
    tel.: 0177 / 79 76 159
    overkamp@anonymised.com <mailto:overkamp@anonymised.com>

    _______________________________________________
    Geoserver-devel mailing list
    Geoserver-devel@lists.sourceforge.net
    <mailto:Geoserver-devel@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/geoserver-devel

--
Ian Turton

--
Dipl. Ing. Stefan Overkamp
Laakmannsbusch 44, 42555 Velbert
tel.: 0177 / 79 76 159
overkamp@anonymised.com

Hi,

I've submitted a pull request:
https://github.com/geoserver/geoserver/pull/4245
But I have not referenced the number of the JIRA ticket in the commit.
Sorry.

Stefan

P.S. I think I need some advice from developers to do everything correct.

Am 14.05.2020 um 10:09 schrieb Ian Turton:

This is great information - can you open an issue
at https://osgeo-org.atlassian.net/projects/GEOS/issues and ideally
submit a PR with the change in it
at https://github.com/geoserver/geoserver

Thanks again for your help

Ian

On Thu, 14 May 2020 at 08:45, Stefan Overkamp <overkamp@anonymised.com
<mailto:overkamp@anonymised.com>> wrote:

    Hi developers,

    I see following Javascript error in Geoserver admin gui, when
    resizing the window.

    Uncaught TypeError: Cannot set property 'disabled' of null
     at resizeStylePage (VM840
    jquery.fullscreen-ver-D69DCBA0FF6B036BBEEE78538C81855F.js:22)

    geoserver-2.17.0\src\web\core\src\main\java\org\geoserver\web\js\jquery.fullscreen.js:22
    is
    document.getElementById('cm_editor_heigth').disabled=false;

    cm_editor_heigth is (only) available in StyleEditorPage. So on
    other pages getElementById('cm_editor_heigth') is null !

    Maybe it would be better to change jquery.fullscreen.js on line 17 to

    if (document.getElementById('cm_editor_heigth')) {
     document.getElementById('cm_editor_heigth').disabled=true;
    }

    andon line 28 to

    if (document.getElementById('cm_editor_heigth')) {
     document.getElementById('cm_editor_heigth').disabled=false;
    }

    Existing code:

     if (isFullscreen) {
     document.getElementById('cm_editor_heigth').disabled=true;
     if (document.gsEditors) {
     //update the default to the old value
     editorDefault = document.gsEditors["editor"].getWrapperElement().offsetHeight;
     }
     document.gsEditors["editor"]
     editorHeight = Math.max(300, windowHeight - editorMargin);
     previewHeight = Math.max(300, windowHeight - previewMargin);
     } else {
     document.getElementById('cm_editor_heigth').disabled=false;
     }
     if (document.gsEditors) {
     var editor = document.gsEditors["editor"];
     editor.setSize("100%", editorHeight);
     editor.refresh();
     }
    Stefan

    --
    Dipl. Ing. Stefan Overkamp
    Laakmannsbusch 44, 42555 Velbert
    tel.: 0177 / 79 76 159
    overkamp@anonymised.com <mailto:overkamp@anonymised.com>

    _______________________________________________
    Geoserver-devel mailing list
    Geoserver-devel@lists.sourceforge.net
    <mailto:Geoserver-devel@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/geoserver-devel

--
Ian Turton

--
Dipl. Ing. Stefan Overkamp
Laakmannsbusch 44, 42555 Velbert
tel.: 0177 / 79 76 159
overkamp@anonymised.com