Files
citrus-cms/resources/views/admin/inc/document-editor.blade.php
T
2026-04-28 21:15:09 +03:00

73 lines
3.2 KiB
PHP

<script src="//cdn.ckeditor.com/4.22.1/full-all/ckeditor.js"></script>
<script>
CKEDITOR.plugins.add('customTool', {
icons: 'custom-tool',
init: function (editor) {
editor.addCommand('openDialog', new CKEDITOR.dialogCommand('customToolDialog'));
editor.ui.addButton('CustomTool', {
label: 'Insert Custom Tool',
command: 'openDialog',
toolbar: 'insert'
});
CKEDITOR.dialog.add('customToolDialog', this.path + 'dialogs/customTool.js');
}
});
CKEDITOR.dialog.add('customToolDialog', function (editor) {
return {
title: 'Insert Custom Tool',
minWidth: 400,
minHeight: 200,
contents: [
{
id: 'info',
elements: [
{
type: 'text',
id: 'type',
label: 'Type',
validate: CKEDITOR.dialog.validate.notEmpty("Type cannot be empty.")
},
{
type: 'text',
id: 'column_name',
label: 'Column Name',
validate: CKEDITOR.dialog.validate.notEmpty("Column Name cannot be empty.")
}
]
}
],
onOk: function () {
var dialog = this,
type = dialog.getValueOf('info', 'type'),
columnName = dialog.getValueOf('info', 'column_name'),
formattedText = '{' + type + '.' + columnName + '}';
editor.insertText(formattedText);
}
};
});
</script>
<script>
CKEDITOR.replace('html', {
extraPlugins: 'customTool',
height: 1000,
}
);
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor = '#AADC6E';
config.extraPlugins = 'customTool';
}
</script>
<style>
.cke_notifications_area {
display:none !important;
}
</style>