Document! X和HelpStudio使用技巧:使可折叠标题小部件最初显示为已折叠

默认情况下,可折叠标题小部件已展开。这是设计使然,标题下的内容可见,但可由用户折叠。但是,您可以决定要使标题最初折叠。您可以通过向项目中添加一些自定义脚本来实现。

HelpStudio以最快的,最简单的方式创建和出版帮助系统,并与您的桌面或基于 络的应用程序或组件整合起来,包括. NET。

Document! X包含了最新的制作工具,它允许你在预览自动生成的页面中直接增加内容-自动生成的文档与功能齐全的注释工具的无缝集成。使用Document! X,文档可以在整个设计和开发过程中自动生成,而不需要花费开发人员的资源,同时为开发团队提供了准确和最新的参考,并允许新的开发人员快速的学习新的组件和架构。


    默认情况下,可折叠标题小部件已展开。这是设计使然,标题下的内容可见,但可由用户折叠。但是,您可以决定要使标题最初折叠。您可以通过向项目中添加一些自定义脚本来实现。

  • 使用记事本在项目脚本目录(例如headings-initially-collapsed.js)中创建一个新的javascript文件,然后复制并粘贴以下脚本:

(function () {    // Define a new feature constructor    var collapseAllOnLoadFeature = function(documentInstance) {        Innovasys.Content.DocumentFeatureBase.call(this, documentInstance);    };    // .. that inherits from the DocumentFeatureBase    __extends(collapseAllOnLoadFeature, Innovasys.Content.DocumentFeatureBase);    // Return a unique feature name    collapseAllOnLoadFeature.prototype.getName = function () {        return "Collapse All Toggle Sections On Load";    };    // Make sure it initializes after the built in features    collapseAllOnLoadFeature.prototype.initializeContentOrdinal = function () {        return 99999;    }    // When the content initializes, collapse any sections that are not already collapsed    collapseAllOnLoadFeature.prototype.initializeContent = function (rootSelector, isInitialLoad) {        var toggleFeature = this.documentInstance.getFeatureByName("Toggle Sections");        var expandedSections = $("." + toggleFeature.getToggleHeadingClassName() +":not(." + toggleFeature.getToggleHeadingClassName() + toggleFeature.getToggledSuffix() + ")");        toggleFeature.toggleSection(expandedSections, true);    }    // The factory is how we register our feature with the Innovasys document object    var collapseAllOnLoadFactory = function() {};       collapseAllOnLoadFactory.prototype.createInstance = function (documentInstance) {        return new collapseAllOnLoadFeature(documentInstance);    };    // Register our factory in the DocumentFeatureConfiguration    Innovasys.Content.DocumentFeatureConfiguration.registerDocumentFeatureFactory(new collapseAllOnLoadFactory());})();

  • 使用添加现有其他文件功能区命令将创建的.js文件添加到项目中。

    重建输出后,默认情况下,主题中的可折叠标题小部件现在将在生成的输出中折叠。

    但是以上代码对于新的Material模板是不适用的,如果您需要在新的Material模板中实践,您可以运用以下代码运行,将其添加到项目或自定义模板中的.js文件中,并且页面加载时所有部分都将折叠。:

(function () {    // Define a new feature constructor    var collapseAllOnLoadFeature = function(documentInstance) {        Innovasys.Content.DocumentFeatureBase.call(this, documentInstance);    };    // .. that inherits from the DocumentFeatureBase    __extends(collapseAllOnLoadFeature, Innovasys.Content.DocumentFeatureBase);    // Return a unique feature name    collapseAllOnLoadFeature.prototype.getName = function () {        return "Collapse All Toggle Sections On Load";    };    // Make sure it initializes after the built in features    collapseAllOnLoadFeature.prototype.initializeContentOrdinal = function () {        return 99999;    }    // When the content initializes, collapse any sections that are not already collapsed    collapseAllOnLoadFeature.prototype.initializeContent = function (rootSelector, isInitialLoad) {        var toggleFeature = this.documentInstance.getFeatureByName("Toggle Sections");        var expandedSections = $("." + toggleFeature.getToggleHeadingClassName() +":not(." + toggleFeature.getToggleHeadingClassName() + toggleFeature.getToggledSuffix() + ")");        toggleFeature.toggleSection(expandedSections, true);    }    // The factory is how we register our feature with the Innovasys document object    var collapseAllOnLoadFactory = function() {};        collapseAllOnLoadFactory.prototype.createInstance = function (documentInstance) {        return new collapseAllOnLoadFeature(documentInstance);    };    // Register our factory in the DocumentFeatureConfiguration    Innovasys.Content.DocumentFeatureConfiguration.registerDocumentFeatureFactory(new collapseAllOnLoadFactory());})();

    如果您对上面的问题有什么疑惑或者建议都可以在评论区留言,大家一起讨论。


如果您对HelpStudioDocument! X感兴趣,可以咨询在线客服>>购买正版授权软件。

标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2019年10月18日
下一篇 2019年10月18日

相关推荐

发表回复

登录后才能评论