gpt4 book ai didi

CKEditor 4自定义下拉菜单

转载 作者:行者123 更新时间:2023-12-04 05:15:51 36 4
gpt4 key购买 nike

我们正在尝试向CKeditor添加一个自定义下拉列表,该下拉列表将提供一个列表,供我们查找和替换预设值,在我生命中,我找不到一种简单的方法来执行此操作。查看TinyMCE非常简单:

http://www.tinymce.com/tryit/menubutton.php

是否有针对CKEditor的简单解决方案,我们宁愿不必为此功能而将CKeditor换成TinyMCE。我找到了一个名为PlaceHolder的插件,但是并不能完全满足我们的要求,老实说,我希望没有插件就能做到这一点,而只是像TinyMCE那样在初始化时进行配置。

非常感谢您的见解。

最佳答案

都是关于 editor.ui.addRichCombo (JSFiddle):

CKEDITOR.replace( 'editor', {
toolbarGroups: [
{ name: 'mode' },
{ name: 'basicstyles' }
],
on: {
pluginsLoaded: function() {
var editor = this,
config = editor.config;

editor.ui.addRichCombo( 'my-combo', {
label: 'My Dropdown Label',
title: 'My Dropdown Title',
toolbar: 'basicstyles,0',

panel: {
css: [ CKEDITOR.skin.getPath( 'editor' ) ].concat( config.contentsCss ),
multiSelect: false,
attributes: { 'aria-label': 'My Dropdown Title' }
},

init: function() {
this.startGroup( 'My Dropdown Group #1' );
this.add( 'foo', 'Foo!' );
this.add( 'bar', 'Bar!' );

this.startGroup( 'My Dropdown Group #2' );
this.add( 'ping', 'Ping!' );
this.add( 'pong', 'Pong!' );

},

onClick: function( value ) {
editor.focus();
editor.fire( 'saveSnapshot' );

editor.insertHtml( value );

editor.fire( 'saveSnapshot' );
}
} );
}
}
} );

关于CKEditor 4自定义下拉菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29645809/

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