Снять скобку функции следует удалить всю функцию - PullRequest
0 голосов
/ 11 ноября 2019

У меня есть какая-то функция, и я использую их в редакторе перьев, также я встроил их в перо, как показано ниже.

let insertvalue = '<div style="color: #606060;padding: 2px; font-weight: bold;display: inline-block; font-size: 14px" value="excelFunction">' + funcValue + '(' + '</div>' // this is one blot

let insertClose = '<div style="color: #606060;padding: 2px;font-weight: bold;display: inline-block; font-size: enter code here14px" value="excelFunctionTail">' + ')' + '</div>' // this is second blot

this.quill.insertEmbed(index, 'trans', insertClose);

this.quill.insertEmbed(index, 'trans', insertvalue); 


// Here the things I want to implement in my project.

**SUM(**4,5,7,8**)** --> insertvalue("SUM + (") + "some argument "+insertClose( ")" ) //this quill editor will return 24



// but when I delete "SUM(" , here this should delete all the things in between till closing bracket also I need to take care of nested function also

// for ex:
// When you detect that “<FunctionName>(“ element was deleted do not look just for the next “)” element since you may have a nested function as an argument.
// So, when you have UPPER(COUNT(1,2,3)) and then you delete “UPPER(“ you want to find the correct closing bracket and delete correct text.

textChangeHandler = (delta, oldDelta, source) => {
            console.log("Delta is    : " + JSON.stringify(delta));
            console.log("Old Delta is: " + JSON.stringify(oldDelta));
            console.log("Source is   : " + source);

            let editor = this.getQuill();
            let text = editor.getContents();
            for(var i=0; i<text.ops.length; i++){

            console.log("Current text is: " + JSON.stringify(text.ops[i].insert));                    
            }                   
    };
...