我想将Medium Editor集成到ExtJs6,但我不知道该怎么做。我从https://github.com/yabwe/medium-editor下载编辑器。我非常感谢你的合作。
答案 0 :(得分:1)
从上面的列表中听起来并不太复杂。
以下是一个例子:
Ext.application({
name: 'Fiddle',
launch: function () {
Ext.define('widget.mediumEditor', {
extend: 'Ext.panel.Panel',
alias: 'widget.mediumEditor',
xtype: 'mediumEditor',
padding: 20,
html: "<div class='editorcontent'></div>",
height: 400,
listeners: {
afterrender: function(component) {
var mediumEditor = new MediumEditor('.editorcontent', component.editorConfig);
component.editorInstance = mediumEditor;
}
}
});
Ext.create('Ext.panel.Panel',{
renderTo: Ext.getBody(),
layout: 'fit',
title: 'Medium editor',
items: [{
xtype: 'mediumEditor',
editorConfig: {
toolbar: {
/* These are the default options for the toolbar,
if nothing is passed this is what is used */
allowMultiParagraphSelection: true,
buttons: ['bold', 'italic', 'underline', 'anchor', 'h2', 'h3', 'quote'],
diffLeft: 0,
diffTop: -10,
firstButtonClass: 'medium-editor-button-first',
lastButtonClass: 'medium-editor-button-last',
relativeContainer: null,
standardizeSelectionStart: false,
static: false,
/* options which only apply when static is true */
align: 'center',
sticky: false,
updateOnEmptySelection: false
}
}
}]
})
}
});