diff --git a/i18n/en.json b/i18n/en.json index 40bfb5c53..7c6e94d09 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -1,65 +1,66 @@ { "@metadata": { "authors": [ "WMDE" ] }, "twocolconflict": "TwoColConflict", "twocolconflict-desc": "Showing a side-by-side edit merge screen for edit conflict resolution", "twocolconflict-beta-feature-message": "Two column edit conflict", "twocolconflict-beta-feature-description": "Show the edit conflict view using a more advanced two column view.", "twocolconflict-explainconflict": "Warning: Another user just edited and saved this page. There is a conflict between your version and the current version. You will have to merge your changes into the current text version. Only the text in the editor field will be saved when you click on \"$1\".", "twocolconflict-changes-col-title": "Conflicting changes", "twocolconflict-changes-col-desc-1": "Differences between", "twocolconflict-changes-col-desc-2": "the currently published version", "twocolconflict-changes-col-desc-3": "changed $1 {{PLURAL:$1|times}} ($2)", "twocolconflict-changes-col-desc-4": "your text.", "twocolconflict-history-link": "revision history", "twocolconflict-editor-col-title": "Editor with version to be published", "twocolconflict-editor-col-desc-1": "Initially, the editor's content is the currently published version.", "twocolconflict-editor-col-desc-2": "Add your changes to the text in the editor and click on \"$1\".", "twocolconflict-base-selection-desc-1": "1) Choose the base version in the popup below.", "twocolconflict-base-selection-desc-2": "2) Adjust the text to combine both versions.", "twocolconflict-base-selection-desc-3": "3) Click on \"$1\". Only what is in the editor will be published.", "twocolconflict-base-selection-dialog-text": "What should initially be in the editor and serve as a basis for combining the conflict versions?", "twocolconflict-base-selection-own-label": "My text", "twocolconflict-base-selection-foreign-label": "The currently published version", "twocolconflict-base-selection-submit-label": "OK", "twocolconflict-diffchange-own-title": "in your version", "twocolconflict-diffchange-foreign-title": "in $1's version", "twocolconflict-diffchange-unchanged-title": "unchanged text", "twocolconflict-label-show": "show", "twocolconflict-label-hide": "hide", "twocolconflict-label-unchanged": "unchanged text", "twocolconflict-label-show-unchanged": "show unchanged text", "twocolconflict-label-hide-unchanged": "hide unchanged text", "twocolconflict-show-help-tooltip": "Show help text", "twocolconflict-help-dialog-slide1": "This page helps you to resolve an edit conflict. There are two columns: The first shows the conflicting changes and the second is a text editor, whose content will be published.\n\n[//www.mediawiki.org/wiki/Help_talk:Two_Column_Edit_Conflict_View Feedback is very much appreciated here].", "twocolconflict-help-dialog-slide2": "The first column shows the changes in your version and the changes in the currently saved version. The differences between both versions are highlighted.", "twocolconflict-help-dialog-slide3": "At the top of the first column you can click on \"{{int:twocolconflict-label-show}}\" to see unchanged text. This might help to understand the context of changes. By default, unchanged text is greyed out and collapsed.", "twocolconflict-help-dialog-slide4": "The second column is an editor. When the page is opened, there is a selection box on top of the editor. It lets you decide which version should be in the editor. This is often the version where more changes were made.", "twocolconflict-help-dialog-slide5": "Copy and paste the desired parts of the other version into the text in the editor. Only what is in the editor will be published, when you click the \"$1\" button.", "twocolconflict-tutorial": "Edit conflict solving tutorial", "twocolconflict-previous-dialog": "Previous", "twocolconflict-next-dialog": "Next", "twocolconflict-close-dialog": "Close", "twocolconflict-test-needsbeta": "You must enable the 'Two column edit conflict' beta feature in your preferences to use this special page.", "twocolconflict-test-page-title": "Edit Conflict: Simulation", "twocolconflict-test-title-label": "Enter the title of a non-protected wiki page for which the edit conflict should be simulated:", "twocolconflict-test-title-submit": "Show edit page", "twocolconflict-test-title-not-existing": "There is no page with this title.", "twocolconflict-test-no-direct-editing": "This page cannot be edited directly.", "twocolconflict-test-text-submit": "Create conflict", "twocolconflict-test-initial-hint": "On this page you can try out the new Two Column Edit Conflict interface without messing anything up.", "twocolconflict-test-edit-hint": "Make some changes below. They won't be saved. They will only be used to simulate an example edit conflict.", "twocolconflict-test-conflict-hint": "This is the test conflict. Changes won't be saved but can be previewed.", "twocolconflict-test-preview-submit": "Simulate save changes", "twocolconflict-test-preview-hint": "Thanks for trying out the Two Column Edit Conflict interface! Help us make improvements by providing us with your feedback [//meta.wikimedia.org/wiki/Talk:WMDE_Technical_Wishes/Edit_Conflicts/Feedback_Round_Test_Page here].\n\nBelow are the results of your test edit conflict resolution.", "twocolconflict-test-username": "ConflictTest User", "twocolconflict-test-summary-text": "Conflict test edit summary", "twocolconflict-split-conflict-hint": "Thank you for using this beta feature. You can help to improve it further, if you leave feedback [//www.mediawiki.org/wiki/Help_talk:Two_Column_Edit_Conflict_View on this page].", "twocolconflict-split-your-version-header": "Your version", "twocolconflict-split-current-version-header": "Conflicting version from $1 (currently live)", "twocolconflict-split-not-saved-at": "not saved $1, $2.", - "twocolconflict-split-saved-at": "saved $1, $2." + "twocolconflict-split-saved-at": "saved $1, $2.", + "twocolconflict-split-choose-version": "Please choose a version" } diff --git a/i18n/qqq.json b/i18n/qqq.json index 6e2f414a9..dd8094a01 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -1,71 +1,72 @@ { "@metadata": { "authors": [ "WMDE", "Robby", "Mormegil", "Liuxinyu970226", "Amire80", "Mainframe98", "Raymond" ] }, "twocolconflict": "TwoColConflict", "twocolconflict-desc": "{{desc|name=TwoColConflict|url=https://www.mediawiki.org/wiki/Extension:TwoColConflict}}", "twocolconflict-beta-feature-message": "Label for the TwoColConflict Beta Feature.", "twocolconflict-beta-feature-description": "Description for the TwoColConflict Beta Feature, describing the feature that will be enabled.", "twocolconflict-explainconflict": "{{doc-important|The \"editor\" here refers to the editor softwares/extensions/features such as Wikitext editor, VisualEditor, ... etc. Not a person who edits pages.}}\nAppears at the top of a page when there is an edit conflict.\n\nParameters:\n$1 - Label of the save button. Either {{msg-mw|savechanges}} or {{msg-mw|publishchanges}}.\n\nSee also:\n* {{msg-mw|Explainconflict}}\n* {{msg-mw|Savearticle}}", "twocolconflict-changes-col-title": "Header for the unified diff column with the changes.", "twocolconflict-changes-col-desc-1": "First line of the description text for the unified diff column.", "twocolconflict-changes-col-desc-2": "Second line of the description text for the unified diff column.", "twocolconflict-changes-col-desc-3": "Third line of the description text for the unified diff column. Does only show if more then two revisions lie in between.\n\nParameters:\n* $1 - Number of changed revisions in between. Always greater then 1.\n* $2 - Link the the revision history see {{msg-mw|twocolconflict-history-link}}.", "twocolconflict-changes-col-desc-4": "Fourth line of the description text for the unified diff column.", "twocolconflict-history-link": "Text for the link the revision history of the article.", "twocolconflict-editor-col-title": "{{doc-important|The \"editor\" here refers to the editor softwares/extensions/features such as Wikitext editor, VisualEditor, ... etc. Not a person who edits pages.}}\nHeader for the editor column.", "twocolconflict-editor-col-desc-1": "{{doc-important|The \"editor\" here refers to the editor softwares/extensions/features such as Wikitext editor, VisualEditor, ... etc. Not a person who edits pages.}}\nFirst half of the description for the editor column.", "twocolconflict-editor-col-desc-2": "{{doc-important|The \"editor\" here refers to the editor softwares/extensions/features such as Wikitext editor, VisualEditor, ... etc. Not a person who edits pages.}}\nSecond half of the description for the editor column.\n\nParameters:\n$1 - Label of the save button. Either {{msg-mw|savechanges}} or {{msg-mw|publishchanges}}.", "twocolconflict-base-selection-desc-1": "The first point describing the steps to be taken in the base version selection for the editor.", "twocolconflict-base-selection-desc-2": "The second point describing the steps to be taken after the base version was selected.", "twocolconflict-base-selection-desc-3": "{{doc-important|The \"editor\" here refers to the editor softwares/extensions/features such as Wikitext editor, VisualEditor, ... etc. Not a person who edits pages.}}\nThe third point describing the steps to be taken after the base version was selected and the content was merged.\n\nParameters:\n$1 - Label of the save button. Either {{msg-mw|savechanges}} or {{msg-mw|publishchanges}}.", "twocolconflict-base-selection-dialog-text": "{{doc-important|The \"editor\" here refers to the editor softwares/extensions/features such as Wikitext editor, VisualEditor, ... etc. Not a person who edits pages.}}\nThe text shown in the dialog when selecting a base version to solve a conflict.", "twocolconflict-base-selection-own-label": "The label for the option in the base version selection dialog to select your own text as base.", "twocolconflict-base-selection-foreign-label": "The label for the option in the base version selection dialog to select the foreign version as base.", "twocolconflict-base-selection-submit-label": "The label on the submit button in the base version selection dialog.\n{{Identical|OK}}", "twocolconflict-diffchange-own-title": "The title text in the unified diff view for changes by the user.", "twocolconflict-diffchange-foreign-title": "The title text in the unified diff view for conflicting changes.\n\nParameters:\n$1 - Username of the user that edited the current revision of the page.", "twocolconflict-diffchange-unchanged-title": "The label text in the unified diff view for unchanged text.", "twocolconflict-label-show": "Label for the option showing elements in the diff view.\n{{Identical|Show}}", "twocolconflict-label-hide": "Label for the option hiding elements in the diff view.\n{{Identical|Hide}}", "twocolconflict-label-unchanged": "Label for the options showing and hiding unchanged text in the diff view.", "twocolconflict-label-show-unchanged": "Label for the buttons in the diff view to show unchanged text.", "twocolconflict-label-hide-unchanged": "Label for the buttons in the diff view to hide unchanged text.", "twocolconflict-show-help-tooltip": "Text shown in a tooltip for the \"Show help\" button.", "twocolconflict-help-dialog-slide1": "{{doc-important|The \"editor\" here refers to the editor softwares/extensions/features such as Wikitext editor, VisualEditor, ... etc. Not a person who edits pages.}}\nText shown on the first slide of the help dialog.", "twocolconflict-help-dialog-slide2": "Text shown on the second slide of the help dialog.", "twocolconflict-help-dialog-slide3": "Text shown on the third slide of the help dialog.\n\nSee also:\n{{msg-mw|twocolconflict-label-show}}.", "twocolconflict-help-dialog-slide4": "{{doc-important|The \"editor\" here refers to the editor softwares/extensions/features such as Wikitext editor, VisualEditor, ... etc. Not a random user who edited some pages.}}\nText shown on the fourth slide of the help dialog.", "twocolconflict-help-dialog-slide5": "{{doc-important|The \"editor\" here refers to the editor softwares/extensions/features such as Wikitext editor, VisualEditor, ... etc. Not a random user who edited some pages.}}\nText shown on the fifth slide of the help dialog.\n\nParameters:\n$1 - Label of the save button. Either {{msg-mw|savechanges}} or {{msg-mw|publishchanges}}.", "twocolconflict-tutorial": "Text shown above the TwoColConflict tutorial. This should contain as few words as possible to avoid being truncated.", "twocolconflict-previous-dialog": "Label of the button to go to the previous tutorial slide.\n{{Identical|Previous}}", "twocolconflict-next-dialog": "Label of the button to go to the next tutorial slide.\n{{Identical|Next}}", "twocolconflict-close-dialog": "Label of the button to close the two column edit conflict tutorial.\n{{Identical|Close}}", "twocolconflict-test-needsbeta": "Error message show on the conflict test page if the beta feature is not enabled.", "twocolconflict-test-page-title": "Page title when simulating edit conflicts on the conflict test pages.", "twocolconflict-test-title-label": "Label for the conflict test page input box to load an article.", "twocolconflict-test-title-submit": "Submit button on the conflict test page to load an article.", "twocolconflict-test-title-not-existing": "Error message shown on the conflict test page when the submitted title does not exist.", "twocolconflict-test-no-direct-editing": "Error message shown on the conflict test page when the submitted page's content model does not support direct editing (e. g. a Structured Discussions topic or a Wikibase item).", "twocolconflict-test-text-submit": "Submit button on the conflict test page to submit changes creating a test conflict.", "twocolconflict-test-initial-hint": "First hint shown on the conflict test page above the input field to load an article to experiment with.", "twocolconflict-test-edit-hint": "Second hint shown on the conflict test page above the editor to make changes.", "twocolconflict-test-conflict-hint": "Third hint shown on the conflict test page above the simulated edit conflict.", "twocolconflict-test-preview-submit": "Label for the submit button to show the conflict result preview.", "twocolconflict-test-preview-hint": "Last hint shown on the conflict test page above the preview of the resolved test conflict.", "twocolconflict-test-username": "Username for the conflict test page's fictitious conflicting edit.", "twocolconflict-test-summary-text": "Edit summary for the conflict test page's fictitious conflicting edit.", "twocolconflict-split-conflict-hint": "General hint shown during an edit conflict.", "twocolconflict-split-your-version-header": "Header for the diff column showing the users changes.", "twocolconflict-split-current-version-header": "Header for the diff column showing the current conflicting changes.", "twocolconflict-split-not-saved-at": "Header for the diff columns showing the time and date when the content was modified by the users.\n\nParameters:\n* $1 - date\n* $2 - time", - "twocolconflict-split-saved-at": "Header for the diff columns showing the time and date when the current conflicting content was modified.\n\nParameters:\n* $1 - date\n* $2 - time" + "twocolconflict-split-saved-at": "Header for the diff columns showing the time and date when the current conflicting content was modified.\n\nParameters:\n* $1 - date\n* $2 - time", + "twocolconflict-split-choose-version": "Label for the version selection on conflicting paragraphs." } diff --git a/includes/SplitTwoColConflict/HtmlSplitConflictView.php b/includes/SplitTwoColConflict/HtmlSplitConflictView.php index 0fd8d9368..da7beba59 100644 --- a/includes/SplitTwoColConflict/HtmlSplitConflictView.php +++ b/includes/SplitTwoColConflict/HtmlSplitConflictView.php @@ -1,97 +1,132 @@ 'mw-twocolconflict-split-view' ] ); $currRowNum = 1; + $isFirstNonCopyLine = true; foreach ( $unifiedDiff as $key => $currentLine ) { foreach ( $currentLine as $changeSet ) { + if ( $changeSet['action'] !== 'copy' && $isFirstNonCopyLine ) { + $out .= $this->buildSideSelectorLabel(); + $isFirstNonCopyLine = false; + } switch ( $changeSet['action'] ) { case 'delete': $out .= $this->startRow( $currRowNum ); $out .= $this->buildRemovedLine( $changeSet['old'] ); + $out .= $this->buildSideSelector( $currRowNum ); if ( !$this->hasConflictInLine( $currentLine ) ) { $out .= $this->buildAddedLine( "\u{00A0}" ); $out .= $this->endRow(); $currRowNum++; } break; case 'add': if ( !$this->hasConflictInLine( $currentLine ) ) { $out .= $this->startRow( $currRowNum ); $out .= $this->buildRemovedLine( "\u{00A0}" ); + $out .= $this->buildSideSelector( $currRowNum ); } $out .= $this->buildAddedLine( $changeSet['new'] ); $out .= $this->endRow(); $currRowNum++; break; case 'copy': $out .= $this->startRow( $currRowNum ); $out .= $this->buildCopiedLine( $changeSet['copy'] ); $out .= $this->endRow(); $currRowNum++; break; } } } $out .= Html::closeElement( 'div' ); return $out; } private function startRow( $lineNum ) { return Html::openElement( 'div', [ 'class' => 'mw-twocolconflict-split-row', 'data-line-number' => $lineNum ] ); } private function endRow() { return Html::closeElement( 'div' ); } private function buildAddedLine( $text ) { return Html::Element( 'div', [ 'class' => 'mw-twocolconflict-split-add mw-twocolconflict-split-column' ], $text ); } private function buildRemovedLine( $text ) { return Html::Element( 'div', [ 'class' => 'mw-twocolconflict-split-delete mw-twocolconflict-split-column' ], $text ); } private function buildCopiedLine( $text ) { return Html::Element( 'div', [ 'class' => 'mw-twocolconflict-split-copy mw-twocolconflict-split-column' ], $text ); } + private function buildSideSelectorLabel() { + return Html::openElement( + 'div', [ 'class' => 'mw-twocolconflict-split-selector-label' ] + ) . + Html::element( + 'span', [], new Message( 'twocolconflict-split-choose-version' ) + ) . + Html::closeElement( 'div' ); + } + + private function buildSideSelector( $rowNum ) { + return Html::openElement( 'div', [ 'class' => 'mw-twocolconflict-split-selection' ] ) . + Html::openElement( 'div', [ 'class' => 'mw-twocolconflict-split-toggle' ] ) . + new OOUI\RadioInputWidget( [ + 'name' => 'mw-twocolconflict-side-selector[' . $rowNum . ']', + 'value' => 'other', + 'autocomplete' => 'off', + 'selected' => true, + ] ) . + new OOUI\RadioInputWidget( [ + 'name' => 'mw-twocolconflict-side-selector[' . $rowNum . ']', + 'value' => 'your', + 'autocomplete' => 'off', + ] ) . + Html::closeElement( 'div' ) . + Html::closeElement( 'div' ); + } + /** * Check if a unified diff line contains an edit conflict. * * @param array[] $currentLine * @return boolean */ private function hasConflictInLine( array $currentLine ) { if ( count( $currentLine ) < 2 ) { return false; } return $currentLine[0]['action'] === 'delete' && $currentLine[1]['action'] === 'add'; } } diff --git a/modules/SplitTwoColConflict/ext.TwoColConflict.Split.less b/modules/SplitTwoColConflict/ext.TwoColConflict.Split.less index 824d2a2d9..1d52fd427 100644 --- a/modules/SplitTwoColConflict/ext.TwoColConflict.Split.less +++ b/modules/SplitTwoColConflict/ext.TwoColConflict.Split.less @@ -1,116 +1,132 @@ .mw-twocolconflict-split-result { display: none; } .mw-twocolconflict-split-header { text-align: right; } .mw-twocolconflict-split-flex-header { display: flex; } .mw-twocolconflict-split-warningbox { display: block; color: #705000; border: 1px solid #fde29b; background-color: #fdf1d1; padding: 0.5em 1em; margin-bottom: 1em; } .mw-twocolconflict-split-current-version-header, .mw-twocolconflict-split-your-version-header { flex: 1 0 50%; text-align: center; margin: 20px 0; span { padding: 0 5px; } } .mw-twocolconflict-split-current-version-header span:first-child { background-color: #ffe8a6; } .mw-twocolconflict-split-your-version-header span:first-child { background-color: #add8ff; } .mw-twocolconflict-split-view { display: flex; flex-direction: column; } .mw-twocolconflict-split-row { display: flex; align-items: baseline; margin: 10px 0; } .mw-twocolconflict-split-column { flex: 1; } .mw-twocolconflict-split-add { border-color: #add8ff; margin-left: 10px; } .mw-twocolconflict-split-delete { border-color: #ffe8a6; margin-right: 10px; } .mw-twocolconflict-split-copy { border-color: #e9e9e9; background-color: #fafafa; } #toolbar { display: none; } .mw-twocolconflict-split-column { background-color: white; color: black; position: relative; border-radius: 8px; border-width: 3px 7px 3px 7px; border-style: solid; padding: 5px 40px 5px 20px; white-space: pre-line; /* Non standard for webkit */ word-break: break-word; } .mw-twocolconflict-split-add { flex: 1 0 20%; border-color: #add8ff; margin-left: 10px; } .mw-twocolconflict-split-delete { flex: 1 0 20%; border-color: #ffe8a6; margin-right: 10px; } .mw-twocolconflict-split-copy { flex: 1 0 20%; border-color: #e9e9e9; background-color: #fafafa; } ins.mw-twocolconflict-diffchange { background-color: #add8ff; } del.mw-twocolconflict-diffchange { background-color: #ffe8a6; } ins.mw-twocolconflict-diffchange, del.mw-twocolconflict-diffchange { text-decoration: none; } + +.mw-twocolconflict-split-selector-label { + margin-bottom: -15px; + text-align: center; +} + +.mw-twocolconflict-split-selector-label span { + display: inline-block; + line-height: 1.2em; + width: 120px; +} + +.mw-twocolconflict-split-selection { + text-align: center; + width: 66px; +}