当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript twitter-text.autoLinkUrlsCustom函数代码示例

本文整理汇总了TypeScript中twitter-text.autoLinkUrlsCustom函数的典型用法代码示例。如果您正苦于以下问题:TypeScript autoLinkUrlsCustom函数的具体用法?TypeScript autoLinkUrlsCustom怎么用?TypeScript autoLinkUrlsCustom使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了autoLinkUrlsCustom函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: if

    } else if (isMentionEntity(e)) {
        console.log("screenName: ", e.screenName);
    } else if (isCashtagEntity(e)) {
        console.log("cashtag: ", e.cashtag);
    } else {
        console.error("Unreachable");
    }
    console.log(`indices: (${e.indices[0]}, ${e.indices[1]})`);
}

let result: string;
result = twitter.autoLink(text);
result = twitter.autoLinkUsernamesOrLists(text);
result = twitter.autoLinkHashtags(text);
result = twitter.autoLinkCashtags(text);
result = twitter.autoLinkUrlsCustom(text, {targetBlank: true, suppressNoFollow: true});

const len: number = twitter.getTweetLength(text);

const linked: string = twitter.autoLink("link @user, and expand url... http://t.co/0JG5Mcq", {
    urlEntities: [
        {
            url: "http://t.co/0JG5Mcq",
            display_url: "blog.twitter.com/2011/05/twitte…",
            expanded_url: "http://blog.twitter.com/2011/05/twitter-for-mac-update.html",
            indices: [
                30,
                48
            ]
        }
    ]});
开发者ID:Crevil,项目名称:DefinitelyTyped,代码行数:31,代码来源:twitter-text-tests.ts

示例2: if

    } else if (isMentionEntity(e)) {
        console.log("screenName: ", e.screenName);
    } else if (isCashtagEntity(e)) {
        console.log("cashtag: ", e.cashtag);
    } else {
        console.error("Unreachable");
    }
    console.log(`indices: (${e.indices[0]}, ${e.indices[1]})`);
}

let result: string;
result = twitter.autoLink(text);
result = twitter.autoLinkUsernamesOrLists(text);
result = twitter.autoLinkHashtags(text);
result = twitter.autoLinkCashtags(text);
result = twitter.autoLinkUrlsCustom(text);

const len: number = twitter.getTweetLength(text);

const linked: string = twitter.autoLink("link @user, and expand url... http://t.co/0JG5Mcq", {
    urlEntities: [
        {
            url: "http://t.co/0JG5Mcq",
            display_url: "blog.twitter.com/2011/05/twitte…",
            expanded_url: "http://blog.twitter.com/2011/05/twitter-for-mac-update.html",
            indices: [
                30,
                48
            ]
        }
    ]});
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:31,代码来源:twitter-text-tests.ts

示例3: if

    } else if (isMentionEntity(e)) {
        console.log("screenName: ", e.screenName);
    } else if (isCashtagEntity(e)) {
        console.log("cashtag: ", e.cashtag);
    } else {
        console.error("Unreachable");
    }
    console.log(`indices: (${e.indices[0]}, ${e.indices[1]})`);
}

let result: string;
result = twitter.autoLink(text);
result = twitter.autoLinkUsernamesOrLists(text);
result = twitter.autoLinkHashtags(text);
result = twitter.autoLinkCashtags(text);
result = twitter.autoLinkUrlsCustom(text, {targetBlank: true, suppressNoFollow: true});
result = twitter.autoLinkUrlsCustom(text, {usernameIncludeSymbol: true, linkTextBlock: (entity, text) => {}});

const len: number = twitter.getTweetLength(text);

const linked: string = twitter.autoLink("link @user, and expand url... http://t.co/0JG5Mcq", {
    urlEntities: [
        {
            url: "http://t.co/0JG5Mcq",
            display_url: "blog.twitter.com/2011/05/twitte…",
            expanded_url: "http://blog.twitter.com/2011/05/twitter-for-mac-update.html",
            indices: [
                30,
                48
            ]
        }
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:31,代码来源:twitter-text-tests.ts


注:本文中的twitter-text.autoLinkUrlsCustom函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。