jenkins-bot has submitted this change and it was merged. (
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
fixed typo and jquery vars
Change-Id: Icfddeb05fae4b51c386d7e2c4c5241d842e858da
---
M VisualEditor/resources/bluespice.visualEditor.css
M VisualEditor/resources/bluespice.visualEditor.js
2 files changed, 115 insertions(+), 9 deletions(-)
Approvals:
Mglaser: Looks good to me, approved
jenkins-bot: Verified
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..a6b07a6 100644
--- a/VisualEditor/resources/bluespice.visualEditor.js
+++ b/VisualEditor/resources/bluespice.visualEditor.js
@@ -16,12 +16,16 @@
$(this).data("text-changed", true);
});
$(window).scroll(function(){
- var toobar = $('.mce-stack-layout-item').first();
+ var toolbar = $('.mce-stack-layout-item').first();
var firstHeading = $( '#firstHeading' );
var previewMode = ( $( '#wikiPreview' ).css( 'display' ) === 'none' ) ?
false : true;
- if( toobar.length == 0 ) return;
+ if( previewMode && $( '#bs-ve-editoptions' ).length == 0 ) {
+ bs_editOptionsBarAdd();
+ }
+
+ if( toolbar.length == 0 ) return;
if( offsetTop === 0 && $( '#editform' ).length > 0 &&
firstHeading.length > 0 && previewMode === false ) {
offsetTop = firstHeading.position().top;
@@ -34,13 +38,17 @@
}
if( $(document).scrollTop() > offsetTop ) { //window.scrollY
- if( toobar.hasClass( 'bs-ve-fixed' ) == false ) {
+ if( toolbar.hasClass( 'bs-ve-fixed' ) == false ) {
- toobar.addClass( 'bs-ve-fixed' );
- toobar.width( toobar.parent().width() );
+ if( $( '#bs-ve-editoptions' ).length == 0 ) {
+ bs_editOptionsBarAdd();
+ }
+
+ toolbar.addClass( 'bs-ve-fixed' );
+ toolbar.width( toolbar.parent().width() );
if( firstHeading.length > 0 ){
- toobar.css( 'top', firstHeading.height() );
+ toolbar.css( 'top', firstHeading.height() );
firstHeading.addClass( 'bs-ve-heading-fixed' );
firstHeading.width(
firstHeading.parent().width() );
@@ -52,12 +60,16 @@
$( '#wpTextbox1_ifr' ).css(
'padding-top',
- toobar.height() + firstHeading.height()
+ toolbar.height() + firstHeading.height()
);
}
}
else {
- toobar.removeClass( 'bs-ve-fixed' );
+ toolbar.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 toolbar = $( '.mce-stack-layout-item' ).first();
+ var $editOptionsContainer = $( '<div id="bs-ve-editoptions"></div>'
).prependTo( toolbar );
+
+ 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: merged
Gerrit-Change-Id: Icfddeb05fae4b51c386d7e2c4c5241d842e858da
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Dvogel hallowelt <[email protected]>
Gerrit-Reviewer: Mglaser <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits