gpt4 book ai didi

javascript - Redactor 没有这样的方法 "destroy"

转载 作者:行者123 更新时间:2023-12-03 02:10:21 27 4
gpt4 key购买 nike

我不确定“方法”这个词是否属于编辑器中的函数或类。但我试图通过 $('#id').redactor('destroy') 销毁编辑器。该代码在创建/实例化编辑器时有效,但在销毁它后立即给出错误No such method "destroy"for Redactor(因为它已经被销毁)。在某种程度上,我想在销毁之前检查该方法是否存在;就像来自 javascript 的检查函数是否存在的方法一样,我也尝试使用 $(#id).hasClass($ (#id).redactor('destroy')) 仍然会导致错误。

所以我不确定如何检查该方法是否存在,因此只有在创建/实例化编辑器时我才会销毁它。

看在贾达夫先生的份上:

这是我的Instructions.js

Ext.define('myNamespace', {
extend: 'Ext.container.Container',
alias : 'widget.instructionstab',

requires:[
'myCommonFunctions',
],
margin: '5 5 5 5',
layout: {
type: 'vbox',
align: 'stretch'
},
initComponent: function() {
var me = this,
cfg = cfg || {};

Ext.applyIf(me, {
items: [
{
xtype: 'textareafield',
flex: 1,
itemId: 'txtHeaderComment',
fieldLabel: 'Header Comment',
enableDrillDown: true,
},
{
xtype: 'textareafield',
flex: 1,
itemId: 'txtFooterComment',
fieldLabel: 'Footer Comment',
enableDrillDown: true
}
]
}, cfg);

me.callParent(arguments);
}

});

我的CommonFunctions:

createRadEditor: function(el) {
var me = this;

var fn = function () {
$('#' + el.inputId).redactor({
buttons: ['bold', 'italic', 'underline', 'deleted', 'alignleft', 'aligncenter', 'alignright', 'unorderedlist', 'orderedlist', 'outdent', 'indent', 'image', 'video', 'table', 'link', 'horizontalrule', 'html', 'fullscreenwindow'],
plugins: ['fontcolor', 'fontfamily', 'fullscreenwindow'],
clipboardUpload: true,
clipboardUploadUrl: './somelink/setimage',
blurCallback: function(e){
console.log("ASDF"); // i'm still trying out something
}
});

$('#'+ el.inputId).redactor('setTextEditorHeight');
$('#'+ el.inputId).attr("id",el.config.itemId);
};
var task = Ext.create('Ext.util.DelayedTask', fn);
task.delay(500);
},

我的 View :

{
xtype: 'panel',
itemId: 'pnlInstructions',
layout: 'fit',
title: 'Instructions',
items: [
{
xtype: 'instructionstab'
}
]
},

我正在使用此处的一些文档 https://imperavi.com/redactor/docs/了解编辑器的属性。

最佳答案

如果你想销毁编辑器,那么你应该使用:

$("#editor").redactor("core.destroy");

关于javascript - Redactor 没有这样的方法 "destroy",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49607830/

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