为什么react-native-pell-rich-editor在打开链接标签时显示Javascript标题?

问题描述 投票:0回答:3

react-native-pell-rich-editor

1

我正在使用react-native-pell-rich-editor,同时打开链接标签,其中显示javascript关键字。请告诉我你知道为什么吗?

react-native rich-text-editor
3个回答
0
投票

因为富编辑器使用 javascript 提示来显示该模式,或者您可以尝试创建自定义模式并将其添加到富编辑器添加链接功能(在 node_modules/react-native-pell-rich-editor/src/ 上找到它) editor.js)或者您可以为其制定自定义操作

editor.js 第 303 行

link: {
  result: function(data) {
    data = data || {};
    var title = data.title;
    title = title || window.getSelection().toString();
    // title = title || window.prompt('Enter the link title');
    var url = data.url || window.prompt('Enter the link URL');
    if (url){
      exec('insertHTML', "<a href='"+ url +"'>"+(title || url)+"</a>");
    }
  }
}

0
投票

etcN00b 解决方案适用于 ios 和 android 创建自定义 URL 模态,传递编辑器的引用并在模态的自定义方法中使用 ref.insertLink(null,link)


0
投票
这个答案可能对某人有帮助!

我构建了一个具有自定义标题和操作的自定义对话框来实现插入链接功能。我还在下面的 github 问题线程中发布了我的实现。请检查。

https://github.com/wxik/react-native-rich-editor/issues/204#issuecomment-1714386729

© www.soinside.com 2019 - 2024. All rights reserved.