Skip to content
Code-Schnipsel Gruppen Projekte
Commit 6e279e64 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

fix: added media button for image2 plugin

Übergeordneter cf1e5933
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -97,6 +97,7 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
var Editor = QUI.Controls.getById(ev.editor.name);
Editor.$imageDialog(ev);
Editor.$image2Dialog(ev);
Editor.$linkDialog(ev);
Editor.$html5AudioDialog(ev);
Editor.$html5VideoDialog(ev);
......@@ -787,6 +788,102 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
return ev;
},
$image2Dialog: function (ev) {
// Take the dialog name and its definition from the event data.
var self = this,
dialogName = ev.data.name,
dialogDefinition = ev.data.definition;
/**
* Image dialog
*/
if (dialogName !== 'image2') {
return ev;
}
var oldOnShow = dialogDefinition.onShow;
// Get a reference to the "Link Info" tab.
dialogDefinition.onShow = function () {
var Button;
oldOnShow.bind(this)();
console.log(this);
// image button
var UrlGroup = this.getContentElement('info', 'src')
.getElement().$;
var HeightInput = this.getContentElement('info', 'height')
.getElement().$
.getElement('input[type="text"]');
var WidthInput = this.getContentElement('info', 'width')
.getElement().$
.getElement('input[type="text"]');
console.log('#############');
console.log(UrlGroup);
var UrlInput = UrlGroup.getElement('input[type="text"]');
if (!UrlGroup.getElement('.qui-button')) {
new Element('button', {
'class': 'qui-button',
html : '<span class="fa fa-picture-o"></span>',
styles : {
margin: 0
},
events : {
click: function () {
self.openMedia({
events: {
onSubmit: function (Win, data) {
UrlInput.value = data.url;
Ajax.get('ajax_media_details', function (fileData) {
if (fileData.image_height > 500 ||
fileData.image_width > 500) {
var result = QUIMath.resizeVar(
fileData.image_height,
fileData.image_width,
500
);
// es darf keine image height gesetzt
// da das Bild sonst im mobile view sich verzieht
// HeightInput.value = result.var1;
WidthInput.value = result.var2;
} else {
// HeightInput.value = fileData.image_height;
WidthInput.value = fileData.image_width;
}
// if (!fileData.image_height) {
// HeightInput.value = '';
// }
if (!fileData.image_width) {
WidthInput.value = '';
}
}, {
project: data.project,
fileid : data.id
});
}
}
});
}
}
}).inject(UrlGroup);
UrlInput.setStyle('float', 'left');
UrlInput.setStyle('width', 'calc(100% - 35px)');
UrlInput.setStyle('lineHeight', 20);
}
console.log(UrlInput);
};
},
/**
* edit the link dialog
*
......@@ -800,7 +897,7 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
/**
* Link dialog
*/
if (dialogName != 'link') {
if (dialogName !== 'link') {
return ev;
}
......
......@@ -18,7 +18,7 @@
"html5video",
"iframe",
"iframedialog",
"image",
"image2",
"indentblock",
"justify",
"language",
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren