react-nativerich-text-editor

Why react-native-pell-rich-editor is showing Javascript title while opening linking tag?


react-native-pell-rich-editor

1

I am using react-native-pell-rich-editor while opening linking tag it showing javascript keyword there. Please tell me if you know why ?


Solution

  • its because rich editor uses a javascript prompt to display that modal, alternatively you could try to create a custom modal and add it to rich editor add link function (find it on node_modules/react-native-pell-rich-editor/src/editor.js) or you can make a custom action for it

    editor.js line 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>");
        }
      }
    }