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

Merge branch 'dev'

Übergeordnete 13963621 6b16927a
No related branches found
No related tags found
1 Merge Request!8fix: display CKE notifications on the center of the page
...@@ -115,17 +115,24 @@ ...@@ -115,17 +115,24 @@
return; return;
} }
var sel = new CKEDITOR.dom.selection(editor.document);
// edit // edit
element.addEventListener('click', function (e) { element.addEventListener('click', function (e) {
var Target = e.target; var Target = e.target;
var Brick = Target;
if (!Brick.classList.contains('quiqqer_bricks_placeholder')) {
Brick = Target.closest('.quiqqer_bricks_placeholder');
}
// delete brick // delete brick
if (Target.name === 'delete') { if (Target.name === 'delete') {
e.preventDefault(); e.preventDefault();
Brick.parentNode.removeChild(Brick)
var Brick = e.target.closest('.quiqqer_bricks_placeholder');
Brick.parentNode.removeChild(Brick);
} }
//sel.selectElement(editor.document.body);
}); });
// element.addEventListener('focus', function () { // element.addEventListener('focus', function () {
...@@ -150,15 +157,17 @@ ...@@ -150,15 +157,17 @@
if (!Info) { if (!Info) {
Info = doc.createElement('div'); Info = doc.createElement('div');
Info.classList.add('quiqqer_bricks_placeholder_info'); Info.classList.add('quiqqer_bricks_placeholder_info');
Info.contentEditable = false;
element.appendChild(Info); element.appendChild(Info);
} }
if (!Settings) { if (!Settings) {
Settings = doc.createElement('div'); Settings = doc.createElement('div');
Settings.innerHTML = '<button name="delete">x</button>'; Settings.innerHTML = '<button name="delete">x</button>';
Settings.classList.add('quiqqer_bricks_placeholder_settings'); Settings.contentEditable = false;
Settings.classList.add('quiqqer_bricks_placeholder_settings');
element.appendChild(Settings); element.appendChild(Settings);
} }
...@@ -183,13 +192,13 @@ ...@@ -183,13 +192,13 @@
}; };
// add ckeditor // add ckeditor
window.CKEDITOR.plugins.add('quiqqerBricks', { CKEDITOR.plugins.add('quiqqerBricks', {
icons: "icon", icons: "icon",
lang : ['en', 'de'], lang : ['en', 'de'],
onLoad: function () { onLoad: function () {
// Register styles for placeholder widget frame. // Register styles for placeholder widget frame.
window.CKEDITOR.addCss( CKEDITOR.addCss(
'.quiqqer_bricks_placeholder {' + '.quiqqer_bricks_placeholder {' +
' cursor: pointer;' + ' cursor: pointer;' +
' display: inline-block;' + ' display: inline-block;' +
...@@ -207,6 +216,9 @@ ...@@ -207,6 +216,9 @@
' position: absolute;' + ' position: absolute;' +
' pointer-events: none;' + ' pointer-events: none;' +
' top: 10px;' + ' top: 10px;' +
' user-select: none;' +
' -webkit-user-select:none;' +
' -moz-user-select:none;' +
'}' + '}' +
'' + '' +
'.quiqqer_bricks_placeholder_settings {' + '.quiqqer_bricks_placeholder_settings {' +
...@@ -273,7 +285,7 @@ ...@@ -273,7 +285,7 @@
result = data.replace( result = data.replace(
/{{brick ([^}}]*)}}/g, /{{brick ([^}}]*)}}/g,
function (match) { function (match) {
match = match.replace('{{brick ', ''); match = match.replace('{{brick ', '')
match = match.replace('}}', ''); match = match.replace('}}', '');
match = match.trim(); match = match.trim();
match = match.split(' '); match = match.split(' ');
...@@ -288,7 +300,10 @@ ...@@ -288,7 +300,10 @@
} }
if ("id" in attributes) { if ("id" in attributes) {
return '<cke:object class="quiqqer_bricks_placeholder" ' + return '<cke:object ' +
'contenteditable="false" ' +
'data-cke-widget-wrapper="1" ' +
'class="quiqqer_bricks_placeholder cke_widget_wrapper cke_widget_inline" ' +
'data-brickid="' + attributes.id + '"' + 'data-brickid="' + attributes.id + '"' +
'></cke:object>'; '></cke:object>';
} }
...@@ -342,7 +357,8 @@ ...@@ -342,7 +357,8 @@
editor.insertHtml( editor.insertHtml(
'<div class="quiqqer_bricks_placeholder" ' + '<div class="quiqqer_bricks_placeholder" ' +
' data-brickid="' + brickId + '"' + ' data-brickid="' + brickId + '"' +
'>&nbsp;</div>' '>&nbsp;</div>' +
'<p>&nbsp;</p>'
); );
var i, len, o; var i, len, o;
...@@ -352,7 +368,12 @@ ...@@ -352,7 +368,12 @@
for (i = 0, len = nodes.length; i < len; i++) { for (i = 0, len = nodes.length; i < len; i++) {
o = doc.createElement('cke:object'); o = doc.createElement('cke:object');
o.setAttribute('data-brickid', nodes[i].getAttribute('data-brickid')); 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('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]); nodes[i].parentNode.replaceChild(o, nodes[i]);
} }
......
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