获取当前 froala 编辑器的 ID
get ID of current froala editor
我在我的 Froala 编辑器中添加了一个自定义按钮。
$.FroalaEditor.DefineIcon('yt', {NAME: 'plus'});
$.FroalaEditor.RegisterCommand('yt', {
title: 'make yt',
focus: true,
undo: true,
refreshAfterCallback: true,
callback: function () {
console.log(this);
}
});
当我点击按钮时,console.log(this) 显示
b {id: 1, opts: {…}, sid: 1, shared: {…}, $oel: m.fn.init(1), …}
$box:m.fn.init [div#jobEditor.fr-box.fr-basic.fr-top, context: div#jobEditor.fr-box.fr-basic.fr-top]
$doc:m.fn.init [document, context: document]
$el:m.fn.init [div.fr-element.fr-view]
$oel:m.fn.init [div#jobEditor.fr-box.fr-basic.fr-top, context: di...
(more stuff)
我看到了我想要的 DIV 的 ID (#jobEditor)。
我如何从 "this"?
中提取它
this.$box.prop('id')
或
this.$box[0].id
我在我的 Froala 编辑器中添加了一个自定义按钮。
$.FroalaEditor.DefineIcon('yt', {NAME: 'plus'});
$.FroalaEditor.RegisterCommand('yt', {
title: 'make yt',
focus: true,
undo: true,
refreshAfterCallback: true,
callback: function () {
console.log(this);
}
});
当我点击按钮时,console.log(this) 显示
b {id: 1, opts: {…}, sid: 1, shared: {…}, $oel: m.fn.init(1), …}
$box:m.fn.init [div#jobEditor.fr-box.fr-basic.fr-top, context: div#jobEditor.fr-box.fr-basic.fr-top]
$doc:m.fn.init [document, context: document]
$el:m.fn.init [div.fr-element.fr-view]
$oel:m.fn.init [div#jobEditor.fr-box.fr-basic.fr-top, context: di...
(more stuff)
我看到了我想要的 DIV 的 ID (#jobEditor)。 我如何从 "this"?
中提取它this.$box.prop('id')
或
this.$box[0].id