【问题标题】:how can get rendition of Epub book at first for highlight some text首先如何获得 Epub 书籍的版本以突出显示某些文本
【发布时间】:2020-09-01 16:36:01
【问题描述】:

我使用Epubjs-rn 打开 Epub 书
我有来自onSelected 方法的rendition,但我想在打开书本时获得rendition,并通过cfi 突出显示一些文本

我的代码:

   onSelected={(cfiRange, rendition) => {
                        console.log("text is selected");
                        this.setState({ selectedCfi: cfiRange });
                        rendition.highlight(cfiRange, {}, (e) => { console.log(e) }, undefined, { 'fill': 'lightblue' });
     
}}

【问题讨论】:

    标签: react-native epub


    【解决方案1】:

    我通过 get ref of epub 组件来解决这个问题:

    <Epub
        ref={ref => this.epub = ref}
        // other props
    />
    

    那么你可以这样称呼它:

    this.epub.rendition.highlight(...)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-04
      • 2021-05-03
      • 2015-04-15
      • 1970-01-01
      • 2022-01-07
      • 1970-01-01
      • 2020-04-30
      • 1970-01-01
      相关资源
      最近更新 更多