在 textAngular 编辑器中使用角度引导模式插入链接

use angular bootstrap modal for insert link in textAngular Editor

本文关键字:模式 插入 链接 编辑器 textAngular      更新时间:2023-09-26

我想从 angularjs 引导模式用于插入链接,因此在 textAngularSetup 中.js文件包含$modal作为依赖项,并在插入链接操作函数中使用它:

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: ....
});

当我在 Chrome 中调试代码时,找出执行但在 HTML 编辑器中不影响的命令。有什么方法可以从引导模式用于插入链接吗?

由于这个问题是在两个地方提出的,我在这里链接到 github 问题中的答案:https://github.com/fraywing/textAngular/issues/419