Dvogel hallowelt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363314 )

Change subject: VisualEditor: add summary, save, preview, changes and cancel btn
......................................................................

VisualEditor: add summary, save, preview, changes and cancel btn

to bs-ve toolbar

Change-Id: Icfddeb05fae4b51c386d7e2c4c5241d842e858da
---
M VisualEditor/resources/bluespice.visualEditor.css
M VisualEditor/resources/bluespice.visualEditor.js
2 files changed, 107 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/14/363314/1

diff --git a/VisualEditor/resources/bluespice.visualEditor.css 
b/VisualEditor/resources/bluespice.visualEditor.css
index 8696a82..efa5e69 100644
--- a/VisualEditor/resources/bluespice.visualEditor.css
+++ b/VisualEditor/resources/bluespice.visualEditor.css
@@ -81,6 +81,42 @@
        z-index: 1000;
 }
 
+#bs-ve-editsummary-group,
+#bs-ve-editbtn-group {
+       display: inline-block;
+       margin-left: 5px;
+}
+
+#bs-ve-wpSummaryLabel label {
+       line-height: 2.5em;
+       padding: 5px;
+}
+
+#bs-ve-wpSummary {
+       height: 23px;
+       margin: 5px;
+       margin-right: 0px;
+       background-color: white;
+       color: black;
+       border: 1px solid black;
+}
+
+#bs-ve-wpSave,
+#bs-ve-wpPreview,
+#bs-ve-wpDiff{
+       height: 17px;
+       width: auto;
+       border: 1px solid black;
+       margin: 5px;
+       margin-right: 0px;
+       padding: 3px;
+}
+
+#bs-ve-mw-editform-cancel {
+       padding: 5px;
+       line-height: 2.5em;
+}
+
 #bs-editbutton-visualeditor {
        /*@embed*/
        background-image: url(images/button_vis-editor.png);
diff --git a/VisualEditor/resources/bluespice.visualEditor.js 
b/VisualEditor/resources/bluespice.visualEditor.js
index d46c3c4..aa3bb22 100644
--- a/VisualEditor/resources/bluespice.visualEditor.js
+++ b/VisualEditor/resources/bluespice.visualEditor.js
@@ -21,6 +21,10 @@
 
        var previewMode = ( $( '#wikiPreview' ).css( 'display' ) === 'none' ) ? 
false : true;
 
+       if( previewMode && $( '#bs-ve-editoptions' ).length == 0 ) {
+               bs_editOptionsBarAdd();
+       }
+
        if( toobar.length == 0 ) return;
 
        if( offsetTop === 0 && $( '#editform' ).length > 0 && 
firstHeading.length > 0 && previewMode === false ) {
@@ -35,6 +39,10 @@
 
        if( $(document).scrollTop() > offsetTop ) { //window.scrollY
                if( toobar.hasClass( 'bs-ve-fixed' ) == false ) {
+
+                       if( $( '#bs-ve-editoptions' ).length == 0 ) {
+                               bs_editOptionsBarAdd();
+                       }
 
                        toobar.addClass( 'bs-ve-fixed' );
                        toobar.width( toobar.parent().width() );
@@ -58,6 +66,10 @@
        }
        else {
                toobar.removeClass( 'bs-ve-fixed' );
+
+               if( $( '#bs-ve-editoptions' ).length > 0 && !previewMode ) {
+                       bs_editOptionsBarRemove();
+               }
 
                if( firstHeading.length > 0 ){
                        firstHeading.removeClass( 'bs-ve-heading-fixed' );
@@ -131,4 +143,62 @@
                });
                $( '#bs-editbutton-visualeditor' ).removeClass( 
'bs-editbutton-disabled' );
        });
-});
\ No newline at end of file
+});
+
+// add some editOptions form editor footer to bs-ve toolbar
+function bs_editOptionsBarAdd() {
+       var toobar = $( '.mce-stack-layout-item' ).first();
+       var editOptionsContainer = $( '<div id="bs-ve-editoptions"></div>' 
).prependTo( toobar );
+
+       var editSummaryContainer = $( '<div 
id="bs-ve-editsummary-group"></div>' ).appendTo( editOptionsContainer );
+
+       var bsTfSummaryLabel = $( '#wpSummaryLabel' ).clone( true );
+       bsTfSummaryLabel.attr( 'id', 'bs-ve-wpSummaryLabel' );
+       bsTfSummaryLabel.appendTo( editSummaryContainer );
+
+       var bsTfSummary = $( '#wpSummary' ).clone( true );
+       bsTfSummary.attr( 'id', 'bs-ve-wpSummary' );
+       bsTfSummary.attr( 'name', 'bs-wpSummary' );
+       bsTfSummary.appendTo( editSummaryContainer );
+
+       var editBtnContainer = $( '<div id="bs-ve-editbtn-group"></div>' 
).appendTo( editOptionsContainer );
+
+       var bsBtnSave = $( '#wpSave' ).clone( true );
+       bsBtnSave.attr( 'id', 'bs-ve-wpSave' );
+       bsBtnSave.appendTo( editBtnContainer );
+
+       var bsBtnPreview = $( '#wpPreview' ).clone( true );
+       bsBtnPreview.attr( 'id', 'bs-ve-wpPreview' );
+       bsBtnPreview.appendTo( editBtnContainer );
+
+       var bsBtnChanges = $( '#wpDiff' ).clone( true );
+       bsBtnChanges.attr( 'id', 'bs-ve-wpDiff' );
+       bsBtnChanges.appendTo( editBtnContainer );
+
+       var bsBtnCancel = $( '#mw-editform-cancel' ).clone( true );
+       bsBtnCancel.attr( 'id', 'bs-ve-mw-editform-cancel' );
+       bsBtnCancel.appendTo( editBtnContainer );
+};
+
+function bs_editOptionsBarRemove() {
+       $( '#bs-ve-editoptions' ).remove();
+};
+
+// event handler for editOptions in bs-ve toolbar
+$( document ).on( 'click', '#bs-ve-wpSummary', function(){
+       $( '#wpSummary' ).removeClass( 'wpSummary-active' );
+       $( '#bs-ve-wpSummary' ).addClass( 'wpSummary-active' );
+});
+
+$( document ).on( 'click', '#wpSummary', function(){
+       $( '#bs-ve-wpSummary' ).removeClass( 'wpSummary-active' );
+       $( '#wpSummary' ).addClass( 'wpSummary-active' );
+});
+
+$( document ).on( 'keyup', '#bs-ve-wpSummary.wpSummary-active', function(){
+       $( '#wpSummary' ).val( $( '#bs-ve-wpSummary' ).val() );
+});
+
+$( document ).on( 'keyup', '#wpSummary.wpSummary-active' , function(){
+       $( '#bs-ve-wpSummary' ).val( $( '#wpSummary' ).val() );
+});

-- 
To view, visit https://gerrit.wikimedia.org/r/363314
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icfddeb05fae4b51c386d7e2c4c5241d842e858da
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Dvogel hallowelt <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to