use angular bootstrap modal for insert link in tex

2019-08-23 06:49发布

问题:

i want use from angularjs bootstrap modal for insert link , so in textAngularSetup.js file include $modal as dependency, and use it in insertLink action function:

taRegisterTool('insertLink',{
    tooltiptext: taTranslations.insertLink.tooltip,
    iconclass: 'icon-link',
    action: function(){
        var that=this;
        var result={
            texttodisplay:'ahmad',
            webaddress:'',
            isOk:''
        }
        var insertLinkmodalScope=$rootScope.$new();
        insertLinkmodalScope.modalInstance=$modal.open({
            templateUrl: 'editor/views/insertlink.client.view.html',
            controller: 'EditorController',
            size: 'sm',
            scope:insertLinkmodalScope,
            resolve:{
                        //pass result to modal
                link:function(){
                    return result;
                }
            }
        });
        //define result modal , when user complete result information 
        insertLinkmodalScope.modalInstance.result.then(function(result){
            if (result.isOk) {
                return that.$editor().wrapSelection('createLink', result.webaddress, true);
            }
        });

    },
   activeState: ....,
   onElementSelect: ....
});

when i debug code in chrome, find out the command executed but didn't affect in HTML editor. is any way to use from bootstrap modal for inset link ?

回答1:

As this was asked in two places, I'm linking to the answer in the github issues here: https://github.com/fraywing/textAngular/issues/419