diff --git a/bin/Editor.css b/bin/Editor.css index 09c6f03be5a9ff141efc9bfa4f24f91e4d92e84e..372dce683e990b693094e9e134c21d2de205bce3 100644 --- a/bin/Editor.css +++ b/bin/Editor.css @@ -3,6 +3,7 @@ .control-editor, .control-editor-container { float: left; + min-height: 300px; height: 100%; width: 100%; } @@ -33,8 +34,8 @@ background: #0069B4; color: #FFFFFF; - box-shadow: none; - -moz-box-shadow: none; + box-shadow: none; + -moz-box-shadow: none; -webkit-box-shadow: none; } @@ -50,8 +51,13 @@ text-decoration: inherit; } -div.cke_panel.cke_combopanel.cke_ltr { width: 300px !important; } -span.cke_rcombo span.cke_styles a span span.cke_text { width: 150px; } +div.cke_panel.cke_combopanel.cke_ltr { + width: 300px !important; +} + +span.cke_rcombo span.cke_styles a span span.cke_text { + width: 150px; +} .cke_notifications_area { position: absolute; diff --git a/locale.xml b/locale.xml index c0bb0c9cc8ead3bc853c41387919ad95b4769b2b..9b9c7618fbcf36c6fda20892d87ec63b84c208b8 100644 --- a/locale.xml +++ b/locale.xml @@ -151,5 +151,14 @@ <de><![CDATA[Editor Baustein ändern]]></de> <en><![CDATA[Change editor brick]]></en> </locale> + + <locale name="window.bricks.editor.selectBrick"> + <de><![CDATA[Anderen Brick auswählen]]></de> + <en><![CDATA[Select other brick]]></en> + </locale> + <locale name="window.bricks.editor.editBrick"> + <de><![CDATA[Brick editieren]]></de> + <en><![CDATA[Edit brick]]></en> + </locale> </groups> </locales> diff --git a/plugins/quiqqer/qui-font-awesome/lang/en.js b/plugins/quiqqer/qui-font-awesome/lang/en.js new file mode 100644 index 0000000000000000000000000000000000000000..555a548acd50b0ebe2670547ea859c53375e18bb --- /dev/null +++ b/plugins/quiqqer/qui-font-awesome/lang/en.js @@ -0,0 +1,3 @@ +CKEDITOR.plugins.setLang('qui-font-awesome', 'en', { + button: 'Font-Awesome' +}); diff --git a/plugins/quiqqer/quiqqerBricks/plugin.js b/plugins/quiqqer/quiqqerBricks/plugin.js index bfe5f64f3fefdddc769ae3d294e58033f9725852..52fc35c3319bb8223dcda6f17b4fb6e1ea5a85b5 100644 --- a/plugins/quiqqer/quiqqerBricks/plugin.js +++ b/plugins/quiqqer/quiqqerBricks/plugin.js @@ -1,11 +1,11 @@ (function () { "use strict"; - + console.log('init quiqqer bricks'); // finds out which project are active var getProjectData = function (Node, editor) { var Panel, Site; var project = ''; - var lang = ''; + var lang = ''; if (Node.closest('.qui-panel')) { Panel = window.QUI.Controls.getById( @@ -16,7 +16,7 @@ Site = Panel.getSite(); project = Site.getProject().getName(); - lang = Site.getProject().getLang(); + lang = Site.getProject().getLang(); } } else { Node = editor.ui.contentsElement.$; @@ -30,7 +30,7 @@ Site = Panel.getSite(); project = Site.getProject().getName(); - lang = Site.getProject().getLang(); + lang = Site.getProject().getLang(); } } } @@ -46,7 +46,7 @@ return; } - var brickId = Node.getAttribute('data-brickid'); + var brickId = Node.getAttribute('data-brickid'); var projectData = getProjectData(Node, editor); require([ @@ -63,18 +63,30 @@ Win.getContent().set( 'html', - '<label style="display: flex; width: 300px; margin: 2rem auto 0;">' + + '<label style="display: flex; width: 350px; 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">' + + ' <button class="qui-button" name="select">' + ' <span class="fa fa-cubes"></span>' + ' </button>' + + ' <button class="qui-button" name="edit">' + + ' <span class="fa fa-edit"></span>' + + ' </button>' + '</label>' ); Win.getContent().getElement('input').set('value', brickId); + Win.getContent().getElement('button[name="select"]').set( + 'title', + QUILocale.get('quiqqer/ckeditor4', 'window.bricks.editor.selectBrick') + ); - Win.getContent().getElement('button').addEvent('click', function () { + Win.getContent().getElement('button[name="edit"]').set( + 'title', + QUILocale.get('quiqqer/ckeditor4', 'window.bricks.editor.editBrick') + ); + + Win.getContent().getElement('button[name="select"]').addEvent('click', function () { require([ 'package/quiqqer/bricks/bin/Controls/backend/BrickSelectWindow' ], function (BrickSelectWindow) { @@ -94,6 +106,29 @@ }).open(); }); }); + + Win.getContent().getElement('button[name="edit"]').addEvent('click', function () { + let brickId = Win.getContent().getElement('input').value; + + if (brickId === '') { + return; + } + + Win.close(); + + require([ + 'utils/Panels', + 'package/quiqqer/bricks/bin/BrickEdit' + ], function (PanelUtils, BrickPanel) { + PanelUtils.openPanelInTasks( + new BrickPanel({ + id : brickId, + projectName: projectData.project, + projectLang: projectData.lang + }) + ); + }); + }); }, onSubmit: function (Win) { @@ -118,7 +153,7 @@ // edit element.addEventListener('click', function (e) { var Target = e.target; - var Brick = Target; + var Brick = Target; if (!Brick.classList.contains('quiqqer_bricks_placeholder')) { Brick = Target.closest('.quiqqer_bricks_placeholder'); @@ -143,8 +178,8 @@ // refresh placeholder display data var refreshPlaceholderDisplay = function (element, editor) { - var doc = editor.document.$; - var Info = element.querySelector('.quiqqer_bricks_placeholder_info'); + var doc = editor.document.$; + var Info = element.querySelector('.quiqqer_bricks_placeholder_info'); var Settings = element.querySelector('.quiqqer_bricks_placeholder_settings'); if (!Info) { @@ -156,8 +191,8 @@ } if (!Settings) { - Settings = doc.createElement('div'); - Settings.innerHTML = '<button name="delete">x</button>'; + Settings = doc.createElement('div'); + Settings.innerHTML = '<button name="delete">x</button>'; Settings.contentEditable = false; Settings.classList.add('quiqqer_bricks_placeholder_settings'); @@ -175,8 +210,8 @@ }; var setCustomEvents = function (evt) { - var editor = evt.editor; - var doc = editor.document.$; + 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++) { @@ -187,9 +222,13 @@ // add ckeditor window.CKEDITOR.plugins.add('quiqqerBricks', { icons: "icon", - lang : ['en', 'de'], + lang : [ + 'en', + 'de' + ], onLoad: function () { + console.log('onload quiqqer bricks'); // Register styles for placeholder widget frame. window.CKEDITOR.addCss( '.quiqqer_bricks_placeholder {' + @@ -229,6 +268,8 @@ }, init: function (editor) { + console.log('on init quiqqer bricks'); + var self = this; this.$Editor = editor; @@ -250,7 +291,7 @@ var brickId, textNode, PH; for (var i = 0, len = placeholders.length; i < len; i++) { - PH = placeholders[i]; + PH = placeholders[i]; brickId = PH.get('data-brickid'); if (!brickId) { @@ -294,11 +335,11 @@ 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>'; + 'contenteditable="false" ' + + 'data-cke-widget-wrapper="1" ' + + 'class="quiqqer_bricks_placeholder cke_widget_wrapper cke_widget_inline" ' + + 'data-brickid="' + attributes.id + '"' + + '></cke:object>'; } return ""; @@ -322,7 +363,7 @@ 'package/quiqqer/bricks/bin/Controls/backend/BrickSelectWindow' ], function (BrickSelectWindow) { // get project, if editor is in panel - var Node = editor.ui.contentsElement.$; + var Node = editor.ui.contentsElement.$; var projectData = getProjectData(Node, editor); new BrickSelectWindow({ @@ -355,7 +396,7 @@ ); var i, len, o; - var doc = editor.document.$; + var doc = editor.document.$; var nodes = doc.body.querySelectorAll('div.quiqqer_bricks_placeholder'); for (i = 0, len = nodes.length; i < len; i++) { diff --git a/src/QUI/Ckeditor/EventHandler.php b/src/QUI/Ckeditor/EventHandler.php index e014feef99ef273d4131bec4e72787b3c03f543b..ed8b5b05c6255fc18bd6f1044b33faa901739d26 100644 --- a/src/QUI/Ckeditor/EventHandler.php +++ b/src/QUI/Ckeditor/EventHandler.php @@ -27,27 +27,6 @@ class EventHandler } $PluginManager = new Manager(); - - // ----- Begin tempfix ----- - // This is a temporary fix for updating the systems - // there was a bug in the utils package which compromised the update process of the ckeditor, thus rendering the ckeditor useless - - if (!file_exists(VAR_DIR . "package/quiqqer/ckeditor4/plugins/bin/image/dialogs/image.js")) { - $newFolder = VAR_DIR . "package/quiqqer/ckeditor4/plugins." . time() . ".bak"; - rename( - VAR_DIR . "package/quiqqer/ckeditor4/plugins", - $newFolder - ); - - file_put_contents( - $newFolder . "/README.md", - "This directory was created as backup. If your ckeditor is working as intended you can delete this directory if you do not need it anymore" - ); - } - - // ----- End tempfix ----- - - $PluginManager->installPluginsFromSource(); }