edit/page: ctrl+S shortkey to save
[minimedit.git] / edit / page.js
index 45f0104e022d8136b96efadbe5f754cb8a3ce42e..522d63e3c41d5b55f05b987ea5b05c6d7620b2b2 100644 (file)
@@ -39,6 +39,7 @@ CKEDITOR.plugins.add('inlinesave', {
                                ajaxpost.send(data);
                        },
                });
+               editor.setKeystroke(CKEDITOR.CTRL + 83 /*S*/, 'inlinesave');
                editor.ui.addButton( 'Inlinesave', {
                        command: 'inlinesave',
                        label: editor.lang.save.toolbar,
@@ -51,15 +52,30 @@ CKEDITOR.on('dialogDefinition', function (event) {
        switch (event.data.name) {
        case 'table':
                // override initial attribute values
-               var infoTab = event.data.definition.getContents('info');
-               infoTab.get('txtWidth').default = '';
-               infoTab.get('txtBorder').default = '0';
-               infoTab.get('txtCellSpace').default = '';
-               infoTab.get('txtCellPad').default = '';
+               var infotab = event.data.definition.getContents('info');
+               infotab.remove('txtWidth');
+               infotab.remove('txtHeight');
+               infotab.remove('txtBorder');
+               infotab.remove('txtCellSpace');
+               infotab.remove('txtCellPad');
+               infotab.remove('cmbAlign');
+
+               // horizontal repositioning of existing elements
+               var hbox = {
+                       id: 'hboxDimensions',
+                       type: 'hbox',
+                       children: [ infotab.get('txtCols'), infotab.get('txtRows') ],
+               };
+               infotab.add(hbox, 'selHeaders');
+               infotab.remove('txtCols');
+               infotab.remove('txtRows');
+
                break;
        case 'link':
-               //TODO: remove unneeded widgets from the Link Info tab
-               var infotab = event.data.definition.getContents('info');
+               // hide unneeded widgets from the Link Info tab
+               event.data.definition.getContents('info').get('linkType').hidden = true;
+               let linktarget = event.data.definition.getContents('target').get('linkTargetType');
+               linktarget.items = [ linktarget.items[0], linktarget.items[3] ]; // only _blank
                break;
        }
 });
@@ -93,14 +109,22 @@ CKEDITOR.on('instanceCreated', function (event) {
                config.image2_alignClasses = ['left', 'center', 'right'];
                config.image2_disableResizer = true;
                config.stylesSet = [
+                       { name: 'Klein', element: 'small' },
+                       { name: 'Zijkant', element: 'span', attributes: { 'class': 'right' } },
+                       { name: 'Attributie', element: 'em', attributes: { 'class': 'right' } },
+                       { name: 'Quote', element: 'q' },
+                       { name: 'Gemarkeerd', element: 'span', styles: { 'background-color': 'Yellow' } },
+
+                       { name: 'Kadertekst', element: 'aside' },
+                       { name: 'Uitgelijnd', element: 'div', attributes: { 'class': 'right' } },
                        { name: 'Kolom', element: 'div', attributes: { 'class': 'col' } },
-                       { name: 'Rechts', element: 'div', attributes: { 'class': 'right' } },
+                       { name: 'Waarschuwing', element: 'div', attributes: { 'class': 'warn' } },
                ];
                config.pasteFilter = pastefilter;
                config.contentsCss = document.styleSheets[0].href;
                config.toolbar = [
                        ['Inlinesave', '-', 'Undo', 'Redo'],
-                       ['Format'],
+                       ['Format', 'Styles'],
                        ['Bold', 'Italic', 'Link'],
                        ['BulletedList', 'NumberedList', 'Blockquote'],
                        ['Table', 'CreateDiv'],
@@ -111,6 +135,7 @@ CKEDITOR.on('instanceCreated', function (event) {
                config.toolbarCanCollapse = true;
                config.floatSpacePreferRight = true;
                config.floatSpaceDockedOffsetY = 0;
+               config.title = false;
                config.startupFocus = true;
 
                config.disableObjectResizing = true;