【问题标题】:Angular-redactor: How to setup blur callback?Angular-redactor:如何设置模糊回调?
【发布时间】:2015-05-14 07:23:40
【问题描述】:

情况:

我正在使用angular-redactor 作为我的应用程序的编辑器。

除了一件事,一切都很好。 我需要触发一个模糊事件来要求用户确认,以防他想离开页面而不保存。

代码

这是编辑器文本区域:

<textarea cols="30" rows="30" ng-model="body" ng-blur="confirmation_email_exit()"redactor="
    { 
      minHeight: 370,
      focus: true,
      plugins: ['fontcolor', 'table', 'fullscreen', 'counter', 'fontfamily'],

    }">
</textarea>

这是一个全局选项正常工作的例子:

app.config(function(redactorOptions) {

    redactorOptions.buttons = ['formatting', '|', 'bold', 'italic'];

});

问题:

如何使用 angular-reactor 触发模糊事件?

我必须在视图或设置中调用它作为全局选项?

【问题讨论】:

    标签: javascript angularjs textarea onblur redactor


    【解决方案1】:

    只需使用 Redactor 的 blurCallback,您可以在视图和 redactorOptions 中使用它:

    <textarea cols="30" rows="30" ng-model="body" redactor="
        { 
          minHeight: 370,
          focus: true,
          plugins: ['fontcolor', 'table', 'fullscreen', 'counter', 'fontfamily'],
          blurCallback: function(){confirmation_email_exit()},
        }">
    </textarea>
    

    app.config(function(redactorOptions) {
    
       redactorOptions.buttons = ['formatting', '|', 'bold', 'italic'];
       redactorOptions.blurCallback = function(){confirmation_email_exit()};
    
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多