Skip to content
Code-Schnipsel Gruppen Projekte

Revisionen vergleichen

Änderungen werden so angezeigt, als ob die Quellrevision mit der Zielrevision zusammengeführt würde. Erfahre mehr über den Vergleich von Revisionen.

Quelle

Zielprojekt auswählen
No results found

Ziel

Zielprojekt auswählen
  • quiqqer/ckeditor4
1 Ergebnis
Änderungen anzeigen
Commits auf Quelle (28)
<?php
/**
* Gets information about a brick
*/
QUI::$Ajax->registerFunction(
'package_quiqqer_ckeditor4_ajax_getBrickInfo',
function ($brickId) {
try {
$Brick = QUI\Bricks\Manager::init()->getBrickById($brickId);
} catch (QUI\Exception $Exception) {
return '';
}
return '#'.$Brick->getAttribute('id').' - '.$Brick->getAttribute('title');
},
['brickId']
);
......@@ -51,4 +51,11 @@
}
div.cke_panel.cke_combopanel.cke_ltr { width: 300px !important; }
span.cke_rcombo span.cke_styles a span span.cke_text { width: 150px; }
\ No newline at end of file
span.cke_rcombo span.cke_styles a span span.cke_text { width: 150px; }
.cke_notifications_area {
position: absolute;
top: 50% !important;
left: 50% !important;
z-index: 999999 !important;
}
......@@ -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);
......@@ -247,23 +248,23 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
}
window.CKEDITOR.replace(instance, {
skinName : 'moono-lisa',
customConfig : '',
language : Locale.getCurrent(),
baseHref : URL_DIR,
basePath : URL_DIR,
height : height,
width : width,
toolbar : toolbar,
allowedContent : true,
extraAllowedContent : 'iframe(*)[*]{*}; img(*)[*]{*}; script(*)[*]{*}; ins(*)[*]{*}',
protectedSource : [/<ins[\s|\S]+?<\/ins>/g],
stylesSet : styles,
contentsCss : data.cssFiles || [],
bodyClass : data.bodyClass,
skinName : 'moono-lisa',
customConfig : '',
language : Locale.getCurrent(),
baseHref : URL_DIR,
basePath : URL_DIR,
height : height,
width : width,
toolbar : toolbar,
allowedContent : true,
extraAllowedContent: 'figure(*)[*]{*}; figcaption; iframe(*)[*]{*}; img(*)[*]{*}; script(*)[*]{*}; ins(*)[*]{*}',
protectedSource : [/<ins[\s|\S]+?<\/ins>/g],
stylesSet : styles,
contentsCss : data.cssFiles || [],
bodyClass : data.bodyClass,
// templates_files : [URL_OPT_DIR +'base/bin/pcsgEditorPlugins/templates.php'],
baseFloatZIndex : zIndex,
extraPlugins : extraPlugins,
baseFloatZIndex: zIndex,
extraPlugins : extraPlugins,
//removePlugins : 'scayt',
disableNativeSpellChecker: config.disableNativeSpellChecker,
autoGrow_onStartup : false,
......@@ -484,7 +485,7 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
var extra = [],
buttonList = [];
if (typeOf(toolbar) == 'array') {
if (typeOf(toolbar) === 'array') {
buttonList = toolbar.flatten();
}
......@@ -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;
}
......
......@@ -57,7 +57,7 @@ define('package/quiqqer/ckeditor4/bin/backend/controls/UploadWindow', [
var Content = this.getContent();
this.$Upload = new UploadForm({
multible : false,
multiple : false,
sendbutton : false,
cancelbutton: false,
events : {
......
......@@ -3,6 +3,7 @@
"type": "quiqqer-module",
"description": "CKEditor for the QUIQQER CMS - enable the ckeditor for quiqqer",
"license": "GPL-2.0-or-later",
"version": "2.3.0",
"authors": [
{
"name": "Henning Leutz",
......@@ -16,8 +17,8 @@
},
"require": {
"quiqqer\/quiqqer": "*",
"quiqqer\/qui": ">=1|dev-master|dev-dev",
"ckeditor\/ckeditor": "4.10.*"
"quiqqer\/qui": ">=1|*@dev",
"ckeditor\/ckeditor": "4.16.*"
},
"autoload": {
"psr-4": {
......@@ -25,4 +26,4 @@
"QUI\\Ckeditor\\Plugins\\": "src\/QUI\/Ckeditor\/Plugins\/"
}
}
}
\ No newline at end of file
}
......@@ -146,5 +146,10 @@
<de><![CDATA[Plugin aktivieren/deaktivieren]]></de>
<en><![CDATA[De-/activate plugin]]></en>
</locale>
<locale name="window.bricks.editor.edit.title">
<de><![CDATA[Editor Baustein ändern]]></de>
<en><![CDATA[Change editor brick]]></en>
</locale>
</groups>
</locales>
\ No newline at end of file
</locales>
......@@ -18,7 +18,7 @@
"html5video",
"iframe",
"iframedialog",
"image",
"image2",
"indentblock",
"justify",
"language",
......@@ -32,6 +32,7 @@
"pastefromword",
"pre",
"qui-font-awesome",
"quiqqerBricks",
"scayt",
"selectall",
"showblocks",
......@@ -39,7 +40,6 @@
"smiley",
"sourcedialog",
"specialchar",
"stylesheetparser",
"table",
"tableresize",
"tabletools",
......@@ -51,4 +51,4 @@
"xml",
"youtube",
"zoom"
]
\ No newline at end of file
]
plugins/quiqqer/quiqqerBricks/images/icon.jpg

3,19 KiB

plugins/quiqqer/quiqqerBricks/images/icon.png

1,58 KiB

CKEDITOR.plugins.setLang('quiqqerBricks', 'de', {
button: 'QUIQQER Bausteine'
});
CKEDITOR.plugins.setLang('quiqqerBricks', 'en', {
button: 'QUIQQER Bricks'
});
(function () {
"use strict";
// finds out which project are active
var getProjectData = function (Node, editor) {
var Panel, Site;
var project = '';
var lang = '';
if (Node.closest('.qui-panel')) {
Panel = window.QUI.Controls.getById(
Node.closest('.qui-panel').get('data-quiid')
);
if (Panel && Panel.getType() === 'controls/projects/project/site/Panel') {
Site = Panel.getSite();
project = Site.getProject().getName();
lang = Site.getProject().getLang();
}
} else {
Node = editor.ui.contentsElement.$;
if (Node.closest('.qui-panel')) {
Panel = window.QUI.Controls.getById(
Node.closest('.qui-panel').get('data-quiid')
);
if (Panel && Panel.getType() === 'controls/projects/project/site/Panel') {
Site = Panel.getSite();
project = Site.getProject().getName();
lang = Site.getProject().getLang();
}
}
}
return {
project: project,
lang : lang
};
};
var editNode = function (Node, editor) {
if (!Node.classList.contains('quiqqer_bricks_placeholder')) {
return;
}
var brickId = Node.getAttribute('data-brickid');
var projectData = getProjectData(Node, editor);
require([
'Locale',
'qui/controls/windows/Confirm'
], function (QUILocale, QUIConfirm) {
new QUIConfirm({
icon : 'fa fa-cubes',
title : QUILocale.get('quiqqer/ckeditor4', 'window.bricks.editor.edit.title'),
maxHeight: 300,
maxWidth : 500,
events : {
onOpen: function (Win) {
Win.getContent().set(
'html',
'<label style="display: flex; width: 300px; margin: 2rem auto 0;">' +
' <span style="padding: 0 10px 0 0; line-height: 30px;">Brick ID:</span>' +
' <input style="flex-grow: 1" type="text" name="brickId" />' +
' <button class="qui-button">' +
' <span class="fa fa-cubes"></span>' +
' </button>' +
'</label>'
);
Win.getContent().getElement('input').set('value', brickId);
Win.getContent().getElement('button').addEvent('click', function () {
require([
'package/quiqqer/bricks/bin/Controls/backend/BrickSelectWindow'
], function (BrickSelectWindow) {
new BrickSelectWindow({
project : projectData.project,
lang : projectData.lang,
multiple: false,
events : {
onSubmit: function (Instance, ids) {
if (ids.length) {
Win.getContent()
.getElement('input')
.set('value', parseInt(ids[0].id));
}
}
}
}).open();
});
});
},
onSubmit: function (Win) {
var brickId = Win.getContent().getElement('input').value;
if (brickId !== '') {
Node.setAttribute('data-brickid', brickId);
refreshPlaceholderDisplay(Node, editor);
}
}
}
}).open();
});
};
// set custom div events
var setPlaceHolderEvents = function (element, editor) {
if (element.getAttribute('data-placeholder-event')) {
return;
}
// edit
element.addEventListener('click', function (e) {
var Target = e.target;
var Brick = Target;
if (!Brick.classList.contains('quiqqer_bricks_placeholder')) {
Brick = Target.closest('.quiqqer_bricks_placeholder');
}
// delete brick
if (Target.name === 'delete') {
e.preventDefault();
Brick.parentNode.removeChild(Brick);
}
});
element.addEventListener('dblclick', function (e) {
editNode(e.target, editor);
});
element.setAttribute('data-placeholder-event', 1);
element.setAttribute('tabindex', -1);
refreshPlaceholderDisplay(element, editor);
};
// refresh placeholder display data
var refreshPlaceholderDisplay = function (element, editor) {
var doc = editor.document.$;
var Info = element.querySelector('.quiqqer_bricks_placeholder_info');
var Settings = element.querySelector('.quiqqer_bricks_placeholder_settings');
if (!Info) {
Info = doc.createElement('div');
Info.classList.add('quiqqer_bricks_placeholder_info');
Info.contentEditable = false;
element.appendChild(Info);
}
if (!Settings) {
Settings = doc.createElement('div');
Settings.innerHTML = '<button name="delete">x</button>';
Settings.contentEditable = false;
Settings.classList.add('quiqqer_bricks_placeholder_settings');
element.appendChild(Settings);
}
require(['Ajax'], function (QUIAjax) {
QUIAjax.get('package_quiqqer_ckeditor4_ajax_getBrickInfo', function (result) {
Info.innerHTML = result;
}, {
'package': 'quiqqer/ckeditor4',
brickId : element.getAttribute('data-brickid')
});
});
};
var setCustomEvents = function (evt) {
var editor = evt.editor;
var doc = editor.document.$;
var elements = doc.querySelectorAll('.quiqqer_bricks_placeholder');
for (var i = 0, len = elements.length; i < len; i++) {
setPlaceHolderEvents(elements[i], editor);
}
};
// add ckeditor
window.CKEDITOR.plugins.add('quiqqerBricks', {
icons: "icon",
lang : ['en', 'de'],
onLoad: function () {
// Register styles for placeholder widget frame.
window.CKEDITOR.addCss(
'.quiqqer_bricks_placeholder {' +
' cursor: pointer;' +
' display: inline-block;' +
' background-color:#dedede;' +
' height: 200px;' +
' margin-bottom: 10px;' +
' position: relative;' +
' width: 100%;' +
'}' +
'.quiqqer_bricks_placeholder:hover {' +
' outline: 2px solid #2F8FC6' +
'}' +
'.quiqqer_bricks_placeholder_info {' +
' left: 10px;' +
' position: absolute;' +
' pointer-events: none;' +
' top: 10px;' +
' user-select: none;' +
' -webkit-user-select:none;' +
' -moz-user-select:none;' +
'}' +
'' +
'.quiqqer_bricks_placeholder_settings {' +
' display: none;' +
//' pointer-events: none;' +
' position: absolute;' +
' top: 10px;' +
' right: 10px;' +
'}' +
'' +
'.quiqqer_bricks_placeholder:hover .quiqqer_bricks_placeholder_settings {' +
' display: inline;' +
'}'
);
},
init: function (editor) {
var self = this;
this.$Editor = editor;
editor.ui.addButton('QuiqqerBricks', {
label : editor.lang.quiqqerBricks.button,
toolbar: 'insert',
command: 'insert-quiqqer-brick',
icon : this.path + 'images/icon.png'
});
// save
editor.on('getData', function (evt) {
var Ghost = new Element('div', {
html: evt.data.dataValue
});
var placeholders = Ghost.getElements('.quiqqer_bricks_placeholder');
var brickId, textNode, PH;
for (var i = 0, len = placeholders.length; i < len; i++) {
PH = placeholders[i];
brickId = PH.get('data-brickid');
if (!brickId) {
continue;
}
textNode = document.createTextNode("{{brick id=" + brickId + "}}");
PH.parentNode.insertBefore(textNode, PH);
PH.parentNode.removeChild(PH);
}
evt.data.dataValue = Ghost.get('html');
});
// load
editor.on('setData', function (evt) {
var result;
var data = evt.data.dataValue;
if (data.indexOf('{{brick ') === -1) {
return;
}
result = data.replace(
/{{brick ([^}}]*)}}/g,
function (match) {
match = match.replace('{{brick ', '');
match = match.replace('}}', '');
match = match.trim();
match = match.split(' ');
var parts;
var attributes = [];
for (var m = 0, len = match.length; m < len; m++) {
parts = match[m].trim().split('=');
attributes[parts[0]] = parts[1];
}
if ("id" in attributes) {
return '<cke:object ' +
'contenteditable="false" ' +
'data-cke-widget-wrapper="1" ' +
'class="quiqqer_bricks_placeholder cke_widget_wrapper cke_widget_inline" ' +
'data-brickid="' + attributes.id + '"' +
'></cke:object>';
}
return "";
}
);
evt.data.dataValue = result;
setTimeout(function () {
setCustomEvents(evt);
}, 500);
});
editor.on('afterInsertHtml', setCustomEvents);
// editor inser command
editor.addCommand('insert-quiqqer-brick', {
exec: function (editor) {
require([
'package/quiqqer/bricks/bin/Controls/backend/BrickSelectWindow'
], function (BrickSelectWindow) {
// get project, if editor is in panel
var Node = editor.ui.contentsElement.$;
var projectData = getProjectData(Node, editor);
new BrickSelectWindow({
project : projectData.project,
lang : projectData.lang,
area : 'content',
multiple: false,
events : {
onSubmit: function (Instance, bricks) {
self.insertBrick(
editor,
bricks[0].id,
bricks[0].project,
bricks[0].lang
);
}
}
}).open();
});
}
});
},
insertBrick: function (editor, brickId) {
editor.insertHtml(
'<div class="quiqqer_bricks_placeholder" ' +
' data-brickid="' + brickId + '"' +
'>&nbsp;</div>' +
'<p>&nbsp;</p>'
);
var i, len, o;
var doc = editor.document.$;
var nodes = doc.body.querySelectorAll('div.quiqqer_bricks_placeholder');
for (i = 0, len = nodes.length; i < len; i++) {
o = doc.createElement('cke:object');
o.setAttribute('data-brickid', nodes[i].getAttribute('data-brickid'));
o.setAttribute('data-cke-widget-wrapper', 1);
o.classList.add('quiqqer_bricks_placeholder');
o.classList.add('cke_widget_wrapper');
o.classList.add('cke_widget_inline');
o.contenteditable = false;
nodes[i].parentNode.replaceChild(o, nodes[i]);
}
setCustomEvents({
editor: editor
});
}
});
})();