选择不再在iPad上突出显示文字(单词) [英] Select no longer highlighting text on iPad (word)

查看:170
本文介绍了选择不再在iPad上突出显示文字(单词)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的插件中,我们通过在段落内调用select或从段落内搜索结果来导航文档。在最新版本的Word for iOS:2.0.2(170415)中,文档滚动到文档的正确部分,但文本不再突出显示。这是在之前发布的单词版本中工作的。

In my add-in we navigate the document by calling select on either a paragraph or a search result from inside a paragraph. In the newest version of Word for iOS : 2.0.2 (170415) the document is scrolling to the correct part of the document but the text is no longer highlighting. This was working in the previous released version of word.

奇怪的是,如果我打开搜索栏,然后浏览我的文档,文本会按预期突出显示。

Oddly the text does highlight as expected if i open the search bar, and then navigate around my document.

  public SelectTextInstance(text: string, paragraphIndex: number, textInstance: number) {
    Word.run(function (context) {

        // Create a proxy object for the paragraphs collection.
        var paragraphs = context.document.body.paragraphs;

        context.load(paragraphs, 'text,font');

        return context.sync().then(function () {

            if (paragraphIndex == -1) {//currently would occur for items that are inside of tables.
                return;
            }

            var paragraph = paragraphs.items[paragraphIndex];

            return context.sync().then(function () {
                var ranges = null;
                //256 is the maximum length for a search item.  Longer than this and we just have to select the paragraph.
                if (text != undefined && text != null && text.length <= 256) {
                    ranges = paragraph.search(text, { matchCase: true, ignoreSpace: true});
                    context.load(ranges, 'text');
                }
                return context.sync().then(function () {
                    if (ranges == null || ranges.items.length == 0) {
                        paragraph.select();
                    }
                    else {
                        //select the paragraph rather than overflow - something bad happened somewhere, so we'll fall back to highlighting the paragraph.
                        if (ranges.items.length <= textInstance) {
                            paragraph.select();
                        } else {
                            ranges.items[textInstance].select();
                        }
                    }
                    return context.sync().then(function () {

                    });

                });
            });
        });
    })
        .catch(function (error) {
            console.log('Error: ' + JSON.stringify(error));
            if (error instanceof OfficeExtension.Error) {
                console.log('Debug info: ' + JSON.stringify(error.debugInfo));
            }
        });
}


推荐答案

非常感谢报道此事。实际上,这是一种回归。选择范围但不着色。我们将推动修复以进行下一次更新。

Thanks so much for reporting this. Effectively this is a regression. The range is selected but not colored. We will push the fix for the next update.

这篇关于选择不再在iPad上突出显示文字(单词)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆