use angular bootstrap modal for insert link in textAngular Editor

别来无恙 提交于 2019-12-25 04:12:15

问题


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



来源:https://stackoverflow.com/questions/27099803/use-angular-bootstrap-modal-for-insert-link-in-textangular-editor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!