Commit 2cef0efb authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Make member links also work in history.

Going to URL like #/api/Ext-method-onReady will automatically
load Ext class and scroll to the onReady method.
parent 13f89f6c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ OUT_DIR=~/public_html/docs
ruby bin/jsduck \
     --template-links \
     --external=Error \
     --link='<a href="#/api/%c%-%m" rel="%c%#%m" class="docClass">%a</a>' \
     --link='<a href="#/api/%c%-%m" rel="%c%-%m" class="docClass">%a</a>' \
     --img='<p><img src="doc-resources/%u" alt="%a"></p>' \
     --output=$OUT_DIR \
     $SDK_DIR/extjs/src $SDK_DIR/platform/src $SDK_DIR/platform/core/src
+6 −4
Original line number Diff line number Diff line
@@ -8,21 +8,22 @@ Ext.define("Docs.ClassLoader", {
    /**
     * Loads class.
     *
     * @param {String} cls  name of the class to load
     * @param {String} clsUrl  name of the class + optionally name of the method, separated with dash.
     * @param {Boolean} noHistory  true to disable adding entry to browser history
     */
    load: function(cls, noHistory) {
    load: function(clsUrl, noHistory) {
        var cls = clsUrl;
        var member;

        // separate class and member name
        var matches = cls.match(/^(.*?)(?:#(.*))?$/);
        var matches = clsUrl.match(/^(.*?)(?:-(.*))?$/);
        if (matches) {
            cls = matches[1];
            member = matches[2];
        }

        if (!noHistory) {
            Docs.History.push("/api/" + cls);
            Docs.History.push("/api/" + clsUrl);
        }

        Docs.App.setClassMode();
@@ -65,6 +66,7 @@ Ext.define("Docs.ClassLoader", {
            pageContent.setVisibilityMode(Ext.core.Element.DISPLAY).hide();
        }

        Ext.getCmp('treePanelCmp').selectClass(cls.name);
        Docs.PageHeader.load(cls);

        var docOverviewTab = Ext.getCmp('doc-overview');
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ Ext.define("Docs.History", {
        var url = this.parseUrl();
        if (url.type === "api") {
            Docs.ClassLoader.load(url.key, true);
            Ext.getCmp('treePanelCmp').selectClass(url.key);
            Ext.getCmp('treePanelCmp').selectClass(url.key.replace(/-.*$/, ''));
        }
        else if (url.type === "guide") {
            Docs.App.setGuideMode();