尝试在summernote中添加链接时,给定范围不在文档中

时间:2018-07-09 14:15:55

标签: javascript summernote

我尝试在Summernote中添加指向文本的链接时,Chrome控制台出现错误。 Summernote是Bootstrap主题的一部分。错误发生在这里:

    // capture loop: add up 'preint' images read out with 12 bit adc resolution
    // and save them as 16 bit image

    // read out current shutter register
    // read the 32-bit hex value into the unsigned long member of the above defined union
    cam.ReadRegister( 0x918, &curShutter.ulValue );
    fCurShutter = curShutter.fValue;

    cout << "Grab # " << ip.cnt << "; Serv: " << ip.servopos << "; Expt: " << ip.exptime << "; T: " << ip.temp  << "; prog " ;

    //inner capture loop
    for ( int imageCnt=0; imageCnt < ip.preint; imageCnt++ )
    {
        error = cam.RetrieveBuffer( &monoImage );
        if (error != PGRERROR_OK){PrintError( error ); continue;}

        cout << "." ;

        //convert to cv::Mat image
        unsigned int rowBytes = (double)monoImage.GetReceivedDataSize()/(double)monoImage.GetRows();
        cv_image = cv::Mat(monoImage.GetRows(), monoImage.GetCols(), CV_16UC1, monoImage.GetData(),rowBytes);

        cv_sum_image = cv_sum_image + cv_image/ip.preint;

        cv::imshow("image", cv_sum_image);
        cv::waitKey(1);
    }

    //t=GetTickCount() - t;
    unsigned int shutterus = fCurShutter*1000000;

    {
    //create filename and save co-added image
    ostringstream filename;
    filename << ip.mode <<"_"<< ip.cdt << "_"   << setfill('0') << setw(5) << ip.cnt << "_" << ip.servopos << "_" << setfill('0') << setw(6) << shutterus << "_" << ip.preint << "_" << ip.temp << "_" << ip.pres <<".pgm";
    //cv::string ss = filename.str();
    string ss = filename.str();
    cv::imwrite(ss,cv_sum_image);
    }

    // Stop capturing images
    error = cam.StopCapture();
    if (error != PGRERROR_OK){PrintError( error ); return -1;}

    // Disconnect the camera
    error = cam.Disconnect();
    if (error != PGRERROR_OK){ PrintError( error ); return -1;}

    return 0;
}
我在this.select = function () { var nativeRng = nativeRange(); if (agent.isW3CRangeSupport) { var selection = document.getSelection(); if (selection.rangeCount > 0) { selection.removeAllRanges(); } selection.addRange(nativeRng); } else { nativeRng.select(); } }; 行中

尝试了此解决方案,方法是将selection.addRange(nativeRng);添加到dialogsInBody: true函数中,但这没有帮助。关于编辑器有什么问题的任何想法?谢谢你。

编辑:我发现只有将summernote()设置为airMode时,它才会发生。如果false-有效,但是编辑器的显示方式不同。

1 个答案:

答案 0 :(得分:0)

通过添加以下代码在Angular 7中进行了修复。

@ViewChild('editor') editor: Editor;
setTimeout(() => {
this.editor.writeValue(data);
this.editor.quill.setSelection(null, data.length, null);
}, 100);