gpt4 book ai didi

javascript - AngularJS 导航在 tinymce 指令后不起作用

转载 作者:搜寻专家 更新时间:2023-11-01 04:38:22 24 4
gpt4 key购买 nike

我遇到了无法解决的问题,但我确实有提示。在集成 TinyMCE 之前,主导航工作正常,例如链接设置、分析、设置;如果您单击它们,它现在不起作用。

这是我的js文件:

var app_htmleditor_module = angular.module('app_htmleditor', ['components']).
config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/', {templateUrl: getBaseURL()+'public/tpl/app/htmleditor.htm', controller: HtmlEditorCtrl, reloadOnSearch:false }).
otherwise( {redirectTo: '/'});
}
]);

angular.module('components', []).directive('imageUpload', function () {
return {
restrict: 'E',
scope: {
uploaderid:'@uploaderid'
},
templateUrl: '/public/tpl/imageupload.htm'
}
});

app_htmleditor_module.directive('uiTinymce', function() {
return {

require: 'ngModel',
link: function(scope, element, attrs, ngModel) {

element.tinymce({
// Location of TinyMCE script
script_url: 'http://resources.holycrap.ws/jscripts/tiny_mce/tiny_mce.js',

// General options
theme: "simple",

// Change from local directive scope -> "parent" scope
// Update Textarea and Trigger change event
// you can also use handle_event_callback which fires more often
onchange_callback: function(e) {

if (this.isDirty()) {
this.save();

// tinymce inserts the value back to the textarea element, so we get the val from element (work's only for textareas)
//ngModel.$setViewValue(e.getBody().innerHTML);
ngModel.$setViewValue(element.val());
scope.$apply();

return true;
}
}
});

}
}
});

然后我使用 ui:tinymce 将上面的 tinymce 指令添加到 textarea 中,如下所示:

<textarea ui:tinymce ng-model="data.html_tab" id="{{fileUploaderID}}_html_tab" name="{{fileUploaderID}}_html_tab" style="width:600px; height:300px"></textarea>

注意上面的ui:tinymce。如果我删除它,导航会再次正常工作。那么如何让我的导航与添加到 textarea 中的 ui:tinymce 一起工作?

演示网址:

http://dev-socialapps.rkm-group.com/app/htmleditor/index#/

任何帮助将不胜感激。谢谢

更新:

按照建议,我首先将 ui js 文件添加到我的模板文件中:

<script src="https://raw.github.com/angular-ui/angular-ui/master/build/angular-ui.js"></script>

然后在我的 js 文件中,我添加:

var app_htmleditor_module = angular.module('app_htmleditor', ['components', 'ui']).
config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/', {
templateUrl: getBaseURL()+'public/tpl/app/htmleditor.htm',
controller: HtmlEditorCtrl,
reloadOnSearch:false
}).
otherwise( {redirectTo: '/'});
}
]);

app_htmleditor_module.value('ui.config', {
tinymce: {
theme: 'simple'
}
});

在textarea标签中:

<textarea ui-tinymce ng-model="tinymce" id="{{fileUploaderID}}_html_tab" name="{{fileUploaderID}}_html_tab" style="width:600px; height:300px"></textarea>

但是我得到了错误:

ReferenceError: tinymce is not defined

虽然ui js文件添加正常,但我通过查看源代码并点击链接确认

最佳答案

您是否尝试过angular-ui库中最新版本的tinymce指令?

Demo

JS file

关于javascript - AngularJS 导航在 tinymce 指令后不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11390709/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com