mirror of
https://github.com/UnickSoft/graphonline.git
synced 2026-04-08 08:46:03 +00:00
first commit
This commit is contained in:
57
lib/ckeditor4/plugins/htmlsource/plugin.js
Executable file
57
lib/ckeditor4/plugins/htmlsource/plugin.js
Executable file
@@ -0,0 +1,57 @@
|
||||
|
||||
plugInName = 'htmlsource';
|
||||
|
||||
CKEDITOR.plugins.add(plugInName,
|
||||
{
|
||||
init: function (editor) {
|
||||
|
||||
editor.addCommand('htmlDialog', new CKEDITOR.dialogCommand('htmlDialog'));
|
||||
editor.ui.addButton(plugInName, {
|
||||
label: 'Html Source',
|
||||
icon: 'http://www.example.com/images/btn_html.png',
|
||||
command: 'htmlDialog'
|
||||
});
|
||||
|
||||
CKEDITOR.dialog.add('htmlDialog', function (editor) {
|
||||
return {
|
||||
title: 'Fuente Html',
|
||||
minWidth: 600,
|
||||
minHeight: 400,
|
||||
contents: [
|
||||
{
|
||||
id: 'general',
|
||||
label: 'Settings',
|
||||
elements:
|
||||
[
|
||||
// UI elements of the Settings tab.
|
||||
{
|
||||
type: 'textarea',
|
||||
id: 'contents',
|
||||
rows: 25,
|
||||
onShow: function () {
|
||||
this.setValue(editor.container.$.innerHTML);
|
||||
|
||||
},
|
||||
commit: function (data) { //--I get only the body part in case I paste a complete html
|
||||
data.contents = this.getValue().replace(/^[\S\s]*<body[^>]*?>/i, "").replace(/<\/body[\S\s]*$/i, "");
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
onOk: function () {
|
||||
var data = {};
|
||||
this.commitContent(data);
|
||||
$(editor.container.$).html(data.contents);
|
||||
},
|
||||
onCancel: function () {
|
||||
// console.log('Cancel');
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user