You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
646 B
23 lines
646 B
|
|
UE.registerUI('gapfilling', function (editor, uiName) { |
|
editor.registerCommand(uiName, { |
|
execCommand: function (cmdName, value) { |
|
editor.execCommand('insertHtml', `<span class="gapfilling-span" data-id="${Math.random() * 100000}">______</span>`) |
|
} |
|
}) |
|
|
|
// 添加按钮 |
|
var btn = new UE.ui.Button({ |
|
//按钮的名字 |
|
name: uiName, |
|
//提示 |
|
title: uiName, |
|
// cssRules: 'width: 30px;height: 30px;background-color: #f00;', |
|
//点击时执行的命令 |
|
onclick: function () { |
|
//这里可以不用执行命令,做你自己的操作也可 |
|
editor.execCommand(uiName); |
|
} |
|
}) |
|
return btn |
|
}) |