當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript text.CoreTextUtilsProvider類代碼示例

本文整理匯總了TypeScript中@providers/utils/text.CoreTextUtilsProvider的典型用法代碼示例。如果您正苦於以下問題:TypeScript CoreTextUtilsProvider類的具體用法?TypeScript CoreTextUtilsProvider怎麽用?TypeScript CoreTextUtilsProvider使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了CoreTextUtilsProvider類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

                    action.fields.forEach((offlineContent) => {
                        if (typeof offlineContents[offlineContent.fieldid] == 'undefined') {
                            offlineContents[offlineContent.fieldid] = {};
                        }

                        if (offlineContent.subfield) {
                            offlineContents[offlineContent.fieldid][offlineContent.subfield] =
                                this.textUtils.parseJSON(offlineContent.value);
                        } else {
                            offlineContents[offlineContent.fieldid][''] = this.textUtils.parseJSON(offlineContent.value);
                        }
                    });
開發者ID:jleyva,項目名稱:moodlemobile2,代碼行數:12,代碼來源:helper.ts

示例2:

 sites.forEach((site: any) => {
     // Format the site name.
     promises.push(this.textUtils.formatText(site.siteName, true, true).catch(() => {
         return site.siteName;
     }).then((formatted) => {
         site.fullNameAndSiteName = this.translate.instant('core.fullnameandsitename',
             { fullname: site.fullName, sitename: formatted });
     }));
 });
開發者ID:jleyva,項目名稱:moodlemobile2,代碼行數:9,代碼來源:site-picker.ts

示例3: showStatus

    /**
     * Set image and description to show as completion icon.
     */
    protected showStatus(): void {
        const moduleName = this.moduleName || '';
        let langKey,
            image;

        if (this.completion.tracking === 1 && this.completion.state === 0) {
            image = 'completion-manual-n';
            langKey = 'core.completion-alt-manual-n';
        } else if (this.completion.tracking === 1 && this.completion.state === 1) {
            image = 'completion-manual-y';
            langKey = 'core.completion-alt-manual-y';
        } else if (this.completion.tracking === 2 && this.completion.state === 0) {
            image = 'completion-auto-n';
            langKey = 'core.completion-alt-auto-n';
        } else if (this.completion.tracking === 2 && this.completion.state === 1) {
            image = 'completion-auto-y';
            langKey = 'core.completion-alt-auto-y';
        } else if (this.completion.tracking === 2 && this.completion.state === 2) {
            image = 'completion-auto-pass';
            langKey = 'core.completion-alt-auto-pass';
        } else if (this.completion.tracking === 2 && this.completion.state === 3) {
            image = 'completion-auto-fail';
            langKey = 'core.completion-alt-auto-fail';
        }

        if (image) {
            if (this.completion.overrideby > 0) {
                image += '-override';
            }
            this.completionImage = 'assets/img/completion/' + image + '.svg';
        }

        if (moduleName) {
            this.textUtils.formatText(moduleName, true, true, 50).then((modNameFormatted) => {
                let promise;

                if (this.completion.overrideby > 0) {
                    langKey += '-override';

                    promise = this.userProvider.getProfile(this.completion.overrideby, this.completion.courseId, true).then(
                        (profile) => {
                            return {
                                overrideuser: profile.fullname,
                                modname: modNameFormatted
                            };
                        });
                } else {
                    promise = Promise.resolve(modNameFormatted);
                }

                return promise.then((translateParams) => {
                    this.completionDescription = this.translate.instant(langKey, { $a: translateParams });
                });
            });
        }
    }
開發者ID:jleyva,項目名稱:moodlemobile2,代碼行數:59,代碼來源:module-completion.ts

示例4: realGradeValueHelper

    /**
     * Calculates the real value of a grade based on real_grade_value.
     *
     * @param  {number} value    Percentual value from 0 to 100.
     * @param  {number} max      The maximal grade.
     * @param  {number} decimals Decimals to show in the formatted grade.
     * @return {string}          Real grade formatted.
     */
    protected realGradeValueHelper(value: number, max: number, decimals: number): string {
        if (value == null) {
            return null;
        } else if (max == 0) {
            return '0';
        } else {
            value = this.textUtils.roundToDecimals(max * value / 100, decimals);

            return this.utils.formatFloat(value);
        }
    }
開發者ID:SATS-Seminary,項目名稱:moodlemobile2,代碼行數:19,代碼來源:helper.ts

示例5: init

    /**
     * Initialize field.
     */
    protected init(): void {
        if (this.isShowOrListMode()) {
            this.component = AddonModDataProvider.COMPONENT;
            this.componentId = this.database.coursemodule;

            return;
        }

        let text;
        // Check if rich text editor is enabled.
        if (this.mode == 'edit') {
            const files = (this.value && this.value.files) || [];
            text = this.value ? this.textUtils.replacePluginfileUrls(this.value.content, files) : '';
        }

        this.addControl('f_' + this.field.id, text);
    }
開發者ID:SATS-Seminary,項目名稱:moodlemobile2,代碼行數:20,代碼來源:textarea.ts

示例6: ngOnInit

    /**
     * Component being initialized.
     */
    ngOnInit(): void {
        this.maxSize = Number(this.maxSize); // Make sure it's defined and it's a number.
        this.maxSize = !isNaN(this.maxSize) && this.maxSize > 0 ? this.maxSize : -1;

        if (this.maxSize == -1) {
            this.maxSizeReadable = this.translate.instant('core.unknown');
        } else {
            this.maxSizeReadable = this.textUtils.bytesToSize(this.maxSize, 2);
        }

        if (typeof this.maxSubmissions == 'undefined' || this.maxSubmissions < 0) {
            this.maxSubmissionsReadable = this.translate.instant('core.unknown');
            this.unlimitedFiles = true;
        } else {
            this.maxSubmissionsReadable = String(this.maxSubmissions);
        }

        if (this.acceptedTypes && this.acceptedTypes.trim()) {
            this.fileTypes = this.fileUploaderProvider.prepareFiletypeList(this.acceptedTypes);
        }
    }
開發者ID:SATS-Seminary,項目名稱:moodlemobile2,代碼行數:24,代碼來源:attachments.ts

示例7: format

    /**
     * Format value to be shown. Replacing plugin file Urls.
     *
     * @param  {any}    value Value to replace.
     * @return {string}       Replaced string to be rendered.
     */
    format(value: any): string {
        const files = (value && value.files) || [];

        return value ? this.textUtils.replacePluginfileUrls(value.content, files) : '';
    }
開發者ID:SATS-Seminary,項目名稱:moodlemobile2,代碼行數:11,代碼來源:textarea.ts

示例8: showInfo

 showInfo(): void {
     this.textUtils.expandText(this.title, this.info, this.component, this.componentId);
 }
開發者ID:SATS-Seminary,項目名稱:moodlemobile2,代碼行數:3,代碼來源:navigation-bar.ts

示例9:

 return this.file.createDir(destination, folder, true).then(() => {
     // Folder created, add it to the destination path.
     destination = this.textUtils.concatenatePaths(destination, folder);
 });
開發者ID:SATS-Seminary,項目名稱:moodlemobile2,代碼行數:4,代碼來源:zip.ts


注:本文中的@providers/utils/text.CoreTextUtilsProvider類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。