Я использую tinymce 5
и хотел бы расширить редактор полем повторителя:
Я хотел бы добавить поле повторителя и вывести данные в текстовое поле
Найдите ниже мой минимальный жизнеспособный пример:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdn.tiny.cloud/1/no-api-key/tinymce/5/tinymce.min.js" referrerpolicy="origin"></script>
<script>
var dialogConfig = {
title: 'Add condition',
body: {
type: 'panel',
items: [
{
type: 'input',
name: 'ifConditionData',
label: 'if '
},
{
type: 'input',
name: 'ifConditionDoData',
label: 'do'
},
{
type: 'input',
name: 'elseifCondition0Data',
label: 'elseif-Condition'
},
{
type: 'input',
name: 'elseifConditionDo0Data',
label: 'elseif-do'
},
{
type: 'input',
name: 'elseData',
label: 'else-do'
}
]
},
buttons: [
{
type: 'cancel',
name: 'closeButton',
text: 'Cancel'
},
{
type: 'submit',
name: 'submitButton',
text: 'Submit',
primary: true
}
],
initialData: {
ifData: 'text < 10',
},
onSubmit: function (api) {
var data = api.getData();
api.close();
}
};
tinymce.init({
selector: '#mytextarea',
plugins: "code",
toolbar: ['dialog-example-btn', 'code'],
setup: function (editor) {
editor.ui.registry.addButton('dialog-example-btn', {
text: 'Add condition',
onAction: function () {
editor.windowManager.open(dialogConfig)
}
})
}
});
</script>
</head>
<body>
<form method="post">
<textarea id="mytextarea">Hello, World!</textarea>
</form>
</body>
</html>
Есть предложения, как добавить это в tinymce?