[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: Fix visual diff timeout
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/385831 ) Change subject: Fix visual diff timeout .. Fix visual diff timeout Bug: T177378 Change-Id: Ia15ec2fa8ce98969a552430ba52c79c21482f2a7 --- M lib/treeDiffer/treeDiffer-dist.js M src/dm/ve.dm.VisualDiff.js 2 files changed, 5 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/31/385831/1 diff --git a/lib/treeDiffer/treeDiffer-dist.js b/lib/treeDiffer/treeDiffer-dist.js index 77e2310..ba4d165 100644 --- a/lib/treeDiffer/treeDiffer-dist.js +++ b/lib/treeDiffer/treeDiffer-dist.js @@ -300,6 +300,7 @@ this.findMinimumTransactions( keyRoot1, keyRoot2, iNulls, jNulls, transactions ); if ( new Date().getTime() > this.endTime ) { + this.transactions = null; return; } } diff --git a/src/dm/ve.dm.VisualDiff.js b/src/dm/ve.dm.VisualDiff.js index 608ef43..9b0c333 100644 --- a/src/dm/ve.dm.VisualDiff.js +++ b/src/dm/ve.dm.VisualDiff.js @@ -433,7 +433,10 @@ newDocChildTree = new this.treeDiffer.Tree( newDocChild, ve.DiffTreeNode ); treeDiff = new this.treeDiffer.Differ( oldDocChildTree, newDocChildTree ) - .transactions[ oldDocChildTree.orderedNodes.length - 1 ][ newDocChildTree.orderedNodes.length - 1 ]; + .transactions; + if ( treeDiff !== null ) { + treeDiff = treeDiff[ oldDocChildTree.orderedNodes.length - 1 ][ newDocChildTree.orderedNodes.length - 1 ]; + } // Length of old content is length of old node minus the open and close // tags for each child node -- To view, visit https://gerrit.wikimedia.org/r/385831 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia15ec2fa8ce98969a552430ba52c79c21482f2a7 Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: WIP Show reference moves in visual diff
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/385827 ) Change subject: WIP Show reference moves in visual diff .. WIP Show reference moves in visual diff Show moves in the reference list. To do: sort out styling Bug: T171587 Change-Id: Id2c5b279ba631b970ccf1795feb5317bf4354ee1 --- M src/dm/ve.dm.VisualDiff.js M src/ui/elements/ve.ui.DiffElement.js 2 files changed, 18 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/27/385827/1 diff --git a/src/dm/ve.dm.VisualDiff.js b/src/dm/ve.dm.VisualDiff.js index 608ef43..5a94413 100644 --- a/src/dm/ve.dm.VisualDiff.js +++ b/src/dm/ve.dm.VisualDiff.js @@ -404,8 +404,8 @@ * been changed to make the new child, and the diff should be discarded. * Otherwise the diff should be cleaned and returned. * - * TODO: It would be possible to discover moves by comparing removed and - * inserted nodes from the tree differ. + * TODO: It would be possible to discover within-child moves by comparing + * removed and inserted nodes from the tree differ. * * @param {ve.dm.Node} oldDocChild Child of the old document node * @param {ve.dm.Node} newDocChild Child of the new document node @@ -665,12 +665,10 @@ } } - // TODO: Work out how to calculate moves; for now, keep in the same order - // as new doc, with removes at the end - // Diff the internal list items for each group for ( i = 0, ilen = groups.length; i < ilen; i++ ) { group = groups[ i ]; + switch ( group.action ) { case 'diff': @@ -693,7 +691,7 @@ // Check there actually are any changes if ( ( diff.rootChildrenRemove.length > 0 || diff.rootChildrenInsert.length > 0 ) || - ( containsDiff( diff.rootChildrenOldToNew ) ) + ( containsDiff( diff.rootChildrenOldToNew ) || containsDiff( diff.moves ) ) ) { // There are changes. @@ -750,6 +748,8 @@ } ); internalListDiffInfo[ group.group ].changes = true; + internalListDiffInfo[ group.group ].moves = diff.moves; + } break; diff --git a/src/ui/elements/ve.ui.DiffElement.js b/src/ui/elements/ve.ui.DiffElement.js index 329fcb2..3c8ef46 100644 --- a/src/ui/elements/ve.ui.DiffElement.js +++ b/src/ui/elements/ve.ui.DiffElement.js @@ -287,11 +287,13 @@ } else if ( internalListItem.diff === 0 ) { - internalListDiffQueue.push( [ 'getInternalListNodeElements', internalListItem, 'none' ] ); + move = internalListGroup.moves[ i ] === 0 ? undefined : internalListGroup.moves[ i ]; + internalListDiffQueue.push( [ 'getInternalListNodeElements', internalListItem, 'none', move ] ); } else { - internalListDiffQueue.push( [ 'getInternalListChangedNodeElements', internalListItem ] ); + move = internalListGroup.moves[ i ] === 0 ? undefined : internalListGroup.moves[ i ]; + internalListDiffQueue.push( [ 'getInternalListChangedNodeElements', internalListItem, move ] ); } } @@ -708,9 +710,10 @@ * * @param {Object} internalListItem Information about the internal list item's diff * @param {string} action 'remove', 'insert' or 'none' + * @param {string} [move] 'up' or 'down' if the node has moved * @return {HTMLElement[]} Elements (not owned by window.document) */ -ve.ui.DiffElement.prototype.getInternalListNodeElements = function ( internalListItem, action ) { +ve.ui.DiffElement.prototype.getInternalListNodeElements = function ( internalListItem, action, move ) { var elements, internalListNode = action === 'remove' ? this.oldDocInternalListNode : this.newDocInternalListNode, node = internalListNode.children[ internalListItem.nodeIndex ].children[ 0 ], @@ -718,7 +721,7 @@ listItemNode = document.createElement( 'li' ); if ( node && node.length ) { - elements = this.getNodeElements( node, action ); + elements = this.getNodeElements( node, action, move ); listItemNode.appendChild( listItemNode.ownerDocument.adoptNode( elements[ 0 ] ) @@ -743,9 +746,10 @@ * from the old document to the new document. * * @param {Object} internalListItem Information about the
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: WIP VisualDiff: Show minimal moves in diff
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/377554 ) Change subject: WIP VisualDiff: Show minimal moves in diff .. WIP VisualDiff: Show minimal moves in diff To do: * write tests for move + insert, move + remove * update design (separate patch?) * implement for reflist moves (separate patch?) Bug: T171451 Change-Id: I0b090b373d6587f8aa356d02e3cfd7271ac0d642 --- M src/dm/ve.dm.VisualDiff.js M src/ui/elements/ve.ui.DiffElement.js M tests/ui/ve.ui.DiffElement.test.js 3 files changed, 131 insertions(+), 10 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/54/377554/1 diff --git a/src/dm/ve.dm.VisualDiff.js b/src/dm/ve.dm.VisualDiff.js index 022ee44..e869e12 100644 --- a/src/dm/ve.dm.VisualDiff.js +++ b/src/dm/ve.dm.VisualDiff.js @@ -160,10 +160,134 @@ } } + // STEP 3: Compute moves (up, down, no move) + if ( Object.keys( diff.rootChildrenNewToOld ).length > 0 ) { + diff.moves = this.calculateDiffMoves( diff.rootChildrenOldToNew, diff.rootChildrenNewToOld ); + } else { + diff.moves = []; + } + return diff; }; /** + * Calculate how children of the new root node have moved, compared to the children of + * the old root node. More specifically, calculate the minimal moves, keeping the + * maximum possible number of nodes unmoved. Do this by finding the longest increasing + * subsequence in the sequence of oldDoc node indices, sorted by their corresponding + * newDoc nodes' indices. Those indices in the longest increasing subsequence represent + * the unmoved nodes. + * + * @param {Object} oldToNew Index map of oldDoc nodes to corresponding newDoc nodes + * @param {Object} newToOld Index map of newDoc nodes to corresponding oldDoc nodes + * @return {Array} Record of whether and how each newDoc node has moved + */ +ve.dm.VisualDiff.prototype.calculateDiffMoves = function ( oldToNew, newToOld ) { + var i, ilen, sortedKeys, moves, latestUnmoved, oldIndex, + oldPermuted = [], + unmoved = 0, + up = 'up', + down = 'down'; + + // See https://en.wikipedia.org/wiki/Longest_increasing_subsequence + function longestIncreasingSubsequence( sequence, moves, oldToNew ) { + var i, ilen, k, low, high, middle, newLength, oldIndex, newIndex, + currentLength = 0, + // finalIndices[i] holds: + // - if i is 0, 0 + // - if there's an increasing subsequence of length i, the final item in that subsequence + // - if i > length of longest increasing subsequence, undefined + finalIndices = Array( oldPermuted.length + 1 ), + // previousIndices[i] holds: + // - if i is in the longest increasing subsequence, the item before i in that subsequence + // - otherwise, 0 + previousIndices = Array( oldPermuted.length ); + + finalIndices[ 0 ] = 0; + + // Perform algorithm (i.e. populate finalIndices and previousIndices) + for ( i = 0, ilen = sequence.length; i < ilen; i++ ) { + low = 1; + high = currentLength; + while ( low <= high ) { + middle = Math.ceil( ( low + high ) / 2 ); + if ( sequence[ finalIndices[ middle ] ] < sequence[ i ] ) { + low = middle + 1; + } else { + high = middle - 1; + } + } + newLength = low; + previousIndices[ i ] = finalIndices[ newLength - 1 ]; + finalIndices[ newLength ] = i; + if ( newLength > currentLength ) { + currentLength = newLength; + } + } + + // Items in the longest increasing subsequence are oldDoc indices of unmoved nodes. + // Mark corresponding newDoc indices of these unmoved nodes, in moves array. + k = finalIndices[ currentLength ]; + for ( i = currentLength, ilen = 0; i > ilen; i-- ) { + oldIndex = sequence[ k ]; + newIndex = oldToNew[ oldIndex ]; + newIndex = typeof newIndex === 'number' ? newIndex : newIndex.node; + moves[ newIndex ] = unmoved; + k = previousIndices[ k ]; + } + + return moves; + } + + // Get oldDoc indices, sorted according to their order in the new
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: WIP Add feedback link for visual diff
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/374636 ) Change subject: WIP Add feedback link for visual diff .. WIP Add feedback link for visual diff To do: - make it link somewhere - mention action bug Bug: T170665 Change-Id: I0b09b1089c834a013ad5fee4ecdf75b483b56323 --- M extension.json M modules/ve-mw/i18n/en.json M modules/ve-mw/i18n/qqq.json M modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js M modules/ve-mw/ui/styles/dialogs/ve.ui.MWSaveDialog.css 5 files changed, 26 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/36/374636/1 diff --git a/extension.json b/extension.json index 0d207a1..3665d86 100644 --- a/extension.json +++ b/extension.json @@ -1347,6 +1347,7 @@ "visualeditor-savedialog-label-review", "visualeditor-savedialog-label-review-good", "visualeditor-savedialog-label-save-short", + "visualeditor-savedialog-label-visual-diff-report", "visualeditor-savedialog-label-warning", "visualeditor-savedialog-review-nosummary", "visualeditor-savedialog-review-visual", diff --git a/modules/ve-mw/i18n/en.json b/modules/ve-mw/i18n/en.json index 0248450..fb9af38 100644 --- a/modules/ve-mw/i18n/en.json +++ b/modules/ve-mw/i18n/en.json @@ -384,6 +384,7 @@ "visualeditor-savedialog-label-review": "Review your changes", "visualeditor-savedialog-label-review-good": "Return to save form", "visualeditor-savedialog-label-save-short": "Save", + "visualeditor-savedialog-label-visual-diff-report": "Report incorrect display for this change", "visualeditor-savedialog-label-warning": "Warning", "visualeditor-savedialog-review-nosummary": "No edit summary", "visualeditor-savedialog-review-visual": "Visual (beta)", diff --git a/modules/ve-mw/i18n/qqq.json b/modules/ve-mw/i18n/qqq.json index 3a4fde9..3012d58 100644 --- a/modules/ve-mw/i18n/qqq.json +++ b/modules/ve-mw/i18n/qqq.json @@ -397,6 +397,7 @@ "visualeditor-savedialog-label-review": "Label for button to go to the review dialog to review the diff", "visualeditor-savedialog-label-review-good": "Label for button to go back to a page in order to save form", "visualeditor-savedialog-label-save-short": "Short label text for save button on private wikis for use on width-restricted devices like mobile phones. This should be as short as possible.\n{{Identical|Save}}", + "visualeditor-savedialog-label-visual-diff-report": "Label for button to report a problem with the visual diff", "visualeditor-savedialog-label-warning": "Label in front of a save dialog warning sentence, separated by {{msg-mw|colon-separator}}.\n{{Identical|Warning}}", "visualeditor-savedialog-review-nosummary": "Message shown when no edit summary was provided.", "visualeditor-savedialog-review-visual": "Label for button to select visual diff mode, with a note that this mode is in beta.", diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js index 925f637..8b8b017 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js @@ -84,6 +84,15 @@ label: OO.ui.deferMsg( 'visualeditor-savedialog-label-resolve-conflict' ), flags: [ 'primary', 'constructive' ], modes: 'conflict' + }, + { + action: 'report', + label: OO.ui.deferMsg( 'visualeditor-savedialog-label-visual-diff-report' ), + flags: [ 'progressive' ], + modes: 'review', + framed: false, + icon: 'feedback', + classes: [ 've-ui-mwSaveDialog-visualDiffFeedback' ] } ]; @@ -584,9 +593,9 @@ ], classes: [ 've-ui-mwSaveDialog-reviewMode' ] } ); - this.reviewModeButtonSelect.connect( this, { select: 'updateReviewMode' } ); // TODO: Make 'visual' the default this.reviewModeButtonSelect.selectItemByData( 'source' ); + this.reviewModeButtonSelect.connect( this, { select: 'updateReviewMode' } ); this.$reviewEditSummary = $( '' ).addClass( 've-ui-mwSaveDialog-summaryPreview' ).addClass( 'comment' ); this.$reviewActions = $( '' ).addClass( 've-ui-mwSaveDialog-actions' ); @@ -649,9 +658,16 @@ ve.ui.MWSaveDialog.prototype.updateReviewMode = function () { var dialog = this, isVisual = this.reviewModeButtonSelect.getSelectedItem().getData() === 'visual'; + + // Get report action so it can be toggled + if ( !this.report ) { + this.report =
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: VisualDiff: Don't diff close elements
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/374340 ) Change subject: VisualDiff: Don't diff close elements .. VisualDiff: Don't diff close elements Force the content diff to be balanced by removing close elements prior to diffing, then re-inserting afterwards. Bug: T171862 Change-Id: I84aa157897ed5774b170e0dc4a3f7d264663c24d --- M src/dm/ve.dm.VisualDiff.js M src/ve.DiffMatchPatch.js 2 files changed, 42 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/40/374340/1 diff --git a/src/dm/ve.dm.VisualDiff.js b/src/dm/ve.dm.VisualDiff.js index 524cd89..022ee44 100644 --- a/src/dm/ve.dm.VisualDiff.js +++ b/src/dm/ve.dm.VisualDiff.js @@ -562,8 +562,7 @@ // Diff internal list items diff = this.computeDiff( oldDocInternalListItems.toDiff, - newDocInternalListItems.toDiff, - this.internalListDiff + newDocInternalListItems.toDiff ); // Check there actually are any changes diff --git a/src/ve.DiffMatchPatch.js b/src/ve.DiffMatchPatch.js index 3d20936..21f12b1 100644 --- a/src/ve.DiffMatchPatch.js +++ b/src/ve.DiffMatchPatch.js @@ -70,14 +70,31 @@ return []; }; -ve.DiffMatchPatch.prototype.getCleanDiff = function () { - var diffs = this.diff_main.apply( this, arguments ), +ve.DiffMatchPatch.prototype.getCleanDiff = function ( oldData, newData, options ) { + var cleanDiff, i, ilen, j, store = this.store, DIFF_DELETE = this.constructor.static.DIFF_DELETE, DIFF_INSERT = this.constructor.static.DIFF_INSERT, DIFF_EQUAL = this.constructor.static.DIFF_EQUAL, DIFF_CHANGE_DELETE = this.constructor.static.DIFF_CHANGE_DELETE, DIFF_CHANGE_INSERT = this.constructor.static.DIFF_CHANGE_INSERT; + + /** +* Remove the close elements from the linear data, to force a balanced diff +* +* @param {Array} data Linear data +* @return {Array} Linear data without close elements +*/ + function removeCloseElements( data ) { + var i; + for ( i = 0; i < data.length; i++ ) { + if ( data[ i ].type && data[ i ].type[ 0 ] === '/' ) { + data.splice( i, 1 ); + i--; + } + } + return data; + } /** * Get the index of the the first or last wordbreak in a data array @@ -285,8 +302,8 @@ cleanDiff.push( [ DIFF_INSERT, insert ] ); } - // Finally, go over any consecutive remove-inserts (also insert-removes?) - // and if they have the same character data, or are modified content nodes, + // Now go over any consecutive remove-inserts (also insert-removes?) and + // if they have the same character data, or are modified content nodes, // make them changes instead for ( i = 0, ilen = cleanDiff.length - 1; i < ilen; i++ ) { aItem = cleanDiff[ i ]; @@ -345,5 +362,24 @@ return cleanDiff; } - return getCleanDiff( diffs ); + // Remove the close elements + oldData = removeCloseElements( oldData ); + newData = removeCloseElements( newData ); + + // Get the diff + cleanDiff = getCleanDiff( this.diff_main( oldData, newData, options ) ); + + // Re-insert the close elements + for ( i = 0, ilen = cleanDiff.length; i < ilen; i++ ) { + for ( j = 0; j < cleanDiff[ i ][ 1 ].length; j++ ) { + if ( cleanDiff[ i ][ 1 ][ j ].type ) { + cleanDiff[ i ][ 1 ].splice( j + 1, 0, { + type: '/' + cleanDiff[ i ][ 1 ][ j ].type + } ); + j++; + } + } + } + + return cleanDiff; }; -- To view, visit https://gerrit.wikimedia.org/r/374340 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I84aa157897ed5774b170e0dc4a3f7d264663c24d Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: VisualDiff: Show internal list remove-inserts
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/371756 ) Change subject: VisualDiff: Show internal list remove-inserts .. VisualDiff: Show internal list remove-inserts Change-Id: I8253ef0efc36308525e812ed8706d3334a44c9ab --- M src/dm/ve.dm.VisualDiff.js 1 file changed, 7 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/56/371756/1 diff --git a/src/dm/ve.dm.VisualDiff.js b/src/dm/ve.dm.VisualDiff.js index 5248160..52ff9b7 100644 --- a/src/dm/ve.dm.VisualDiff.js +++ b/src/dm/ve.dm.VisualDiff.js @@ -456,7 +456,7 @@ */ ve.dm.VisualDiff.prototype.getInternalListDiffInfo = function () { var i, ilen, j, jlen, diff, item, group, - newItems, oldItems, nodeIndices, + newItems, oldItems, itemIndex, oldDocNodeGroups = this.oldDoc.getInternalList().getNodeGroups(), newDocNodeGroups = this.newDoc.getInternalList().getNodeGroups(), oldDocInternalListItems, @@ -575,29 +575,26 @@ // There are changes. // Mark each new doc internal list item as unchanged, changed or inserted newItems = newDocInternalListItems.indices; - nodeIndices = {}; // For finding removed internalListItems for ( j = 0, jlen = newItems.length; j < jlen; j++ ) { item = newItems[ j ]; - if ( typeof diff.rootChildrenNewToOld[ item.indexOrder ] === 'number' ) { + itemIndex = item.indexOrder; + if ( typeof diff.rootChildrenNewToOld[ itemIndex ] === 'number' ) { // Item hasn't changed item.diff = 0; - nodeIndices[ item.nodeIndex ] = true; - } else if ( diff.rootChildrenNewToOld[ item.indexOrder ] === undefined ) { + } else if ( diff.rootChildrenNewToOld[ itemIndex ] === undefined ) { // Item was inserted item.diff = 1; - nodeIndices[ item.nodeIndex ] = true; } else { // Item has changed // (The diff object is stored in rootChildrenOldToNew) item.diff = diff.rootChildrenOldToNew[ - diff.rootChildrenNewToOld[ item.indexOrder ].node + diff.rootChildrenNewToOld[ itemIndex ].node ].diff; - nodeIndices[ item.nodeIndex ] = true; } } @@ -606,7 +603,8 @@ oldItems = oldDocInternalListItems.indices; for ( j = 0, jlen = oldItems.length; j < jlen; j++ ) { item = oldItems[ j ]; - if ( !( item.nodeIndex in nodeIndices ) ) { + itemIndex = item.nodeIndex; + if ( diff.rootChildrenRemove.indexOf( itemIndex ) !== -1 ) { // Item was removed item.diff = -1; -- To view, visit https://gerrit.wikimedia.org/r/371756 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8253ef0efc36308525e812ed8706d3334a44c9ab Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...Cite[master]: VisualDiff: Show less information about ref nodes
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/371588 ) Change subject: VisualDiff: Show less information about ref nodes .. VisualDiff: Show less information about ref nodes If a ref node's index changes (e.g. because an earlier reference was inserted/removed), only describe the index change. (Currently the edit diffs in the save dialog don't show any change if only the index has changed. Perhaps ideally that is what would happen here eventually.) Bug: T170235 Change-Id: I2513bb82099a92529516e4e217e61a2d0a2dd43b --- M modules/ve-cite/ve.dm.MWReferenceNode.js 1 file changed, 6 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cite refs/changes/88/371588/1 diff --git a/modules/ve-cite/ve.dm.MWReferenceNode.js b/modules/ve-cite/ve.dm.MWReferenceNode.js index de55223..1fae5b8 100644 --- a/modules/ve-cite/ve.dm.MWReferenceNode.js +++ b/modules/ve-cite/ve.dm.MWReferenceNode.js @@ -323,7 +323,11 @@ return clone; }; +/** + * @inheritdoc + */ ve.dm.MWReferenceNode.static.describeChange = function ( key, change ) { + // Only display messages for refGroup and listIndex changes if ( key === 'refGroup' ) { if ( change.from ) { if ( change.to ) { @@ -334,11 +338,9 @@ } return ve.msg( 'cite-ve-changedesc-reflist-group-to', change.to ); } - if ( key === 'listGroup' || key === 'originalMw' ) { - return null; + if ( key === 'listIndex' ) { + return ve.dm.MWReferenceNode.parent.static.describeChange.apply( this, arguments ); } - - return ve.dm.MWReferenceNode.parent.static.describeChange.apply( this, arguments ); }; /* Methods */ -- To view, visit https://gerrit.wikimedia.org/r/371588 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2513bb82099a92529516e4e217e61a2d0a2dd43b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Cite Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Inform users visual diffs are in beta
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/371517 ) Change subject: Inform users visual diffs are in beta .. Inform users visual diffs are in beta Bug: T170665 Change-Id: Ia144c4409767567e41693a3fecd245a6b49c27c7 --- M modules/ve-mw/i18n/en.json M modules/ve-mw/i18n/qqq.json 2 files changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/17/371517/1 diff --git a/modules/ve-mw/i18n/en.json b/modules/ve-mw/i18n/en.json index f6ae9f4..be51d46 100644 --- a/modules/ve-mw/i18n/en.json +++ b/modules/ve-mw/i18n/en.json @@ -371,7 +371,7 @@ "visualeditor-savedialog-label-save-short": "Save", "visualeditor-savedialog-label-warning": "Warning", "visualeditor-savedialog-review-nosummary": "No edit summary", - "visualeditor-savedialog-review-visual": "Visual", + "visualeditor-savedialog-review-visual": "Visual (beta)", "visualeditor-savedialog-review-wikitext": "Wikitext", "visualeditor-savedialog-title-conflict": "Conflict", "visualeditor-savedialog-title-preview": "Preview your changes", diff --git a/modules/ve-mw/i18n/qqq.json b/modules/ve-mw/i18n/qqq.json index c240824..6066a84 100644 --- a/modules/ve-mw/i18n/qqq.json +++ b/modules/ve-mw/i18n/qqq.json @@ -384,7 +384,7 @@ "visualeditor-savedialog-label-save-short": "Short label text for save button on private wikis for use on width-restricted devices like mobile phones. This should be as short as possible.\n{{Identical|Save}}", "visualeditor-savedialog-label-warning": "Label in front of a save dialog warning sentence, separated by {{msg-mw|colon-separator}}.\n{{Identical|Warning}}", "visualeditor-savedialog-review-nosummary": "Message shown when no edit summary was provided.", - "visualeditor-savedialog-review-visual": "Label for button to select visual diff mode.\n{{Identical|Visual}}", + "visualeditor-savedialog-review-visual": "Label for button to select visual diff mode, with a note that this mode is in beta.\n{{Identical|Visual}}", "visualeditor-savedialog-review-wikitext": "Label for button to select wikitext diff mode.\n{{Identical|Wikitext}}", "visualeditor-savedialog-title-conflict": "Title for save dialog slide if there is an edit conflict\n{{Identical|Conflict}}", "visualeditor-savedialog-title-preview": "Title for save dialog slide for the HTML preview from wikitext mode", -- To view, visit https://gerrit.wikimedia.org/r/371517 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia144c4409767567e41693a3fecd245a6b49c27c7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: VisualDiff: Merge old internal list into new document
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/371515 ) Change subject: VisualDiff: Merge old internal list into new document .. VisualDiff: Merge old internal list into new document The new document needs to know about removed references. Bug: T173100 Change-Id: I8a11d2d558236939fcb2e7c9fc018e3b93c8240e --- M src/dm/ve.dm.Document.js M src/dm/ve.dm.VisualDiff.js M src/ui/elements/ve.ui.DiffElement.js 3 files changed, 14 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/15/371515/1 diff --git a/src/dm/ve.dm.Document.js b/src/dm/ve.dm.Document.js index 7c38cf4..6087c9b 100644 --- a/src/dm/ve.dm.Document.js +++ b/src/dm/ve.dm.Document.js @@ -656,16 +656,17 @@ * will be clones of the ones in this document. * * @param {ve.Range} [range] Range of data to clone, clones the whole document if ommitted. + * @param {boolean} [detachedCopy] The copy is not intended to be merged into the original * @return {ve.dm.Document} New document */ -ve.dm.Document.prototype.cloneFromRange = function ( range ) { +ve.dm.Document.prototype.cloneFromRange = function ( range, detachedCopy ) { var listRange = this.getInternalList().getListNode().getOuterRange(), data = ve.copy( this.getFullData( range, true ) ); if ( range && ( range.start > listRange.start || range.end < listRange.end ) ) { // The range does not include the entire internal list, so add it data = data.concat( this.getFullData( listRange ) ); } - return this.cloneWithData( data, true ); + return this.cloneWithData( data, true, detachedCopy ); }; /** @@ -675,9 +676,10 @@ * @param {Array|ve.dm.ElementLinearData|ve.dm.FlatLinearData} data Raw linear model data, * ElementLinearData or FlatLinearData * @param {boolean} [copyInternalList] Copy the internal list + * @param {boolean} [detachedCopy] The copy is not intended to be merged into the original * @return {ve.dm.Document} New document */ -ve.dm.Document.prototype.cloneWithData = function ( data, copyInternalList ) { +ve.dm.Document.prototype.cloneWithData = function ( data, copyInternalList, detachedCopy ) { var newDoc; if ( Array.isArray( data ) ) { @@ -697,7 +699,7 @@ // lang+dir this.getLang(), this.getDir() ); - if ( copyInternalList ) { + if ( copyInternalList && !detachedCopy ) { // Record the length of the internal list at the time the slice was created so we can // reconcile additions properly newDoc.origDoc = this; diff --git a/src/dm/ve.dm.VisualDiff.js b/src/dm/ve.dm.VisualDiff.js index a2c006e..5248160 100644 --- a/src/dm/ve.dm.VisualDiff.js +++ b/src/dm/ve.dm.VisualDiff.js @@ -18,8 +18,8 @@ * @param {Number} [timeout=1000] Timeout after which to stop performing linear diffs (in ms) */ ve.dm.VisualDiff = function VeDmVisualDiff( oldDoc, newDoc, timeout ) { - this.oldDoc = oldDoc.cloneFromRange(); - this.newDoc = newDoc.cloneFromRange(); + this.oldDoc = oldDoc.cloneFromRange( undefined, true ); + this.newDoc = newDoc.cloneFromRange( undefined, true ); this.oldDocNode = this.oldDoc.getDocumentNode(); this.newDocNode = this.newDoc.getDocumentNode(); this.oldDocChildren = this.getDocChildren( this.oldDocNode ); diff --git a/src/ui/elements/ve.ui.DiffElement.js b/src/ui/elements/ve.ui.DiffElement.js index e52a4c1..3a877e7 100644 --- a/src/ui/elements/ve.ui.DiffElement.js +++ b/src/ui/elements/ve.ui.DiffElement.js @@ -16,7 +16,7 @@ * @param {Object} [config] */ ve.ui.DiffElement = function VeUiDiffElement( visualDiff, config ) { - var diff = visualDiff.diff; + var tx, diff = visualDiff.diff; // Parent constructor ve.ui.DiffElement.super.call( this, config ); @@ -29,6 +29,11 @@ this.oldDocChildren = visualDiff.oldDocChildren; this.newDocChildren = visualDiff.newDocChildren; + // Merge the old internal list into the new document, so that it knows + // about removed references + tx = ve.dm.TransactionBuilder.static.newFromDocumentInsertion( this.newDoc, 0, this.oldDoc, new ve.Range( 0 ) ); + this.newDoc.commit( tx ); + // Internal list this.newDocInternalListNode = visualDiff.newDocInternalListNode; this.oldDocInternalListNode = visualDiff.oldDocInternalListNode; -- To view, visit https://gerrit.wikimedia.org/r/371515 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8a11d2d558236939fcb2e7c9fc018e3b93c8240e Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: VisualDiff: Refactor in preparation for historical diffs
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/368587 ) Change subject: VisualDiff: Refactor in preparation for historical diffs .. VisualDiff: Refactor in preparation for historical diffs Make computeDiff and associated functions more generic, so they can be used for the document diff and the internal list diff. (For historical revisions, assumptions we currently make about internal list diffs don't apply. Therefore the internal list diff will have to be done the same way as the document diff.) Change-Id: Idf7f694080f8f633147dd861ea0180140f16c1d8 --- M src/dm/ve.dm.VisualDiff.js M src/ui/elements/ve.ui.DiffElement.js 2 files changed, 95 insertions(+), 72 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/87/368587/1 diff --git a/src/dm/ve.dm.VisualDiff.js b/src/dm/ve.dm.VisualDiff.js index c6e2806..ab7352d 100644 --- a/src/dm/ve.dm.VisualDiff.js +++ b/src/dm/ve.dm.VisualDiff.js @@ -34,7 +34,14 @@ this.freezeInternalListIndices( this.oldDoc ); this.freezeInternalListIndices( this.newDoc ); - this.computeDiff(); + this.docDiff = {}; + this.internalListDiff = {}; + this.diff = { + docDiff: this.docDiff, + internalListDiff: this.getInternalListDiffInfo() + }; + + this.computeDiff( this.oldDocChildren, this.newDocChildren, this.docDiff, 'doc' ); }; /** @@ -84,91 +91,95 @@ }; /** - * Get the diff between the two documents, in two steps: (1) Compare the children - * of the old and new document nodes and record any pair where the old child and + * Get the diff between the two trees, in two steps: (1) Compare the children + * of the old and new root nodes and record any pair where the old child and * new child are identical. (If an old child is identical to two new children, it * will be paired with the first one only.) (2) If any children of the old or new - * document nodes remain unpaired, decide whether they are an old child that has + * root nodes remain unpaired, decide whether they are an old child that has * been removed, a new child that has been inserted, or a pair in which the old * child was changed into the new child. + * + * @param {Array} oldRootChildren Children of the old root node + * @param {Array} newRootChildren Children of the new root node + * @param {Object} diff Object that will contain information about the diff + * @param {String} diffType The type of diff to perform */ -ve.dm.VisualDiff.prototype.computeDiff = function () { +ve.dm.VisualDiff.prototype.computeDiff = function ( oldRootChildren, newRootChildren, diff, diffType ) { var i, ilen, j, jlen, - oldDocChildrenToDiff = [], - newDocChildrenToDiff = []; + oldRootChildrenToDiff = [], + newRootChildrenToDiff = []; - this.diff = { - docChildrenOldToNew: {}, - docChildrenNewToOld: {}, - docChildrenRemove: [], - docChildrenInsert: [], - internalListDiff: this.getInternalListDiffInfo() - }; + diff.rootChildrenOldToNew = {}; + diff.rootChildrenNewToOld = {}; + diff.rootChildrenRemove = []; + diff.rootChildrenInsert = []; - // STEP 1: Find identical document-node children + // STEP 1: Find identical root-node children - for ( i = 0, ilen = this.oldDocChildren.length; i < ilen; i++ ) { - for ( j = 0, jlen = this.newDocChildren.length; j < jlen; j++ ) { - if ( !this.diff.docChildrenNewToOld.hasOwnProperty( j ) && - this.compareDocChildren( this.oldDocChildren[ i ], this.newDocChildren[ j ] ) ) { + for ( i = 0, ilen = oldRootChildren.length; i < ilen; i++ ) { + for ( j = 0, jlen = newRootChildren.length; j < jlen; j++ ) { + if ( !diff.rootChildrenNewToOld.hasOwnProperty( j ) && + this.compareRootChildren( oldRootChildren[ i ], newRootChildren[ j ] ) ) { - this.diff.docChildrenOldToNew[ i ] = j; - this.diff.docChildrenNewToOld[ j ] = i; + diff.rootChildrenOldToNew[ i ] = j; + diff.rootChildrenNewToOld[ j ] = i; break; } // If no new nodes equalled the old node, add it to nodes to diff if ( j === jlen - 1 ) { - oldDocChildrenToDiff.push( i ); + oldRootChildrenToDiff.push( i ); } } } for ( j = 0; j < jlen; j++ ) { - if ( !this.diff.docChildrenNewToOld.hasOwnProperty( j ) ) { -
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: VisualDiff: Use and on whole paragraphs
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/364326 ) Change subject: VisualDiff: Use and on whole paragraphs .. VisualDiff: Use and on whole paragraphs When a whole child node of the document node is deleted or inserted, wrap the content in or tags. Bug: T170136 Change-Id: I106ba0ea3122d4b28e7008e5108c046df05c184e --- M src/ui/elements/ve.ui.DiffElement.js M src/ui/styles/elements/ve.ui.DiffElement.css M tests/ui/ve.ui.DiffElement.test.js 3 files changed, 28 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/26/364326/1 diff --git a/src/ui/elements/ve.ui.DiffElement.js b/src/ui/elements/ve.ui.DiffElement.js index b13f6fc..2550f15 100644 --- a/src/ui/elements/ve.ui.DiffElement.js +++ b/src/ui/elements/ve.ui.DiffElement.js @@ -375,7 +375,7 @@ * @return {HTMLElement[]} Elements (not owned by window.document) */ ve.ui.DiffElement.prototype.getNodeElements = function ( node, action, move ) { - var nodeData, doc, body, element, + var nodeData, doc, body, element, annIndex, annType, nodeDoc = action === 'remove' ? this.oldDoc : this.newDoc, documentSlice = nodeDoc.cloneFromRange( node.getOuterRange() ); @@ -385,9 +385,23 @@ // Add the classes to the outer element (in case there was a move) nodeData[ 0 ] = this.addAttributesToNode( nodeData[ 0 ], nodeDoc, { 'data-diff-action': action, 'data-diff-move': move } ); + if ( action !== 'none' ) { + annType = action === 'remove' ? 'textStyle/delete' : 'textStyle/insert'; + annIndex = documentSlice.getStore().index( + ve.dm.annotationFactory.create( annType, { + type: annType + } ) + ); + ve.dm.Document.static.addAnnotationsToData( + nodeData, + new ve.dm.AnnotationSet( documentSlice.getStore(), [ annIndex ] ) + ); + } + // Get the html for the linear model with classes // Doc is always the new doc when inserting into the store documentSlice.getStore().merge( this.newDoc.getStore() ); + // forClipboard is true, so that we can render otherwise invisible nodes doc = ve.dm.converter.getDomFromModel( documentSlice, true ); body = doc.body; diff --git a/src/ui/styles/elements/ve.ui.DiffElement.css b/src/ui/styles/elements/ve.ui.DiffElement.css index 274d6eb..55bbfbc 100644 --- a/src/ui/styles/elements/ve.ui.DiffElement.css +++ b/src/ui/styles/elements/ve.ui.DiffElement.css @@ -64,6 +64,7 @@ } [data-diff-action='insert'], +[data-diff-action='insert'] > ins, [data-diff-action='remove'], [data-diff-action='change-insert'], [data-diff-action='change-remove'] { @@ -96,13 +97,19 @@ display: none; } -del[data-diff-action='remove'] { +del[data-diff-action='remove'], +[data-diff-action='remove'] > del { text-decoration: line-through; } del[data-diff-action='remove']:hover { text-decoration: none; } +del[data-diff-action='remove']:hover, +[data-diff-action='remove']:hover > del { + text-decoration: none; +} + [data-diff-action='insert'] [rel='ve:Comment'], [data-diff-action='remove'] [rel='ve:Comment'], [data-diff-action='change-insert'] [rel='ve:Comment'], diff --git a/tests/ui/ve.ui.DiffElement.test.js b/tests/ui/ve.ui.DiffElement.test.js index 676e869..e88e64f 100644 --- a/tests/ui/ve.ui.DiffElement.test.js +++ b/tests/ui/ve.ui.DiffElement.test.js @@ -120,10 +120,10 @@ newDoc: 'boobarbaz', expected: '' + - 'foo' + + 'foo' + '' + '' + - 'boo' + + 'boo' + '' + 'bar' + spacer @@ -134,10 +134,10 @@ newDoc: 'boo', expected: '' + - 'foo' + + 'foo' + '' + '' + - 'boo' + + 'boo' + '' }, { @@ -187,7 +187,7 @@ 'Alien' + '' +
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Include message for comment diff
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/361516 ) Change subject: Include message for comment diff .. Include message for comment diff Bug: T149821 Change-Id: I6bfe77ecd53432e5c400f7efd60a1421d7917c4f --- M extension.json 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/16/361516/1 diff --git a/extension.json b/extension.json index 54f9a8f..8ed4279 100644 --- a/extension.json +++ b/extension.json @@ -1847,6 +1847,7 @@ "messages": [ "visualeditor-changedesc-align", "visualeditor-changedesc-changed", + "visualeditor-changedesc-comment", "visualeditor-changedesc-image-size", "visualeditor-changedesc-language", "visualeditor-changedesc-link-href", -- To view, visit https://gerrit.wikimedia.org/r/361516 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6bfe77ecd53432e5c400f7efd60a1421d7917c4f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: Visual Diff: add internal list diff
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/355716 ) Change subject: Visual Diff: add internal list diff .. Visual Diff: add internal list diff Display changes to references in the visual diff. Bug: T162819 Change-Id: If603a1861b32c1241396608ea1bd1927ebba9049 --- M src/dm/ve.dm.VisualDiff.js M src/ui/elements/ve.ui.DiffElement.js 2 files changed, 173 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/16/355716/1 diff --git a/src/dm/ve.dm.VisualDiff.js b/src/dm/ve.dm.VisualDiff.js index 750d112..6782614 100644 --- a/src/dm/ve.dm.VisualDiff.js +++ b/src/dm/ve.dm.VisualDiff.js @@ -21,16 +21,19 @@ this.oldDoc = oldDoc.cloneFromRange(); this.newDoc = newDoc.cloneFromRange(); - this.oldDocNode = oldDoc.getDocumentNode(); - this.newDocNode = newDoc.getDocumentNode(); + this.oldDocNode = this.oldDoc.getDocumentNode(); + this.newDocNode = this.newDoc.getDocumentNode(); this.oldDocChildren = this.oldDocNode.children; this.newDocChildren = this.newDocNode.children; + this.oldDocInternalListNode = this.oldDocChildren[ this.oldDocChildren.length - 1 ]; + this.newDocInternalListNode = this.newDocChildren[ this.newDocChildren.length - 1 ]; this.treeDiffer = treeDiffer; // eslint-disable-next-line camelcase,new-cap this.linearDiffer = new ve.DiffMatchPatch( this.oldDoc.getStore(), this.newDoc.getStore() ); this.endTime = new Date().getTime() + ( timeout || 1000 ); this.diff = this.getDiff(); + this.diff.internalListDiff = this.getInternalListDiffInfo(); }; /** @@ -364,6 +367,7 @@ if ( keepLength < 0.5 * diffLength ) { return false; } + return { treeDiff: treeDiff, diffInfo: diffInfo, @@ -372,3 +376,81 @@ }; }; + +/* + * Get the diff between the old document's internal list and the new document's + * internal list. The diff is grouped by list group, and each node in each list + * group is marked as removed, inserted, the same, or changed (in which case the + * linear diff is given). + * + * @return {Object} Internal list diff object + */ +ve.dm.VisualDiff.prototype.getInternalListDiffInfo = function () { + var i, ilen, diff, + group, groupIndexOrder, nodeIndex, + oldDocInternalListNodes = this.oldDoc.internalList.nodes, + newDocInternalListNodes = this.newDoc.internalList.nodes, + retainedInternalListItems = {}, + removedInternalListItems = {}, + internalListDiffInfo = {}; + + // Find all nodes referenced by the new document's internal list + for ( group in newDocInternalListNodes ) { + groupIndexOrder = newDocInternalListNodes[ group ].indexOrder; + internalListDiffInfo[ group ] = {}; + for ( i = 0, ilen = groupIndexOrder.length; i < ilen; i++ ) { + nodeIndex = groupIndexOrder[ i ]; + retainedInternalListItems[ nodeIndex ] = group; + internalListDiffInfo[ group ] = { + changes: false + }; + } + } + + // Find all nodes referenced by the old document's internal list + for ( group in oldDocInternalListNodes ) { + groupIndexOrder = oldDocInternalListNodes[ group ].indexOrder; + for ( i = 0, ilen = groupIndexOrder.length; i < ilen; i++ ) { + nodeIndex = groupIndexOrder[ i ]; + if ( retainedInternalListItems[ nodeIndex ] ) { + continue; + } + removedInternalListItems[ nodeIndex ] = group; + // TODO: Work out what should happen if the whole list group was removed + internalListDiffInfo[ group ] = { + changes: false + }; + } + } + + for ( i = 0, ilen = this.newDocInternalListNode.children.length; i < ilen; i++ ) { + nodeIndex = i; + group = retainedInternalListItems[ nodeIndex ] || removedInternalListItems[ nodeIndex ]; + if ( i > this.oldDocInternalListNode.children.length - 1 ) { + // Item was inserted + internalListDiffInfo[ group ][ nodeIndex ] = 1; + internalListDiffInfo[ group ].changes = true; + } else if ( i in removedInternalListItems ) { + // Item was removed + internalListDiffInfo[ group ][ nodeIndex ] = -1; + internalListDiffInfo[ group ].changes = true; + } else { +
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: MediaSearchWidget: Only resize new results
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/354129 ) Change subject: MediaSearchWidget: Only resize new results .. MediaSearchWidget: Only resize new results When repositioning images based on the "change" event, ignore images that have already been assigned to a row. Bug: T163727 Change-Id: Ida7556d8848f98d97d82aef9caf5c1d43bb47d7b --- M resources/src/mediawiki.widgets/MediaSearch/mw.widgets.MediaSearchWidget.js 1 file changed, 33 insertions(+), 26 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/29/354129/1 diff --git a/resources/src/mediawiki.widgets/MediaSearch/mw.widgets.MediaSearchWidget.js b/resources/src/mediawiki.widgets/MediaSearch/mw.widgets.MediaSearchWidget.js index 5cbd2ec..894905f 100644 --- a/resources/src/mediawiki.widgets/MediaSearch/mw.widgets.MediaSearchWidget.js +++ b/resources/src/mediawiki.widgets/MediaSearch/mw.widgets.MediaSearchWidget.js @@ -374,40 +374,47 @@ // Go over the added items row = search.getAvailableRow(); for ( i = 0, ilen = items.length; i < ilen; i++ ) { - itemWidth = items[ i ].$element.outerWidth( true ); - // Add items to row until it is full - if ( search.rows[ row ].width + itemWidth >= maxRowWidth ) { - // Mark this row as full - search.rows[ row ].isFull = true; - search.rows[ row ].$element.attr( 'data-full', true ); + // Check item has just been added + if ( items[ i ].row === null ) { - // Find the resize factor - effectiveWidth = search.rows[ row ].width; - resizeFactor = maxRowWidth / effectiveWidth; + itemWidth = items[ i ].$element.outerWidth( true ); - search.rows[ row ].$element.attr( 'data-effectiveWidth', effectiveWidth ); - search.rows[ row ].$element.attr( 'data-resizeFactor', resizeFactor ); - search.rows[ row ].$element.attr( 'data-row', row ); + // Add items to row until it is full + if ( search.rows[ row ].width + itemWidth >= maxRowWidth ) { + // Mark this row as full + search.rows[ row ].isFull = true; + search.rows[ row ].$element.attr( 'data-full', true ); - // Resize all images in the row to fit the width - for ( j = 0, jlen = search.rows[ row ].items.length; j < jlen; j++ ) { - search.rows[ row ].items[ j ].resizeThumb( resizeFactor ); + // Find the resize factor + effectiveWidth = search.rows[ row ].width; + resizeFactor = maxRowWidth / effectiveWidth; + + search.rows[ row ].$element.attr( 'data-effectiveWidth', effectiveWidth ); + search.rows[ row ].$element.attr( 'data-resizeFactor', resizeFactor ); + search.rows[ row ].$element.attr( 'data-row', row ); + + // Resize all images in the row to fit the width + for ( j = 0, jlen = search.rows[ row ].items.length; j < jlen; j++ ) { + search.rows[ row ].items[ j ].resizeThumb( resizeFactor ); + } + + // find another row + row = search.getAvailableRow(); } - // find another row - row = search.getAvailableRow(); + // Add the cumulative + search.rows[ row ].width += itemWidth; + + // Store reference to the item and to the row + search.rows[ row ].items.push( items[ i ] ); + items[ i ].setRow( row ); + +
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: ImageCaptionNode: correct documentation typo
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/344216 ) Change subject: ImageCaptionNode: correct documentation typo .. ImageCaptionNode: correct documentation typo Change-Id: Ic6e66e82662ec2fbf673062a0b3bc1087c54c4c7 --- M modules/ve-mw/ce/nodes/ve.ce.MWImageCaptionNode.js 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/16/344216/1 diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWImageCaptionNode.js b/modules/ve-mw/ce/nodes/ve.ce.MWImageCaptionNode.js index 484e53a..a9b5dd3 100644 --- a/modules/ve-mw/ce/nodes/ve.ce.MWImageCaptionNode.js +++ b/modules/ve-mw/ce/nodes/ve.ce.MWImageCaptionNode.js @@ -1,12 +1,12 @@ /*! - * VisualEditor ContentEditable ListItemNode class. + * VisualEditor ContentEditable ImageCaptionNode class. * * @copyright 2011-2017 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt */ /** - * ContentEditable image caption item node. + * ContentEditable image caption node. * * @class * @extends ve.ce.BranchNode -- To view, visit https://gerrit.wikimedia.org/r/344216 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic6e66e82662ec2fbf673062a0b3bc1087c54c4c7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: Update treeDiffer.js library
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/343136 ) Change subject: Update treeDiffer.js library .. Update treeDiffer.js library https://github.com/Tchanders/treeDiffer.js/commit/c0aa2c6 Change-Id: I9ce8148512b06004ca87d5749a5f165d731559a3 --- M lib/treeDiffer/treeDiffer-dist.js 1 file changed, 5 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/36/343136/1 diff --git a/lib/treeDiffer/treeDiffer-dist.js b/lib/treeDiffer/treeDiffer-dist.js index 4240dcd..0333ed3 100644 --- a/lib/treeDiffer/treeDiffer-dist.js +++ b/lib/treeDiffer/treeDiffer-dist.js @@ -173,6 +173,10 @@ * Released under the MIT license */ +// eslint-disable dot-notation +// We use [ 'null' ] as an index, but for consistencty with +// variable indicies [ i ][ j ] we prefer not to use dot notation + /** * Differ * @@ -462,7 +466,7 @@ remove.sort( function ( a, b ) { return a - b; } ); insert.sort( function ( a, b ) { return a - b; } ); - for ( i = 0, j = 0; i < ilen, j < jlen; i++, j++ ) { + for ( i = 0, j = 0; i < ilen && j < jlen; i++, j++ ) { if ( i === remove[ 0 ] ) { // Old node is a remove remove.shift(); -- To view, visit https://gerrit.wikimedia.org/r/343136 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9ce8148512b06004ca87d5749a5f165d731559a3 Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Remove line breaks from gallery dialog captions
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/342242 ) Change subject: Remove line breaks from gallery dialog captions .. Remove line breaks from gallery dialog captions A gallery tag is parsed line by line, so captions (and other image data) should not contain line breaks Bug: T153373 Change-Id: Ib1d1c18216d07c83b2d4358d2dda71c9d17e3e44 --- M modules/ve-mw/ui/widgets/ve.ui.MWGalleryItemWidget.js 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/42/342242/1 diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWGalleryItemWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWGalleryItemWidget.js index 674395a..e93f227 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWGalleryItemWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWGalleryItemWidget.js @@ -82,7 +82,7 @@ * @param {string} caption The caption */ ve.ui.MWGalleryItemWidget.prototype.setCaption = function ( caption ) { - this.caption = caption; + this.caption = caption.replace('\n', ' '); }; /** -- To view, visit https://gerrit.wikimedia.org/r/342242 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib1d1c18216d07c83b2d4358d2dda71c9d17e3e44 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Update gallery actions in response to changes
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/342240 ) Change subject: Update gallery actions in response to changes .. Update gallery actions in response to changes Change-Id: Icf51b92cb9a88471c5f11843473523787c177742 --- M modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js 1 file changed, 69 insertions(+), 34 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/40/342240/1 diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js index 5df7232..0c3a3ee 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js @@ -332,7 +332,6 @@ this.toggleEmptyGalleryMessage( true ); this.showSearchPanelButton.toggle( false ); this.toggleSearchPanel( true ); - this.updateActions(); } // Options card @@ -362,11 +361,20 @@ // Add event handlers this.indexLayout.connect( this, { set: 'updateDialogSize' } ); + this.highlightedCaptionInput.connect( this, { change: 'updateActions' } ); this.searchWidget.getResults().connect( this, { choose: 'onSearchResultsChoose' } ); this.showSearchPanelButton.connect( this, { click: 'onShowSearchPanelButtonClick' } ); this.galleryGroup.connect( this, { editItem: 'onHighlightItem' } ); + this.galleryGroup.connect( this, { itemDragEnd: 'updateActions' } ); this.removeButton.connect( this, { click: 'onRemoveItem' } ); this.modeDropdown.getMenu().connect( this, { choose: 'onModeDropdownChange' } ); + this.captionInput.connect( this, { change: 'updateActions' } ); + this.widthsInput.connect( this, { change: 'updateActions' } ); + this.heightsInput.connect( this, { change: 'updateActions' } ); + this.perrowInput.connect( this, { change: 'updateActions' } ); + this.showFilenameCheckbox.connect( this, { change: 'updateActions' } ); + this.classesInput.connect( this, { change: 'updateActions' } ); + this.stylesInput.connect( this, { change: 'updateActions' } ); // Hack: Give the input a value so that this.insertOrUpdateNode gets called this.input.setValue( 'gallery' ); @@ -398,11 +406,19 @@ // Disconnect events this.indexLayout.disconnect( this ); + this.highlightedCaptionInput.disconnect( this ); this.searchWidget.getResults().disconnect( this ); this.showSearchPanelButton.disconnect( this ); this.galleryGroup.disconnect( this ); this.removeButton.disconnect( this ); this.modeDropdown.disconnect( this ); + this.captionInput.disconnect( this ); + this.widthsInput.disconnect( this ); + this.heightsInput.disconnect( this ); + this.perrowInput.disconnect( this ); + this.showFilenameCheckbox.disconnect( this ); + this.classesInput.disconnect( this ); + this.stylesInput.disconnect( this ); }, this ); }; @@ -508,6 +524,8 @@ if ( !Object.prototype.hasOwnProperty( this.selectedFilenames, title ) ) { this.addNewImage( title ); } + + this.updateActions(); }; /** @@ -577,6 +595,8 @@ // heights is only ignored in slideshow mode this.heightsInput.setDisabled( mode === 'slideshow' ); + + this.updateActions(); }; /** @@ -661,50 +681,65 @@ * Disable the "Done" button if the gallery is empty, otherwise enable it */ ve.ui.MWGalleryDialog.prototype.updateActions = function () { - this.actions.setAbilities( { done: this.galleryGroup.items.length > 0 } ); + this.actions.setAbilities( { done: this.galleryGroup.items.length > 0 && this.isModified() } ); +}; + +/** + * Get the current images and options data + * + * @return {Object} Images and options data + */ +ve.ui.MWGalleryDialog.prototype.getCurrentData = function () { + var i, ilen, + data = {}, + items = this.galleryGroup.items; + + // Get data from options card + data.mode = this.modeDropdown.getMenu().getSelectedItem().getData(); + data.caption = this.captionInput.getValue() || undefined; +
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: WIP Clean up DiffElement logic
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/340656 ) Change subject: WIP Clean up DiffElement logic .. WIP Clean up DiffElement logic In particular, distinguish between structural differences from content differences. This vastly improves list handling, and paves the way for structural list diffs to be described like annotation changes, so removed/inserted highlighting is reserved for actual content. To do: make sure removed content is only spliced in once Bug: T149537 Change-Id: I997793770b150739df32f15c2f2ac1454ee9c9c7 --- M src/ui/elements/ve.ui.DiffElement.js 1 file changed, 90 insertions(+), 76 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/56/340656/1 diff --git a/src/ui/elements/ve.ui.DiffElement.js b/src/ui/elements/ve.ui.DiffElement.js index e82e94e..eb514a6 100644 --- a/src/ui/elements/ve.ui.DiffElement.js +++ b/src/ui/elements/ve.ui.DiffElement.js @@ -217,7 +217,8 @@ newTree = diff.newTree, oldNodes = oldTree.orderedNodes, newNodes = newTree.orderedNodes, - correspondingNodes = this.oldToNew[ oldNodeIndex ].correspondingNodes; + correspondingNodes = this.oldToNew[ oldNodeIndex ].correspondingNodes, + structuralRemoves = []; /** * Splice in the removed data for the subtree rooted at this node, from the old @@ -226,58 +227,76 @@ * @param {number} nodeIndex The index of this node in the subtree rooted at * this document child */ - function highlightRemovedSubTree( nodeIndex ) { - var i, ilen, subTreeRootNode, subTreeRootNodeData, siblingNodes, - newPreviousNodeIndex, oldPreviousNodeIndex, insertIndex, descendants; + function highlightRemovedNode( nodeIndex ) { + var i, ilen, node, nodeDiffData, siblingNodes, + newPreviousNodeIndex, oldPreviousNodeIndex, insertIndex, + highestRemovedAncestor; + + function findRemovedAncestor( node ) { + if ( !node.parent ) { + return node.index; + } else if ( structuralRemoves.indexOf( node.parent.index ) === -1 ) { + return node.index; + } else { + return findRemovedAncestor( node.parent ); + } + } // Get outer data for this node from the old doc and add remove class - subTreeRootNode = oldNodes[ nodeIndex ]; - subTreeRootNodeData = this.oldDoc.getData( subTreeRootNode.node.getOuterRange() ); - subTreeRootNodeData[ 0 ] = this.addAttributesToNode( subTreeRootNodeData[ 0 ], this.oldDoc, { 'data-diff-action': 'remove' } ); + node = oldNodes[ nodeIndex ]; + // nodeDiffData = this.oldDoc.getData( node.node.getOuterRange() ); + // nodeDiffData[ 0 ] = this.addAttributesToNode( nodeDiffData[ 0 ], this.oldDoc, { + // 'data-diff-action': node.node instanceof ve.dm.ContentBranchNode ? 'remove' : 'structural-remove' + // } ); - // If this node is a child of the document node, then it won't have a "previous - // node" (see below), in which case, insert it just before its corresponding - // node in the new document. - if ( subTreeRootNode.index === 0 ) { - insertIndex = newNodes[ correspondingNodes.oldToNew[ 0 ] ] - .node.getOuterRange().from - nodeRange.from; + if ( !( node.node instanceof ve.dm.ContentBranchNode ) ) { + structuralRemoves.push( nodeIndex ); } else { + // Find highest inserted ancestor + highestRemovedAncestor = oldNodes[ findRemovedAncestor( node ) ]; - // Find the node that corresponds to the "previous node" of this node. The - // "previous node" is either: - // - the rightmost left sibling that corresponds to a node in the new document - // - or if there isn't one, then this node's parent (which must correspond to - // a node in the new document, or this node would have been marked already - // processed) - siblingNodes = subTreeRootNode.parent.children; - for ( i = 0, ilen = siblingNodes.length; i < ilen; i++ ) { - if ( siblingNodes[ i ].index === nodeIndex ) { - break; + // If this node is a child of the document node, then it won't
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: VisualDiff: Distinguish between annotation/character changes
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/336547 ) Change subject: VisualDiff: Distinguish between annotation/character changes .. VisualDiff: Distinguish between annotation/character changes Add a check to see if adjacent removed and inserted content has the same characters. If so, describe it as a change instead, and add change classes. This commit does not change the design of the diff - yet. Bug: T156189 Change-Id: I5925c608fd7daf551e5f3708e8ea7954c6df23ec --- M src/dm/lineardata/ve.dm.ElementLinearData.js M src/dm/ve.dm.VisualDiff.js M src/ui/elements/ve.ui.DiffElement.js M src/ui/styles/elements/ve.ui.DiffElement.css 4 files changed, 78 insertions(+), 10 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/47/336547/1 diff --git a/src/dm/lineardata/ve.dm.ElementLinearData.js b/src/dm/lineardata/ve.dm.ElementLinearData.js index f7bc569..c45c80c 100644 --- a/src/dm/lineardata/ve.dm.ElementLinearData.js +++ b/src/dm/lineardata/ve.dm.ElementLinearData.js @@ -476,6 +476,20 @@ }; /** + * Get character data from some linear data + * + * @param {Array} linearData Linear data from which to get character + * @return {string} Character data + */ +ve.dm.ElementLinearData.static.getCharacterDataFromLinearData = function ( linearData ) { + var i, ilen, data = ''; + for ( i = 0, ilen = linearData.length; i < ilen; i++ ) { + data += Array.isArray( linearData[ i ] ) ? linearData[ i ][ 0 ] : linearData[ i ]; + } + return data.length > 0 ? data : ''; +}; + +/** * Gets the range of content surrounding a given offset that's covered by a given annotation. * * @method diff --git a/src/dm/ve.dm.VisualDiff.js b/src/dm/ve.dm.VisualDiff.js index 4861914..4e93411 100644 --- a/src/dm/ve.dm.VisualDiff.js +++ b/src/dm/ve.dm.VisualDiff.js @@ -294,7 +294,8 @@ * @return {Array} A human-friendlier linear diff */ function getCleanDiff( diff ) { - var i, ilen, action, data, firstWordbreak, lastWordbreak, start, end, + var i, ilen, action, data, firstWordbreak, lastWordbreak, + start, end, aItem, bItem, aAction, bAction, previousData = null, previousAction = null, cleanDiff = [], @@ -406,6 +407,30 @@ cleanDiff.push( [ 1, insert ] ); } + // Finally, go over any consecutive remove-inserts (also insert-removes?) + // and if they have the same character data, make them changes instead + for ( i = 0, ilen = cleanDiff.length - 1; i < ilen; i++ ) { + aItem = cleanDiff[ i ]; + bItem = cleanDiff[ i + 1 ]; + aAction = aItem[ 0 ]; + bAction = bItem[ 0 ]; + // If they have the same length content and they are a consecutive + // remove and insert, and they have the same contentm then mark the + // old one as a change-remove (-2) and the new one as a change-insert + // (2) + if ( + ( aItem[ 1 ].length === bItem[ 1 ].length ) && + ( aAction === -1 && bAction === 1 || aAction === 1 && bAction === -1 ) && + ( ve.dm.ElementLinearData.static.getCharacterDataFromLinearData( aAction ) === + ve.dm.ElementLinearData.static.getCharacterDataFromLinearData( bAction ) ) + ) { + aAction = aAction === -1 ? -2 : 2; + bAction = bAction === -1 ? -2 : 2; + // No need to check bItem against the following item + i += 1; + } + } + return cleanDiff; } diff --git a/src/ui/elements/ve.ui.DiffElement.js b/src/ui/elements/ve.ui.DiffElement.js index 67fbdcb..c95215f 100644 --- a/src/ui/elements/ve.ui.DiffElement.js +++ b/src/ui/elements/ve.ui.DiffElement.js @@ -475,7 +475,7 @@ * @return {Array} Data with annotations added */ ve.ui.DiffElement.prototype.annotateNode = function ( linearDiff ) { - var i, ilen, range, type, annType, + var i, ilen, range, type, typeAsString, annType, domElementType, start = 0, // The starting index for a range for building an annotation end, transaction, annotatedLinearDiff, domElement, domElements, originalDomElementsIndex, @@ -495,16 +495,37 @@ if ( start !== end ) { range = { start: start, end: end }; type = linearDiff[ i ][ 0 ]; -
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: Follow-up on Id00817
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/334205 ) Change subject: Follow-up on Id00817 .. Follow-up on Id00817 Correct a mistake with handling of forced replacements. Change-Id: I348899e0a467f9e8bd4fc95abba0218ada5963b5 --- M src/ui/elements/ve.ui.DiffElement.js 1 file changed, 35 insertions(+), 24 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/05/334205/1 diff --git a/src/ui/elements/ve.ui.DiffElement.js b/src/ui/elements/ve.ui.DiffElement.js index 63b6e24..2075de1 100644 --- a/src/ui/elements/ve.ui.DiffElement.js +++ b/src/ui/elements/ve.ui.DiffElement.js @@ -223,31 +223,42 @@ subTreeRootNodeData = this.oldDoc.getData( subTreeRootNode.node.getOuterRange() ); subTreeRootNodeData[ 0 ] = this.addClassesToNode( subTreeRootNodeData[ 0 ], this.oldDoc, 'remove' ); - // Find the node that corresponds to the "previous node" of this node. The - // "previous node" is either: - // - the rightmost left sibling that corresponds to a node in the new document - // - or if there isn't one, then this node's parent (which must correspond to - // a node in the new document, or this node would have been marked already - // processed) - siblingNodes = subTreeRootNode.parent.children; - for ( i = 0, ilen = siblingNodes.length; i < ilen; i++ ) { - if ( siblingNodes[ i ].index === nodeIndex ) { - break; - } else { - oldPreviousNodeIndex = siblingNodes[ i ].index; - newPreviousNodeIndex = correspondingNodes.oldToNew[ oldPreviousNodeIndex ] || newPreviousNodeIndex; + // If this node is a child of the document node, then it won't have a "previous + // node" (see below), in which case, insert it just before its corresponding + // node in the new document. + if ( subTreeRootNode.index === 0 ) { + insertIndex = newNodes[ correspondingNodes.oldToNew[ 0 ] ] + .node.getOuterRange().from - nodeRange.from; + } else { + + // Find the node that corresponds to the "previous node" of this node. The + // "previous node" is either: + // - the rightmost left sibling that corresponds to a node in the new document + // - or if there isn't one, then this node's parent (which must correspond to + // a node in the new document, or this node would have been marked already + // processed) + siblingNodes = subTreeRootNode.parent.children; + for ( i = 0, ilen = siblingNodes.length; i < ilen; i++ ) { + if ( siblingNodes[ i ].index === nodeIndex ) { + break; + } else { + oldPreviousNodeIndex = siblingNodes[ i ].index; + newPreviousNodeIndex = correspondingNodes.oldToNew[ oldPreviousNodeIndex ] || newPreviousNodeIndex; + } } + + // If previous node was found among siblings, insert the removed subtree just + // after its corresponding node in the new document. Otherwise insert the + // removed subtree just inside its parent node's corresponding node. + if ( newPreviousNodeIndex ) { + insertIndex = newNodes[ newPreviousNodeIndex ].node.getRange().to - nodeRange.from; + } else { + newPreviousNodeIndex = correspondingNodes.oldToNew[ subTreeRootNode.parent.index ]; + insertIndex = newNodes[ newPreviousNodeIndex ].node.getRange().from - nodeRange.from; + } + } - // If previous node was found among siblings, insert the removed subtree just - // after its corresponding node in the new document. Otherwise insert the - // removed subtree just inside its parent node's corresponding node. - if ( newPreviousNodeIndex ) { - insertIndex = newNodes[ newPreviousNodeIndex ].node.getRange().to - nodeRange.from; - } else { - newPreviousNodeIndex = correspondingNodes.oldToNew[ subTreeRootNode.parent.index ]; - insertIndex = newNodes[ newPreviousNodeIndex ].node.getRange().from - nodeRange.from; - }
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: WIP Visual diff node type and attribute changes
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/333992 ) Change subject: WIP Visual diff node type and attribute changes .. WIP Visual diff node type and attribute changes Detect and record node type and attribute changes. To do: work out how to display these Also display changed sub-trees according to whether they have content, type and/or attribute changes, rather than whether they involve content branch nodes. Bug: T151404 Bug: T151589 Change-Id: Id00817d05aa08420ad31681eb55ed451ea36ce2f --- M src/dm/ve.dm.VisualDiff.js M src/ui/elements/ve.ui.DiffElement.js 2 files changed, 45 insertions(+), 13 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/92/333992/1 diff --git a/src/dm/ve.dm.VisualDiff.js b/src/dm/ve.dm.VisualDiff.js index c5fad39..48ac90a 100644 --- a/src/dm/ve.dm.VisualDiff.js +++ b/src/dm/ve.dm.VisualDiff.js @@ -243,7 +243,7 @@ insertLength, diffLength = 0, keepLength = 0, - diffInfo = {}; + diffInfo = []; /** * Get the index of the first or last wordbreak in a data array @@ -436,16 +436,22 @@ !( newNode instanceof ve.dm.ContentBranchNode ) ) { // There is no content change + diffInfo.push( { + typeChange: oldNode.type !== newNode.type, + attributeChange: !ve.compare( oldNode.getAttributes(), newNode.getAttributes() ) + } ); continue; } else if ( !( newNode instanceof ve.dm.ContentBranchNode ) ) { // Content was removed + diffInfo.push( { replacement: true } ); removeLength = oldNode.length; } else if ( !( oldNode instanceof ve.dm.ContentBranchNode ) ) { // Content was inserted + diffInfo.push( { replacement: true } ); insertLength = newNode.length; // If we got this far, they are both CBNs @@ -458,7 +464,11 @@ linearDiff = getCleanDiff( linearDiff ); - diffInfo[ i ] = { linearDiff: linearDiff }; + diffInfo.push( { + linearDiff: linearDiff, + typeChange: oldNode.type !== newNode.type, + attributeChange: !ve.compare( oldNode.getAttributes(), newNode.getAttributes() ) + } ); // Record how much content was removed and inserted for ( j = 0, jlen = linearDiff.length; j < jlen; j++ ) { diff --git a/src/ui/elements/ve.ui.DiffElement.js b/src/ui/elements/ve.ui.DiffElement.js index d7fad7b..9d87bc1 100644 --- a/src/ui/elements/ve.ui.DiffElement.js +++ b/src/ui/elements/ve.ui.DiffElement.js @@ -241,7 +241,7 @@ // If previous node was found among siblings, insert the removed subtree just // after its corresponding node in the new document. Otherwise insert the - // removed subtree just inside its parent node's correspondign node. + // removed subtree just inside its parent node's corresponding node. if ( newPreviousNodeIndex ) { insertIndex = newNodes[ newPreviousNodeIndex ].node.getRange().to - nodeRange.from; } else { @@ -288,27 +288,38 @@ * Mark this node as changed and, if it is a content branch node, splice in * the diff data. * -* @param {number} nodeIndex The index of this node in the subtree rooted at -* this document child +* @param {number} newNodeIndex The index of the new node in the subtree rooted at +* the new document child +* @param {number} oldNodeIndex The index of the old node in the subtree rooted at +* the old document child */ - function highlightChangedSubTree( nodeIndex ) { - var subTreeRootNode, subTreeRootNodeRangeStart, subTreeRootNodeData, annotatedData; + function highlightChangedSubTree( newNodeIndex, oldNodeIndex ) { + var subTreeRootNode, subTreeRootNodeRangeStart, subTreeRootNodeData, annotatedData, + subTreeDiffInfo = diffInfo[ k ]; // The new node was changed. // Get data for this node - subTreeRootNode = newNodes[ nodeIndex ]; + subTreeRootNode = newNodes[ newNodeIndex ];
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: Fix a typo in visual diffs
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/333972 ) Change subject: Fix a typo in visual diffs .. Fix a typo in visual diffs Change-Id: If093ea3064c6c47836510e9d81b2deae0eb0a589 --- M src/ui/elements/ve.ui.DiffElement.js 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/72/333972/1 diff --git a/src/ui/elements/ve.ui.DiffElement.js b/src/ui/elements/ve.ui.DiffElement.js index d7fad7b..3ce3148 100644 --- a/src/ui/elements/ve.ui.DiffElement.js +++ b/src/ui/elements/ve.ui.DiffElement.js @@ -340,7 +340,7 @@ // The new node was changed. for ( k = 0, klen = treeDiff.length; k < klen; k++ ) { if ( treeDiff[ k ][ 0 ] === iModified && treeDiff[ k ][ 1 ] === jModified ) { - if ( !( iModified in alreadyProcessed.remove ) && + if ( !( jModified in alreadyProcessed.remove ) && !( iModified in alreadyProcessed.insert ) ) { highlightChangedSubTree.call( this, iModified ); -- To view, visit https://gerrit.wikimedia.org/r/333972 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If093ea3064c6c47836510e9d81b2deae0eb0a589 Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Correct BlockImageNode to MWBlockImageNode in comment
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/332091 ) Change subject: Correct BlockImageNode to MWBlockImageNode in comment .. Correct BlockImageNode to MWBlockImageNode in comment Change-Id: I99058f97ac74b57c648be51cdb267d24a197b16a --- M modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/91/332091/1 diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js index d83e1b8..f7f938c 100644 --- a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js +++ b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js @@ -29,7 +29,7 @@ this.captionVisible = false; this.typeToRdfa = this.getTypeToRdfa(); - // DOM Hierarchy for BlockImageNode: + // DOM Hierarchy for MWBlockImageNode: //this.$element (ve-ce-mwBlockImageNode-{type}) // this.$a //this.$image -- To view, visit https://gerrit.wikimedia.org/r/332091 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I99058f97ac74b57c648be51cdb267d24a197b16a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Update actions on live inspectors and preview dialogs
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/332084 ) Change subject: Update actions on live inspectors and preview dialogs .. Update actions on live inspectors and preview dialogs Make inspectors inheriting from MWLiveExtensionInspector and dialogs inheriting from MWExtensionPreviewDialog update their 'done' action every time updatePreview is called. Since both mix in ExtensionWindow, two new methods, updateActions and isModified are added there. This should make it more difficult to insert an empty node accidentally or create a transaction just by opening and closing an inspector or dialog. For more complicated dialogs, or inspectors or dialogs that don't live-update, this behaviour will have to be implemented separately. Bug: T155330 Change-Id: Iacafa01fcd419faaec9b112c96be86693a57d561 --- M modules/ve-mw/ui/dialogs/ve.ui.MWExtensionPreviewDialog.js M modules/ve-mw/ui/inspectors/ve.ui.MWLiveExtensionInspector.js M modules/ve-mw/ui/ve.ui.MWExtensionWindow.js 3 files changed, 32 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/84/332084/1 diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWExtensionPreviewDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWExtensionPreviewDialog.js index d956d1e..01825c6 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWExtensionPreviewDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWExtensionPreviewDialog.js @@ -80,6 +80,7 @@ doc = this.previewNode.getDocument(); this.updateMwData( mwData ); + this.updateActions(); doc.commit( ve.dm.TransactionBuilder.static.newFromAttributeChanges( diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWLiveExtensionInspector.js b/modules/ve-mw/ui/inspectors/ve.ui.MWLiveExtensionInspector.js index ce9b000..25b934f 100644 --- a/modules/ve-mw/ui/inspectors/ve.ui.MWLiveExtensionInspector.js +++ b/modules/ve-mw/ui/inspectors/ve.ui.MWLiveExtensionInspector.js @@ -120,6 +120,7 @@ var mwData = ve.copy( this.selectedNode.getAttribute( 'mw' ) ); this.updateMwData( mwData ); + this.updateActions(); this.hideGeneratedContentsError(); diff --git a/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js b/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js index 203007c..c2ea83f 100644 --- a/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js +++ b/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js @@ -17,6 +17,7 @@ ve.ui.MWExtensionWindow = function VeUiMWExtensionWindow() { this.whitespace = null; this.input = null; + this.originalMwData = null; }; /* Inheritance */ @@ -80,6 +81,7 @@ if ( this.selectedNode ) { this.input.setValueAndWhitespace( this.selectedNode.getAttribute( 'mw' ).body.extsrc ); + this.originalMwData = this.selectedNode.getAttribute( 'mw' ); } else { if ( !this.constructor.static.modelClasses[ 0 ].static.isContent ) { // New nodes should use linebreaks for blocks @@ -92,6 +94,9 @@ dir = this.constructor.static.dir || data.dir; this.input.setDir( dir ); + + this.actions.setAbilities( { done: false } ); + this.input.connect( this, { change: 'updateActions' } ); }, this ); }; @@ -127,6 +132,31 @@ }; /** + * Update the 'done' action according to whether there are changes + */ +ve.ui.MWExtensionWindow.prototype.updateActions = function () { + this.actions.setAbilities( { done: this.isModified() } ); +}; + +/** + * Check if mwData would be modified if window contents were applied + * + * @return {boolean} mwData would be modified + */ +ve.ui.MWExtensionWindow.prototype.isModified = function () { + var mwDataCopy, modified; + + if ( this.originalMwData ) { + mwDataCopy = ve.copy( this.originalMwData ); + this.updateMwData( mwDataCopy ); + modified = !ve.compare( this.originalMwData, mwDataCopy ); + } else { + modified = true; + } + return modified; +}; + +/** * Create an new data element for the model class associated with this inspector * * @return {Object} Element data -- To view, visit https://gerrit.wikimedia.org/r/332084 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iacafa01fcd419faaec9b112c96be86693a57d561 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Allow AceEditorWidget to accept autocomplete word list
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/331685 ) Change subject: Allow AceEditorWidget to accept autocomplete word list .. Allow AceEditorWidget to accept autocomplete word list Bug: T155107 Change-Id: I2dd752fb55a4d5596dbc8b8dc69eb55083d7ec66 --- M modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js 1 file changed, 16 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/85/331685/1 diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js index cd646ad..96bdb83 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js @@ -33,6 +33,7 @@ config = config || {}; this.autocomplete = config.autocomplete || 'none'; + this.autocompleteWordList = config.autocompleteWordList || []; this.$ace = $( '' ); this.editor = null; @@ -99,7 +100,20 @@ * @fires resize */ ve.ui.MWAceEditorWidget.prototype.setupEditor = function () { - var basePath = mw.config.get( 'wgExtensionAssetsPath', '' ); + var basePath = mw.config.get( 'wgExtensionAssetsPath', '' ), + widget = this, + completer = { + getCompletions: function( editor, session, pos, prefix, callback ) { + var wordList = widget.autocompleteWordList; + callback( null, wordList.map( function( word ) { + return { + caption: word, + value: word, + meta: 'static' + }; + } ) ); + } + }; if ( basePath.slice( 0, 2 ) === '//' ) { // ACE uses web workers, which have importScripts, which don't like relative links. basePath = window.location.protocol + basePath; @@ -113,6 +127,7 @@ enableBasicAutocompletion: this.autocomplete !== 'none', enableLiveAutocompletion: this.autocomplete === 'live' } ); + this.editor.completers = [ completer ]; this.editor.getSession().on( 'change', this.onEditorChange.bind( this ) ); this.editor.renderer.on( 'resize', this.onEditorResize.bind( this ) ); this.setEditorValue( this.getValue() ); -- To view, visit https://gerrit.wikimedia.org/r/331685 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2dd752fb55a4d5596dbc8b8dc69eb55083d7ec66 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...Math[master]: Add word list to math dialog for autocompletion
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/331684 ) Change subject: Add word list to math dialog for autocompletion .. Add word list to math dialog for autocompletion Bug: T155107 Change-Id: I57bbf9d9a75810cd06b9ba43a173f9bf4a74c9fc --- M modules/ve-math/ve.ui.MWMathDialog.js 1 file changed, 74 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/84/331684/1 diff --git a/modules/ve-math/ve.ui.MWMathDialog.js b/modules/ve-math/ve.ui.MWMathDialog.js index 0d57bd2..6fb481a 100644 --- a/modules/ve-math/ve.ui.MWMathDialog.js +++ b/modules/ve-math/ve.ui.MWMathDialog.js @@ -39,6 +39,78 @@ ve.ui.MWMathDialog.static.symbols = null; +ve.ui.MWMathDialog.static.autocompleteWordList = [ + '\\AA', '\\aleph', '\\alpha', '\\amalg', '\\And', '\\angle', '\\approx', '\\approxeq', + '\\ast', '\\asymp', '\\backepsilon', '\\backprime', '\\backsim', '\\backsimeq', '\\barwedge', '\\Bbbk', '\\because', '\\beta', + '\\beth', '\\between', '\\bigcap', '\\bigcirc', '\\bigcup', '\\bigodot', '\\bigoplus', '\\bigotimes', '\\bigsqcup', '\\bigstar', + '\\bigtriangledown', '\\bigtriangleup', '\\biguplus', '\\bigvee', '\\bigwedge', '\\blacklozenge', '\\blacksquare', '\\blacktriangle', '\\blacktriangledown', '\\blacktriangleleft', + '\\blacktriangleright', '\\bot', '\\bowtie', '\\Box', '\\boxdot', '\\boxminus', '\\boxplus', '\\boxtimes', '\\bullet', '\\bumpeq', + '\\Bumpeq', '\\cap', '\\Cap', '\\cdot', '\\cdots', '\\centerdot', '\\checkmark', '\\chi', '\\circ', '\\circeq', + '\\circlearrowleft', '\\circlearrowright', '\\circledast', '\\circledcirc', '\\circleddash', '\\circledS', '\\clubsuit', '\\colon', '\\color', '\\complement', + '\\cong', '\\coprod', '\\cup', '\\Cup', '\\curlyeqprec', '\\curlyeqsucc', '\\curlyvee', '\\curlywedge', '\\curvearrowleft', '\\curvearrowright', + '\\dagger', '\\daleth', '\\dashv', '\\ddagger', '\\ddots', '\\definecolor', '\\delta', '\\Delta', '\\diagdown', '\\diagup', + '\\diamond', '\\Diamond', '\\diamondsuit', '\\digamma', '\\displaystyle', '\\div', '\\divideontimes', '\\doteq', '\\doteqdot', '\\dotplus', + '\\dots', '\\dotsb', '\\dotsc', '\\dotsi', '\\dotsm', '\\dotso', '\\doublebarwedge', '\\downdownarrows', '\\downharpoonleft', '\\downharpoonright', + '\\ell', '\\emptyset', '\\epsilon', '\\eqcirc', '\\eqsim', '\\eqslantgtr', '\\eqslantless', '\\equiv', '\\eta', '\\eth', + '\\exists', '\\fallingdotseq', '\\Finv', '\\flat', '\\forall', '\\frown', '\\Game', '\\gamma', '\\Gamma', '\\geq', + '\\geqq', '\\geqslant', '\\gets', '\\gg', '\\ggg', '\\gimel', '\\gnapprox', '\\gneq', '\\gneqq', '\\gnsim', + '\\gtrapprox', '\\gtrdot', '\\gtreqless', '\\gtreqqless', '\\gtrless', '\\gtrsim', '\\gvertneqq', '\\hbar', '\\heartsuit', '\\hline', + '\\hookleftarrow', '\\hookrightarrow', '\\hslash', '\\iff', '\\nt', '\\iiint', '\\iint', '\\Im', '\\imath', '\\implies', + '\\in', '\\infty', '\\injlim', '\\int', '\\intercal', '\\iota', '\\jmath', '\\kappa', '\\lambda', '\\Lambda', + '\\land', '\\ldots', '\\leftarrow', '\\Leftarrow', '\\leftarrowtail', '\\leftharpoondown', '\\leftharpoonup', '\\leftleftarrows', '\\leftrightarrow', '\\Leftrightarrow', + '\\leftrightarrows', '\\leftrightharpoons', '\\leftrightsquigarrow', '\\leftthreetimes', '\\leq', '\\leqq', '\\leqslant', '\\lessapprox', '\\lessdot', '\\lesseqgtr', + '\\lesseqqgtr', '\\lessgtr', '\\lesssim', '\\limits', '\\ll', '\\Lleftarrow', '\\lll', '\\lnapprox', '\\lneq', '\\lneqq', + '\\lnot', '\\lnsim', '\\longleftarrow', '\\Longleftarrow', '\\longleftrightarrow', '\\Longleftrightarrow', '\\longmapsto', '\\longrightarrow', '\\Longrightarrow', '\\looparrowleft', + '\\looparrowright', '\\lor', '\\lozenge', '\\Lsh', '\\ltimes', '\\lVert', '\\lvertneqq', '\\mapsto', '\\measuredangle', '\\mho', + '\\mid', '\\mod', '\\models', '\\mp', '\\mu', '\\multimap', '\\nabla', '\\natural', '\\ncong', '\\nearrow', + '\\neg', '\\neq', '\\nexists', '\\ngeq', '\\ngeqq', '\\ngeqslant', '\\ngtr', '\\ni', '\\nleftarrow', '\\nLeftarrow', + '\\nleftrightarrow', '\\nLeftrightarrow', '\\nleq', '\\nleqq', '\\nleqslant', '\\nless', '\\nmid', '\\nolimits', '\\not', '\\notin', + '\\nparallel', '\\nprec', '\\npreceq', '\\nrightarrow', '\\nRightarrow', '\\nshortmid', '\\nshortparallel', '\\nsim', '\\nsubseteq', '\\nsubseteqq', + '\\nsucc', '\\nsucceq', '\\nsupseteq', '\\nsupseteqq', '\\ntriangleleft', '\\ntrianglelefteq', '\\ntriangleright', '\\ntrianglerighteq', '\\nu', '\\nvdash', + '\\nVdash', '\\nvDash', '\\nVDash', '\\nwarrow', '\\odot', '\\oint', '\\omega', '\\Omega', '\\ominus', '\\oplus', + '\\oslash', '\\otimes', '\\overbrace', '\\overleftarrow', '\\overleftrightarrow', '\\overline', '\\overrightarrow', '\\P',
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: Record no diff if linear diff length is zero
Tchanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/331517 ) Change subject: Record no diff if linear diff length is zero .. Record no diff if linear diff length is zero The tree diff should not be able to return a diff between two nodes if the diff length is zero. Bug: T151589 Change-Id: I0f18f5d4d50facae0e0e98063cd7c391a86a3d3a --- M src/dm/ve.dm.VisualDiff.js 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/17/331517/1 diff --git a/src/dm/ve.dm.VisualDiff.js b/src/dm/ve.dm.VisualDiff.js index c5fad39..42015b3 100644 --- a/src/dm/ve.dm.VisualDiff.js +++ b/src/dm/ve.dm.VisualDiff.js @@ -495,7 +495,7 @@ } // Only return the diff if enough content has changed - if ( keepLength < 0.5 * diffLength ) { + if ( diffLength === 0 || keepLength < 0.5 * diffLength ) { return false; } return { -- To view, visit https://gerrit.wikimedia.org/r/331517 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0f18f5d4d50facae0e0e98063cd7c391a86a3d3a Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Decrease height of gallery search results for better fit
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/325108 Change subject: Decrease height of gallery search results for better fit .. Decrease height of gallery search results for better fit Bug: T151509 Change-Id: I92c812952457df99251fc0b8f1a17d4e55fe52f7 --- M modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js 1 file changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/08/325108/1 diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js index 63726c3..245cbec 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js @@ -123,7 +123,9 @@ } ); // Search panel - this.searchWidget = new mw.widgets.MediaSearchWidget(); + this.searchWidget = new mw.widgets.MediaSearchWidget( { + rowHeight: 150 + } ); // Options card -- To view, visit https://gerrit.wikimedia.org/r/325108 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I92c812952457df99251fc0b8f1a17d4e55fe52f7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Scroll highlighted item into view in gallery dialog
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/325103 Change subject: Scroll highlighted item into view in gallery dialog .. Scroll highlighted item into view in gallery dialog Bug: T152053 Change-Id: I6b77f6c27d5629dc18e421f984cf31badfb2ff04 --- M modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/03/325103/1 diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js index 63726c3..1799cda 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js @@ -529,6 +529,9 @@ item.toggleHighlighted( true ); this.highlightedItem = item; + // Scroll item into view in menu + OO.ui.Element.static.scrollIntoView( item.$element[ 0 ] ); + // Populate edit panel this.$highlightedImage .css( 'background-image', 'url(' + item.thumbUrl + ')' ); -- To view, visit https://gerrit.wikimedia.org/r/325103 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6b77f6c27d5629dc18e421f984cf31badfb2ff04 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Disable heights option in gallery dialog when mode is slideshow
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/325102 Change subject: Disable heights option in gallery dialog when mode is slideshow .. Disable heights option in gallery dialog when mode is slideshow Bug: T151482 Change-Id: Ic511e1832a9fcaaeaed71c1d495aecc65fdd1d3b --- M modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/02/325102/1 diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js index 63726c3..9cbd3a9 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js @@ -550,6 +550,9 @@ this.widthsInput.setDisabled( disabled ); this.perrowInput.setDisabled( disabled ); + + // heights is only ignored in slideshow mode + this.heightsInput.setDisabled( mode === 'slideshow' ); }; /** -- To view, visit https://gerrit.wikimedia.org/r/325102 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic511e1832a9fcaaeaed71c1d495aecc65fdd1d3b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Correct class/classes typo in gallery dialog
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/325098 Change subject: Correct class/classes typo in gallery dialog .. Correct class/classes typo in gallery dialog Bug: T152226 Change-Id: I569df87cf82359c13ad61a3ddffacd83f5f03bae --- M modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/98/325098/1 diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js index 63726c3..4c30f53 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js @@ -673,7 +673,7 @@ mwData.attrs.heights = heights || undefined; mwData.attrs.perrow = perrow || undefined; mwData.attrs.showfilename = showFilename ? 'yes' : undefined; - mwData.attrs.classes = classes || undefined; + mwData.attrs.class = classes || undefined; mwData.attrs.style = styles || undefined; // Unset mode attribute if it is the same as the default -- To view, visit https://gerrit.wikimedia.org/r/325098 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I569df87cf82359c13ad61a3ddffacd83f5f03bae Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Fix "Add new image" button in the gallery dialog
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/324604 Change subject: Fix "Add new image" button in the gallery dialog .. Fix "Add new image" button in the gallery dialog Make sure the button is always visible in the gallery dialog menu by fixing it to the bottom. Bug: T151506 Change-Id: I560b0dffbaad9e18c6f7f703cb155356470580ee --- M modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js M modules/ve-mw/ui/styles/dialogs/ve.ui.MWGalleryDialog.css 2 files changed, 37 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/04/324604/1 diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js index 63726c3..091d3a6 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js @@ -42,7 +42,8 @@ * @inheritdoc */ ve.ui.MWGalleryDialog.prototype.initialize = function () { - var imagesCard, optionsCard, menuLayout, menuPanel, + var imagesCard, optionsCard, menuLayout, + innerMenuLayout, innerMenuPanel, innerContentPanel, modeField, captionField, widthsField, heightsField, perrowField, showFilenameField, classesField, stylesField; @@ -79,11 +80,21 @@ // Images card // General layout - menuLayout = new OO.ui.MenuLayout(); - menuPanel = new OO.ui.PanelLayout( { + menuLayout = new OO.ui.MenuLayout( { + classes: [ 've-ui-mwGalleryDialog-menuLayout' ] + } ); + innerMenuLayout = new OO.ui.MenuLayout( { + menuPosition: 'bottom', + classes: [ 've-ui-mwGalleryDialog-innerMenuLayout' ] + } ); + innerMenuPanel = new OO.ui.PanelLayout( { padded: true, expanded: true, scrollable: true + } ); + innerContentPanel = new OO.ui.PanelLayout( { + padded: true, + expanded: true } ); this.editPanel = new OO.ui.PanelLayout( { padded: true, @@ -216,12 +227,19 @@ } ); // Append everything - menuLayout.$menu.append( - menuPanel.$element.append( - this.$emptyGalleryMessage, - this.galleryGroup.$element, + innerMenuLayout.$menu.append( + innerContentPanel.$element.append( this.showSearchPanelButton.$element ) + ) + innerMenuLayout.$content.append( + innerMenuPanel.$element.append( + this.$emptyGalleryMessage, + this.galleryGroup.$element + ) + ); + menuLayout.$menu.append( + innerMenuLayout.$element ); menuLayout.$content.append( this.editPanel.$element.append( diff --git a/modules/ve-mw/ui/styles/dialogs/ve.ui.MWGalleryDialog.css b/modules/ve-mw/ui/styles/dialogs/ve.ui.MWGalleryDialog.css index 774220b..0a44ace 100644 --- a/modules/ve-mw/ui/styles/dialogs/ve.ui.MWGalleryDialog.css +++ b/modules/ve-mw/ui/styles/dialogs/ve.ui.MWGalleryDialog.css @@ -41,13 +41,23 @@ margin-top: 0.5em; } -.ve-ui-mwGalleryDialog .oo-ui-menuLayout-menu { +.ve-ui-mwGalleryDialog-menuLayout > .oo-ui-menuLayout-menu { width: 14em; border-left: 1px solid #ccc; border-right: 1px solid #ccc; } -.ve-ui-mwGalleryDialog .oo-ui-menuLayout-content { +.ve-ui-mwGalleryDialog-menuLayout > .oo-ui-menuLayout-content { left: 14em; right: 14em; } + +.ve-ui-mwGalleryDialog-innerMenuLayout > .oo-ui-menuLayout-content { + bottom: 5em; +} + +.ve-ui-mwGalleryDialog-innerMenuLayout > .oo-ui-menuLayout-menu { + height: 5em; + border-top: 1px solid #e6e6e6; + box-shadow: 0 -1px 0 0 rgba( 0, 0, 0, 0.05 ); /* stylelint-disable-line no-unsupported-browser-features */ +} -- To view, visit https://gerrit.wikimedia.org/r/324604 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I560b0dffbaad9e18c6f7f703cb155356470580ee Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Let gallery dialog handle unprefixed filenames
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/323090 Change subject: Let gallery dialog handle unprefixed filenames .. Let gallery dialog handle unprefixed filenames The namespace prefix before image filenames is optional in galleries, but the API requires it. If the prefix is omitted, add the file namespace prefix (but if a different prefix is given, don't change it). Change-Id: I3d126550c2ad2e84454122f92307ba4bc943780b --- M modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js 1 file changed, 6 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/90/323090/1 diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js index ddb0506..695b35b 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js @@ -261,7 +261,7 @@ var titlesString, title, titleText, imageTitles, mode, caption, widths, heights, perrow, showFilename, classes, styles, - pageTitle, namespace, namespacesWithSubpages, + pageTitle, namespace, namespacesWithSubpages, namespaceIds, dialog = this, attributes = this.selectedNode && this.selectedNode.getAttribute( 'mw' ).attrs; @@ -271,6 +271,7 @@ pageTitle = mw.config.get( 'wgTitle' ); namespace = mw.config.get( 'wgNamespaceNumber' ); namespacesWithSubpages = mw.config.get( 'wgVisualEditorConfig' ).namespacesWithSubpages; + namespaceIds = mw.config.get( 'wgNamespaceIds' ); if ( namespacesWithSubpages[ namespace ] ) { pageTitle = pageTitle.slice( pageTitle.lastIndexOf( '/' ) + 1 ); @@ -295,6 +296,10 @@ // Ignore any empty lines if ( matches ) { title = mw.Title.newFromText( matches[ 1 ] ); + // The "File:" prefix is optional in wikitext galleries + if ( title.getNamespaceId() === namespaceIds[ '' ] ) { + title = mw.Title.newFromText( matches[ 1 ], namespaceIds.file ); + } // Ignore any invalid titles // (which will result in title being null) if ( title ) { -- To view, visit https://gerrit.wikimedia.org/r/323090 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3d126550c2ad2e84454122f92307ba4bc943780b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Allow the gallery dialog to insert duplicate images initially
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/322428 Change subject: Allow the gallery dialog to insert duplicate images initially .. Allow the gallery dialog to insert duplicate images initially Change I94f4fadd84cd3e prevents the gallery dialog from inserting duplicate images into the gallery dialog after one request (e.g. so double-clicking on an image in the search widget doesn't cause the image to be inserted twice). However, galleries can intentionally contain duplicates of the same image, so it is possible to make a spearate request to insert a duplicate image. When the dialog is first opened, it requests all the images in the gallery at once, so the above change was causing the duplicates in an existing gallery to be dropped. Duplicates should be allowed to be inserted following this initial request. Change-Id: I34353bc9b8db947488474c4be52292e0a1447705 --- M modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js 1 file changed, 26 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/28/322428/1 diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js index ddb0506..275c515 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js @@ -53,6 +53,8 @@ this.highlightedItem = null; this.searchPanelVisible = false; this.imageCaptions = {}; + this.initialRequest = true; + this.initialImageData = []; // Default settings this.defaults = mw.config.get( 'wgVisualEditorConfig' ).galleryOptions; @@ -300,6 +302,10 @@ if ( title ) { titleText = title.getPrefixedText(); imageTitles.push( titleText ); + dialog.initialImageData.push( { + title: titleText, + caption: matches[ 3 ] + } ); dialog.imageCaptions[ titleText ] = matches[ 3 ]; } } @@ -387,6 +393,10 @@ this.galleryGroup.disconnect( this ); this.removeButton.disconnect( this ); this.modeDropdown.disconnect( this ); + + // Reset states + this.initialRequest = true; + this.initialImageData = []; }, this ); }; @@ -433,14 +443,21 @@ } } - for ( title in this.imageCaptions ) { - if ( Object.prototype.hasOwnProperty.call( thumbUrls, title ) ) { - items.push( new ve.ui.MWGalleryItemWidget( { - title: title, - caption: this.imageCaptions[ title ], - thumbUrl: thumbUrls[ title ] - } ) ); - delete this.imageCaptions[ title ]; + if ( this.initialRequest ) { + this.initialImageData.forEach( function ( image ) { + image.thumbUrl = thumbUrls[ image.title ]; + items.push( new ve.ui.MWGalleryItemWidget( image ) ); + } ); + } else { + for ( title in this.imageCaptions ) { + if ( Object.prototype.hasOwnProperty.call( thumbUrls, title ) ) { + items.push( new ve.ui.MWGalleryItemWidget( { + title: title, + caption: this.imageCaptions[ title ], + thumbUrl: thumbUrls[ title ] + } ) ); + delete this.imageCaptions[ title ]; + } } } this.galleryGroup.addItems( items ); @@ -449,6 +466,7 @@ this.updateActions(); this.toggleEmptyGalleryMessage( false ); this.showSearchPanelButton.toggle( true ); + this.initialRequest = false; }; /** -- To view, visit https://gerrit.wikimedia.org/r/322428 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I34353bc9b8db947488474c4be52292e0a1447705 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Fix attribute.style typo in gallery dialog
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/321551 Change subject: Fix attribute.style typo in gallery dialog .. Fix attribute.style typo in gallery dialog Change-Id: I71162652df5e09c4d974e0f863ea661c4bd7902e --- M modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/51/321551/1 diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js index 5ddb705..ee5f062 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js @@ -655,7 +655,7 @@ mwData.attrs.perrow = perrow || undefined; mwData.attrs.showfilename = showFilename ? 'yes' : undefined; mwData.attrs.classes = classes || undefined; - mwData.attrs.styles = styles || undefined; + mwData.attrs.style = styles || undefined; // Unset mode attribute if it is the same as the default mwData.attrs.mode = mode === this.defaults.mode ? undefined : mode; -- To view, visit https://gerrit.wikimedia.org/r/321551 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I71162652df5e09c4d974e0f863ea661c4bd7902e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: Refactor diff element getChangedNodeHtml
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/320101 Change subject: Refactor diff element getChangedNodeHtml .. Refactor diff element getChangedNodeHtml Change-Id: I23d0c982e3a5c2073ea2dc2e73d451d8eb7bc7dd --- M src/ui/elements/ve.ui.DiffElement.js 1 file changed, 109 insertions(+), 163 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/01/320101/1 diff --git a/src/ui/elements/ve.ui.DiffElement.js b/src/ui/elements/ve.ui.DiffElement.js index b22a64e..c75bb2c 100644 --- a/src/ui/elements/ve.ui.DiffElement.js +++ b/src/ui/elements/ve.ui.DiffElement.js @@ -163,15 +163,11 @@ */ ve.ui.DiffElement.prototype.getChangedNodeHtml = function ( oldNodeIndex, move ) { var i, ilen, j, jlen, k, klen, - iModified, jModified, nodeHtml, + iModified, jModified, classes, nodeHtml, newNodeIndex = this.oldToNew[ oldNodeIndex ].node, nodeRange = this.newDocChildren[ newNodeIndex ].getOuterRange(), nodeData = this.newDoc.getData( nodeRange ), alreadyProcessed = { - remove: [], - insert: [] - }, - markedNodes = { remove: [], insert: [] }, @@ -185,139 +181,112 @@ correspondingNodes = this.oldToNew[ oldNodeIndex ].correspondingNodes; /** -* Modify the linear data to reflect the diff, one node at a time. (Nodes here -* are descendants of the child of the document, which have been tree diffed.) -* At this level, a ve.dm.BranchNode could either have been inserted or removed, -* whereas a ve.dm.ContentBranchNode could also have been changed, meaning that -* part of its data has been inserted and/or removed. +* Splice in the removed data for the subtree rooted at this node, from the old +* document. * -* We start with data from the new document, then (1) splice in data -* corresponding to any removed nodes from the old document, and (2) highlight -* and data that has been removed or inserted. -* -* @param {number} nodeIndex The index of the node in its tree's orderedNodes -* array. -* @param {string} action 'remove', 'insert' or 'change' -* @param {string} [move] 'up' or 'down' if the node has moved +* @param {number} nodeIndex The index of this node in the subtree rooted at +* this document child */ - function nodesInsertOrRemove( nodeIndex, action, move ) { - var i, ilen, - doc, nodes, - subNodeTreeNode, - subNode, - subNodeRange, - subNodeData, - spliceIndex, - annotatedData, - descendant, descendants, - outerNodeRange, outerNodeData, - correspondingNodesObject, tree, - parentNode, siblingNodes, - rightMostLeftSiblingNode, - oldPreviousNode, newPreviousNodeRange, - insertIndex; + function highlightRemovedSubTree( nodeIndex ) { + var i, ilen, subTreeRootNode, subTreeRootNodeData, siblingNodes, + newPreviousNodeIndex, oldPreviousNodeIndex, insertIndex, descendants; - // Define tree and doc - tree = action === 'remove' ? oldTree : newTree; - doc = action === 'remove' ? this.oldDoc : this.newDoc; - nodes = action === 'remove' ? oldNodes : newNodes; + // Get outer data for this node from the old doc and add remove class + subTreeRootNode = oldNodes[ nodeIndex ]; + subTreeRootNodeData = this.oldDoc.getData( subTreeRootNode.node.getOuterRange() ); + subTreeRootNodeData[ 0 ] = this.addClassesToNode( subTreeRootNodeData[ 0 ], this.oldDoc, 'remove' ); - // Get the outer node - outerNodeRange = action === 'remove' ? tree.orderedNodes[ nodeIndex ].node.getOuterRange() : nodeRange; - outerNodeData = action === 'remove' ? doc.getData( outerNodeRange ) : nodeData; - subNodeTreeNode = nodes[ nodeIndex ]; - - // Get subNode and add action class - subNode = subNodeTreeNode.node; - subNodeRange = subNode.getOuterRange(); - spliceIndex = subNodeRange.from - outerNodeRange.from; - subNodeData = outerNodeData.splice( spliceIndex, subNodeRange.to - subNodeRange.from ); - subNodeData[ 0 ] = this.addClassesToNode( subNodeData[ 0 ], doc, action, move ); - -
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: Fix splice typo
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/319416 Change subject: Fix splice typo .. Fix splice typo Bug: T149537 Bug: T149528 Change-Id: If8d137aeaf4e0097ca4643feaeed381ded65d51b --- M src/ui/elements/ve.ui.DiffElement.js 1 file changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/16/319416/1 diff --git a/src/ui/elements/ve.ui.DiffElement.js b/src/ui/elements/ve.ui.DiffElement.js index cb88dee..02ac060 100644 --- a/src/ui/elements/ve.ui.DiffElement.js +++ b/src/ui/elements/ve.ui.DiffElement.js @@ -313,9 +313,11 @@ insertIndex = newPreviousNodeRange.from - nodeRange.from; } // Splice in the subnode's annotated data just after the new node's open tag - ve.batchSplice( nodeData, 0, insertIndex, outerNodeData ); + ve.batchSplice( nodeData, insertIndex, 0, outerNodeData ); } + alreadyProcessed[ action ].push( nodeIndex ); + } ilen = Math.max( oldNodes.length, newNodes.length ); -- To view, visit https://gerrit.wikimedia.org/r/319416 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If8d137aeaf4e0097ca4643feaeed381ded65d51b Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...Math[master]: Make medium width buttons in math dialog
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/315898 Change subject: Make medium width buttons in math dialog .. Make medium width buttons in math dialog Previously there were only two possible button widths, now there are three. Bug: T145613 Change-Id: I233f4f7c6cb810d6b5d54a5242514afed7c2ad9d --- M modules/ve-math/symbols.json M modules/ve-math/ve.ui.MWMathDialog.css M modules/ve-math/ve.ui.MWMathPage.js 3 files changed, 67 insertions(+), 54 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/98/315898/1 diff --git a/modules/ve-math/symbols.json b/modules/ve-math/symbols.json index 9e68644..23185cb 100644 --- a/modules/ve-math/symbols.json +++ b/modules/ve-math/symbols.json @@ -107,7 +107,7 @@ "alignBaseline": true }, { -"wide": true, +"width": "wide", "tex": "\\exp_a", "encapsulate": { "pre": "\\exp_", @@ -132,7 +132,7 @@ "alignBaseline": true }, { -"wide": true, +"width": "wide", "tex": "\\log_{10}", "encapsulate": { "pre": "\\log_{", @@ -173,57 +173,61 @@ }, { "insert": "\\arcsin", -"wide": true, +"width": "wide", "tex": "\\arcsin", "alignBaseline": true }, { "insert": "\\arccos", -"wide": true, +"width": "wide", "tex": "\\arccos", "alignBaseline": true }, { "insert": "\\arctan", -"wide": true, +"width": "wide", "tex": "\\arctan", "alignBaseline": true }, { "insert": "\\arccot", -"wide": true, +"width": "wide", "tex": "\\arccot", "alignBaseline": true }, { "insert": "\\arcsec", -"wide": true, +"width": "wide", "tex": "\\arcsec", "alignBaseline": true }, { "insert": "\\arccsc", -"wide": true, +"width": "wide", "tex": "\\arccsc", "alignBaseline": true }, { "insert": "\\sinh", +"width": "wide", "tex": "\\sinh", "alignBaseline": true }, { "insert": "\\cosh", +"width": "wide", "tex": "\\cosh", "alignBaseline": true }, { "insert": "\\tanh", +"width": "wide", "tex": "\\tanh", "alignBaseline": true }, { "insert": "\\coth", +"width": "wide", "tex": "\\coth", "alignBaseline": true }, @@ -244,24 +248,25 @@ }, { "insert": "\\operatorname{coth}", +"width": "wide", "tex": "\\operatorname{coth}", "alignBaseline": true }, { "insert": "\\operatorname{argsh}", -"wide": true, +"width": "wide", "tex": "\\operatorname{argsh}", "alignBaseline": true }, { "insert": "\\operatorname{argch}", -"wide": true, +"width": "wide", "tex": "\\operatorname{argch}", "alignBaseline": true }, { "insert": "\\operatorname{argth}", -"wide": true, +"width": "wide", "tex": "\\operatorname{argth}", "alignBaseline": true }, @@ -280,7 +285,7 @@ "alignBaseline": true }, { -"wide": true, +"width": "wider", "tex": "\\min(x,y)", "encapsulate": { "pre": "\\min(", @@ -290,7 +295,7 @@ "alignBaseline": true }, { -"wide": true, +"width": "wider", "tex": "\\max(x,y)", "encapsulate": { "pre": "\\max(", @@ -328,13 +333,13 @@ }, { "insert": "\\liminf", -"wide": true, +"width": "wide", "tex": "\\liminf", "alignBaseline": true }, { "insert": "\\limsup", -"wide": true, +"width": "wide", "tex": "\\limsup", "alignBaseline": true }, @@ -367,6 +372,7 @@ }, { "insert": "\\hom", +"width": "wide", "tex": "\\hom", "alignBaseline": true }, @@ -404,12 +410,12 @@ }, { "insert": "dy/dx", -
[MediaWiki-commits] [Gerrit] mediawiki...Graph[master]: Correct inheritance in graph dialog documentation
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/315619 Change subject: Correct inheritance in graph dialog documentation .. Correct inheritance in graph dialog documentation Change-Id: I9c74f69c260035fdc0603dbf54b13e35290d5572 --- M modules/ve-graph/ve.ui.MWGraphDialog.js 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Graph refs/changes/19/315619/1 diff --git a/modules/ve-graph/ve.ui.MWGraphDialog.js b/modules/ve-graph/ve.ui.MWGraphDialog.js index 7c9865f..dcbad45 100644 --- a/modules/ve-graph/ve.ui.MWGraphDialog.js +++ b/modules/ve-graph/ve.ui.MWGraphDialog.js @@ -8,7 +8,7 @@ * MediaWiki graph dialog. * * @class - * @extends ve.ui.NodeDialog + * @extends ve.ui.MWExtensionDialog * * @constructor * @param {Object} [element] -- To view, visit https://gerrit.wikimedia.org/r/315619 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9c74f69c260035fdc0603dbf54b13e35290d5572 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Graph Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Take only the last part of a URL query in media search widget
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/315561 Change subject: Take only the last part of a URL query in media search widget .. Take only the last part of a URL query in media search widget Quick fix to the problem that searching for the file name or page title currently returns the image, but searching for the URL does not. Bug: T121354 Change-Id: I13e665226e5dc15ba626126dc4806ce8f4e0040b --- M modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js 1 file changed, 4 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/61/315561/1 diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js index 59cde6d..21dfef1 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js @@ -202,6 +202,10 @@ ve.ui.MWMediaSearchWidget.prototype.onQueryChange = function ( value ) { var trimmed = value.trim(); + if ( trimmed.match( ve.init.platform.getExternalLinkUrlProtocolsRegExp() ) ) { + trimmed = trimmed.match( /.+\/([^\/]+)/ )[ 1 ]; + this.query.setValue( trimmed ); + } if ( trimmed === this.searchValue ) { return; } -- To view, visit https://gerrit.wikimedia.org/r/315561 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I13e665226e5dc15ba626126dc4806ce8f4e0040b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Set gallery dialog to larger size when search panel is focused
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/315462 Change subject: Set gallery dialog to larger size when search panel is focused .. Set gallery dialog to larger size when search panel is focused Bug: T145246 Change-Id: I49b218f704d31b4f699fe39f414a84abbfffc093 --- M modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/62/315462/1 diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js index bfd54f1..c9d6219 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js @@ -578,8 +578,10 @@ // If the edit panel is visible, focus the caption input if ( !visible ) { this.highlightedCaptionInput.focus(); + this.setSize( 'large' ); } else { this.searchWidget.getQuery().focus().select(); + this.setSize( 'larger' ); } }; -- To view, visit https://gerrit.wikimedia.org/r/315462 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I49b218f704d31b4f699fe39f414a84abbfffc093 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: WIP Update gallery dialog actions to reflect presence of cha...
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/315449 Change subject: WIP Update gallery dialog actions to reflect presence of changes .. WIP Update gallery dialog actions to reflect presence of changes Every time a change is made in the gallery dialog, disable or enable the Done button according to whether the dialog has changed since it was opened. Changes have been made upstream, so they also apply to inspectors and dialogs that inherit from MWLiveExtensionInspector or MWExtensionWindow. Bug: T62311 Change-Id: I2295d77114fe024921b6e2bbcf76e04faefa47f1 --- M modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js M modules/ve-mw/ui/inspectors/ve.ui.MWLiveExtensionInspector.js M modules/ve-mw/ui/ve.ui.MWExtensionWindow.js 3 files changed, 96 insertions(+), 34 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/49/315449/1 diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js index bfd54f1..18a87d5 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js @@ -322,7 +322,6 @@ this.toggleEmptyGalleryMessage( true ); this.showSearchPanelButton.toggle( false ); this.toggleSearchPanel( true ); - this.updateActions(); } // Options card @@ -348,11 +347,20 @@ this.stylesInput.setValue( styles ); // Add event handlers + this.highlightedCaptionInput.connect( this, { change: 'updateActions' } ); this.searchWidget.getResults().connect( this, { choose: 'onSearchResultsChoose' } ); this.showSearchPanelButton.connect( this, { click: 'onShowSearchPanelButtonClick' } ); this.galleryGroup.connect( this, { editItem: 'onHighlightItem' } ); + this.galleryGroup.connect( this, { itemDragEnd: 'updateActions' } ); this.removeButton.connect( this, { click: 'onRemoveItem' } ); this.modeDropdown.getMenu().connect( this, { choose: 'onModeDropdownChange' } ); + this.captionInput.connect( this, { change: 'updateActions' } ); + this.widthsInput.connect( this, { change: 'updateActions' } ); + this.heightsInput.connect( this, { change: 'updateActions' } ); + this.perrowInput.connect( this, { change: 'updateActions' } ); + this.showFilenameCheckbox.connect( this, { change: 'updateActions' } ); + this.classesInput.connect( this, { change: 'updateActions' } ); + this.stylesInput.connect( this, { change: 'updateActions' } ); // Hack: Give the input a value so that this.insertOrUpdateNode gets called this.input.setValue( 'gallery' ); @@ -383,11 +391,19 @@ this.searchPanelVisible = false; // Disconnect events + this.highlightedCaptionInput.disconnect( this ); this.searchWidget.getResults().disconnect( this ); this.showSearchPanelButton.disconnect( this ); this.galleryGroup.disconnect( this ); this.removeButton.disconnect( this ); this.modeDropdown.disconnect( this ); + this.captionInput.disconnect( this ); + this.widthsInput.disconnect( this ); + this.heightsInput.disconnect( this ); + this.perrowInput.disconnect( this ); + this.showFilenameCheckbox.disconnect( this ); + this.classesInput.disconnect( this ); + this.stylesInput.disconnect( this ); }, this ); }; @@ -481,6 +497,7 @@ */ ve.ui.MWGalleryDialog.prototype.onSearchResultsChoose = function ( item ) { this.addNewImage( item.getData().title ); + this.updateActions(); }; /** @@ -544,6 +561,7 @@ this.widthsInput.setDisabled( disabled ); this.perrowInput.setDisabled( disabled ); + this.updateActions(); }; /** @@ -600,50 +618,65 @@ * Disable the "Done" button if the gallery is empty, otherwise enable it */ ve.ui.MWGalleryDialog.prototype.updateActions = function () { - this.actions.setAbilities( { done: this.galleryGroup.items.length > 0 } ); + this.actions.setAbilities( { done: this.galleryGroup.items.length > 0 && this.isModified() } ); +}; + +/** + * Get the current images and options data +
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: Allow ommission of range from ve.dm.Document cloneFromRange
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/314724 Change subject: Allow ommission of range from ve.dm.Document cloneFromRange .. Allow ommission of range from ve.dm.Document cloneFromRange Clone the whole document if range is omitted. Change-Id: I8dba1e3dfb24a32e0add6caaa9d3c78993c34f0a --- M src/dm/ve.dm.Document.js 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/24/314724/1 diff --git a/src/dm/ve.dm.Document.js b/src/dm/ve.dm.Document.js index 67b343a..901f951 100644 --- a/src/dm/ve.dm.Document.js +++ b/src/dm/ve.dm.Document.js @@ -596,13 +596,13 @@ * Clone a sub-document from a range in this document. The new document's elements, store and internal list * will be clones of the ones in this document. * - * @param {ve.Range} range Range of data to clone + * @param {ve.Range} [range] Range of data to clone, clones the whole document if ommitted. * @return {ve.dm.Document} New document */ ve.dm.Document.prototype.cloneFromRange = function ( range ) { var listRange = this.getInternalList().getListNode().getOuterRange(), data = ve.copy( this.getFullData( range, true ) ); - if ( range.start > listRange.start || range.end < listRange.end ) { + if ( range && ( range.start > listRange.start || range.end < listRange.end ) ) { // The range does not include the entire internal list, so add it data = data.concat( this.getFullData( listRange ) ); } -- To view, visit https://gerrit.wikimedia.org/r/314724 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8dba1e3dfb24a32e0add6caaa9d3c78993c34f0a Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Pre-load the article title in gallery dialog search
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/313118 Change subject: Pre-load the article title in gallery dialog search .. Pre-load the article title in gallery dialog search Bug: T145243 Change-Id: I4cd04dee4c875524ecdf90027dc878eb15f47ce6 --- M modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js 1 file changed, 15 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/18/313118/1 diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js index 71fdf3d..187db69 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js @@ -260,10 +260,23 @@ var titlesString, title, titleText, imageTitles, mode, caption, widths, heights, perrow, showFilename, classes, styles, + pageTitle, namespace, namespacesWithSubpages, dialog = this, attributes = this.selectedNode && this.selectedNode.getAttribute( 'mw' ).attrs; + // Images card + + // First set the search widget input value to the page title + pageTitle = mw.config.get( 'wgTitle' ); + namespace = mw.config.get( 'wgNamespaceNumber' ); + namespacesWithSubpages = mw.config.get( 'wgVisualEditorConfig' ).namespacesWithSubpages; + + if ( namespacesWithSubpages[ namespace ] ) { + pageTitle = pageTitle.slice( pageTitle.lastIndexOf( '/' ) + 1 ); + } + + this.searchWidget.getQuery().setValue( pageTitle ); // If editing an existing gallery, populate with the images... if ( this.selectedNode ) { @@ -353,7 +366,7 @@ ve.ui.MWGalleryDialog.prototype.getReadyProcess = function ( data ) { return ve.ui.MWGalleryDialog.super.prototype.getReadyProcess.call( this, data ) .next( function () { - this.searchWidget.getQuery().focus(); + this.searchWidget.getQuery().focus().select(); return this.imagesPromise; }, this ); }; @@ -567,7 +580,7 @@ if ( !visible ) { this.highlightedCaptionInput.focus(); } else { - this.searchWidget.getQuery().focus(); + this.searchWidget.getQuery().focus().select(); } }; -- To view, visit https://gerrit.wikimedia.org/r/313118 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4cd04dee4c875524ecdf90027dc878eb15f47ce6 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: WIP/EXPERIMENTAL Make ve.dm.VisualDiff
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/311173 Change subject: WIP/EXPERIMENTAL Make ve.dm.VisualDiff .. WIP/EXPERIMENTAL Make ve.dm.VisualDiff A ve.dm.VisualDiff gets everything that is needed to build a visualisation of the diff: - a mapping of old nodes to their analogous new nodes (changed or unchanged) - the moves that map a changed old node to its analogous new node - a list of removed nodes - a list of inserted nodes NB Nodes are ordered, so it is also possible to infer moves. Next steps: build something basic for visualising the diff in VE UI - to be adapted according to collaboration with design. Change-Id: I23295efd75e9e37b273b99a361ded99a98217295 --- M demos/ve/desktop.html M demos/ve/ve.demo.SurfaceContainer.js A lib/diff-match-patch/diff_match_patch_uncompressed.js M lib/treeDiffer/diff.differ.js M src/dm/lineardata/ve.dm.ElementLinearData.js M src/dm/ve.dm.Document.js A src/dm/ve.dm.VisualDiff.js 7 files changed, 2,702 insertions(+), 101 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/73/311173/1 diff --git a/demos/ve/desktop.html b/demos/ve/desktop.html index f51a8cb..5053c34 100644 --- a/demos/ve/desktop.html +++ b/demos/ve/desktop.html @@ -88,10 +88,38 @@ + + .diff-div { + border: 1px solid; + } + .diff-insert { + border: 1px solid green; + } + .diff-remove { + border: 1px solid red; + } + .diff-change { + border: 1px solid blue; + } + .diff-move-up { + border-top: 1px dashed; + } + .diff-move-down { + border-bottom: 1px dashed; + } + del { + color: red; + } + ins{ + color: green; + } + + + Diff goes here @@ -150,6 +178,9 @@ + + + @@ -295,6 +326,7 @@ + diff --git a/demos/ve/ve.demo.SurfaceContainer.js b/demos/ve/ve.demo.SurfaceContainer.js index b622783..e82872d 100644 --- a/demos/ve/ve.demo.SurfaceContainer.js +++ b/demos/ve/ve.demo.SurfaceContainer.js @@ -88,83 +88,12 @@ console.log( diff.sort( sortChangeBase ) ); } ); treeDiffButton.on( 'click', function () { - var diff, differ, root1, root2, tree1, tree2; - diff = window.diff; + var oldDoc = ve.init.target.oldDoc, + newDoc = ve.init.target.surface.model.documentModel, + visualDiff = new ve.dm.VisualDiff( oldDoc, newDoc ); - // Wraps each node of a tree in a treeNode - function wrapNodes( parentNode ) { - var i, ilen, childNode; + console.log( visualDiff.getDiff() ); - if ( parentNode.node.children ) { - for ( i = 0, ilen = parentNode.node.children.length; i < ilen; i++ ) { - - // Wrap this node - childNode = new diff.treeNode( parentNode.node.children[ i ] ); - parentNode.addChild( childNode ); - - // Wrap this node's children - wrapNodes( childNode ); - - } - } - - } - - // Logs descriptions of the minimum diff transactions - function logTransactionDescriptions( transactions ) { - var i, ilen = transactions.length; - - // Log number of transactions - console.log( ilen + ' transaction(s)' ); - - // Log type of transactions - for ( i = 0; i < ilen; i++ ) { - if ( transactions[i][0] === null ) { - console.log( 'insert', tree2.orderedNodes[ transactions[ i ][ 1 ] ] ); - } else if ( transactions[ i ][ 1 ] === null ) { - console.log( 'remove', tree1.orderedNodes[ transactions[ i ][ 0 ] ] ); - } else { - console.log( -
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: Add method to compare elements and their annotations
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/309804 Change subject: Add method to compare elements and their annotations .. Add method to compare elements and their annotations Change-Id: Iaf11d16a01b0f8def516015126f425608065fc3f --- M src/dm/lineardata/ve.dm.ElementLinearData.js 1 file changed, 36 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/04/309804/1 diff --git a/src/dm/lineardata/ve.dm.ElementLinearData.js b/src/dm/lineardata/ve.dm.ElementLinearData.js index 58f300c..d4b47b1 100644 --- a/src/dm/lineardata/ve.dm.ElementLinearData.js +++ b/src/dm/lineardata/ve.dm.ElementLinearData.js @@ -46,7 +46,7 @@ * @param {Object|Array|string} b Second element * @return {boolean} Elements are comparable */ -ve.dm.ElementLinearData.static.compareElements = function ( a, b ) { +ve.dm.ElementLinearData.static.compareElementsUnannotated = function ( a, b ) { var aPlain = a, bPlain = b; @@ -75,6 +75,41 @@ return ve.compare( aPlain, bPlain ); }; +/** + * Compare two elements' basic properties and annotations + * + * Elements are comparable if they have the same type, attributes, + * text data and annotations. + * + * @param {Object|Array|string} a First element + * @param {Object|Array|string} b Second element + * @param {ve.dm.IndexValueStore} aStore First element's store + * @param {ve.dm.IndexValueStore} bStore Second element's store, if different + * @return {boolean} Elements are comparable + */ +ve.dm.ElementLinearData.static.compareElements = function ( a, b, aStore, bStore ) { + var aSet, bSet, aAnnotations, bAnnotations; + + bStore = bStore ? bStore : aStore; + + if ( !this.compareElementsUnannotated( a, b ) ) { + return false; + } + if ( Array.isArray( a ) ) { + aAnnotations = a[ 1 ]; + bAnnotations = b[ 1 ]; + } + if ( a && a.type ) { + aAnnotations = a.annotations; + bAnnotations = b.annotations; + } + + aSet = new ve.dm.AnnotationSet( aStore, aAnnotations ); + bSet = new ve.dm.AnnotationSet( bStore, bAnnotations ); + + return aSet.compareTo( bSet ); +}; + /* Methods */ /** -- To view, visit https://gerrit.wikimedia.org/r/309804 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iaf11d16a01b0f8def516015126f425608065fc3f Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: WIP/EXPERIMENTAL Tree differ to run on dm.DocumentNode
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/306712 Change subject: WIP/EXPERIMENTAL Tree differ to run on dm.DocumentNode .. WIP/EXPERIMENTAL Tree differ to run on dm.DocumentNode reconcile.js is very fast, but relies on stable IDs, which are not always available, so it often won't find the minimal diff. This isn't ideal for highlighting differences. The tree differ finds the minimal diff, but currently with a heavy performance cost, as it treats the entire documents as single trees and searches all possible alignments. Given the predictable properties of real-world document changes, it may be possible to use some simple heuristics to vastly reduce the search space for the tree differ and still find the minimal diff in the majority of cases. For example, edits do not tend to affect many different children of the dm.DocumentNode. Next steps: (1) treat the documents as multiple trees, rooted at the children of the document node. (2) Exclude identical trees before doing the full diff. Change-Id: I30162f5d24e53de84455b62f19fd0bb3c7069489 --- M demos/ve/desktop.html M demos/ve/ve.demo.SurfaceContainer.js A lib/treeDiffer/diff.abstractNode.js A lib/treeDiffer/diff.differ.js A lib/treeDiffer/diff.js A lib/treeDiffer/diff.tree.js A lib/treeDiffer/diff.treeNode.js A lib/treeDiffer/index.html A lib/treeDiffer/index.js 9 files changed, 412 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/12/306712/1 diff --git a/demos/ve/desktop.html b/demos/ve/desktop.html index 0c0f854..c4dce7a 100644 --- a/demos/ve/desktop.html +++ b/demos/ve/desktop.html @@ -145,6 +145,12 @@ + + + + + + diff --git a/demos/ve/ve.demo.SurfaceContainer.js b/demos/ve/ve.demo.SurfaceContainer.js index a0deae4..b622783 100644 --- a/demos/ve/ve.demo.SurfaceContainer.js +++ b/demos/ve/ve.demo.SurfaceContainer.js @@ -12,7 +12,7 @@ * @param {string} dir Directionality */ ve.demo.SurfaceContainer = function VeDemoSurfaceContainer( target, page, lang, dir ) { - var pageDropdown, pageLabel, removeButton, saveButton, diffButton, $exitReadButton, + var pageDropdown, pageLabel, removeButton, saveButton, diffButton, treeDiffButton, $exitReadButton, container = this; // Parent constructor @@ -41,6 +41,9 @@ } ); diffButton = new OO.ui.ButtonWidget( { label: 'Diff DOM' + } ); + treeDiffButton = new OO.ui.ButtonWidget( { + label: 'Tree diff DOM' } ); $exitReadButton = $( '' ).text( 'Back to editor' ).on( 'click', function () { container.change( 've' ); @@ -84,6 +87,85 @@ diff = reconcile.diff( ve.init.target.surface.model.documentModel.documentNode, ve.init.target.oldDoc.documentNode ); console.log( diff.sort( sortChangeBase ) ); } ); + treeDiffButton.on( 'click', function () { + var diff, differ, root1, root2, tree1, tree2; + diff = window.diff; + + // Wraps each node of a tree in a treeNode + function wrapNodes( parentNode ) { + var i, ilen, childNode; + + if ( parentNode.node.children ) { + for ( i = 0, ilen = parentNode.node.children.length; i < ilen; i++ ) { + + // Wrap this node + childNode = new diff.treeNode( parentNode.node.children[ i ] ); + parentNode.addChild( childNode ); + + // Wrap this node's children + wrapNodes( childNode ); + + } + } + + } + + // Logs descriptions of the minimum diff transactions + function logTransactionDescriptions( transactions ) { + var i, ilen = transactions.length; + + // Log number of transactions + console.log( ilen + ' transaction(s)' ); + + // Log type of transactions + for ( i = 0; i < ilen; i++ ) { + if ( transactions[i][0] === null ) { + console.log( 'insert', tree2.orderedNodes[ transactions[ i ][ 1 ] ] ); + } else if ( transactions[ i ][ 1 ] === null ) { + console.log( 'remove', tree1.orderedNodes[ transactions[ i ][ 0 ] ] ); + } else { + console.log( +
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Fetch default options for gallery dialog
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/303103 Change subject: Fetch default options for gallery dialog .. Fetch default options for gallery dialog Fetch default options for mode, image heights and image widths rather than hard-coding them. Bug: T139632 Change-Id: I1adc7987fdeb1258ee87ce46acbab469ea18116e --- M VisualEditor.hooks.php M modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js 2 files changed, 15 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/03/303103/1 diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php index f7c3e86..9b1a8e7 100644 --- a/VisualEditor.hooks.php +++ b/VisualEditor.hooks.php @@ -697,6 +697,7 @@ 'defaultUserOptions' => [ 'defaultthumbsize' => $thumbLimits[ $defaultUserOptions['thumbsize'] ] ], + 'galleryOptions' => $coreConfig->get( 'GalleryOptions' ), 'blacklist' => $veConfig->get( 'VisualEditorBrowserBlacklist' ), 'skins' => $veConfig->get( 'VisualEditorSupportedSkins' ), 'tabPosition' => $veConfig->get( 'VisualEditorTabPosition' ), diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js index 390b5f1..285a74e 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js @@ -252,7 +252,8 @@ caption, widths, heights, perrow, showFilename, classes, styles, dialog = this, - attributes = this.selectedNode && this.selectedNode.getAttribute( 'mw' ).attrs; + attributes = this.selectedNode && this.selectedNode.getAttribute( 'mw' ).attrs, + defaults = mw.config.get( 'wgVisualEditorConfig' ).galleryOptions; // Images card @@ -307,10 +308,10 @@ // Options card // Set options - mode = attributes && attributes.mode || 'traditional'; + mode = attributes && attributes.mode || defaults.mode; caption = attributes && attributes.caption || ''; - widths = attributes && parseInt( attributes.widths ) || ''; - heights = attributes && parseInt( attributes.heights ) || ''; + widths = attributes && parseInt( attributes.widths ) || defaults.imageWidth; + heights = attributes && parseInt( attributes.heights ) || defaults.imageHeight; perrow = attributes && attributes.perrow || ''; showFilename = attributes && attributes.showfilename === 'yes'; classes = attributes && attributes.class || ''; @@ -589,9 +590,9 @@ var i, ilen, mode, caption, widths, heights, perrow, showFilename, classes, styles, selectedNode = this.selectedNode, - oldMode = selectedNode && selectedNode.getAttribute( 'mw' ).attrs.mode, extsrc = '', - items = this.galleryGroup.items; + items = this.galleryGroup.items, + defaults = mw.config.get( 'wgVisualEditorConfig' ).galleryOptions; // Parent method ve.ui.MWGalleryDialog.super.prototype.updateMwData.call( this, mwData ); @@ -604,9 +605,6 @@ // Get data from options card mode = this.modeDropdown.getMenu().getSelectedItem().getData(); - if ( oldMode === undefined && mode === 'traditional' ) { - mode = undefined; - } caption = this.captionInput.getValue(); widths = this.widthsInput.getValue(); heights = this.heightsInput.getValue(); @@ -619,12 +617,17 @@ mwData.body.extsrc = extsrc + '\n'; mwData.attrs.mode = mode || undefined; mwData.attrs.caption = caption || undefined; - mwData.attrs.widths = widths ? widths + 'px' : undefined; - mwData.attrs.heights = heights ? heights + 'px' : undefined; + mwData.attrs.widths = widths || undefined; + mwData.attrs.heights = heights || undefined; mwData.attrs.perrow = perrow || undefined; mwData.attrs.showfilename = showFilename ? 'yes' : undefined; mwData.attrs.classes = classes || undefined; mwData.attrs.styles = styles || undefined; + + // Unset attributes with defaults if they are the same as the default + mwData.attrs.mode = mode === defaults.mode ? undefined : mode; + mwData.attrs.widths = widths === defaults.imageWidth.toString() ? undefined : widths + 'px'; +
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Make image list keyboard accessible in gallery dialog
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/303028 Change subject: Make image list keyboard accessible in gallery dialog .. Make image list keyboard accessible in gallery dialog Bug: T140874 Change-Id: I0f00f1ddb397fb8f543a04d62b94fc5db32180f6 --- M modules/ve-mw/ui/widgets/ve.ui.MWGalleryItemWidget.js 1 file changed, 18 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/28/303028/1 diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWGalleryItemWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWGalleryItemWidget.js index 78cccb3..81941a7 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWGalleryItemWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWGalleryItemWidget.js @@ -34,8 +34,12 @@ // Mixin constructors OO.ui.mixin.DraggableElement.call( this, ve.extendObject( { $handle: this.$element }, this.config ) ); + OO.ui.mixin.TabIndexedElement.call( this, config ); - this.$element.on( 'click', this.onItemClick.bind( this ) ); + this.$element.on( { + 'click': this.onItemClick.bind( this ), + 'keypress': this.onItemKeyPress.bind( this ) + } ); }; /* Inheritance */ @@ -43,6 +47,7 @@ OO.inheritClass( ve.ui.MWGalleryItemWidget, OO.ui.Widget ); OO.mixinClass( ve.ui.MWGalleryItemWidget, OO.ui.mixin.DraggableElement ); +OO.mixinClass( ve.ui.MWGalleryItemWidget, OO.ui.mixin.TabIndexedElement ); /* Events */ @@ -60,6 +65,18 @@ }; /** + * Handle key press events + * + * @param {jQuery.Event} e Key press event + */ +ve.ui.MWGalleryItemWidget.prototype.onItemKeyPress = function ( e ) { + if ( e.which === OO.ui.Keys.ENTER ) { + this.emit( 'edit', this ); + return false; + } +}; + +/** * Set the caption property * * @param {string} caption The caption -- To view, visit https://gerrit.wikimedia.org/r/303028 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0f00f1ddb397fb8f543a04d62b94fc5db32180f6 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...CodeEditor[master]: Add jquery.textSelection dependency
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/302984 Change subject: Add jquery.textSelection dependency .. Add jquery.textSelection dependency Change-Id: I66de8620adced0c810ebd7b1037f790eec688534 --- M extension.json 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CodeEditor refs/changes/84/302984/1 diff --git a/extension.json b/extension.json index d87ea30..85aa672 100644 --- a/extension.json +++ b/extension.json @@ -57,7 +57,8 @@ "mediawiki.api", "mediawiki.api.options", "user.options", - "mediawiki.cookie" + "mediawiki.cookie", + "jquery.textSelection" ], "messages": [ "codeeditor-next-annotation", -- To view, visit https://gerrit.wikimedia.org/r/302984 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I66de8620adced0c810ebd7b1037f790eec688534 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CodeEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Add jquery.textSelection dependencies
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/302961 Change subject: Add jquery.textSelection dependencies .. Add jquery.textSelection dependencies Change-Id: I0a5c60f259989be6db0e547c864abad197ee6ebe --- M extension.json 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/61/302961/1 diff --git a/extension.json b/extension.json index 2a6ed54..a3916d2 100644 --- a/extension.json +++ b/extension.json @@ -282,6 +282,7 @@ "dependencies": [ "jquery.client", "jquery.cookie", + "jquery.textSelection", "mediawiki.page.startup", "mediawiki.Title", "mediawiki.Uri", @@ -323,6 +324,7 @@ "scripts": "modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js", "dependencies": [ "ext.visualEditor.track", + "jquery.textSelection", "mediawiki.api" ], "messages": [ -- To view, visit https://gerrit.wikimedia.org/r/302961 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0a5c60f259989be6db0e547c864abad197ee6ebe Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix Gallery Dialog dimensions editing - change (mediawiki...VisualEditor)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/298629 Change subject: Fix Gallery Dialog dimensions editing .. Fix Gallery Dialog dimensions editing If width or height attributes are left empty in the form, they are now undefined in mwData. Bug: T140094 Change-Id: I76dadbd07a89ce762e42ce714f364ce74a9cc1f0 --- M modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/29/298629/1 diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js index 9499d06..76813fd 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js @@ -610,8 +610,8 @@ mwData.body.extsrc = extsrc + '\n'; mwData.attrs.mode = mode || undefined; mwData.attrs.caption = caption || undefined; - mwData.attrs.widths = widths + 'px' || undefined; - mwData.attrs.heights = heights + 'px' || undefined; + mwData.attrs.widths = widths ? widths + 'px' : undefined; + mwData.attrs.heights = heights ? heights + 'px' : undefined; mwData.attrs.perrow = perrow || undefined; mwData.attrs.showfilename = showFilename ? 'yes' : undefined; mwData.attrs.classes = classes || undefined; -- To view, visit https://gerrit.wikimedia.org/r/298629 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I76dadbd07a89ce762e42ce714f364ce74a9cc1f0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Make gallery dialog caption field multiline - change (mediawiki...VisualEditor)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/297612 Change subject: Make gallery dialog caption field multiline .. Make gallery dialog caption field multiline Also change remove button label from "Remove" to "Remove image". Bug: T139421 Bug: T137982 Change-Id: I1b11eb44c672bad0d53d139d66e796a0657457f5 --- M modules/ve-mw/i18n/en.json M modules/ve-mw/i18n/qqq.json M modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js 3 files changed, 5 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/12/297612/1 diff --git a/modules/ve-mw/i18n/en.json b/modules/ve-mw/i18n/en.json index 7f6f062..8dfe99d 100644 --- a/modules/ve-mw/i18n/en.json +++ b/modules/ve-mw/i18n/en.json @@ -281,7 +281,7 @@ "visualeditor-mwgallerydialog-mode-dropdown-label-packed-overlay": "Packed with overlaid captions", "visualeditor-mwgallerydialog-mode-dropdown-label-traditional": "Traditional", "visualeditor-mwgallerydialog-mode-field-label": "Display mode", - "visualeditor-mwgallerydialog-remove-button-label": "Remove", + "visualeditor-mwgallerydialog-remove-button-label": "Remove image", "visualeditor-mwgallerydialog-perrow-field-label": "Images per row", "visualeditor-mwgallerydialog-search-button-label": "Add new image", "visualeditor-mwgallerydialog-styles-field-label": "CSS styles", diff --git a/modules/ve-mw/i18n/qqq.json b/modules/ve-mw/i18n/qqq.json index 44aca9b..54d1b25 100644 --- a/modules/ve-mw/i18n/qqq.json +++ b/modules/ve-mw/i18n/qqq.json @@ -292,7 +292,7 @@ "visualeditor-mwgallerydialog-mode-dropdown-label-packed-overlay": "Label for the packed-overlay option in the mode dropdown of the gallery dialog", "visualeditor-mwgallerydialog-mode-dropdown-label-traditional": "Label for the traditional option in the mode dropdown of the gallery dialog", "visualeditor-mwgallerydialog-mode-field-label": "Label for the mode field of the gallery dialog", - "visualeditor-mwgallerydialog-remove-button-label": "Label for the remove button of the gallery dialog\n{{Identical|Remove}}", + "visualeditor-mwgallerydialog-remove-button-label": "Label for the remove image button of the gallery dialog\n{{Identical|Remove}}", "visualeditor-mwgallerydialog-perrow-field-label": "Label for the perrow field of the gallery dialog", "visualeditor-mwgallerydialog-search-button-label": "Label for the show search panel button of the gallery dialog", "visualeditor-mwgallerydialog-styles-field-label": "Label for the styles field of the gallery dialog", diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js index fb5c94f..9499d06 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js @@ -107,7 +107,9 @@ .addClass( 've-ui-mwGalleryDialog-highlighted-image' ); // TODO: make into a ve.ui.MWTargetWidget once Parsoid handles galleries this.highlightedCaptionInput = new OO.ui.TextInputWidget( { - placeholder: 'Image caption' + placeholder: 'Image caption', + multiline: true, + autosize: true } ); this.removeButton = new OO.ui.ButtonWidget( { label: ve.msg( 'visualeditor-mwgallerydialog-remove-button-label' ), -- To view, visit https://gerrit.wikimedia.org/r/297612 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1b11eb44c672bad0d53d139d66e796a0657457f5 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Make short mode for the math dialog - change (mediawiki...Math)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/283128 Change subject: Make short mode for the math dialog .. Make short mode for the math dialog When the math dialog's layoutMenu height is below 450 px, make the symbol menu and the preview element shorter, so the input is still in view. (This works until about 280px, below which the user will need to scroll down to use the input. NB Nested setTimeouts were needed in order to check the space available for the input after the symbols menu transition has finished. This means that resizing the dialog multiple times is slow. It is probably rare for a user to change the height of the dialog while using it, however. Bug: T121150 Change-Id: I9e41cce80c3f770b1e3d0e7b133470045a1afe67 --- M modules/ve-math/ve.ui.MWMathDialog.css M modules/ve-math/ve.ui.MWMathDialog.js 2 files changed, 32 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/28/283128/1 diff --git a/modules/ve-math/ve.ui.MWMathDialog.css b/modules/ve-math/ve.ui.MWMathDialog.css index 139d0e2..8cb23b4 100644 --- a/modules/ve-math/ve.ui.MWMathDialog.css +++ b/modules/ve-math/ve.ui.MWMathDialog.css @@ -26,6 +26,14 @@ overflow: auto; } +.ve-ui-mwMathDialog-menuLayout-short .oo-ui-menuLayout-menu { + height: 10em; +} + +.ve-ui-mwMathDialog-menuLayout-short .oo-ui-menuLayout-content { + bottom: 10em; +} + .ve-ui-mwMathPage-symbol { background-position: center; background-repeat: no-repeat; @@ -71,6 +79,11 @@ height: 10em; } +.ve-ui-mwMathDialog-menuLayout-short .ve-ui-mwMathDialog-preview { + line-height: 6em; + height: 6em; +} + /* Ensures the preview image is vertically centred */ .ve-ui-mwMathDialog-preview .mwe-math-fallback-image-display { display: inline-block; diff --git a/modules/ve-math/ve.ui.MWMathDialog.js b/modules/ve-math/ve.ui.MWMathDialog.js index 3f96aa7..9b1e0e2 100644 --- a/modules/ve-math/ve.ui.MWMathDialog.js +++ b/modules/ve-math/ve.ui.MWMathDialog.js @@ -276,16 +276,29 @@ ve.ui.MWMathDialog.prototype.onWindowManagerResize = function () { var dialog = this; this.input.loadingPromise.done( function () { + // Wait for the window resize transition to finish setTimeout( function () { var availableSpace, maxInputHeight, singleLineHeight, minRows, border = 1, - padding = 3; - availableSpace = dialog.menuLayout.$content.height() - dialog.input.$element.position().top; - singleLineHeight = 19; - maxInputHeight = availableSpace - 2 * ( border + padding ); - minRows = Math.floor( maxInputHeight / singleLineHeight ); - dialog.input.setMinRows( minRows ); + padding = 3, + borderAndPadding = 2 * ( border + padding ); + + // Toggle short mode as necessary + // NB a change of mode triggers a transition... + dialog.menuLayout.$element.toggleClass( + 've-ui-mwMathDialog-menuLayout-short', dialog.menuLayout.$element.height() < 450 + ); + + // ...So wait for the possible menuLayout transition to finish + setTimeout( function () { + // Give the input the right number of rows to fit the space + availableSpace = dialog.menuLayout.$content.height() - dialog.input.$element.position().top; + singleLineHeight = 19; + maxInputHeight = availableSpace - borderAndPadding; + minRows = Math.floor( maxInputHeight / singleLineHeight ); + dialog.input.setMinRows( minRows ); + }, 250 ); }, 250 ); } ); }; -- To view, visit https://gerrit.wikimedia.org/r/283128 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9e41cce80c3f770b1e3d0e7b133470045a1afe67 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] build: Bump various devDependencies to latest - change (VisualEditor/VisualEditor)
Tchanders has submitted this change and it was merged. Change subject: build: Bump various devDependencies to latest .. build: Bump various devDependencies to latest grunt-cli 0.1.13 → 1.1.0 grunt-banana-checker0.4.0 → 0.5.0 grunt-karma0.12.1 → 0.12.2 karma-chrome-launcher 0.2.2 → 0.2.3 qunitjs1.22.0 → 1.23.0 Change-Id: I7cc9c04ae60665109579ada9e6d40bf78ee19b98 --- M package.json 1 file changed, 5 insertions(+), 5 deletions(-) Approvals: Tchanders: Looks good to me, approved jenkins-bot: Verified diff --git a/package.json b/package.json index d08a8db..35d3586 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,8 @@ ], "devDependencies": { "grunt": "0.4.5", -"grunt-cli": "0.1.13", -"grunt-banana-checker": "0.4.0", +"grunt-cli": "1.1.0", +"grunt-banana-checker": "0.5.0", "grunt-contrib-clean": "1.0.0", "grunt-contrib-concat": "1.0.0", "grunt-contrib-copy": "1.0.0", @@ -34,13 +34,13 @@ "grunt-cssjanus": "0.2.4", "grunt-jscs": "2.8.0", "grunt-jsonlint": "1.0.7", -"grunt-karma": "0.12.1", +"grunt-karma": "0.12.2", "grunt-tyops": "0.1.0", -"karma-chrome-launcher": "0.2.2", +"karma-chrome-launcher": "0.2.3", "karma-coverage": "0.5.5", "karma-firefox-launcher": "0.1.7", "karma-qunit": "0.1.9", "karma": "0.13.22", -"qunitjs": "1.22.0" +"qunitjs": "1.23.0" } } -- To view, visit https://gerrit.wikimedia.org/r/280853 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7cc9c04ae60665109579ada9e6d40bf78ee19b98 Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: JforresterGerrit-Reviewer: Tchanders Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Document#writeElement: Avoid double-space in error message - change (VisualEditor/VisualEditor)
Tchanders has submitted this change and it was merged. Change subject: Document#writeElement: Avoid double-space in error message .. Document#writeElement: Avoid double-space in error message Change-Id: I6d39400d3264ae557ab92e9be8f059434078656f --- M src/dm/ve.dm.Document.js 1 file changed, 2 insertions(+), 3 deletions(-) Approvals: Tchanders: Looks good to me, approved jenkins-bot: Verified diff --git a/src/dm/ve.dm.Document.js b/src/dm/ve.dm.Document.js index 0de6326..71f5e99 100644 --- a/src/dm/ve.dm.Document.js +++ b/src/dm/ve.dm.Document.js @@ -1187,9 +1187,8 @@ // within data. Don't track that on closingStack } else { if ( !parentNode.getParent() ) { - throw new Error( 'Cannot insert ' + childType + ' even ' + - ' after closing all containing nodes ' + - '(at index ' + i + ')' ); + throw new Error( 'Cannot insert ' + childType + ' even after closing ' + + 'all containing nodes (at index ' + i + ')' ); } // openingStack is empty, so we're closing a node that was already in the // document. This means we have to reopen it later, so track this on -- To view, visit https://gerrit.wikimedia.org/r/280838 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6d39400d3264ae557ab92e9be8f059434078656f Gerrit-PatchSet: 2 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: JforresterGerrit-Reviewer: Tchanders Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Make increment buttons optional in number input widget - change (oojs/ui)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/277352 Change subject: Make increment buttons optional in number input widget .. Make increment buttons optional in number input widget Make configuration option for showing the plus and minus buttons in a number input widget. (Show them by default.) Bug: T129318 Change-Id: I91401a681fcfa1aa929514a2a90b5bbc8616b9fb --- M src/widgets/NumberInputWidget.js 1 file changed, 41 insertions(+), 34 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/52/277352/1 diff --git a/src/widgets/NumberInputWidget.js b/src/widgets/NumberInputWidget.js index 49e4c3f..603a63c 100644 --- a/src/widgets/NumberInputWidget.js +++ b/src/widgets/NumberInputWidget.js @@ -26,6 +26,7 @@ * @cfg {number} [max=Infinity] Maximum allowed value * @cfg {number} [step=1] Delta when using the buttons or up/down arrow keys * @cfg {number|null} [pageStep] Delta when using the page-up/page-down keys. Defaults to 10 times #step. + * @cfg {boolean} [showButtons=true] Whether to show the plus and minus buttons. */ OO.ui.NumberInputWidget = function OoUiNumberInputWidget( config ) { // Configuration initialization @@ -34,7 +35,8 @@ min: -Infinity, max: Infinity, step: 1, - pageStep: null + pageStep: null, + showButtons: true }, config ); // Parent constructor @@ -47,28 +49,30 @@ }, config.input ) ); - this.minusButton = new OO.ui.ButtonWidget( $.extend( - { - disabled: this.isDisabled(), - tabIndex: -1 - }, - config.minusButton, - { - classes: [ 'oo-ui-numberInputWidget-minusButton' ], - label: '−' - } - ) ); - this.plusButton = new OO.ui.ButtonWidget( $.extend( - { - disabled: this.isDisabled(), - tabIndex: -1 - }, - config.plusButton, - { - classes: [ 'oo-ui-numberInputWidget-plusButton' ], - label: '+' - } - ) ); + if ( config.showButtons ) { + this.minusButton = new OO.ui.ButtonWidget( $.extend( + { + disabled: this.isDisabled(), + tabIndex: -1 + }, + config.minusButton, + { + classes: [ 'oo-ui-numberInputWidget-minusButton' ], + label: '−' + } + ) ); + this.plusButton = new OO.ui.ButtonWidget( $.extend( + { + disabled: this.isDisabled(), + tabIndex: -1 + }, + config.plusButton, + { + classes: [ 'oo-ui-numberInputWidget-plusButton' ], + label: '+' + } + ) ); + } // Events this.input.connect( this, { @@ -79,12 +83,14 @@ keydown: this.onKeyDown.bind( this ), 'wheel mousewheel DOMMouseScroll': this.onWheel.bind( this ) } ); - this.plusButton.connect( this, { - click: [ 'onButtonClick', +1 ] - } ); - this.minusButton.connect( this, { - click: [ 'onButtonClick', -1 ] - } ); + if ( config.showButtons ) { + this.plusButton.connect( this, { + click: [ 'onButtonClick', +1 ] + } ); + this.minusButton.connect( this, { + click: [ 'onButtonClick', -1 ] + } ); + } // Initialization this.setIsInteger( !!config.isInteger ); @@ -92,11 +98,12 @@ this.setStep( config.step, config.pageStep ); this.$field = $( '' ).addClass( 'oo-ui-numberInputWidget-field' ) - .append( - this.minusButton.$element, - this.input.$element, - this.plusButton.$element - ); + .append( this.input.$element ); + if ( config.showButtons ) { + this.$field + .prepend( this.minusButton.$element ) + .append( this.plusButton.$element ); + } this.$element.addClass( 'oo-ui-numberInputWidget' ).append( this.$field ); this.input.setValidation( this.validateNumber.bind( this ) ); }; -- To view, visit https://gerrit.wikimedia.org/r/277352 To unsubscribe, visit
[MediaWiki-commits] [Gerrit] WIP Make dialog for editing galleries - change (mediawiki...VisualEditor)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/275931 Change subject: WIP Make dialog for editing galleries .. WIP Make dialog for editing galleries Change-Id: I2b4082e991268241a15b9bbd6d85c94cdc2185f2 --- M extension.json A modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js A modules/ve-mw/ui/styles/dialogs/ve.ui.MWGalleryDialog.css A modules/ve-mw/ui/widgets/ve.ui.MWGalleryGroupWidget.js A modules/ve-mw/ui/widgets/ve.ui.MWGalleryItemWidget.js 5 files changed, 466 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/31/275931/1 diff --git a/extension.json b/extension.json index 2919a82..dbb947e 100644 --- a/extension.json +++ b/extension.json @@ -1684,7 +1684,13 @@ "modules/ve-mw/dm/nodes/ve.dm.MWGalleryNode.js", "modules/ve-mw/ce/nodes/ve.ce.MWGalleryNode.js", "modules/ve-mw/ui/inspectors/ve.ui.MWGalleryInspector.js", - "modules/ve-mw/ui/tools/ve.ui.MWGalleryInspectorTool.js" + "modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js", + "modules/ve-mw/ui/tools/ve.ui.MWGalleryInspectorTool.js", + "modules/ve-mw/ui/widgets/ve.ui.MWGalleryGroupWidget.js", + "modules/ve-mw/ui/widgets/ve.ui.MWGalleryItemWidget.js" + ], + "styles": [ + "modules/ve-mw/ui/styles/dialogs/ve.ui.MWGalleryDialog.css" ], "dependencies": [ "ext.visualEditor.mwcore", diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js new file mode 100644 index 000..9b14b43 --- /dev/null +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js @@ -0,0 +1,326 @@ +/*! + * VisualEditor user interface MWGalleryDialog class. + * + * @copyright 2016 VisualEditor Team and others; see AUTHORS.txt + * @license The MIT License (MIT); see LICENSE.txt + */ + +/** + * Dialog for editing MediaWiki galleries. + * + * @class + * @extends ve.ui.MWExtensionDialog + * + * @constructor + * @param {Object} [config] Configuration options + */ +ve.ui.MWGalleryDialog = function VeUiMWGalleryDialog() { + // Parent constructor + ve.ui.MWGalleryDialog.super.apply( this, arguments ); + + this.$element.addClass( 've-ui-mwGalleryDialog' ); // CSS rule doesn't exist yet +}; + +/* Inheritance */ + +OO.inheritClass( ve.ui.MWGalleryDialog, ve.ui.MWExtensionDialog ); + +/* Static properties */ + +ve.ui.MWGalleryDialog.static.name = 'gallery'; + +ve.ui.MWGalleryDialog.static.icon = 'imageGallery'; + +ve.ui.MWGalleryDialog.static.size = 'large'; + +ve.ui.MWGalleryDialog.static.title = + OO.ui.deferMsg( 'visualeditor-mwgallerydialog-title' ); + +ve.ui.MWGalleryDialog.static.modelClasses = [ ve.dm.MWGalleryNode ]; + +/* Methods */ + +/** + * @inheritdoc + */ +ve.ui.MWGalleryDialog.prototype.initialize = function () { + var optionsCard, modeField, captionField, widthsField, heightsField, + perrowField, showFilenameField, classesField, stylesField; + + // Parent method + ve.ui.MWGalleryDialog.super.prototype.initialize.call( this ); + + // NB options for indexlayout and cards set arbitrarily for now + this.indexLayout = new OO.ui.IndexLayout( { + scrollable: false, + expanded: true + } ); + + this.imagesCard = new OO.ui.CardLayout( 'images', { + label: ve.msg( 'visualeditor-mwgallerydialog-card-images' ), + expandable: false, + scrollable: false, + padded: true + } ); + optionsCard = new OO.ui.CardLayout( 'options', { + label: ve.msg( 'visualeditor-mwgallerydialog-card-options' ), + expandable: false, + scrollable: false, + padded: true + } ); + + // Images card elements + this.galleryGroup = new ve.ui.MWGalleryGroupWidget(); + // Also need button for adding a new item + + // Options card elements + this.modeSelect = new OO.ui.SelectWidget( { + items: [ + new OO.ui.OptionWidget( { + data: 'traditional', + label: 'traditional' // add i18n + } ), + new OO.ui.OptionWidget( { + data: 'nolines', + label: 'nolines' // add i18n + } ), + new OO.ui.OptionWidget( { + data: 'packed', + label: 'packed' // add
[MediaWiki-commits] [Gerrit] Add option to adjust SVG baseline on math dialog buttons - change (mediawiki...Math)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/267452 Change subject: Add option to adjust SVG baseline on math dialog buttons .. Add option to adjust SVG baseline on math dialog buttons If a symbol has "backgroundPosition" set to true, adjust its vertical position in the button, according to the vertical-align property on the SVG, by adding a background-position property on its CSS rule. Also set "backgroundPosition" to true for a number of symbols and generate a new CSS file. Bug: T123397 Change-Id: Ic9bbb65d2bedf38f569d8922599a2e3d2575f153 --- M modules/ve-math/symbols.json M modules/ve-math/tools/makeSvgsAndCss.js M modules/ve-math/tools/package.json M modules/ve-math/ve.ui.MWMathSymbols.css 4 files changed, 534 insertions(+), 259 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/52/267452/1 -- To view, visit https://gerrit.wikimedia.org/r/267452 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic9bbb65d2bedf38f569d8922599a2e3d2575f153 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Correct \mathit button in math dialog - change (mediawiki...Math)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/265933 Change subject: Correct \mathit button in math dialog .. Correct \mathit button in math dialog Change-Id: Ida4d82a9b859234e84a93ac34549076be9c42c46 --- M modules/ve-math/symbols.json 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/33/265933/1 diff --git a/modules/ve-math/symbols.json b/modules/ve-math/symbols.json index 56247d7..4200e69 100644 --- a/modules/ve-math/symbols.json +++ b/modules/ve-math/symbols.json @@ -,7 +,7 @@ { "tex": "\\mathit{1}", "encapsulate": { -"pre": "mathit{", +"pre": "\\mathit{", "placeholder": "1", "post": "}" } -- To view, visit https://gerrit.wikimedia.org/r/265933 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ida4d82a9b859234e84a93ac34549076be9c42c46 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add method for setting minimum number of rows in Ace editor ... - change (mediawiki...VisualEditor)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/265765 Change subject: Add method for setting minimum number of rows in Ace editor widget .. Add method for setting minimum number of rows in Ace editor widget Bug: T123891 Change-Id: Ia2e094071f385628449f1935f0250cbeb75196f0 --- M modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js 1 file changed, 16 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/65/265765/1 diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js index 2e7d898..72ce4f6 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js @@ -159,6 +159,22 @@ }; /** + * Set the minimum number of rows in the Ace editor widget + * + * @param {number} minRows The minimum number of rows + */ +ve.ui.MWAceEditorWidget.prototype.setMinRows = function ( minRows ) { + var widget = this; + this.loadingPromise.done( function () { + widget.editor.setOptions( { + minLines: minRows + } ); + } ); + // TODO: Implement minRows setter for OO.ui.TextInputWidget + // and call it here in loadingPromise.fail +}; + +/** * @inheritdoc */ ve.ui.MWAceEditorWidget.prototype.getRange = function () { -- To view, visit https://gerrit.wikimedia.org/r/265765 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia2e094071f385628449f1935f0250cbeb75196f0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Resize math dialog input to fit the available space - change (mediawiki...Math)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/264701 Change subject: Resize math dialog input to fit the available space .. Resize math dialog input to fit the available space Every time the math dialog is resized, calculate the vertical space available to the input and resize the input to fill this space. Bug: T123891 Change-Id: I3f3c915469f282a6e0459a7e4d10e19bee68b8db --- M modules/ve-math/ve.ui.MWMathDialog.js 1 file changed, 27 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/01/264701/1 diff --git a/modules/ve-math/ve.ui.MWMathDialog.js b/modules/ve-math/ve.ui.MWMathDialog.js index d9a87d2..4a3ea23 100644 --- a/modules/ve-math/ve.ui.MWMathDialog.js +++ b/modules/ve-math/ve.ui.MWMathDialog.js @@ -44,7 +44,7 @@ /* static methods */ /** - * Set the symbols property + * Set the symbols property * * @param {Object} symbols The math symbols and their group names */ @@ -101,8 +101,7 @@ this.input = new ve.ui.MWAceEditorWidget( { multiline: true, - autosize: true, - maxRows: 7, + rows: 1, // This will be recalculated later in onWindowManagerResize autocomplete: 'live' } ).setLanguage( 'latex' ); @@ -230,6 +229,8 @@ .next( function () { // Resize the input once the dialog has been appended this.input.adjustSize( true ).focus().moveCursorToEnd(); + this.getManager().connect( this, { resize: 'onWindowManagerResize' } ); + this.onWindowManagerResize(); }, this ); }; @@ -242,13 +243,14 @@ this.input.off( 'change', this.onChangeHandler ); this.displaySelect.off( 'choose', this.onChangeHandler ); this.idInput.off( 'change', this.onChangeHandler ); + this.getManager().disconnect( this ); }, this ); }; /** * @inheritdoc */ - ve.ui.MWMathDialog.prototype.updateMwData = function ( mwData ) { +ve.ui.MWMathDialog.prototype.updateMwData = function ( mwData ) { var display, id; // Parent method @@ -261,7 +263,7 @@ // Update attributes mwData.attrs.display = display !== 'default' ? display : undefined; mwData.attrs.id = id || undefined; - }; +}; /** * @inheritdoc @@ -271,6 +273,26 @@ }; /** + * Handle the window resize event + */ +ve.ui.MWMathDialog.prototype.onWindowManagerResize = function () { + var dialog = this; + this.input.loadingPromise.done( function () { + // Wait for the window resize transition to finish + setTimeout( function () { + var availableSpace, maxInputHeight, singleLineHeight, minRows, + border = 1, + padding = 3; + availableSpace = dialog.menuLayout.$content.height() - dialog.input.$element.position().top; + singleLineHeight = 19; + maxInputHeight = availableSpace - 2 * ( border + padding ); + minRows = Math.floor( maxInputHeight / singleLineHeight ); + dialog.input.setMinRows( minRows ); + }, 250 ); + } ); +}; + +/** * Handle the click event on the list * * @param {jQuery.Event} e Mouse click event -- To view, visit https://gerrit.wikimedia.org/r/264701 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3f3c915469f282a6e0459a7e4d10e19bee68b8db Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add a few symbols to the math dialog menu - change (mediawiki...Math)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/263781 Change subject: Add a few symbols to the math dialog menu .. Add a few symbols to the math dialog menu Change-Id: Id9fdbde64957af149784bb16ac225e3896bb9b8d --- M modules/ve-math/symbols.json M modules/ve-math/ve.ui.MWMathSymbols.css 2 files changed, 57 insertions(+), 73 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/81/263781/1 diff --git a/modules/ve-math/symbols.json b/modules/ve-math/symbols.json index db5c591..35e41ca 100644 --- a/modules/ve-math/symbols.json +++ b/modules/ve-math/symbols.json @@ -1812,6 +1812,24 @@ { "insert": "\\twoheadleftarrow", "tex": "\\twoheadleftarrow" +}, +{ +"contain": true, +"tex": "\\xrightarrow[b]{a}", +"encapsulate": { +"pre": "\\xrightarrow[", +"placeholder": "b", +"post": "]{a}" +} +}, +{ +"contain": true, +"tex": "\\xleftarrow[b]{a}", +"encapsulate": { +"pre": "\\xleftarrow[", +"placeholder": "b", +"post": "]{a}" +} } ], "math-visualeditor-symbol-group-special": [ @@ -2258,7 +2276,7 @@ { "tex": "\\mathit{1}", "encapsulate": { -"pre": "mathit{", +"pre": "\\mathit{", "placeholder": "1", "post": "}" } @@ -2574,6 +2592,18 @@ { "insert": "\\rceil", "tex": "\\rceil" +}, +{ +"insert": "\\rceil", +"tex": "\\rceil" +}, +{ +"tex": "\\lfloor x \\rceil", +"encapsulate": { +"pre": "\\lfloor ", +"placeholder": "x", +"post": " \\rceil" +} } ], "math-visualeditor-symbol-group-matrices": [ @@ -3134,6 +3164,12 @@ "largeLayout": true, "wide": true, "tex": "\\underbrace{ a+b+\\cdots+z }_{26}" +}, +{ +"insert": "{}_pF_q\\left({a_1, \\ldots, a_p \\atop b_1, \\ldots, b_q}; z\\right)", +"largeLayout": true, +"wide": true, +"tex": "{}_pF_q\\left({a_1, \\ldots, a_p \\atop b_1, \\ldots, b_q}; z\\right)" } ] } diff --git a/modules/ve-math/ve.ui.MWMathSymbols.css b/modules/ve-math/ve.ui.MWMathSymbols.css index a92aacf..0d5d271 100644 --- a/modules/ve-math/ve.ui.MWMathSymbols.css +++ b/modules/ve-math/ve.ui.MWMathSymbols.css @@ -23,6 +23,10 @@ background-image:
[MediaWiki-commits] [Gerrit] Use more generic host and port for updating the math menu - change (mediawiki...Math)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/263399 Change subject: Use more generic host and port for updating the math menu .. Use more generic host and port for updating the math menu Change-Id: Iaa079b8037d3c73cfc8a283aa3f7c7926feb328b --- M modules/ve-math/tools/makeSvgsAndCss.js 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/99/263399/1 diff --git a/modules/ve-math/tools/makeSvgsAndCss.js b/modules/ve-math/tools/makeSvgsAndCss.js index ba2e8ac..d831597 100755 --- a/modules/ve-math/tools/makeSvgsAndCss.js +++ b/modules/ve-math/tools/makeSvgsAndCss.js @@ -48,8 +48,8 @@ } ), // API call to mathoid options = { - host: '192.168.37.177', - port: '10044', + host: 'localhost', + port: '10042', path: '/', method: 'POST', headers: { -- To view, visit https://gerrit.wikimedia.org/r/263399 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iaa079b8037d3c73cfc8a283aa3f7c7926feb328b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Small corrections to the math dialog menu - change (mediawiki...Math)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/263397 Change subject: Small corrections to the math dialog menu .. Small corrections to the math dialog menu Remove some duplicated symbols and correct some typos Change-Id: I41e98a7b80554f3332e9abff33b9d12701a5d855 --- M modules/ve-math/symbols.json M modules/ve-math/ve.ui.MWMathSymbols.css 2 files changed, 6 insertions(+), 134 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/97/263397/1 diff --git a/modules/ve-math/symbols.json b/modules/ve-math/symbols.json index db5c591..56247d7 100644 --- a/modules/ve-math/symbols.json +++ b/modules/ve-math/symbols.json @@ -378,10 +378,6 @@ "tex": "\\backprime" }, { -"insert": "f^\\prime", -"tex": "f^\\prime" -}, -{ "insert": "f'", "tex": "f'" }, @@ -392,9 +388,9 @@ { "tex": "f^{(3)}", "encapsulate": { -"pre": "f^{", +"pre": "f^{(", "placeholder": "3", -"post": "}" +"post": ")}" } }, { @@ -484,11 +480,11 @@ }, { "wide": true, -"tex": "a\\,\\bmod\\,b", +"tex": "a\\bmod b", "encapsulate": { "pre": "", "placeholder": "a", -"post": "\\,\\bmod\\,b" +"post": "\\bmod b" } }, { @@ -1442,38 +1438,6 @@ { "insert": "\\bigwedge", "tex": "\\bigwedge" -}, -{ -"tex": "\\bar{q}", -"encapsulate": { -"pre": "\\bar{", -"placeholder": "q", -"post": "}" -} -}, -{ -"tex": "\\bar{abc}", -"encapsulate": { -"pre": "\\bar{", -"placeholder": "abc", -"post": "}" -} -}, -{ -"tex": "\\overline{q}", -"encapsulate": { -"pre": "\\overline{", -"placeholder": "q", -"post": "}" -} -}, -{ -"tex": "\\overline{abc}", -"encapsulate": { -"pre": "\\overline{", -"placeholder": "abc", -"post": "}" -} }, { "insert": "\\vdash", diff --git a/modules/ve-math/ve.ui.MWMathSymbols.css b/modules/ve-math/ve.ui.MWMathSymbols.css index a92aacf..c8004b7 100644 --- a/modules/ve-math/ve.ui.MWMathSymbols.css +++ b/modules/ve-math/ve.ui.MWMathSymbols.css @@ -147,10 +147,6 @@ background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20style%3D%22vertical-align%3A-.338ex%22%20width%3D%221.946ex%22%20height%3D%222.343ex%22%20viewBox%3D%220%20-863.1%20838%201008.6%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ctitle%3EEquation%3C%2Ftitle%3E%3Cdesc%3Enormal%20upper%20Delta%3C%2Fdesc%3E%3Cdefs%3E%3Cpath%20stroke-width%3D%2210%22%20id%3D%22a%22%20d%3D%22M51%200q-5%204-5%207%200%202%20169%20350t173%20352q3%207%2028%207%2023%200%2028-7%203-4%20172-352T786%207q0-3-5-7H51zm456%20344L384%20596%20137%2092l246-1h247q0%202-123%20253z%22%2F%3E%3C%2Fdefs%3E%3Cuse%20xlink%3Ahref%3D%22%23a%22%20stroke%3D%22currentColor%22%20fill%3D%22currentColor%22%20stroke-width%3D%220%22%20transform%3D%22matrix%281%200%200%20-1%200%200%29%22%2F%3E%3C%2Fsvg%3E); } -.ve-ui-mwMathSymbol-_92_Diamond { - background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20style%3D%22vertical-align%3A-.505ex%22%20width%3D%221.561ex%22%20height%3D%222.509ex%22%20viewBox%3D%220%20-863.1%20672%201080.4%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ctitle%3EEquation%3C%2Ftitle%3E%3Cdesc%3Elozenge%3C%2Fdesc%3E%3Cdefs%3E%3Cpath%20stroke-width%3D%2210%22%20id%3D%22a%22%20d%3D%22M318%20709q7%207%2014%207%208%200%2012-3t130-202q137-213%20137-219%200-7-85-140-32-49-52-80-127-200-130-202-4-2-11-2t-11%202q-3%202-65%2099T131%20169%2060%20278q-4%207-4%2014%200%206%204%2013%2013%2021%20134%20211t124%20193zm249-419v1L451%20475%20333%20658%20100%20293q0-5%20115-185L333-74q1%200%20117%20182z%22%2F%3E%3C%2Fdefs%3E%3Cuse%20xlink%3Ahref%3D%22%23a%22%20stroke%3D%22currentColor%22%20fill%3D%22currentColor%22%20stroke-width%3D%220%22%20transform%3D%22matrix%281%200%200%20-1%200%200%29%22%2F%3E%3C%2Fsvg%3E); -} - .ve-ui-mwMathSymbol-_92_Downarrow { background-image:
[MediaWiki-commits] [Gerrit] Make Ace Editor adjustSize method chainable - change (mediawiki...VisualEditor)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/260179 Change subject: Make Ace Editor adjustSize method chainable .. Make Ace Editor adjustSize method chainable Change-Id: I48307bd9184bb238a553d178c0d66084244e9ebf --- M modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/79/260179/1 diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js index 545d767..5493abb 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js @@ -340,4 +340,5 @@ // Parent method ve.ui.MWAceEditorWidget.super.prototype.adjustSize.call( widget ); } ); + return this; }; -- To view, visit https://gerrit.wikimedia.org/r/260179 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I48307bd9184bb238a553d178c0d66084244e9ebf Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Force Ace Editor to resize after the dialog has appended - change (mediawiki...Math)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/260180 Change subject: Force Ace Editor to resize after the dialog has appended .. Force Ace Editor to resize after the dialog has appended If the editor resizes first, the height is 0px. Depends on: I48307bd9184b Bug: T121164 Change-Id: Ieb4ed963b03c9e7d802e9547478eb3c9cde512ae --- M modules/ve-math/ve.ui.MWMathDialog.js 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/80/260180/1 diff --git a/modules/ve-math/ve.ui.MWMathDialog.js b/modules/ve-math/ve.ui.MWMathDialog.js index b46d1cc..1ab67af 100644 --- a/modules/ve-math/ve.ui.MWMathDialog.js +++ b/modules/ve-math/ve.ui.MWMathDialog.js @@ -228,7 +228,8 @@ return this.symbolsPromise; }, this ) .next( function () { - this.input.focus().moveCursorToEnd(); + // Resize the input once the dialog has been appended + this.input.adjustSize( true ).focus().moveCursorToEnd(); }, this ); }; -- To view, visit https://gerrit.wikimedia.org/r/260180 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ieb4ed963b03c9e7d802e9547478eb3c9cde512ae Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Focus the math dialog input after the symbols promise has re... - change (mediawiki...Math)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/257381 Change subject: Focus the math dialog input after the symbols promise has returned .. Focus the math dialog input after the symbols promise has returned Bug: T119778 Change-Id: Ia5afe667241543addbda95d4d284b8af63f693a1 --- M modules/ve-math/ve.ui.MWMathDialog.js 1 file changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/81/257381/1 diff --git a/modules/ve-math/ve.ui.MWMathDialog.js b/modules/ve-math/ve.ui.MWMathDialog.js index 74964f3..b20c662 100644 --- a/modules/ve-math/ve.ui.MWMathDialog.js +++ b/modules/ve-math/ve.ui.MWMathDialog.js @@ -225,8 +225,10 @@ ve.ui.MWMathDialog.prototype.getReadyProcess = function ( data ) { return ve.ui.MWMathDialog.super.prototype.getReadyProcess.call( this, data ) .next( function () { - this.input.focus().moveCursorToEnd(); return this.symbolsPromise; + }, this ) + .next( function () { + this.input.focus().moveCursorToEnd(); }, this ); }; -- To view, visit https://gerrit.wikimedia.org/r/257381 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia5afe667241543addbda95d4d284b8af63f693a1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] WIP Allow users to choose math inspector or math dialog - change (mediawiki...Math)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/257261 Change subject: WIP Allow users to choose math inspector or math dialog .. WIP Allow users to choose math inspector or math dialog The context item for math nodes now has two edit buttons, one for the inspector (edit inline) and one for the dialog (edit). Creating a new math node automatically opens the dialog. Bug: T120382 Change-Id: Icd3ec75262fcc5e0cbc304051c651278b0d8b01c --- M extension.json M i18n/en.json M i18n/qqq.json A modules/ve-math/ve.ui.MWMathContextItem.js M modules/ve-math/ve.ui.MWMathDialog.js A modules/ve-math/ve.ui.MWMathDialogTool.js A modules/ve-math/ve.ui.MWMathInspector.css A modules/ve-math/ve.ui.MWMathInspector.js D modules/ve-math/ve.ui.MWMathInspectorTool.js 9 files changed, 283 insertions(+), 48 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/61/257261/1 diff --git a/extension.json b/extension.json index 20d87fe..117563e 100644 --- a/extension.json +++ b/extension.json @@ -142,19 +142,23 @@ "scripts": [ "ve-math/ve.dm.MWMathNode.js", "ve-math/ve.ce.MWMathNode.js", + "ve-math/ve.ui.MWMathInspector.js", + "ve-math/ve.ui.MWMathContextItem.js", "ve-math/ve.ui.MWMathDialog.js", "ve-math/ve.ui.MWMathPage.js", - "ve-math/ve.ui.MWMathInspectorTool.js" + "ve-math/ve.ui.MWMathDialogTool.js" ], "styles": [ "ve-math/ve.ce.MWMathNode.css", "ve-math/ve.ui.MWMathIcons.css", + "ve-math/ve.ui.MWMathInspector.css", "ve-math/ve.ui.MWMathDialog.css" ], "dependencies": [ "ext.visualEditor.mwcore" ], "messages": [ + "math-visualeditor-mwmathcontextitem-editinline", "math-visualeditor-mwmathdialog-title", "math-visualeditor-mwmathdialog-card-formula", "math-visualeditor-mwmathdialog-card-options", diff --git a/i18n/en.json b/i18n/en.json index a4e2bc0..b2cf398 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -18,6 +18,7 @@ ] }, "math-desc": "Render mathematical formulas between math ... /math tags", + "math-visualeditor-mwmathcontextitem-editinline": "Edit inline", "math-visualeditor-mwmathdialog-title": "Formula", "math-visualeditor-mwmathdialog-card-formula": "Formula", "math-visualeditor-mwmathdialog-card-options": "Options", diff --git a/i18n/qqq.json b/i18n/qqq.json index 46a7294..64434e0 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -17,6 +17,7 @@ ] }, "math-desc": "{{desc|name=Math|url=https://www.mediawiki.org/wiki/Extension:Math}};, + "math-visualeditor-mwmathcontextitem-editinline": "Label for the edit inline button in the math context item", "math-visualeditor-mwmathdialog-title": "Title for the dialog to edit formula blocks.\n{{Identical|Formula}}", "math-visualeditor-mwmathdialog-card-formula": "Label for the formula card of the math dialog\n{{Identical|Formula}}", "math-visualeditor-mwmathdialog-card-options": "Label for the options card of the math dialog\n{{Identical|Options}}", diff --git a/modules/ve-math/ve.ui.MWMathContextItem.js b/modules/ve-math/ve.ui.MWMathContextItem.js new file mode 100644 index 000..183575e --- /dev/null +++ b/modules/ve-math/ve.ui.MWMathContextItem.js @@ -0,0 +1,69 @@ +/*! + * VisualEditor MWMathContextItem class. + * + * @copyright 2015 VisualEditor Team and others; see http://ve.mit-license.org + */ + +/** + * Context item for a link. + * + * @class + * @extends ve.ui.LinearContextItem + * + * @param {ve.ui.Context} context Context item is in + * @param {ve.dm.Model} model Model item is related to + * @param {Object} config Configuration options + */ +ve.ui.MWMathContextItem = function VeUiMWMathContextItem() { + // Parent constructor + ve.ui.MWMathContextItem.super.apply( this, arguments ); + + this.editInlineButton = new OO.ui.ButtonWidget( { + label: ve.msg( 'math-visualeditor-mwmathcontextitem-editinline' ), + flags: [ 'progressive' ] + } ); + + this.actionButtons.addItems( [ this.editInlineButton ], 0 ); + + this.editInlineButton.connect( this, { click: 'onInlineEditButtonClick' } ); + + // Initialization + this.$element.addClass(
[MediaWiki-commits] [Gerrit] Make math dialog menu content scrollable - change (mediawiki...Math)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/256634 Change subject: Make math dialog menu content scrollable .. Make math dialog menu content scrollable Also make input widget height respond to its contents. These two changes address the problems of overlapping when the screen height is limited. Bug: T119900 Change-Id: Ie21c141673a9343d05da05cdbd2eaa96efff0a58 --- M modules/ve-math/ve.ui.MWMathDialog.css M modules/ve-math/ve.ui.MWMathDialog.js 2 files changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/34/256634/1 diff --git a/modules/ve-math/ve.ui.MWMathDialog.css b/modules/ve-math/ve.ui.MWMathDialog.css index 00bbe1b..2b2b8f8 100644 --- a/modules/ve-math/ve.ui.MWMathDialog.css +++ b/modules/ve-math/ve.ui.MWMathDialog.css @@ -23,6 +23,7 @@ .ve-ui-mwMathDialog-menuLayout > .oo-ui-menuLayout-content { border-bottom: 1px solid #e6e6e6; box-shadow: 0 1px 0 0 rgba( 0, 0, 0, 0.05 ); + overflow: scroll; } .ve-ui-mwMathPage-symbol { diff --git a/modules/ve-math/ve.ui.MWMathDialog.js b/modules/ve-math/ve.ui.MWMathDialog.js index 7d22f6c..7c42fea 100644 --- a/modules/ve-math/ve.ui.MWMathDialog.js +++ b/modules/ve-math/ve.ui.MWMathDialog.js @@ -101,7 +101,8 @@ this.input = new ve.ui.MWAceEditorWidget( { multiline: true, - rows: 7, + autosize: true, + maxRows: 7, autocomplete: 'live' } ).setLanguage( 'latex' ); -- To view, visit https://gerrit.wikimedia.org/r/256634 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie21c141673a9343d05da05cdbd2eaa96efff0a58 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Focus input and move cursor to end when MathDialog opens - change (mediawiki...Math)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/255467 Change subject: Focus input and move cursor to end when MathDialog opens .. Focus input and move cursor to end when MathDialog opens Change-Id: Ie963913723b8c5f8ffb32701477627387c77eb85 --- M modules/ve-math/ve.ui.MWMathDialog.js 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/67/255467/1 diff --git a/modules/ve-math/ve.ui.MWMathDialog.js b/modules/ve-math/ve.ui.MWMathDialog.js index ef9612a..7d22f6c 100644 --- a/modules/ve-math/ve.ui.MWMathDialog.js +++ b/modules/ve-math/ve.ui.MWMathDialog.js @@ -224,6 +224,7 @@ ve.ui.MWMathDialog.prototype.getReadyProcess = function ( data ) { return ve.ui.MWMathDialog.super.prototype.getReadyProcess.call( this, data ) .next( function () { + this.input.focus().moveCursorToEnd(); return this.symbolsPromise; }, this ); }; -- To view, visit https://gerrit.wikimedia.org/r/255467 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie963913723b8c5f8ffb32701477627387c77eb85 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Ensure the formula preview in MathDialog is vertically centered - change (mediawiki...Math)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/255462 Change subject: Ensure the formula preview in MathDialog is vertically centered .. Ensure the formula preview in MathDialog is vertically centered The formula preview is not centered when the display attribute is set to block. Correct this by enforcing display: inline-block when the math image is inside the preview element. Bug: T119670 Change-Id: I77d9b213a31d3005212c8c11874112ddb64aa74a --- M modules/ve-math/ve.ui.MWMathDialog.css 1 file changed, 5 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/62/255462/1 diff --git a/modules/ve-math/ve.ui.MWMathDialog.css b/modules/ve-math/ve.ui.MWMathDialog.css index 7098c57..00bbe1b 100644 --- a/modules/ve-math/ve.ui.MWMathDialog.css +++ b/modules/ve-math/ve.ui.MWMathDialog.css @@ -70,6 +70,11 @@ height: 10em; } +/* Ensures the preview image is vertically centred */ +.ve-ui-mwMathDialog-preview .mwe-math-fallback-image-display { + display: inline-block; +} + .ve-ui-mwMathPage-outline { padding: 0.5em; color: #555; -- To view, visit https://gerrit.wikimedia.org/r/255462 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I77d9b213a31d3005212c8c11874112ddb64aa74a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Modify updateMwData in MathDialog to update display and id a... - change (mediawiki...Math)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/255459 Change subject: Modify updateMwData in MathDialog to update display and id attributes .. Modify updateMwData in MathDialog to update display and id attributes Also populate the options form with pre-existing values and add event handlers. Bug: T119663 Change-Id: I32fbecdb9b204fa33e309662f1f670942968fee7 --- M modules/ve-math/ve.ui.MWMathDialog.js 1 file changed, 31 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/59/255459/1 diff --git a/modules/ve-math/ve.ui.MWMathDialog.js b/modules/ve-math/ve.ui.MWMathDialog.js index a23f51b..135d3b9 100644 --- a/modules/ve-math/ve.ui.MWMathDialog.js +++ b/modules/ve-math/ve.ui.MWMathDialog.js @@ -203,9 +203,18 @@ ve.ui.MWMathDialog.prototype.getSetupProcess = function ( data ) { return ve.ui.MWMathDialog.super.prototype.getSetupProcess.call( this, data ) .next( function () { - var display = ( this.selectedNode && this.selectedNode.getAttribute( 'mw' ).attrs.display ) || 'default'; - this.input.on( 'change', this.onChangeHandler ); + var attributes = this.selectedNode && this.selectedNode.getAttribute( 'mw' ).attrs, + display = attributes && attributes.display || 'default', + id = attributes && attributes.id || ''; + + // Populate form this.displaySelect.selectItemByData( display ); + this.idInput.setValue( id ); + + // Add event handlers + this.input.on( 'change', this.onChangeHandler ); + this.displaySelect.on( 'choose', this.onChangeHandler ); + this.idInput.on( 'change', this.onChangeHandler ); }, this ); }; @@ -226,12 +235,32 @@ return ve.ui.MWMathDialog.super.prototype.getTeardownProcess.call( this, data ) .first( function () { this.input.off( 'change', this.onChangeHandler ); + this.displaySelect.off( 'choose', this.onChangeHandler ); + this.idInput.off( 'change', this.onChangeHandler ); }, this ); }; /** * @inheritdoc */ + ve.ui.MWMathDialog.prototype.updateMwData = function ( mwData ) { + var display, id; + + // Parent method + ve.ui.MWMathDialog.super.prototype.updateMwData.call( this, mwData ); + + // Get data from dialog + display = this.displaySelect.getSelectedItem().getData(); + id = this.idInput.getValue(); + + // Update attributes + mwData.attrs.display = display; + mwData.attrs.id = id; + }; + +/** + * @inheritdoc + */ ve.ui.MWMathDialog.prototype.getBodyHeight = function () { return 600; }; -- To view, visit https://gerrit.wikimedia.org/r/255459 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I32fbecdb9b204fa33e309662f1f670942968fee7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add autocomplete options to AceEditorWidget config options - change (mediawiki...VisualEditor)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/255300 Change subject: Add autocomplete options to AceEditorWidget config options .. Add autocomplete options to AceEditorWidget config options Bug: T119549 Change-Id: I57db44c876c5cb0487bda6a72e36fedaccb532b5 --- M modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js 1 file changed, 6 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/00/255300/1 diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js index ff695aa..b549c32 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js @@ -29,6 +29,9 @@ // Configuration config = config || {}; + this.autocomplete = config.autocomplete || false; + this.liveAutocomplete = config.liveAutocomplete || false; + this.$ace = $( '' ); this.editor = null; // Initialise to a rejected promise for the setValue call in the parent constructor @@ -98,7 +101,9 @@ this.editor = ace.edit( this.$ace[ 0 ] ); this.editor.setOptions( { minLines: this.minRows || 3, - maxLines: this.autosize ? this.maxRows : this.minRows || 3 + maxLines: this.autosize ? this.maxRows : this.minRows || 3, + enableBasicAutocompletion: this.autocomplete, + enableLiveAutocompletion: this.liveAutocomplete } ); this.editor.getSession().on( 'change', this.onEditorChange.bind( this ) ); this.editor.renderer.on( 'resize', this.onEditorResize.bind( this ) ); -- To view, visit https://gerrit.wikimedia.org/r/255300 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I57db44c876c5cb0487bda6a72e36fedaccb532b5 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Set autocomplete options for math dialog input - change (mediawiki...Math)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/255302 Change subject: Set autocomplete options for math dialog input .. Set autocomplete options for math dialog input Depends on I57db44c876c in ve-mw Bug: T119549 Change-Id: I80193b7b662336c65b81556eb000f3895cddf49f --- M modules/ve-math/ve.ui.MWMathDialog.js 1 file changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/02/255302/1 diff --git a/modules/ve-math/ve.ui.MWMathDialog.js b/modules/ve-math/ve.ui.MWMathDialog.js index 70eaed6..7eae112 100644 --- a/modules/ve-math/ve.ui.MWMathDialog.js +++ b/modules/ve-math/ve.ui.MWMathDialog.js @@ -101,7 +101,9 @@ this.input = new ve.ui.MWAceEditorWidget( { multiline: true, - rows: 7 + rows: 7, + autocomplete: true, + liveAutocomplete: true } ).setLanguage( 'latex' ); this.input.togglePrintMargin( false ); -- To view, visit https://gerrit.wikimedia.org/r/255302 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I80193b7b662336c65b81556eb000f3895cddf49f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add parameter to SpecialCharacterDialog onListClick document... - change (VisualEditor/VisualEditor)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/255040 Change subject: Add parameter to SpecialCharacterDialog onListClick documentation .. Add parameter to SpecialCharacterDialog onListClick documentation Change-Id: Ib6c3964336565f7539d429e71c66a677c29b2050 --- M src/ui/dialogs/ve.ui.SpecialCharacterDialog.js 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/40/255040/1 diff --git a/src/ui/dialogs/ve.ui.SpecialCharacterDialog.js b/src/ui/dialogs/ve.ui.SpecialCharacterDialog.js index 24ccf75..74c0f6a 100644 --- a/src/ui/dialogs/ve.ui.SpecialCharacterDialog.js +++ b/src/ui/dialogs/ve.ui.SpecialCharacterDialog.js @@ -150,6 +150,8 @@ /** * Handle the click event on the list + * + * @param {jQuery.Event} e Mouse click event */ ve.ui.SpecialCharacterDialog.prototype.onListClick = function ( e ) { var -- To view, visit https://gerrit.wikimedia.org/r/255040 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib6c3964336565f7539d429e71c66a677c29b2050 Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add documentation to setupOutlineItem in SpecialCharacterPage - change (VisualEditor/VisualEditor)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/254619 Change subject: Add documentation to setupOutlineItem in SpecialCharacterPage .. Add documentation to setupOutlineItem in SpecialCharacterPage Change-Id: I540b828d0660c7f1985f1cd1c5a3a23b65a5e4b8 --- M src/ui/pages/ve.ui.SpecialCharacterPage.js 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/19/254619/1 diff --git a/src/ui/pages/ve.ui.SpecialCharacterPage.js b/src/ui/pages/ve.ui.SpecialCharacterPage.js index 8c77614..63eeb52 100644 --- a/src/ui/pages/ve.ui.SpecialCharacterPage.js +++ b/src/ui/pages/ve.ui.SpecialCharacterPage.js @@ -52,6 +52,9 @@ /* Methods */ +/** + * @inheritdoc + */ ve.ui.SpecialCharacterPage.prototype.setupOutlineItem = function ( outlineItem ) { ve.ui.SpecialCharacterPage.super.prototype.setupOutlineItem.call( this, outlineItem ); this.outlineItem.setLabel( this.label ); -- To view, visit https://gerrit.wikimedia.org/r/254619 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I540b828d0660c7f1985f1cd1c5a3a23b65a5e4b8 Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add method to insert new content to encapsulate a selection - change (oojs/ui)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/254314 Change subject: Add method to insert new content to encapsulate a selection .. Add method to insert new content to encapsulate a selection Also update insertContent to make sure start <= end. Change-Id: Ie814f59086b4581aec87c43ce605d420ea89a2f2 --- M src/widgets/TextInputWidget.js 1 file changed, 31 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/14/254314/1 diff --git a/src/widgets/TextInputWidget.js b/src/widgets/TextInputWidget.js index a2ad473..a9a6ade 100644 --- a/src/widgets/TextInputWidget.js +++ b/src/widgets/TextInputWidget.js @@ -602,11 +602,39 @@ * @chainable */ OO.ui.TextInputWidget.prototype.insertContent = function ( content ) { - var range = this.getRange(), + var start, end, + range = this.getRange(), value = this.getValue(); - this.setValue( value.slice( 0, range.from ) + content + value.slice( range.to ) ); - this.selectRange( range.from + content.length ); + start = Math.min( range.from, range.to ); + end = Math.max( range.from, range.to ); + + this.setValue( value.slice( 0, start ) + content + value.slice( end ) ); + this.selectRange( start + content.length ); + return this; +}; + +/** + * Insert new content either side of a selection. + * + * @param {string} pre Content to be inserted before the selection + * @param {string} post Content to be inserted after the selection + * @chainable + */ +OO.ui.TextInputWidget.prototype.insertEncapsulateContent = function ( pre, post ) { + var start, end, + range = this.getRange(), + offset = pre.length; + + start = Math.min( range.from, range.to ); + end = Math.max( range.from, range.to ); + + this.selectRange( start ); + this.insertContent( pre ); + this.selectRange( offset + end ); + this.insertContent( post ); + + this.selectRange( offset + start, offset + end ); return this; }; -- To view, visit https://gerrit.wikimedia.org/r/254314 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie814f59086b4581aec87c43ce605d420ea89a2f2 Gerrit-PatchSet: 1 Gerrit-Project: oojs/ui Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Make focus method of AceEditorWidget chainable - change (mediawiki...VisualEditor)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/253962 Change subject: Make focus method of AceEditorWidget chainable .. Make focus method of AceEditorWidget chainable The focus method of InputWidget and other descendants of InputWidget is already chainable Change-Id: Ib75fb7b08769e86c652c63dac069e2573e61f89a --- M modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/62/253962/1 diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js index 83449ca..9186fb9 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js @@ -276,6 +276,7 @@ } ).fail( function () { ve.ui.MWAceEditorWidget.super.prototype.focus.call( widget ); } ); + return widget; }; /** -- To view, visit https://gerrit.wikimedia.org/r/253962 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib75fb7b08769e86c652c63dac069e2573e61f89a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add insertContent method to the TextInputWidget - change (oojs/ui)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/254090 Change subject: Add insertContent method to the TextInputWidget .. Add insertContent method to the TextInputWidget Change-Id: If08203618df68f36b84ff5d86bcda337e71e7c23 --- M src/widgets/TextInputWidget.js 1 file changed, 14 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/90/254090/1 diff --git a/src/widgets/TextInputWidget.js b/src/widgets/TextInputWidget.js index 374a29e..28b06d9 100644 --- a/src/widgets/TextInputWidget.js +++ b/src/widgets/TextInputWidget.js @@ -579,6 +579,20 @@ }; /** + * Focus the input and move the cursor to the end. + * + * @chainable + */ +OO.ui.TextInputWidget.prototype.insertContent = function ( content ) { + var range = this.getRange(), + value = this.getValue(); + + this.setValue( value.slice( 0, range.from ) + content + value.slice( range.to ) ); + this.selectRange( range.from + content.length ); + return this; +}; + +/** * Set the validation pattern. * * The validation pattern is either a regular expression, a function, or the symbolic name of a -- To view, visit https://gerrit.wikimedia.org/r/254090 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If08203618df68f36b84ff5d86bcda337e71e7c23 Gerrit-PatchSet: 1 Gerrit-Project: oojs/ui Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add method to toggle the AceEditorWidget print margin - change (mediawiki...VisualEditor)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/254034 Change subject: Add method to toggle the AceEditorWidget print margin .. Add method to toggle the AceEditorWidget print margin Change-Id: I758f90abb92a91491237150f607e7b0f93bf8f85 --- M modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js 1 file changed, 14 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/34/254034/1 diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js index 83449ca..1ff6513 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js @@ -253,6 +253,20 @@ }; /** + * Toggle the visibility of the print margin + * + * @param {boolean} visible Visible + * @chainable + */ +ve.ui.MWAceEditorWidget.prototype.togglePrintMargin = function ( visible ) { + var widget = this; + this.loadingPromise.done( function () { + widget.editor.renderer.setShowPrintMargin( visible ); + } ); + return this; +}; + +/** * Set the language mode of the editor (programming language) * * @param {string} lang Language -- To view, visit https://gerrit.wikimedia.org/r/254034 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I758f90abb92a91491237150f607e7b0f93bf8f85 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add latex to Ace modes module - change (mediawiki...CodeEditor)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/254036 Change subject: Add latex to Ace modes module .. Add latex to Ace modes module Change-Id: Ibcd941d938c80ffa7206df1b58acf6d1fc7c388b --- M extension.json 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CodeEditor refs/changes/36/254036/1 diff --git a/extension.json b/extension.json index 1cc94a7..6a607d6 100644 --- a/extension.json +++ b/extension.json @@ -91,6 +91,7 @@ "ace/mode-groovy.js", "ace/mode-html.js", "ace/mode-java.js", + "ace/mode-latex.js", "ace/mode-ocaml.js", "ace/mode-perl.js", "ace/mode-php.js", -- To view, visit https://gerrit.wikimedia.org/r/254036 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibcd941d938c80ffa7206df1b58acf6d1fc7c388b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CodeEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix documentation of TextInputWidget insertContent method - change (oojs/ui)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/254095 Change subject: Fix documentation of TextInputWidget insertContent method .. Fix documentation of TextInputWidget insertContent method Change-Id: If540670bf269f6669123a54cb822a57e19a32e59 --- M src/widgets/TextInputWidget.js 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/95/254095/1 diff --git a/src/widgets/TextInputWidget.js b/src/widgets/TextInputWidget.js index e0c9b5a..a2ad473 100644 --- a/src/widgets/TextInputWidget.js +++ b/src/widgets/TextInputWidget.js @@ -596,9 +596,9 @@ }; /** - * Focus the input and move the cursor to the end. + * Insert new content into the input. * - * @param {String} content Content to be inserted + * @param {string} content Content to be inserted * @chainable */ OO.ui.TextInputWidget.prototype.insertContent = function ( content ) { -- To view, visit https://gerrit.wikimedia.org/r/254095 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If540670bf269f6669123a54cb822a57e19a32e59 Gerrit-PatchSet: 1 Gerrit-Project: oojs/ui Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Make selectRange method of AceEditorWidget focus the input - change (mediawiki...VisualEditor)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/254092 Change subject: Make selectRange method of AceEditorWidget focus the input .. Make selectRange method of AceEditorWidget focus the input The selectRange method does this in TextInputWidget, so it should here too. Change-Id: Ib3851e0c72876d3c25ae5992cf9732637238d117 --- M modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/92/254092/1 diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js index 83449ca..7a35049 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js @@ -170,6 +170,7 @@ */ ve.ui.MWAceEditorWidget.prototype.selectRange = function ( from, to ) { var widget = this; + this.focus(); this.loadingPromise.done( function () { var fromOffset, toOffset, selection, range, doc = widget.editor.getSession().getDocument(), -- To view, visit https://gerrit.wikimedia.org/r/254092 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib3851e0c72876d3c25ae5992cf9732637238d117 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] WIP Make math dialog with clickable list of formula fragments - change (mediawiki...Math)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/253374 Change subject: WIP Make math dialog with clickable list of formula fragments .. WIP Make math dialog with clickable list of formula fragments The main components are: - a menu of formula fragment buttons - a text input into which LaTeX commands are inserted on clicking the buttons - a preview of the formula The deviations from the draft design (wider menu, smaller buttons, dialog is 'larger' instead of 'large') are so that more buttons can be seen at once. Needs more work: - the menu headings - the list of formula fragments, which will eventually be more comprehensive - user research on how to group/order the fragments Bug: T114163 Change-Id: I96d4b72f2e49ad3f43a2e5c71f0d348fdfb35503 --- M .jshintrc A MathDataModule.php M extension.json M i18n/en.json M i18n/qqq.json M modules/ve-math/symbols.json A modules/ve-math/ve.ui.MWMathDialog.css A modules/ve-math/ve.ui.MWMathDialog.js M modules/ve-math/ve.ui.MWMathInspector.js A modules/ve-math/ve.ui.MWMathPage.js 10 files changed, 1,268 insertions(+), 396 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/74/253374/1 diff --git a/.jshintrc b/.jshintrc index b0a9b23..64e1703 100644 --- a/.jshintrc +++ b/.jshintrc @@ -20,6 +20,7 @@ "globals": { "mediaWiki": false, "OO": false, - "ve": false + "ve": false, + "mw": false } } diff --git a/MathDataModule.php b/MathDataModule.php new file mode 100644 index 000..ddb8cfb --- /dev/null +++ b/MathDataModule.php @@ -0,0 +1,38 @@ + $this->getScript( $context ), + ); + return $summary; + } +} diff --git a/extension.json b/extension.json index 83dcddf..28c98c4 100644 --- a/extension.json +++ b/extension.json @@ -12,6 +12,7 @@ "callback": "MathHooks::registerExtension", "type": "parserhook", "AutoloadClasses": { + "MathDataModule": "MathDataModule.php", "MathHooks": "Math.hooks.php", "MathRenderer": "MathRenderer.php", "MathTexvc": "MathTexvc.php", @@ -138,29 +139,56 @@ "scripts": [ "ve-math/ve.dm.MWMathNode.js", "ve-math/ve.ce.MWMathNode.js", - "ve-math/ve.ui.MWMathInspector.js", + "ve-math/ve.ui.MWMathDialog.js", + "ve-math/ve.ui.MWMathPage.js", "ve-math/ve.ui.MWMathInspectorTool.js" ], "styles": [ "ve-math/ve.ce.MWMathNode.css", "ve-math/ve.ui.MWMathIcons.css", - "ve-math/ve.ui.MWMathInspector.css" + "ve-math/ve.ui.MWMathInspector.css", + "ve-math/ve.ui.MWMathDialog.css" ], "dependencies": [ "ext.visualEditor.mwcore" ], "messages": [ + "math-visualeditor-mwmathdialog-title", "math-visualeditor-mwmathinspector-display", "math-visualeditor-mwmathinspector-display-block", "math-visualeditor-mwmathinspector-display-default", "math-visualeditor-mwmathinspector-display-inline", "math-visualeditor-mwmathinspector-id", - "math-visualeditor-mwmathinspector-title" + "math-visualeditor-mwmathinspector-title", + "math-visualeditor-symbol-group-accents", + "math-visualeditor-symbol-group-arrows", + "math-visualeditor-symbol-group-derivatives", + "math-visualeditor-symbol-group-functions", + "math-visualeditor-symbol-group-geometry", + "math-visualeditor-symbol-group-logic", + "math-visualeditor-symbol-group-modular", + "math-visualeditor-symbol-group-operators", + "math-visualeditor-symbol-group-relations", + "math-visualeditor-symbol-group-root", + "math-visualeditor-symbol-group-sets", + "math-visualeditor-symbol-group-special", + "math-visualeditor-symbol-group-unsorted" ], "targets": [
[MediaWiki-commits] [Gerrit] WIP Add tool to create svg files of LaTeX symbols - change (mediawiki...Math)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/252891 Change subject: WIP Add tool to create svg files of LaTeX symbols .. WIP Add tool to create svg files of LaTeX symbols Also produces a css file for the symbol buttons, using the svg filenames. Gets the list of symbols from symbols.json. Change-Id: Iaa792418d870a7e266b6455ef037994e31278278 --- M extension.json A modules/ve-math/symbols.json A modules/ve-math/tools/makeSvgsAndCss.js A modules/ve-math/tools/package.json 4 files changed, 1,320 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/91/252891/1 diff --git a/extension.json b/extension.json index 83dcddf..07c074f 100644 --- a/extension.json +++ b/extension.json @@ -144,7 +144,7 @@ "styles": [ "ve-math/ve.ce.MWMathNode.css", "ve-math/ve.ui.MWMathIcons.css", - "ve-math/ve.ui.MWMathInspector.css" + "ve-math/ve.ui.MWMathSymbols.css" ], "dependencies": [ "ext.visualEditor.mwcore" diff --git a/modules/ve-math/symbols.json b/modules/ve-math/symbols.json new file mode 100644 index 000..fab6b7e --- /dev/null +++ b/modules/ve-math/symbols.json @@ -0,0 +1,1195 @@ +{ + "Derivatives": [ + { + "tex": "\\nabla" + }, + { + "tex": "\\partial" + } + ], + "Accents/diacritics": [ + { + "tex": "\\acute{a}" + }, + { + "tex": "\\grave{a}" + }, + { + "tex": "\\hat{a}" + }, + { + "tex": "\\tilde{a}" + }, + { + "tex": "\\breve{a}" + }, + { + "tex": "\\check{a}" + }, + { + "tex": "\\bar{a}" + }, + { + "tex": "\\ddot{a}" + }, + { + "tex": "\\dot{a}" + } + ], + "Modular arithmetic": [ + { + "tex": "\\pmod{a}" + }, + { + "tex": "\\bmod{a}" + } + ], + "Operators": [ + { + "tex": "+" + }, + { + "tex": "\\oplus" + }, + { + "tex": "\\bigoplus" + }, + { + "tex": "\\pm" + }, + { + "tex": "\\mp" + }, + { + "tex": "-" + }, + { + "tex": "\\times" + }, + { + "tex": "\\otimes" + }, + { + "tex": "\\bigotimes" + }, + { + "tex": "\\cdot" + }, + { + "tex": "\\circ" + }, + { + "tex": "\\bullet" + }, + { + "tex": "\\bigodot" + }, + { + "tex": "\\star" + }, + { + "tex": "*" + }, + { + "tex": "/" + }, + { + "tex": "\\div" + } + ], + "Logic": [ + { + "tex": "\\land" + }, + { + "tex": "\\wedge" + }, + { + "tex": "\\bigwedge" + }, + { + "tex": "\\lor" + }, + { + "tex": "\\vee" + }, + { + "tex": "\\bigvee" + }, + { + "tex": "\\lnot" + }, + { + "tex": "\\neg" + }, + { + "tex": "\\And" + } + ], + "Arrows": [ + { + "tex": "\\Leftarrow" + }, + { + "tex": "\\Rightarrow" + }, + { + "tex": "\\nleftarrow" + }, + { +
[MediaWiki-commits] [Gerrit] WIP Make new error element - change (mediawiki...VisualEditor)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/246789 Change subject: WIP Make new error element .. WIP Make new error element Change-Id: I5839ba62fe4b4708ff51dc549c5294189d7f8843 --- M extension.json A modules/ve-mw/ui/elements/ve.ui.MWExpandableErrorElement.js M modules/ve-mw/ui/inspectors/ve.ui.MWLiveExtensionInspector.js A modules/ve-mw/ui/styles/elements/ve.ui.MWExpandableErrorElement.css 4 files changed, 183 insertions(+), 57 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/89/246789/1 diff --git a/extension.json b/extension.json index 90d3dfc..cfa844e 100644 --- a/extension.json +++ b/extension.json @@ -974,6 +974,7 @@ "modules/ve-mw/ui/dialogs/ve.ui.MWCommandHelpDialog.js", "modules/ve-mw/ui/dialogs/ve.ui.MWCancelConfirmDialog.js", "modules/ve-mw/ui/dialogs/ve.ui.MWWikitextSwitchConfirmDialog.js", + "modules/ve-mw/ui/elements/ve.ui.MWExpandableErrorElement.js", "modules/ve-mw/ui/tools/ve.ui.MWEditModeTool.js", "modules/ve-mw/ui/tools/ve.ui.MWPopupTool.js", "modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js", @@ -986,6 +987,7 @@ "modules/ve-mw/ui/styles/inspectors/ve.ui.MWLiveExtensionInspector.css", "modules/ve-mw/ui/styles/dialogs/ve.ui.MWWelcomeDialog.css", "modules/ve-mw/ui/styles/dialogs/ve.ui.MWSaveDialog.css", + "modules/ve-mw/ui/styles/elements/ve.ui.MWExpandableErrorElement.css", "modules/ve-mw/ui/styles/tools/ve.ui.MWPopupTool.css", "modules/ve-mw/ui/styles/widgets/ve.ui.MWTocWidget.css", "modules/ve-mw/ui/styles/tools/ve.ui.MWEducationPopupTool.css" diff --git a/modules/ve-mw/ui/elements/ve.ui.MWExpandableErrorElement.js b/modules/ve-mw/ui/elements/ve.ui.MWExpandableErrorElement.js new file mode 100644 index 000..8c68d4b --- /dev/null +++ b/modules/ve-mw/ui/elements/ve.ui.MWExpandableErrorElement.js @@ -0,0 +1,134 @@ +/*! + * VisualEditor UserInterface MWExpandableErrorElement class. + * + * @copyright 2015 VisualEditor Team and others; see AUTHORS.txt + * @license The MIT License (MIT); see LICENSE.txt + */ + +/*global ve, OO */ + +/** + * MediaWiki expandable error element. + * + * @class + * @extends OO.ui.Element + * @mixins OO.EventEmitter + * + * @constructor + * @param {Object} [config] Configuration options + */ +ve.ui.MWExpandableErrorElement = function VeUiMWExpandableErrorElement( config ) { + // Parent constructor + ve.ui.MWExpandableErrorElement.super.call( this, config ); + + // Mixin constructors + OO.EventEmitter.call( this ); + + // Interaction + this.expanded = false; + this.expandable = false; + + this.$element.addClass( 'oo-ui-element-hidden' ); + this.label = new OO.ui.LabelWidget( { + classes: [ 've-ui-mwExpandableErrorElement-label' ] + } ); + this.button = new OO.ui.ButtonWidget( { + framed: false, + classes: [ + 've-ui-mwExpandableErrorElement-button ' + + 'oo-ui-element-hidden' ], + icon: 'expand' + } ); + + this.$element.append( + this.button.$element, + this.label.$element + ); +}; + +/* Inheritance */ + +OO.inheritClass( ve.ui.MWExpandableErrorElement, OO.ui.Element ); + +OO.mixinClass( ve.ui.MWExpandableErrorElement, OO.EventEmitter ); + +/* Methods */ + +/** + * Set this.expandable property + * + * @param {boolean} [expandable] Force expandable if true, force not + * expandable if false, determine based on label size if omitted + */ +ve.ui.MWExpandableErrorElement.prototype.setExpandable = function ( expandable ) { + if ( expandable !== undefined ) { + this.expandable = expandable; + } else { + this.label.$element + .addClass( 've-ui-mwExpandableErrorElement-label-not-expandable' ); + this.expandable = this.label.$element.prop( 'scrollWidth' ) > + this.label.$element.innerWidth(); + } + this.label.$element + .toggleClass( 've-ui-mwExpandableErrorElement-label-not-expandable', !this.expandable ); +}; + +/** + * Show the error and set the label to contain the error text. + * + * @param {jQuery} [$element] Element containing the error + */ +ve.ui.MWExpandableErrorElement.prototype.show = function ( $element ) { + this.label.setLabel( $element || null ); + this.$element.removeClass(
[MediaWiki-commits] [Gerrit] WIP Changes around error element - change (mediawiki...Score)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/246787 Change subject: WIP Changes around error element .. WIP Changes around error element Depends on I5839ba62fe in VE-MW Change-Id: I181f5cc2e6fc609870c2cb21b9255c57a6d33764 --- M modules/ve-score/ve.ui.MWScoreInspector.css M modules/ve-score/ve.ui.MWScoreInspector.js 2 files changed, 2 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Score refs/changes/87/246787/1 diff --git a/modules/ve-score/ve.ui.MWScoreInspector.css b/modules/ve-score/ve.ui.MWScoreInspector.css index 0d8ed06..1b3ec20 100644 --- a/modules/ve-score/ve.ui.MWScoreInspector.css +++ b/modules/ve-score/ve.ui.MWScoreInspector.css @@ -8,7 +8,3 @@ .ve-ui-mwScoreInspector-content .ve-ui-mwExtensionWindow-input textarea { font-family: monospace, Courier; } - -.ve-ui-mwScoreInspector-content .ve-ui-mwLiveExtensionInspector-error-expanded { - white-space: pre-wrap; -} diff --git a/modules/ve-score/ve.ui.MWScoreInspector.js b/modules/ve-score/ve.ui.MWScoreInspector.js index 97084a6..85e62b9 100644 --- a/modules/ve-score/ve.ui.MWScoreInspector.js +++ b/modules/ve-score/ve.ui.MWScoreInspector.js @@ -152,7 +152,7 @@ notationCard.$element.append( inputField.$element, langField.$element, - this.$generatedContentsErrorContainer + this.generatedContentsError.$element ); audioCard.$element.append( vorbisField.$element, @@ -306,7 +306,7 @@ * Append the error to the current card. */ ve.ui.MWScoreInspector.prototype.onCardSet = function () { - this.indexLayout.getCurrentCard().$element.append( this.$generatedContentsErrorContainer ); + this.indexLayout.getCurrentCard().$element.append( this.generatedContentsError.$element ); }; /* Registration */ -- To view, visit https://gerrit.wikimedia.org/r/246787 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I181f5cc2e6fc609870c2cb21b9255c57a6d33764 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Score Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] WIP append error element - change (mediawiki...Math)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/246788 Change subject: WIP append error element .. WIP append error element Depends on I5839ba62fe in VE-MW Change-Id: Iedd632af8743a53aa96b736ca5ef5af40c28bc7a --- M modules/ve-math/ve.ui.MWMathInspector.js 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/88/246788/1 diff --git a/modules/ve-math/ve.ui.MWMathInspector.js b/modules/ve-math/ve.ui.MWMathInspector.js index 19b33b5..36ff09e 100644 --- a/modules/ve-math/ve.ui.MWMathInspector.js +++ b/modules/ve-math/ve.ui.MWMathInspector.js @@ -87,7 +87,7 @@ this.$content.addClass( 've-ui-mwMathInspector-content' ); this.form.$element.append( inputField.$element, - this.$generatedContentsErrorContainer, + this.generatedContentsError.$element, displayField.$element, idField.$element ); -- To view, visit https://gerrit.wikimedia.org/r/246788 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iedd632af8743a53aa96b736ca5ef5af40c28bc7a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove values from checkboxes in score inspector - change (mediawiki...Score)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/244143 Change subject: Remove values from checkboxes in score inspector .. Remove values from checkboxes in score inspector Change-Id: Ibaca632fc60685498649eedb9c87f5352255a017 --- M modules/ve-score/ve.ui.MWScoreInspector.js 1 file changed, 3 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Score refs/changes/43/244143/1 diff --git a/modules/ve-score/ve.ui.MWScoreInspector.js b/modules/ve-score/ve.ui.MWScoreInspector.js index 351f911..8776dcb 100644 --- a/modules/ve-score/ve.ui.MWScoreInspector.js +++ b/modules/ve-score/ve.ui.MWScoreInspector.js @@ -104,15 +104,9 @@ } ); // Checkboxes - this.midiCheckbox = new OO.ui.CheckboxInputWidget( { - value: '0' - } ); - this.audioCheckbox = new OO.ui.CheckboxInputWidget( { - value: '0' - } ); - this.rawCheckbox = new OO.ui.CheckboxInputWidget( { - value: '0' - } ); + this.midiCheckbox = new OO.ui.CheckboxInputWidget(); + this.audioCheckbox = new OO.ui.CheckboxInputWidget(); + this.rawCheckbox = new OO.ui.CheckboxInputWidget(); // Text inputs this.overrideMidiInput = new OO.ui.TextInputWidget( { -- To view, visit https://gerrit.wikimedia.org/r/244143 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibaca632fc60685498649eedb9c87f5352255a017 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Score Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add documentation for config. - change (oojs/ui)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/244146 Change subject: Add documentation for config. .. Add documentation for config. Change-Id: I9d5ce254f6891cade886ea3f155232438c98e0d5 --- M src/Element.js 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/46/244146/1 diff --git a/src/Element.js b/src/Element.js index fe10f98..01f52ba 100644 --- a/src/Element.js +++ b/src/Element.js @@ -17,7 +17,8 @@ * @cfg {Array} [content] An array of content elements to append (after #text). * Strings will be html-escaped; use an OO.ui.HtmlSnippet to append raw HTML. * Instances of OO.ui.Element will have their $element appended. - * @cfg {jQuery} [$content] Content elements to append (after #text) + * @cfg {jQuery} [$content] Content elements to append (after #text). + * @cfg {jQuery} [$element] Wrapper element. Defaults to a new element with #getTagName. * @cfg {Mixed} [data] Custom data of any type or combination of types (e.g., string, number, array, object). * Data can also be specified with the #setData method. */ -- To view, visit https://gerrit.wikimedia.org/r/244146 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9d5ce254f6891cade886ea3f155232438c98e0d5 Gerrit-PatchSet: 1 Gerrit-Project: oojs/ui Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Move error element to the bottom of the inspector - change (mediawiki...Score)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/243926 Change subject: Move error element to the bottom of the inspector .. Move error element to the bottom of the inspector Also trim the text in formatGeneratedContentsError Change-Id: Ia616f7a94d4c9b6af4621abcfc708a07f2d7a534 --- M modules/ve-score/ve.ui.MWScoreInspector.js 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Score refs/changes/26/243926/1 diff --git a/modules/ve-score/ve.ui.MWScoreInspector.js b/modules/ve-score/ve.ui.MWScoreInspector.js index 351f911..da66e10 100644 --- a/modules/ve-score/ve.ui.MWScoreInspector.js +++ b/modules/ve-score/ve.ui.MWScoreInspector.js @@ -157,8 +157,8 @@ notationCard.$element.append( inputField.$element, - this.$generatedContentsErrorContainer, - langField.$element + langField.$element, + this.$generatedContentsErrorContainer ); audioCard.$element.append( vorbisField.$element, @@ -305,7 +305,7 @@ * @inheritdoc */ ve.ui.MWScoreInspector.prototype.formatGeneratedContentsError = function ( $element ) { - return $element.text(); + return $element.text().trim(); }; /** -- To view, visit https://gerrit.wikimedia.org/r/243926 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia616f7a94d4c9b6af4621abcfc708a07f2d7a534 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Score Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Append error container to inspector - change (mediawiki...Math)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/243684 Change subject: Append error container to inspector .. Append error container to inspector Also modify method that formats the error so only the text is appended. Depends on Ie84130d4ac0 in VE-MW. Bug: T113172 Change-Id: I5310f22877f56d1828a9d1782ee335d5793700df --- M modules/ve-math/ve.ui.MWMathInspector.js 1 file changed, 13 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/84/243684/1 diff --git a/modules/ve-math/ve.ui.MWMathInspector.js b/modules/ve-math/ve.ui.MWMathInspector.js index 7932284..19b33b5 100644 --- a/modules/ve-math/ve.ui.MWMathInspector.js +++ b/modules/ve-math/ve.ui.MWMathInspector.js @@ -85,7 +85,12 @@ // Initialization this.$content.addClass( 've-ui-mwMathInspector-content' ); - this.form.$element.append( inputField.$element, displayField.$element, idField.$element ); + this.form.$element.append( + inputField.$element, + this.$generatedContentsErrorContainer, + displayField.$element, + idField.$element + ); }; /** @@ -126,6 +131,13 @@ mwData.attrs.id = id || undefined; }; +/** + * @inheritdoc + */ +ve.ui.MWMathInspector.prototype.formatGeneratedContentsError = function ( $element ) { + return $element.text().trim(); +}; + /* Registration */ ve.ui.windowFactory.register( ve.ui.MWMathInspector ); -- To view, visit https://gerrit.wikimedia.org/r/243684 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5310f22877f56d1828a9d1782ee335d5793700df Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Pass generated content error to inspector - change (VisualEditor/VisualEditor)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/243599 Change subject: Pass generated content error to inspector .. Pass generated content error to inspector If an error is returned in generated content, pass it to the inspector so it can be rendered there. Bug: T113172 Change-Id: I6002d9870d2b38275245fbf48f0e19b57c41de01 --- M src/ce/nodes/ve.ce.GeneratedContentNode.js 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/99/243599/1 diff --git a/src/ce/nodes/ve.ce.GeneratedContentNode.js b/src/ce/nodes/ve.ce.GeneratedContentNode.js index 444eb65..66747b1 100644 --- a/src/ce/nodes/ve.ce.GeneratedContentNode.js +++ b/src/ce/nodes/ve.ce.GeneratedContentNode.js @@ -159,6 +159,9 @@ this.$element.remove(); this.$element = $newElements; } + } else { + this.generatedContentsValid = false; + this.model.emit( 'generatedContentsError', $newElements ); } // Update focusable and resizable elements if necessary -- To view, visit https://gerrit.wikimedia.org/r/243599 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6002d9870d2b38275245fbf48f0e19b57c41de01 Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Append error container to inspector - change (mediawiki...Score)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/243601 Change subject: Append error container to inspector .. Append error container to inspector Also modify method that formats the error so only the text is appended, with white-space preserved. Additionally make sure the error is always appended to the current card. Depends on Ie84130d4ac0 in VE-MW. Bug: T113172 Change-Id: Id62d60f465f6c2eae7b9f30565a2d07d3247a866 --- M modules/ve-score/ve.ui.MWScoreInspector.css M modules/ve-score/ve.ui.MWScoreInspector.js 2 files changed, 22 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Score refs/changes/01/243601/1 diff --git a/modules/ve-score/ve.ui.MWScoreInspector.css b/modules/ve-score/ve.ui.MWScoreInspector.css index 1b3ec20..0d8ed06 100644 --- a/modules/ve-score/ve.ui.MWScoreInspector.css +++ b/modules/ve-score/ve.ui.MWScoreInspector.css @@ -8,3 +8,7 @@ .ve-ui-mwScoreInspector-content .ve-ui-mwExtensionWindow-input textarea { font-family: monospace, Courier; } + +.ve-ui-mwScoreInspector-content .ve-ui-mwLiveExtensionInspector-error-expanded { + white-space: pre-wrap; +} diff --git a/modules/ve-score/ve.ui.MWScoreInspector.js b/modules/ve-score/ve.ui.MWScoreInspector.js index 2b0f11c..66a053e 100644 --- a/modules/ve-score/ve.ui.MWScoreInspector.js +++ b/modules/ve-score/ve.ui.MWScoreInspector.js @@ -142,8 +142,10 @@ // Initialization this.$content.addClass( 've-ui-mwScoreInspector-content' ); + notationCard.$element.append( inputField.$element, + this.$generatedContentsErrorContainer, langField.$element, rawField.$element ); @@ -195,6 +197,7 @@ this.overrideMidiInput.on( 'change', this.onChangeHandler ); this.overrideOggInput.on( 'change', this.onChangeHandler ); + this.indexLayout.connect( this, { set: 'onCardSet' } ); this.indexLayout.connect( this, { set: 'updateSize' } ); this.langMenu.connect( this, { choose: 'toggleDisableRawCheckbox' } ); this.midiCheckbox.connect( this, { change: 'toggleDisableOverrideMidiInput' } ); @@ -215,6 +218,7 @@ this.overrideMidiInput.off( 'change', this.onChangeHandler ); this.overrideOggInput.off( 'change', this.onChangeHandler ); + this.indexLayout.disconnect( this ); this.langMenu.disconnect( this ); this.midiCheckbox.disconnect( this ); this.vorbisCheckbox.disconnect( this ); @@ -273,6 +277,20 @@ this.overrideOggInput.setDisabled( this.vorbisCheckbox.isSelected() ); }; +/** + * @inheritdoc + */ +ve.ui.MWScoreInspector.prototype.formatGeneratedContentsError = function ( $element ) { + return $element.text(); +}; + +/** + * Append the error to the current card. + */ +ve.ui.MWScoreInspector.prototype.onCardSet = function () { + this.indexLayout.getCurrentCard().$element.append( this.$generatedContentsErrorContainer ); +}; + /* Registration */ ve.ui.windowFactory.register( ve.ui.MWScoreInspector ); -- To view, visit https://gerrit.wikimedia.org/r/243601 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id62d60f465f6c2eae7b9f30565a2d07d3247a866 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Score Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add error element to MWLiveExtensionInspector - change (mediawiki...VisualEditor)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/243600 Change subject: Add error element to MWLiveExtensionInspector .. Add error element to MWLiveExtensionInspector As part of the plan to render extension errors in the inspector instead of the view, append an element to contain the error. More specifically, the element is a div that contains a LabelWidget (in which the error message is displayed) and a ButtonWidget (to expand and collapse the error). Initially the error element is hidden, but if Parsoid returns an error, the element will be shown. If the error is longer than 1 line, it is truncated but can be expanded. On closing the inspector, any remaining error is collapsed and hidden. Depends on I6002d9870d2b to work Bug: T113172 Change-Id: Ie84130d4ac0da9a738bf98ad0a3677d47566d585 --- M extension.json M modules/ve-mw/ui/inspectors/ve.ui.MWLiveExtensionInspector.js A modules/ve-mw/ui/styles/inspectors/ve.ui.MWLiveExtensionInspector.css 3 files changed, 124 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/00/243600/1 diff --git a/extension.json b/extension.json index 1dad207..16f83d6 100644 --- a/extension.json +++ b/extension.json @@ -979,6 +979,7 @@ ], "styles": [ "modules/ve-mw/ui/styles/inspectors/ve.ui.MWExtensionInspector.css", + "modules/ve-mw/ui/styles/inspectors/ve.ui.MWLiveExtensionInspector.css", "modules/ve-mw/ui/styles/dialogs/ve.ui.MWWelcomeDialog.css", "modules/ve-mw/ui/styles/dialogs/ve.ui.MWSaveDialog.css", "modules/ve-mw/ui/styles/tools/ve.ui.MWPopupTool.css", diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWLiveExtensionInspector.js b/modules/ve-mw/ui/inspectors/ve.ui.MWLiveExtensionInspector.js index 57450e2..ece97b0 100644 --- a/modules/ve-mw/ui/inspectors/ve.ui.MWLiveExtensionInspector.js +++ b/modules/ve-mw/ui/inspectors/ve.ui.MWLiveExtensionInspector.js @@ -32,6 +32,35 @@ /** * @inheritdoc */ +ve.ui.MWLiveExtensionInspector.prototype.initialize = function () { + // Parent method + ve.ui.MWLiveExtensionInspector.super.prototype.initialize.call( this ); + + // Elements for displaying errors + this.$generatedContentsErrorContainer = $( '', { + 'class': 've-ui-mwLiveExtensionInspector-error-container-hidden' + } ); + this.generatedContentsErrorLabel = new OO.ui.LabelWidget( { + classes: [ + 've-ui-mwLiveExtensionInspector-error ve-ui-mwLiveExtensionInspector-error-collapsed' + ] + } ); + this.generatedContentsErrorButton = new OO.ui.ButtonWidget( { + framed: false, + classes: [ 've-ui-mwLiveExtensionInspector-error-button' ], + icon: 'expand' + } ); + + this.$generatedContentsErrorContainer.append( + this.generatedContentsErrorButton.$element, + this.generatedContentsErrorLabel.$element + ); + this.form.$element.append( this.$generatedContentsErrorContainer ); +}; + +/** + * @inheritdoc + */ ve.ui.MWLiveExtensionInspector.prototype.getSetupProcess = function ( data ) { return ve.ui.MWLiveExtensionInspector.super.prototype.getSetupProcess.call( this, data ) .next( function () { @@ -46,7 +75,8 @@ element, { type: '/' + element.type } ] ); - // Check if the node was inserted at a structural offset and wrapped in a paragraph + // Check if the node was inserted at a structural offset and + // wrapped in a paragraph if ( this.getFragment().getSelection().getRange().getLength() === 4 ) { this.fragment = this.getFragment().adjustLinearSelection( 1, -1 ); } @@ -54,6 +84,9 @@ this.selectedNode = this.getFragment().getSelectedNode(); } this.input.on( 'change', this.onChangeHandler ); + this.selectedNode.connect( this, { + generatedContentsError: this.renderGeneratedContentsError + } ); }, this ); }; @@ -63,7 +96,9 @@ ve.ui.MWLiveExtensionInspector.prototype.getTeardownProcess = function ( data ) { return ve.ui.MWLiveExtensionInspector.super.prototype.getTeardownProcess.call( this, data ) .first( function () { +
[MediaWiki-commits] [Gerrit] Always render generated content the first time, including er... - change (VisualEditor/VisualEditor)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/243153 Change subject: Always render generated content the first time, including errors .. Always render generated content the first time, including errors While using an inspector to edit an extension node, the generated content only renders if there is no error, because rendering the errors causes the node to keep changing size, causing the inspector to jump around. It is currently possible to save an extension node with errors. If this has happened, then the error message SHOULD be displayed when visual editor is opened, allowing the user to inspect and correct it. Therefore a check has been added, so that generated content is always rendered the first time, regardless of whether there is an error. Subsequently it only rerenders if there is no error. Bug: T114455 Change-Id: Id16a2ff836a84cd30e15ae9d2fd894896dc46e90 --- M src/ce/nodes/ve.ce.GeneratedContentNode.js 1 file changed, 5 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/53/243153/1 diff --git a/src/ce/nodes/ve.ce.GeneratedContentNode.js b/src/ce/nodes/ve.ce.GeneratedContentNode.js index 60ef806..aeed8e5 100644 --- a/src/ce/nodes/ve.ce.GeneratedContentNode.js +++ b/src/ce/nodes/ve.ce.GeneratedContentNode.js @@ -16,6 +16,7 @@ // Properties this.generatingPromise = null; this.generatedContentsValid = false; + this.generatedContentsFirstRender = true; // Events this.model.connect( this, { update: 'onGeneratedContentNodeUpdate' } ); @@ -144,7 +145,10 @@ this.emit( 'teardown' ); } $newElements = $( this.getRenderedDomElements( ve.copyDomElements( generatedContents ) ) ); - if ( this.validateGeneratedContents( $( generatedContents ) ) ) { + // Render is this is the first time rendering, regardless of whether there is an error; otherwise only + // render if there is no error + if ( this.generatedContentsFirstRender || this.validateGeneratedContents( $( generatedContents ) ) ) { + this.generatedContentsFirstRender = false; this.generatedContentsValid = true; if ( !this.$element[ 0 ].parentNode ) { // this.$element hasn't been attached yet, so just overwrite it -- To view, visit https://gerrit.wikimedia.org/r/243153 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id16a2ff836a84cd30e15ae9d2fd894896dc46e90 Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Improve the score inspector interface - change (mediawiki...Score)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/243216 Change subject: Improve the score inspector interface .. Improve the score inspector interface Separate the inspector into more tabs (notation, audio, MIDI and advanced), so that it takes up less space and so that the options are more logically organised. Only have the bare minimum on the default tab (the notation tab) to avoid confusing anyone who doesn't want to edit the advanced options. Also improve the overall experience by making the audio options work the same way as the MIDI options. Bug: T114227 Change-Id: I9b927ffd0e04674ac8a6f27aaf7219eab307f813 --- M Score.php M i18n/en.json M i18n/qqq.json M modules/ve-score/ve.ui.MWScoreInspector.js 4 files changed, 99 insertions(+), 68 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Score refs/changes/16/243216/1 diff --git a/Score.php b/Score.php index 7bb1dcd..612e62a 100644 --- a/Score.php +++ b/Score.php @@ -121,14 +121,16 @@ 'ext.visualEditor.mwcore', ), 'messages' => array( - 'score-visualeditor-mwscoreinspector-audio', + 'score-visualeditor-mwscoreinspector-card-advanced', + 'score-visualeditor-mwscoreinspector-card-audio', + 'score-visualeditor-mwscoreinspector-card-midi', + 'score-visualeditor-mwscoreinspector-card-notation', 'score-visualeditor-mwscoreinspector-lang', 'score-visualeditor-mwscoreinspector-lang-abc', 'score-visualeditor-mwscoreinspector-lang-lilypond', 'score-visualeditor-mwscoreinspector-midi', 'score-visualeditor-mwscoreinspector-override-midi', 'score-visualeditor-mwscoreinspector-override-midi-placeholder', - 'score-visualeditor-mwscoreinspector-notation', 'score-visualeditor-mwscoreinspector-override-ogg', 'score-visualeditor-mwscoreinspector-override-ogg-placeholder', 'score-visualeditor-mwscoreinspector-raw', diff --git a/i18n/en.json b/i18n/en.json index 5356327..4365cb5 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -32,18 +32,20 @@ "score-renameerr": "Error moving score files to upload directory.", "score-trimerr": "Image could not be trimmed:\n$1\nSet $wgScoreTrim=false if this problem persists.", "score-versionerr": "Unable to obtain LilyPond version:\n$1", -"score-visualeditor-mwscoreinspector-audio": "Audio", +"score-visualeditor-mwscoreinspector-card-advanced": "Advanced", +"score-visualeditor-mwscoreinspector-card-audio": "Audio", +"score-visualeditor-mwscoreinspector-card-midi": "MIDI", +"score-visualeditor-mwscoreinspector-card-notation": "Notation", "score-visualeditor-mwscoreinspector-lang": "Language", "score-visualeditor-mwscoreinspector-lang-abc": "ABC", "score-visualeditor-mwscoreinspector-lang-lilypond": "LilyPond", -"score-visualeditor-mwscoreinspector-midi": "Link to a MIDI file", -"score-visualeditor-mwscoreinspector-notation": "Notation", -"score-visualeditor-mwscoreinspector-override-midi": "Link to an existing MIDI file (optional)", +"score-visualeditor-mwscoreinspector-midi": "Link to a MIDI file (auto-generated by default)", +"score-visualeditor-mwscoreinspector-override-midi": "Use an existing MIDI file", "score-visualeditor-mwscoreinspector-override-midi-placeholder": "Name of existing MIDI file", -"score-visualeditor-mwscoreinspector-override-ogg": "Use an existing audio file (must be Ogg/Vorbis format)", -"score-visualeditor-mwscoreinspector-override-ogg-placeholder": "Name of existing audio file", +"score-visualeditor-mwscoreinspector-override-ogg": "Use an existing audio file", +"score-visualeditor-mwscoreinspector-override-ogg-placeholder": "Name of existing audio file (must be Ogg/Vorbis)", "score-visualeditor-mwscoreinspector-raw": "This is a complete LilyPond file", "score-visualeditor-mwscoreinspector-title": "Musical notation", -"score-visualeditor-mwscoreinspector-vorbis": "Generate an audio file", +"score-visualeditor-mwscoreinspector-vorbis": "Include an audio file (auto-generated by default)", "score-vorbisoverrideogg": "You cannot request Ogg/Vorbis rendering and specify override_ogg at the same time." } diff --git a/i18n/qqq.json b/i18n/qqq.json index ac4ace6..a7db948 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -36,12 +36,14 @@ "score-renameerr": "Displayed if moving the resultant files from the working environment to the upload directory fails.", "score-trimerr": "Displayed if the extension failed to trim an output image. $1 is the error (generally big block of text in a pre tag)", "score-versionerr": "Displayed if the extension failed to obtain the version string of LilyPond.
[MediaWiki-commits] [Gerrit] Call updatePreview when closing the LiveExtensionInspector - change (mediawiki...VisualEditor)
Tchanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/242902 Change subject: Call updatePreview when closing the LiveExtensionInspector .. Call updatePreview when closing the LiveExtensionInspector Call updatePreview in insertOrUpdate node, when closing the inspector. If edits have only been made to attributes that don't affect the rendering, updatePreview will not have been called, so the model won't have changed. Therefore updatePreview should be called every time the inspector is closed to make sure such edits are applied. Bug: T113078 Change-Id: I48fb291487f76fc515f122646d205366a60dca62 --- M modules/ve-mw/ui/inspectors/ve.ui.MWLiveExtensionInspector.js 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/02/242902/1 diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWLiveExtensionInspector.js b/modules/ve-mw/ui/inspectors/ve.ui.MWLiveExtensionInspector.js index e676084..57450e2 100644 --- a/modules/ve-mw/ui/inspectors/ve.ui.MWLiveExtensionInspector.js +++ b/modules/ve-mw/ui/inspectors/ve.ui.MWLiveExtensionInspector.js @@ -76,6 +76,7 @@ ve.ui.MWLiveExtensionInspector.prototype.insertOrUpdateNode = function () { // No need to call parent method as changes have already been made // to the model in staging, just need to apply them. + this.updatePreview(); this.getFragment().getSurface().applyStaging(); }; -- To view, visit https://gerrit.wikimedia.org/r/242902 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I48fb291487f76fc515f122646d205366a60dca62 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits